path
stringlengths
5
304
repo_name
stringlengths
6
79
content
stringlengths
27
1.05M
ajax/libs/yasr/2.3.2/yasr.bundled.min.js
pc035860/cdnjs
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.YASR=t()}}(function(){var t;return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){e.exports=t("./main.js")},{"./main.js":32}],2:[function(e,n,r){(function(n,i,o){(function(n){"use strict";"function"==typeof t&&t.amd?t("datatables",["jquery"],n):"object"==typeof r?n(e("jquery")):jQuery&&!jQuery.fn.dataTable&&n(jQuery)})(function(t){"use strict";function e(n){var r,i,o="a aa ai ao as b fn i m o s ",a={};t.each(n,function(t){r=t.match(/^([^A-Z]+?)([A-Z])/);if(r&&-1!==o.indexOf(r[1]+" ")){i=t.replace(r[0],r[2].toLowerCase());a[i]=t;"o"===r[1]&&e(n[t])}});n._hungarianMap=a}function r(n,i,a){n._hungarianMap||e(n);var s;t.each(i,function(e){s=n._hungarianMap[e];if(s!==o&&(a||i[s]===o))if("o"===s.charAt(0)){i[s]||(i[s]={});t.extend(!0,i[s],i[e]);r(n[s],i[s],a)}else i[s]=i[e]})}function a(t){var e=$e.defaults.oLanguage,n=t.sZeroRecords;!t.sEmptyTable&&n&&"No data available in table"===e.sEmptyTable&&Oe(t,t,"sZeroRecords","sEmptyTable");!t.sLoadingRecords&&n&&"Loading..."===e.sLoadingRecords&&Oe(t,t,"sZeroRecords","sLoadingRecords");t.sInfoThousands&&(t.sThousands=t.sInfoThousands);var r=t.sDecimal;r&&Xe(r)}function s(t){yn(t,"ordering","bSort");yn(t,"orderMulti","bSortMulti");yn(t,"orderClasses","bSortClasses");yn(t,"orderCellsTop","bSortCellsTop");yn(t,"order","aaSorting");yn(t,"orderFixed","aaSortingFixed");yn(t,"paging","bPaginate");yn(t,"pagingType","sPaginationType");yn(t,"pageLength","iDisplayLength");yn(t,"searching","bFilter");var e=t.aoSearchCols;if(e)for(var n=0,i=e.length;i>n;n++)e[n]&&r($e.models.oSearch,e[n])}function l(t){yn(t,"orderable","bSortable");yn(t,"orderData","aDataSort");yn(t,"orderSequence","asSorting");yn(t,"orderDataType","sortDataType")}function u(e){var n=e.oBrowser,r=t("<div/>").css({position:"absolute",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(t("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(t('<div class="test"/>').css({width:"100%",height:10}))).appendTo("body"),i=r.find(".test");n.bScrollOversize=100===i[0].offsetWidth;n.bScrollbarLeft=1!==i.offset().left;r.remove()}function c(t,e,n,r,i,a){var s,l=r,u=!1;if(n!==o){s=n;u=!0}for(;l!==i;)if(t.hasOwnProperty(l)){s=u?e(s,t[l],l,t):t[l];u=!0;l+=a}return s}function f(e,n){var r=$e.defaults.column,o=e.aoColumns.length,a=t.extend({},$e.models.oColumn,r,{nTh:n?n:i.createElement("th"),sTitle:r.sTitle?r.sTitle:n?n.innerHTML:"",aDataSort:r.aDataSort?r.aDataSort:[o],mData:r.mData?r.mData:o,idx:o});e.aoColumns.push(a);var s=e.aoPreSearchCols;s[o]=t.extend({},$e.models.oSearch,s[o]);h(e,o,null)}function h(e,n,i){var a=e.aoColumns[n],s=e.oClasses,u=t(a.nTh);if(!a.sWidthOrig){a.sWidthOrig=u.attr("width")||null;var c=(u.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);c&&(a.sWidthOrig=c[1])}if(i!==o&&null!==i){l(i);r($e.defaults.column,i);i.mDataProp===o||i.mData||(i.mData=i.mDataProp);i.sType&&(a._sManualType=i.sType);i.className&&!i.sClass&&(i.sClass=i.className);t.extend(a,i);Oe(a,i,"sWidth","sWidthOrig");"number"==typeof i.iDataSort&&(a.aDataSort=[i.iDataSort]);Oe(a,i,"aDataSort")}var f=a.mData,h=M(f),d=a.mRender?M(a.mRender):null,p=function(t){return"string"==typeof t&&-1!==t.indexOf("@")};a._bAttrSrc=t.isPlainObject(f)&&(p(f.sort)||p(f.type)||p(f.filter));a.fnGetData=function(t,e,n){var r=h(t,e,o,n);return d&&e?d(r,e,t,n):r};a.fnSetData=function(t,e,n){return D(f)(t,e,n)};if(!e.oFeatures.bSort){a.bSortable=!1;u.addClass(s.sSortableNone)}var g=-1!==t.inArray("asc",a.asSorting),m=-1!==t.inArray("desc",a.asSorting);if(a.bSortable&&(g||m))if(g&&!m){a.sSortingClass=s.sSortableAsc;a.sSortingClassJUI=s.sSortJUIAscAllowed}else if(!g&&m){a.sSortingClass=s.sSortableDesc;a.sSortingClassJUI=s.sSortJUIDescAllowed}else{a.sSortingClass=s.sSortable;a.sSortingClassJUI=s.sSortJUI}else{a.sSortingClass=s.sSortableNone;a.sSortingClassJUI=""}}function d(t){if(t.oFeatures.bAutoWidth!==!1){var e=t.aoColumns;ye(t);for(var n=0,r=e.length;r>n;n++)e[n].nTh.style.width=e[n].sWidth}var i=t.oScroll;(""!==i.sY||""!==i.sX)&&me(t);ze(t,null,"column-sizing",[t])}function p(t,e){var n=v(t,"bVisible");return"number"==typeof n[e]?n[e]:null}function g(e,n){var r=v(e,"bVisible"),i=t.inArray(n,r);return-1!==i?i:null}function m(t){return v(t,"bVisible").length}function v(e,n){var r=[];t.map(e.aoColumns,function(t,e){t[n]&&r.push(e)});return r}function y(t){var e,n,r,i,a,s,l,u,c,f=t.aoColumns,h=t.aoData,d=$e.ext.type.detect;for(e=0,n=f.length;n>e;e++){l=f[e];c=[];if(!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){for(r=0,i=d.length;i>r;r++){for(a=0,s=h.length;s>a;a++){c[a]===o&&(c[a]=T(t,a,e,"type"));u=d[r](c[a],t);if(!u||"html"===u)break}if(u){l.sType=u;break}}l.sType||(l.sType="string")}}}function b(e,n,r,i){var a,s,l,u,c,h,d,p=e.aoColumns;if(n)for(a=n.length-1;a>=0;a--){d=n[a];var g=d.targets!==o?d.targets:d.aTargets;t.isArray(g)||(g=[g]);for(l=0,u=g.length;u>l;l++)if("number"==typeof g[l]&&g[l]>=0){for(;p.length<=g[l];)f(e);i(g[l],d)}else if("number"==typeof g[l]&&g[l]<0)i(p.length+g[l],d);else if("string"==typeof g[l])for(c=0,h=p.length;h>c;c++)("_all"==g[l]||t(p[c].nTh).hasClass(g[l]))&&i(c,d)}if(r)for(a=0,s=r.length;s>a;a++)i(a,r[a])}function x(e,n,r,i){var o=e.aoData.length,a=t.extend(!0,{},$e.models.oRow,{src:r?"dom":"data"});a._aData=n;e.aoData.push(a);for(var s=e.aoColumns,l=0,u=s.length;u>l;l++){r&&_(e,o,l,T(e,o,l));s[l].sType=null}e.aiDisplayMaster.push(o);(r||!e.oFeatures.bDeferRender)&&I(e,o,r,i);return o}function w(e,n){var r;n instanceof t||(n=t(n));return n.map(function(t,n){r=j(e,n);return x(e,r.data,n,r.cells)})}function S(t,e){return e._DT_RowIndex!==o?e._DT_RowIndex:null}function C(e,n,r){return t.inArray(r,e.aoData[n].anCells)}function T(t,e,n,r){var i=t.iDraw,a=t.aoColumns[n],s=t.aoData[e]._aData,l=a.sDefaultContent,u=a.fnGetData(s,r,{settings:t,row:e,col:n});if(u===o){if(t.iDrawError!=i&&null===l){He(t,0,"Requested unknown parameter "+("function"==typeof a.mData?"{function}":"'"+a.mData+"'")+" for row "+e,4);t.iDrawError=i}return l}if(u!==s&&null!==u||null===l){if("function"==typeof u)return u.call(s)}else u=l;return null===u&&"display"==r?"":u}function _(t,e,n,r){var i=t.aoColumns[n],o=t.aoData[e]._aData;i.fnSetData(o,r,{settings:t,row:e,col:n})}function k(e){return t.map(e.match(/(\\.|[^\.])+/g),function(t){return t.replace(/\\./g,".")})}function M(e){if(t.isPlainObject(e)){var n={};t.each(e,function(t,e){e&&(n[t]=M(e))});return function(t,e,r,i){var a=n[e]||n._;return a!==o?a(t,e,r,i):t}}if(null===e)return function(t){return t};if("function"==typeof e)return function(t,n,r,i){return e(t,n,r,i)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t){return t[e]};var r=function(t,e,n){var i,a,s,l;if(""!==n)for(var u=k(n),c=0,f=u.length;f>c;c++){i=u[c].match(bn);a=u[c].match(xn);if(i){u[c]=u[c].replace(bn,"");""!==u[c]&&(t=t[u[c]]);s=[];u.splice(0,c+1);l=u.join(".");for(var h=0,d=t.length;d>h;h++)s.push(r(t[h],e,l));var p=i[0].substring(1,i[0].length-1);t=""===p?s:s.join(p);break}if(a){u[c]=u[c].replace(xn,"");t=t[u[c]]()}else{if(null===t||t[u[c]]===o)return o;t=t[u[c]]}}return t};return function(t,n){return r(t,n,e)}}function D(e){if(t.isPlainObject(e))return D(e._);if(null===e)return function(){};if("function"==typeof e)return function(t,n,r){e(t,"set",n,r)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t,n){t[e]=n};var n=function(t,e,r){for(var i,a,s,l,u,c=k(r),f=c[c.length-1],h=0,d=c.length-1;d>h;h++){a=c[h].match(bn);s=c[h].match(xn);if(a){c[h]=c[h].replace(bn,"");t[c[h]]=[];i=c.slice();i.splice(0,h+1);u=i.join(".");for(var p=0,g=e.length;g>p;p++){l={};n(l,e[p],u);t[c[h]].push(l)}return}if(s){c[h]=c[h].replace(xn,"");t=t[c[h]](e)}(null===t[c[h]]||t[c[h]]===o)&&(t[c[h]]={});t=t[c[h]]}f.match(xn)?t=t[f.replace(xn,"")](e):t[f.replace(bn,"")]=e};return function(t,r){return n(t,r,e)}}function L(t){return dn(t.aoData,"_aData")}function A(t){t.aoData.length=0;t.aiDisplayMaster.length=0;t.aiDisplay.length=0}function N(t,e,n){for(var r=-1,i=0,a=t.length;a>i;i++)t[i]==e?r=i:t[i]>e&&t[i]--;-1!=r&&n===o&&t.splice(r,1)}function E(t,e,n,r){var i,a,s=t.aoData[e];if("dom"!==n&&(n&&"auto"!==n||"dom"!==s.src)){var l,u=s.anCells;if(u)for(i=0,a=u.length;a>i;i++){l=u[i];for(;l.childNodes.length;)l.removeChild(l.firstChild);u[i].innerHTML=T(t,e,i,"display")}}else s._aData=j(t,s).data;s._aSortData=null;s._aFilterData=null;var c=t.aoColumns;if(r!==o)c[r].sType=null;else for(i=0,a=c.length;a>i;i++)c[i].sType=null;P(s)}function j(e,n){var r,i,o,a,s=[],l=[],u=n.firstChild,c=0,f=e.aoColumns,h=function(t,e,n){if("string"==typeof t){var r=t.indexOf("@");if(-1!==r){var i=t.substring(r+1);o["@"+i]=n.getAttribute(i)}}},d=function(e){i=f[c];a=t.trim(e.innerHTML);if(i&&i._bAttrSrc){o={display:a};h(i.mData.sort,o,e);h(i.mData.type,o,e);h(i.mData.filter,o,e);s.push(o)}else s.push(a);c++};if(u)for(;u;){r=u.nodeName.toUpperCase();if("TD"==r||"TH"==r){d(u);l.push(u)}u=u.nextSibling}else{l=n.anCells;for(var p=0,g=l.length;g>p;p++)d(l[p])}return{data:s,cells:l}}function I(t,e,n,r){var o,a,s,l,u,c=t.aoData[e],f=c._aData,h=[];if(null===c.nTr){o=n||i.createElement("tr");c.nTr=o;c.anCells=h;o._DT_RowIndex=e;P(c);for(l=0,u=t.aoColumns.length;u>l;l++){s=t.aoColumns[l];a=n?r[l]:i.createElement(s.sCellType);h.push(a);(!n||s.mRender||s.mData!==l)&&(a.innerHTML=T(t,e,l,"display"));s.sClass&&(a.className+=" "+s.sClass);s.bVisible&&!n?o.appendChild(a):!s.bVisible&&n&&a.parentNode.removeChild(a);s.fnCreatedCell&&s.fnCreatedCell.call(t.oInstance,a,T(t,e,l),f,e,l)}ze(t,"aoRowCreatedCallback",null,[o,f,e])}c.nTr.setAttribute("role","row")}function P(e){var n=e.nTr,r=e._aData;if(n){r.DT_RowId&&(n.id=r.DT_RowId);if(r.DT_RowClass){var i=r.DT_RowClass.split(" ");e.__rowc=e.__rowc?vn(e.__rowc.concat(i)):i;t(n).removeClass(e.__rowc.join(" ")).addClass(r.DT_RowClass)}r.DT_RowData&&t(n).data(r.DT_RowData)}}function H(e){var n,r,i,o,a,s=e.nTHead,l=e.nTFoot,u=0===t("th, td",s).length,c=e.oClasses,f=e.aoColumns;u&&(o=t("<tr/>").appendTo(s));for(n=0,r=f.length;r>n;n++){a=f[n];i=t(a.nTh).addClass(a.sClass);u&&i.appendTo(o);if(e.oFeatures.bSort){i.addClass(a.sSortingClass);if(a.bSortable!==!1){i.attr("tabindex",e.iTabIndex).attr("aria-controls",e.sTableId);Ae(e,a.nTh,n)}}a.sTitle!=i.html()&&i.html(a.sTitle);Ue(e,"header")(e,i,a,c)}u&&z(e.aoHeader,s);t(s).find(">tr").attr("role","row");t(s).find(">tr>th, >tr>td").addClass(c.sHeaderTH);t(l).find(">tr>th, >tr>td").addClass(c.sFooterTH);if(null!==l){var h=e.aoFooter[0];for(n=0,r=h.length;r>n;n++){a=f[n];a.nTf=h[n].cell;a.sClass&&t(a.nTf).addClass(a.sClass)}}}function O(e,n,r){var i,a,s,l,u,c,f,h,d,p=[],g=[],m=e.aoColumns.length;if(n){r===o&&(r=!1);for(i=0,a=n.length;a>i;i++){p[i]=n[i].slice();p[i].nTr=n[i].nTr;for(s=m-1;s>=0;s--)e.aoColumns[s].bVisible||r||p[i].splice(s,1);g.push([])}for(i=0,a=p.length;a>i;i++){f=p[i].nTr;if(f)for(;c=f.firstChild;)f.removeChild(c);for(s=0,l=p[i].length;l>s;s++){h=1;d=1;if(g[i][s]===o){f.appendChild(p[i][s].cell);g[i][s]=1;for(;p[i+h]!==o&&p[i][s].cell==p[i+h][s].cell;){g[i+h][s]=1;h++}for(;p[i][s+d]!==o&&p[i][s].cell==p[i][s+d].cell;){for(u=0;h>u;u++)g[i+u][s+d]=1;d++}t(p[i][s].cell).attr("rowspan",h).attr("colspan",d)}}}}}function F(e){var n=ze(e,"aoPreDrawCallback","preDraw",[e]);if(-1===t.inArray(!1,n)){var r=[],i=0,a=e.asStripeClasses,s=a.length,l=(e.aoOpenRows.length,e.oLanguage),u=e.iInitDisplayStart,c="ssp"==Be(e),f=e.aiDisplay;e.bDrawing=!0;if(u!==o&&-1!==u){e._iDisplayStart=c?u:u>=e.fnRecordsDisplay()?0:u;e.iInitDisplayStart=-1}var h=e._iDisplayStart,d=e.fnDisplayEnd();if(e.bDeferLoading){e.bDeferLoading=!1;e.iDraw++;pe(e,!1)}else if(c){if(!e.bDestroying&&!B(e))return}else e.iDraw++;if(0!==f.length)for(var p=c?0:h,g=c?e.aoData.length:d,v=p;g>v;v++){var y=f[v],b=e.aoData[y];null===b.nTr&&I(e,y);var x=b.nTr;if(0!==s){var w=a[i%s];if(b._sRowStripe!=w){t(x).removeClass(b._sRowStripe).addClass(w);b._sRowStripe=w}}ze(e,"aoRowCallback",null,[x,b._aData,i,v]);r.push(x);i++}else{var S=l.sZeroRecords;1==e.iDraw&&"ajax"==Be(e)?S=l.sLoadingRecords:l.sEmptyTable&&0===e.fnRecordsTotal()&&(S=l.sEmptyTable);r[0]=t("<tr/>",{"class":s?a[0]:""}).append(t("<td />",{valign:"top",colSpan:m(e),"class":e.oClasses.sRowEmpty}).html(S))[0]}ze(e,"aoHeaderCallback","header",[t(e.nTHead).children("tr")[0],L(e),h,d,f]);ze(e,"aoFooterCallback","footer",[t(e.nTFoot).children("tr")[0],L(e),h,d,f]);var C=t(e.nTBody);C.children().detach();C.append(t(r));ze(e,"aoDrawCallback","draw",[e]);e.bSorted=!1;e.bFiltered=!1;e.bDrawing=!1}else pe(e,!1)}function R(t,e){var n=t.oFeatures,r=n.bSort,i=n.bFilter;r&&Me(t);i?Y(t,t.oPreviousSearch):t.aiDisplay=t.aiDisplayMaster.slice();e!==!0&&(t._iDisplayStart=0);t._drawHold=e;F(t);t._drawHold=!1}function W(e){var n=e.oClasses,r=t(e.nTable),i=t("<div/>").insertBefore(r),o=e.oFeatures,a=t("<div/>",{id:e.sTableId+"_wrapper","class":n.sWrapper+(e.nTFoot?"":" "+n.sNoFooter)});e.nHolding=i[0];e.nTableWrapper=a[0];e.nTableReinsertBefore=e.nTable.nextSibling;for(var s,l,u,c,f,h,d=e.sDom.split(""),p=0;p<d.length;p++){s=null;l=d[p];if("<"==l){u=t("<div/>")[0];c=d[p+1];if("'"==c||'"'==c){f="";h=2;for(;d[p+h]!=c;){f+=d[p+h];h++}"H"==f?f=n.sJUIHeader:"F"==f&&(f=n.sJUIFooter);if(-1!=f.indexOf(".")){var g=f.split(".");u.id=g[0].substr(1,g[0].length-1);u.className=g[1]}else"#"==f.charAt(0)?u.id=f.substr(1,f.length-1):u.className=f;p+=h}a.append(u);a=t(u)}else if(">"==l)a=a.parent();else if("l"==l&&o.bPaginate&&o.bLengthChange)s=ce(e);else if("f"==l&&o.bFilter)s=$(e);else if("r"==l&&o.bProcessing)s=de(e);else if("t"==l)s=ge(e);else if("i"==l&&o.bInfo)s=ie(e);else if("p"==l&&o.bPaginate)s=fe(e);else if(0!==$e.ext.feature.length)for(var m=$e.ext.feature,v=0,y=m.length;y>v;v++)if(l==m[v].cFeature){s=m[v].fnInit(e);break}if(s){var b=e.aanFeatures;b[l]||(b[l]=[]);b[l].push(s);a.append(s)}}i.replaceWith(a)}function z(e,n){var r,i,o,a,s,l,u,c,f,h,d,p=t(n).children("tr"),g=function(t,e,n){for(var r=t[e];r[n];)n++;return n};e.splice(0,e.length);for(o=0,l=p.length;l>o;o++)e.push([]);for(o=0,l=p.length;l>o;o++){r=p[o];c=0;i=r.firstChild;for(;i;){if("TD"==i.nodeName.toUpperCase()||"TH"==i.nodeName.toUpperCase()){f=1*i.getAttribute("colspan");h=1*i.getAttribute("rowspan");f=f&&0!==f&&1!==f?f:1;h=h&&0!==h&&1!==h?h:1;u=g(e,o,c);d=1===f?!0:!1;for(s=0;f>s;s++)for(a=0;h>a;a++){e[o+a][u+s]={cell:i,unique:d};e[o+a].nTr=r}}i=i.nextSibling}}}function q(t,e,n){var r=[];if(!n){n=t.aoHeader;if(e){n=[];z(n,e)}}for(var i=0,o=n.length;o>i;i++)for(var a=0,s=n[i].length;s>a;a++)!n[i][a].unique||r[a]&&t.bSortCellsTop||(r[a]=n[i][a].cell);return r}function U(e,n,r){ze(e,"aoServerParams","serverParams",[n]);if(n&&t.isArray(n)){var i={},o=/(.*?)\[\]$/;t.each(n,function(t,e){var n=e.name.match(o);if(n){var r=n[0];i[r]||(i[r]=[]);i[r].push(e.value)}else i[e.name]=e.value});n=i}var a,s=e.ajax,l=e.oInstance;if(t.isPlainObject(s)&&s.data){a=s.data;var u=t.isFunction(a)?a(n):a;n=t.isFunction(a)&&u?u:t.extend(!0,n,u);delete s.data}var c={data:n,success:function(t){var n=t.error||t.sError;n&&e.oApi._fnLog(e,0,n);e.json=t;ze(e,null,"xhr",[e,t]);r(t)},dataType:"json",cache:!1,type:e.sServerMethod,error:function(t,n){var r=e.oApi._fnLog;"parsererror"==n?r(e,0,"Invalid JSON response",1):4===t.readyState&&r(e,0,"Ajax error",7);pe(e,!1)}};e.oAjaxData=n;ze(e,null,"preXhr",[e,n]);if(e.fnServerData)e.fnServerData.call(l,e.sAjaxSource,t.map(n,function(t,e){return{name:e,value:t}}),r,e);else if(e.sAjaxSource||"string"==typeof s)e.jqXHR=t.ajax(t.extend(c,{url:s||e.sAjaxSource}));else if(t.isFunction(s))e.jqXHR=s.call(l,n,r,e);else{e.jqXHR=t.ajax(t.extend(c,s));s.data=a}}function B(t){if(t.bAjaxDataGet){t.iDraw++;pe(t,!0);U(t,V(t),function(e){X(t,e)});return!1}return!0}function V(e){var n,r,i,o,a=e.aoColumns,s=a.length,l=e.oFeatures,u=e.oPreviousSearch,c=e.aoPreSearchCols,f=[],h=ke(e),d=e._iDisplayStart,p=l.bPaginate!==!1?e._iDisplayLength:-1,g=function(t,e){f.push({name:t,value:e})};g("sEcho",e.iDraw);g("iColumns",s);g("sColumns",dn(a,"sName").join(","));g("iDisplayStart",d);g("iDisplayLength",p);var m={draw:e.iDraw,columns:[],order:[],start:d,length:p,search:{value:u.sSearch,regex:u.bRegex}};for(n=0;s>n;n++){i=a[n];o=c[n];r="function"==typeof i.mData?"function":i.mData;m.columns.push({data:r,name:i.sName,searchable:i.bSearchable,orderable:i.bSortable,search:{value:o.sSearch,regex:o.bRegex}});g("mDataProp_"+n,r);if(l.bFilter){g("sSearch_"+n,o.sSearch);g("bRegex_"+n,o.bRegex);g("bSearchable_"+n,i.bSearchable)}l.bSort&&g("bSortable_"+n,i.bSortable)}if(l.bFilter){g("sSearch",u.sSearch);g("bRegex",u.bRegex)}if(l.bSort){t.each(h,function(t,e){m.order.push({column:e.col,dir:e.dir});g("iSortCol_"+t,e.col);g("sSortDir_"+t,e.dir)});g("iSortingCols",h.length)}var v=$e.ext.legacy.ajax;return null===v?e.sAjaxSource?f:m:v?f:m}function X(t,e){var n=function(t,n){return e[t]!==o?e[t]:e[n]},r=n("sEcho","draw"),i=n("iTotalRecords","recordsTotal"),a=n("iTotalDisplayRecords","recordsFiltered");if(r){if(1*r<t.iDraw)return;t.iDraw=1*r}A(t);t._iRecordsTotal=parseInt(i,10);t._iRecordsDisplay=parseInt(a,10);for(var s=G(t,e),l=0,u=s.length;u>l;l++)x(t,s[l]);t.aiDisplay=t.aiDisplayMaster.slice();t.bAjaxDataGet=!1;F(t);t._bInitComplete||le(t,e);t.bAjaxDataGet=!0;pe(t,!1)}function G(e,n){var r=t.isPlainObject(e.ajax)&&e.ajax.dataSrc!==o?e.ajax.dataSrc:e.sAjaxDataProp;return"data"===r?n.aaData||n[r]:""!==r?M(r)(n):n}function $(e){var n=e.oClasses,r=e.sTableId,o=e.oLanguage,a=e.oPreviousSearch,s=e.aanFeatures,l='<input type="search" class="'+n.sFilterInput+'"/>',u=o.sSearch;u=u.match(/_INPUT_/)?u.replace("_INPUT_",l):u+l;var c=t("<div/>",{id:s.f?null:r+"_filter","class":n.sFilter}).append(t("<label/>").append(u)),f=function(){var t=(s.f,this.value?this.value:"");if(t!=a.sSearch){Y(e,{sSearch:t,bRegex:a.bRegex,bSmart:a.bSmart,bCaseInsensitive:a.bCaseInsensitive});e._iDisplayStart=0;F(e)}},h=t("input",c).val(a.sSearch).attr("placeholder",o.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT","ssp"===Be(e)?be(f,400):f).bind("keypress.DT",function(t){return 13==t.keyCode?!1:void 0}).attr("aria-controls",r);t(e.nTable).on("search.dt.DT",function(t,n){if(e===n)try{h[0]!==i.activeElement&&h.val(a.sSearch)}catch(r){}});return c[0]}function Y(t,e,n){var r=t.oPreviousSearch,i=t.aoPreSearchCols,a=function(t){r.sSearch=t.sSearch;r.bRegex=t.bRegex;r.bSmart=t.bSmart;r.bCaseInsensitive=t.bCaseInsensitive},s=function(t){return t.bEscapeRegex!==o?!t.bEscapeRegex:t.bRegex};y(t);if("ssp"!=Be(t)){Z(t,e.sSearch,n,s(e),e.bSmart,e.bCaseInsensitive);a(e);for(var l=0;l<i.length;l++)K(t,i[l].sSearch,l,s(i[l]),i[l].bSmart,i[l].bCaseInsensitive);J(t)}else a(e);t.bFiltered=!0;ze(t,null,"search",[t])}function J(t){for(var e,n,r=$e.ext.search,i=t.aiDisplay,o=0,a=r.length;a>o;o++){for(var s=[],l=0,u=i.length;u>l;l++){n=i[l];e=t.aoData[n];r[o](t,e._aFilterData,n,e._aData,l)&&s.push(n)}i.length=0;i.push.apply(i,s)}}function K(t,e,n,r,i,o){if(""!==e)for(var a,s=t.aiDisplay,l=Q(e,r,i,o),u=s.length-1;u>=0;u--){a=t.aoData[s[u]]._aFilterData[n];l.test(a)||s.splice(u,1)}}function Z(t,e,n,r,i,o){var a,s,l,u=Q(e,r,i,o),c=t.oPreviousSearch.sSearch,f=t.aiDisplayMaster;0!==$e.ext.search.length&&(n=!0);s=ee(t);if(e.length<=0)t.aiDisplay=f.slice();else{(s||n||c.length>e.length||0!==e.indexOf(c)||t.bSorted)&&(t.aiDisplay=f.slice());a=t.aiDisplay;for(l=a.length-1;l>=0;l--)u.test(t.aoData[a[l]]._sFilterRow)||a.splice(l,1)}}function Q(e,n,r,i){e=n?e:te(e);if(r){var o=t.map(e.match(/"[^"]+"|[^ ]+/g)||"",function(t){return'"'===t.charAt(0)?t.match(/^"(.*)"$/)[1]:t});e="^(?=.*?"+o.join(")(?=.*?")+").*$"}return new RegExp(e,i?"i":"")}function te(t){return t.replace(on,"\\$1")}function ee(t){var e,n,r,i,o,a,s,l,u=t.aoColumns,c=$e.ext.type.search,f=!1;for(n=0,i=t.aoData.length;i>n;n++){l=t.aoData[n];if(!l._aFilterData){a=[];for(r=0,o=u.length;o>r;r++){e=u[r];if(e.bSearchable){s=T(t,n,r,"filter");c[e.sType]&&(s=c[e.sType](s));null===s&&(s="");"string"!=typeof s&&s.toString&&(s=s.toString())}else s="";if(s.indexOf&&-1!==s.indexOf("&")){wn.innerHTML=s;s=Sn?wn.textContent:wn.innerText}s.replace&&(s=s.replace(/[\r\n]/g,""));a.push(s)}l._aFilterData=a;l._sFilterRow=a.join(" ");f=!0}}return f}function ne(t){return{search:t.sSearch,smart:t.bSmart,regex:t.bRegex,caseInsensitive:t.bCaseInsensitive}}function re(t){return{sSearch:t.search,bSmart:t.smart,bRegex:t.regex,bCaseInsensitive:t.caseInsensitive}}function ie(e){var n=e.sTableId,r=e.aanFeatures.i,i=t("<div/>",{"class":e.oClasses.sInfo,id:r?null:n+"_info"});if(!r){e.aoDrawCallback.push({fn:oe,sName:"information"});i.attr("role","status").attr("aria-live","polite");t(e.nTable).attr("aria-describedby",n+"_info")}return i[0]}function oe(e){var n=e.aanFeatures.i;if(0!==n.length){var r=e.oLanguage,i=e._iDisplayStart+1,o=e.fnDisplayEnd(),a=e.fnRecordsTotal(),s=e.fnRecordsDisplay(),l=s?r.sInfo:r.sInfoEmpty;s!==a&&(l+=" "+r.sInfoFiltered);l+=r.sInfoPostFix;l=ae(e,l);var u=r.fnInfoCallback;null!==u&&(l=u.call(e.oInstance,e,i,o,a,s,l));t(n).html(l)}}function ae(t,e){var n=t.fnFormatNumber,r=t._iDisplayStart+1,i=t._iDisplayLength,o=t.fnRecordsDisplay(),a=-1===i;return e.replace(/_START_/g,n.call(t,r)).replace(/_END_/g,n.call(t,t.fnDisplayEnd())).replace(/_MAX_/g,n.call(t,t.fnRecordsTotal())).replace(/_TOTAL_/g,n.call(t,o)).replace(/_PAGE_/g,n.call(t,a?1:Math.ceil(r/i))).replace(/_PAGES_/g,n.call(t,a?1:Math.ceil(o/i)))}function se(t){var e,n,r,i=t.iInitDisplayStart,o=t.aoColumns,a=t.oFeatures;if(t.bInitialised){W(t);H(t);O(t,t.aoHeader);O(t,t.aoFooter);pe(t,!0);a.bAutoWidth&&ye(t);for(e=0,n=o.length;n>e;e++){r=o[e];r.sWidth&&(r.nTh.style.width=Te(r.sWidth))}R(t);var s=Be(t);if("ssp"!=s)if("ajax"==s)U(t,[],function(n){var r=G(t,n);for(e=0;e<r.length;e++)x(t,r[e]);t.iInitDisplayStart=i;R(t);pe(t,!1);le(t,n)},t);else{pe(t,!1);le(t)}}else setTimeout(function(){se(t)},200)}function le(t,e){t._bInitComplete=!0;e&&d(t);ze(t,"aoInitComplete","init",[t,e])}function ue(t,e){var n=parseInt(e,10);t._iDisplayLength=n;qe(t);ze(t,null,"length",[t,n])}function ce(e){for(var n=e.oClasses,r=e.sTableId,i=e.aLengthMenu,o=t.isArray(i[0]),a=o?i[0]:i,s=o?i[1]:i,l=t("<select/>",{name:r+"_length","aria-controls":r,"class":n.sLengthSelect}),u=0,c=a.length;c>u;u++)l[0][u]=new Option(s[u],a[u]);var f=t("<div><label/></div>").addClass(n.sLength);e.aanFeatures.l||(f[0].id=r+"_length");f.children().append(e.oLanguage.sLengthMenu.replace("_MENU_",l[0].outerHTML));t("select",f).val(e._iDisplayLength).bind("change.DT",function(){ue(e,t(this).val());F(e)});t(e.nTable).bind("length.dt.DT",function(n,r,i){e===r&&t("select",f).val(i)});return f[0]}function fe(e){var n=e.sPaginationType,r=$e.ext.pager[n],i="function"==typeof r,o=function(t){F(t)},a=t("<div/>").addClass(e.oClasses.sPaging+n)[0],s=e.aanFeatures;i||r.fnInit(e,a,o);if(!s.p){a.id=e.sTableId+"_paginate";e.aoDrawCallback.push({fn:function(t){if(i){var e,n,a=t._iDisplayStart,l=t._iDisplayLength,u=t.fnRecordsDisplay(),c=-1===l,f=c?0:Math.ceil(a/l),h=c?1:Math.ceil(u/l),d=r(f,h);for(e=0,n=s.p.length;n>e;e++)Ue(t,"pageButton")(t,s.p[e],e,d,f,h)}else r.fnUpdate(t,o)},sName:"pagination"})}return a}function he(t,e,n){var r=t._iDisplayStart,i=t._iDisplayLength,o=t.fnRecordsDisplay();if(0===o||-1===i)r=0;else if("number"==typeof e){r=e*i;r>o&&(r=0)}else if("first"==e)r=0;else if("previous"==e){r=i>=0?r-i:0;0>r&&(r=0)}else"next"==e?o>r+i&&(r+=i):"last"==e?r=Math.floor((o-1)/i)*i:He(t,0,"Unknown paging action: "+e,5);var a=t._iDisplayStart!==r;t._iDisplayStart=r;if(a){ze(t,null,"page",[t]);n&&F(t)}return a}function de(e){return t("<div/>",{id:e.aanFeatures.r?null:e.sTableId+"_processing","class":e.oClasses.sProcessing}).html(e.oLanguage.sProcessing).insertBefore(e.nTable)[0]}function pe(e,n){e.oFeatures.bProcessing&&t(e.aanFeatures.r).css("display",n?"block":"none");ze(e,null,"processing",[e,n])}function ge(e){var n=t(e.nTable);n.attr("role","grid");var r=e.oScroll;if(""===r.sX&&""===r.sY)return e.nTable;var i=r.sX,o=r.sY,a=e.oClasses,s=n.children("caption"),l=s.length?s[0]._captionSide:null,u=t(n[0].cloneNode(!1)),c=t(n[0].cloneNode(!1)),f=n.children("tfoot"),h="<div/>",d=function(t){return t?Te(t):null};r.sX&&"100%"===n.attr("width")&&n.removeAttr("width");f.length||(f=null);var p=t(h,{"class":a.sScrollWrapper}).append(t(h,{"class":a.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:i?d(i):"100%"}).append(t(h,{"class":a.sScrollHeadInner}).css({"box-sizing":"content-box",width:r.sXInner||"100%"}).append(u.removeAttr("id").css("margin-left",0).append(n.children("thead")))).append("top"===l?s:null)).append(t(h,{"class":a.sScrollBody}).css({overflow:"auto",height:d(o),width:d(i)}).append(n));f&&p.append(t(h,{"class":a.sScrollFoot}).css({overflow:"hidden",border:0,width:i?d(i):"100%"}).append(t(h,{"class":a.sScrollFootInner}).append(c.removeAttr("id").css("margin-left",0).append(n.children("tfoot")))).append("bottom"===l?s:null));var g=p.children(),m=g[0],v=g[1],y=f?g[2]:null;i&&t(v).scroll(function(){var t=this.scrollLeft;m.scrollLeft=t;f&&(y.scrollLeft=t)});e.nScrollHead=m;e.nScrollBody=v;e.nScrollFoot=y;e.aoDrawCallback.push({fn:me,sName:"scrolling"});return p[0]}function me(e){var n,r,i,o,a,s,l,u,c,f=e.oScroll,h=f.sX,d=f.sXInner,g=f.sY,m=f.iBarWidth,v=t(e.nScrollHead),y=v[0].style,b=v.children("div"),x=b[0].style,w=b.children("table"),S=e.nScrollBody,C=t(S),T=S.style,_=t(e.nScrollFoot),k=_.children("div"),M=k.children("table"),D=t(e.nTHead),L=t(e.nTable),A=L[0],N=A.style,E=e.nTFoot?t(e.nTFoot):null,j=e.oBrowser,I=j.bScrollOversize,P=[],H=[],O=[],F=function(t){var e=t.style;e.paddingTop="0";e.paddingBottom="0";e.borderTopWidth="0";e.borderBottomWidth="0";e.height=0};L.children("thead, tfoot").remove();a=D.clone().prependTo(L);n=D.find("tr");i=a.find("tr");a.find("th, td").removeAttr("tabindex");if(E){s=E.clone().prependTo(L);r=E.find("tr");o=s.find("tr")}if(!h){T.width="100%";v[0].style.width="100%"}t.each(q(e,a),function(t,n){l=p(e,t);n.style.width=e.aoColumns[l].sWidth});E&&ve(function(t){t.style.width=""},o);f.bCollapse&&""!==g&&(T.height=C[0].offsetHeight+D[0].offsetHeight+"px");c=L.outerWidth();if(""===h){N.width="100%";I&&(L.find("tbody").height()>S.offsetHeight||"scroll"==C.css("overflow-y"))&&(N.width=Te(L.outerWidth()-m))}else if(""!==d)N.width=Te(d);else if(c==C.width()&&C.height()<L.height()){N.width=Te(c-m);L.outerWidth()>c-m&&(N.width=Te(c))}else N.width=Te(c);c=L.outerWidth();ve(F,i);ve(function(e){O.push(e.innerHTML);P.push(Te(t(e).css("width")))},i);ve(function(t,e){t.style.width=P[e]},n);t(i).height(0);if(E){ve(F,o);ve(function(e){H.push(Te(t(e).css("width")))},o);ve(function(t,e){t.style.width=H[e]},r);t(o).height(0)}ve(function(t,e){t.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+O[e]+"</div>";t.style.width=P[e]},i);E&&ve(function(t,e){t.innerHTML="";t.style.width=H[e]},o);if(L.outerWidth()<c){u=S.scrollHeight>S.offsetHeight||"scroll"==C.css("overflow-y")?c+m:c;I&&(S.scrollHeight>S.offsetHeight||"scroll"==C.css("overflow-y"))&&(N.width=Te(u-m));(""===h||""!==d)&&He(e,1,"Possible column misalignment",6)}else u="100%";T.width=Te(u);y.width=Te(u);E&&(e.nScrollFoot.style.width=Te(u));g||I&&(T.height=Te(A.offsetHeight+m));if(g&&f.bCollapse){T.height=Te(g);var R=h&&A.offsetWidth>S.offsetWidth?m:0;A.offsetHeight<S.offsetHeight&&(T.height=Te(A.offsetHeight+R))}var W=L.outerWidth();w[0].style.width=Te(W);x.width=Te(W);var z=L.height()>S.clientHeight||"scroll"==C.css("overflow-y"),U="padding"+(j.bScrollbarLeft?"Left":"Right");x[U]=z?m+"px":"0px";if(E){M[0].style.width=Te(W);k[0].style.width=Te(W);k[0].style[U]=z?m+"px":"0px"}C.scroll();!e.bSorted&&!e.bFiltered||e._drawHold||(S.scrollTop=0)}function ve(t,e,n){for(var r,i,o=0,a=0,s=e.length;s>a;){r=e[a].firstChild;i=n?n[a].firstChild:null;for(;r;){if(1===r.nodeType){n?t(r,i,o):t(r,o);o++}r=r.nextSibling;i=n?i.nextSibling:null}a++}}function ye(e){var r,i,o,a,s,l=e.nTable,u=e.aoColumns,c=e.oScroll,f=c.sY,h=c.sX,p=c.sXInner,g=u.length,y=v(e,"bVisible"),b=t("th",e.nTHead),x=l.getAttribute("width"),w=l.parentNode,S=!1;for(r=0;r<y.length;r++){i=u[y[r]];if(null!==i.sWidth){i.sWidth=xe(i.sWidthOrig,w);S=!0}}if(S||h||f||g!=m(e)||g!=b.length){var C=t(l).clone().empty().css("visibility","hidden").removeAttr("id").append(t(e.nTHead).clone(!1)).append(t(e.nTFoot).clone(!1)).append(t("<tbody><tr/></tbody>"));C.find("tfoot th, tfoot td").css("width","");var T=C.find("tbody tr");b=q(e,C.find("thead")[0]);for(r=0;r<y.length;r++){i=u[y[r]];b[r].style.width=null!==i.sWidthOrig&&""!==i.sWidthOrig?Te(i.sWidthOrig):""}if(e.aoData.length)for(r=0;r<y.length;r++){o=y[r];i=u[o];t(Se(e,o)).clone(!1).append(i.sContentPadding).appendTo(T)}C.appendTo(w);if(h&&p)C.width(p);else if(h){C.css("width","auto");C.width()<w.offsetWidth&&C.width(w.offsetWidth)}else f?C.width(w.offsetWidth):x&&C.width(x);we(e,C[0]);if(h){var _=0;for(r=0;r<y.length;r++){i=u[y[r]];s=t(b[r]).outerWidth();_+=null===i.sWidthOrig?s:parseInt(i.sWidth,10)+s-t(b[r]).width()}C.width(Te(_));l.style.width=Te(_)}for(r=0;r<y.length;r++){i=u[y[r]];a=t(b[r]).width();a&&(i.sWidth=Te(a))}l.style.width=Te(C.css("width"));C.remove()}else for(r=0;g>r;r++)u[r].sWidth=Te(b.eq(r).width());x&&(l.style.width=Te(x));if((x||h)&&!e._reszEvt){t(n).bind("resize.DT-"+e.sInstance,be(function(){d(e)}));e._reszEvt=!0}}function be(t,e){var n,r,i=e||200;return function(){var e=this,a=+new Date,s=arguments;if(n&&n+i>a){clearTimeout(r);r=setTimeout(function(){n=o;t.apply(e,s)},i)}else if(n){n=a;t.apply(e,s)}else n=a}}function xe(e,n){if(!e)return 0;var r=t("<div/>").css("width",Te(e)).appendTo(n||i.body),o=r[0].offsetWidth;r.remove();return o}function we(e,n){var r=e.oScroll;if(r.sX||r.sY){var i=r.sX?0:r.iBarWidth;n.style.width=Te(t(n).outerWidth()-i)}}function Se(e,n){var r=Ce(e,n);if(0>r)return null;var i=e.aoData[r];return i.nTr?i.anCells[n]:t("<td/>").html(T(e,r,n,"display"))[0]}function Ce(t,e){for(var n,r=-1,i=-1,o=0,a=t.aoData.length;a>o;o++){n=T(t,o,e,"display")+"";n=n.replace(Cn,"");if(n.length>r){r=n.length;i=o}}return i}function Te(t){return null===t?"0px":"number"==typeof t?0>t?"0px":t+"px":t.match(/\d$/)?t+"px":t}function _e(){if(!$e.__scrollbarWidth){var e=t("<p/>").css({width:"100%",height:200,padding:0})[0],n=t("<div/>").css({position:"absolute",top:0,left:0,width:200,height:150,padding:0,overflow:"hidden",visibility:"hidden"}).append(e).appendTo("body"),r=e.offsetWidth;n.css("overflow","scroll");var i=e.offsetWidth;r===i&&(i=n[0].clientWidth);n.remove();$e.__scrollbarWidth=r-i}return $e.__scrollbarWidth}function ke(e){var n,r,i,o,a,s,l,u=[],c=e.aoColumns,f=e.aaSortingFixed,h=t.isPlainObject(f),d=[],p=function(e){e.length&&!t.isArray(e[0])?d.push(e):d.push.apply(d,e)};t.isArray(f)&&p(f);h&&f.pre&&p(f.pre);p(e.aaSorting);h&&f.post&&p(f.post);for(n=0;n<d.length;n++){l=d[n][0];o=c[l].aDataSort;for(r=0,i=o.length;i>r;r++){a=o[r];s=c[a].sType||"string";u.push({src:l,col:a,dir:d[n][1],index:d[n][2],type:s,formatter:$e.ext.type.order[s+"-pre"]})}}return u}function Me(t){var e,n,r,i,o,a=[],s=$e.ext.type.order,l=t.aoData,u=(t.aoColumns,0),c=t.aiDisplayMaster;y(t);o=ke(t);for(e=0,n=o.length;n>e;e++){i=o[e];i.formatter&&u++;Ee(t,i.col)}if("ssp"!=Be(t)&&0!==o.length){for(e=0,r=c.length;r>e;e++)a[c[e]]=e;c.sort(u===o.length?function(t,e){var n,r,i,s,u,c=o.length,f=l[t]._aSortData,h=l[e]._aSortData;for(i=0;c>i;i++){u=o[i];n=f[u.col];r=h[u.col];s=r>n?-1:n>r?1:0;if(0!==s)return"asc"===u.dir?s:-s}n=a[t];r=a[e];return r>n?-1:n>r?1:0}:function(t,e){var n,r,i,u,c,f,h=o.length,d=l[t]._aSortData,p=l[e]._aSortData; for(i=0;h>i;i++){c=o[i];n=d[c.col];r=p[c.col];f=s[c.type+"-"+c.dir]||s["string-"+c.dir];u=f(n,r);if(0!==u)return u}n=a[t];r=a[e];return r>n?-1:n>r?1:0})}t.bSorted=!0}function De(t){for(var e,n,r=t.aoColumns,i=ke(t),o=t.oLanguage.oAria,a=0,s=r.length;s>a;a++){var l=r[a],u=l.asSorting,c=l.sTitle.replace(/<.*?>/g,""),f=l.nTh;f.removeAttribute("aria-sort");if(l.bSortable){if(i.length>0&&i[0].col==a){f.setAttribute("aria-sort","asc"==i[0].dir?"ascending":"descending");n=u[i[0].index+1]||u[0]}else n=u[0];e=c+("asc"===n?o.sSortAscending:o.sSortDescending)}else e=c;f.setAttribute("aria-label",e)}}function Le(e,n,r,i){var a,s=e.aoColumns[n],l=e.aaSorting,u=s.asSorting,c=function(e){var n=e._idx;n===o&&(n=t.inArray(e[1],u));return n+1>=u.length?0:n+1};"number"==typeof l[0]&&(l=e.aaSorting=[l]);if(r&&e.oFeatures.bSortMulti){var f=t.inArray(n,dn(l,"0"));if(-1!==f){a=c(l[f]);l[f][1]=u[a];l[f]._idx=a}else{l.push([n,u[0],0]);l[l.length-1]._idx=0}}else if(l.length&&l[0][0]==n){a=c(l[0]);l.length=1;l[0][1]=u[a];l[0]._idx=a}else{l.length=0;l.push([n,u[0]]);l[0]._idx=0}R(e);"function"==typeof i&&i(e)}function Ae(t,e,n,r){var i=t.aoColumns[n];Re(e,{},function(e){if(i.bSortable!==!1)if(t.oFeatures.bProcessing){pe(t,!0);setTimeout(function(){Le(t,n,e.shiftKey,r);"ssp"!==Be(t)&&pe(t,!1)},0)}else Le(t,n,e.shiftKey,r)})}function Ne(e){var n,r,i,o=e.aLastSort,a=e.oClasses.sSortColumn,s=ke(e),l=e.oFeatures;if(l.bSort&&l.bSortClasses){for(n=0,r=o.length;r>n;n++){i=o[n].src;t(dn(e.aoData,"anCells",i)).removeClass(a+(2>n?n+1:3))}for(n=0,r=s.length;r>n;n++){i=s[n].src;t(dn(e.aoData,"anCells",i)).addClass(a+(2>n?n+1:3))}}e.aLastSort=s}function Ee(t,e){var n,r=t.aoColumns[e],i=$e.ext.order[r.sSortDataType];i&&(n=i.call(t.oInstance,t,e,g(t,e)));for(var o,a,s=$e.ext.type.order[r.sType+"-pre"],l=0,u=t.aoData.length;u>l;l++){o=t.aoData[l];o._aSortData||(o._aSortData=[]);if(!o._aSortData[e]||i){a=i?n[l]:T(t,l,e,"sort");o._aSortData[e]=s?s(a):a}}}function je(e){if(e.oFeatures.bStateSave&&!e.bDestroying){var n={time:+new Date,start:e._iDisplayStart,length:e._iDisplayLength,order:t.extend(!0,[],e.aaSorting),search:ne(e.oPreviousSearch),columns:t.map(e.aoColumns,function(t,n){return{visible:t.bVisible,search:ne(e.aoPreSearchCols[n])}})};ze(e,"aoStateSaveParams","stateSaveParams",[e,n]);e.oSavedState=n;e.fnStateSaveCallback.call(e.oInstance,e,n)}}function Ie(e){var n,r,i=e.aoColumns;if(e.oFeatures.bStateSave){var o=e.fnStateLoadCallback.call(e.oInstance,e);if(o&&o.time){var a=ze(e,"aoStateLoadParams","stateLoadParams",[e,o]);if(-1===t.inArray(!1,a)){var s=e.iStateDuration;if(!(s>0&&o.time<+new Date-1e3*s)&&i.length===o.columns.length){e.oLoadedState=t.extend(!0,{},o);e._iDisplayStart=o.start;e.iInitDisplayStart=o.start;e._iDisplayLength=o.length;e.aaSorting=[];t.each(o.order,function(t,n){e.aaSorting.push(n[0]>=i.length?[0,n[1]]:n)});t.extend(e.oPreviousSearch,re(o.search));for(n=0,r=o.columns.length;r>n;n++){var l=o.columns[n];i[n].bVisible=l.visible;t.extend(e.aoPreSearchCols[n],re(l.search))}ze(e,"aoStateLoaded","stateLoaded",[e,o])}}}}}function Pe(e){var n=$e.settings,r=t.inArray(e,dn(n,"nTable"));return-1!==r?n[r]:null}function He(t,e,r,i){r="DataTables warning: "+(null!==t?"table id="+t.sTableId+" - ":"")+r;i&&(r+=". For more information about this error, please see http://datatables.net/tn/"+i);if(e)n.console&&console.log&&console.log(r);else{var o=$e.ext,a=o.sErrMode||o.errMode;if("alert"!=a)throw new Error(r);alert(r)}}function Oe(e,n,r,i){if(t.isArray(r))t.each(r,function(r,i){t.isArray(i)?Oe(e,n,i[0],i[1]):Oe(e,n,i)});else{i===o&&(i=r);n[r]!==o&&(e[i]=n[r])}}function Fe(e,n,r){var i;for(var o in n)if(n.hasOwnProperty(o)){i=n[o];if(t.isPlainObject(i)){t.isPlainObject(e[o])||(e[o]={});t.extend(!0,e[o],i)}else e[o]=r&&"data"!==o&&"aaData"!==o&&t.isArray(i)?i.slice():i}return e}function Re(e,n,r){t(e).bind("click.DT",n,function(t){e.blur();r(t)}).bind("keypress.DT",n,function(t){if(13===t.which){t.preventDefault();r(t)}}).bind("selectstart.DT",function(){return!1})}function We(t,e,n,r){n&&t[e].push({fn:n,sName:r})}function ze(e,n,r,i){var o=[];n&&(o=t.map(e[n].slice().reverse(),function(t){return t.fn.apply(e.oInstance,i)}));null!==r&&t(e.nTable).trigger(r+".dt",i);return o}function qe(t){var e=t._iDisplayStart,n=t.fnDisplayEnd(),r=t._iDisplayLength;n===t.fnRecordsDisplay()&&(e=n-r);(-1===r||0>e)&&(e=0);t._iDisplayStart=e}function Ue(e,n){var r=e.renderer,i=$e.ext.renderer[n];return t.isPlainObject(r)&&r[n]?i[r[n]]||i._:"string"==typeof r?i[r]||i._:i._}function Be(t){return t.oFeatures.bServerSide?"ssp":t.ajax||t.sAjaxSource?"ajax":"dom"}function Ve(t,e){var n=[],r=Vn.numbers_length,i=Math.floor(r/2);if(r>=e)n=gn(0,e);else if(i>=t){n=gn(0,r-2);n.push("ellipsis");n.push(e-1)}else if(t>=e-1-i){n=gn(e-(r-2),e);n.splice(0,0,"ellipsis");n.splice(0,0,0)}else{n=gn(t-1,t+2);n.push("ellipsis");n.push(e-1);n.splice(0,0,"ellipsis");n.splice(0,0,0)}n.DT_el="span";return n}function Xe(e){t.each({num:function(t){return Xn(t,e)},"num-fmt":function(t){return Xn(t,e,an)},"html-num":function(t){return Xn(t,e,en)},"html-num-fmt":function(t){return Xn(t,e,en,an)}},function(t,n){Ye.type.order[t+e+"-pre"]=n})}function Ge(t){return function(){var e=[Pe(this[$e.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return $e.ext.internal[t].apply(this,e)}}var $e,Ye,Je,Ke,Ze,Qe={},tn=/[\r\n]/g,en=/<.*?>/g,nn=/^[\w\+\-]/,rn=/[\w\+\-]$/,on=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^","-"].join("|\\")+")","g"),an=/[',$£€¥%\u2009\u202F]/g,sn=function(t){return t&&t!==!0&&"-"!==t?!1:!0},ln=function(t){var e=parseInt(t,10);return!isNaN(e)&&isFinite(t)?e:null},un=function(t,e){Qe[e]||(Qe[e]=new RegExp(te(e),"g"));return"string"==typeof t?t.replace(/\./g,"").replace(Qe[e],"."):t},cn=function(t,e,n){var r="string"==typeof t;e&&r&&(t=un(t,e));n&&r&&(t=t.replace(an,""));return sn(t)||!isNaN(parseFloat(t))&&isFinite(t)},fn=function(t){return sn(t)||"string"==typeof t},hn=function(t,e,n){if(sn(t))return!0;var r=fn(t);return r&&cn(mn(t),e,n)?!0:null},dn=function(t,e,n){var r=[],i=0,a=t.length;if(n!==o)for(;a>i;i++)t[i]&&t[i][e]&&r.push(t[i][e][n]);else for(;a>i;i++)t[i]&&r.push(t[i][e]);return r},pn=function(t,e,n,r){var i=[],a=0,s=e.length;if(r!==o)for(;s>a;a++)i.push(t[e[a]][n][r]);else for(;s>a;a++)i.push(t[e[a]][n]);return i},gn=function(t,e){var n,r=[];if(e===o){e=0;n=t}else{n=e;e=t}for(var i=e;n>i;i++)r.push(i);return r},mn=function(t){return t.replace(en,"")},vn=function(t){var e,n,r,i=[],o=t.length,a=0;t:for(n=0;o>n;n++){e=t[n];for(r=0;a>r;r++)if(i[r]===e)continue t;i.push(e);a++}return i},yn=function(t,e,n){t[e]!==o&&(t[n]=t[e])},bn=/\[.*?\]$/,xn=/\(\)$/,wn=t("<div>")[0],Sn=wn.textContent!==o,Cn=/<.*?>/g;$e=function(e){this.$=function(t,e){return this.api(!0).$(t,e)};this._=function(t,e){return this.api(!0).rows(t,e).data()};this.api=function(t){return new Je(t?Pe(this[Ye.iApiIndex]):this)};this.fnAddData=function(e,n){var r=this.api(!0),i=t.isArray(e)&&(t.isArray(e[0])||t.isPlainObject(e[0]))?r.rows.add(e):r.row.add(e);(n===o||n)&&r.draw();return i.flatten().toArray()};this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],r=n.oScroll;t===o||t?e.draw(!1):(""!==r.sX||""!==r.sY)&&me(n)};this.fnClearTable=function(t){var e=this.api(!0).clear();(t===o||t)&&e.draw()};this.fnClose=function(t){this.api(!0).row(t).child.hide()};this.fnDeleteRow=function(t,e,n){var r=this.api(!0),i=r.rows(t),a=i.settings()[0],s=a.aoData[i[0][0]];i.remove();e&&e.call(this,a,s);(n===o||n)&&r.draw();return s};this.fnDestroy=function(t){this.api(!0).destroy(t)};this.fnDraw=function(t){this.api(!0).draw(!t)};this.fnFilter=function(t,e,n,r,i,a){var s=this.api(!0);null===e||e===o?s.search(t,n,r,a):s.column(e).search(t,n,r,a);s.draw()};this.fnGetData=function(t,e){var n=this.api(!0);if(t!==o){var r=t.nodeName?t.nodeName.toLowerCase():"";return e!==o||"td"==r||"th"==r?n.cell(t,e).data():n.row(t).data()||null}return n.data().toArray()};this.fnGetNodes=function(t){var e=this.api(!0);return t!==o?e.row(t).node():e.rows().nodes().flatten().toArray()};this.fnGetPosition=function(t){var e=this.api(!0),n=t.nodeName.toUpperCase();if("TR"==n)return e.row(t).index();if("TD"==n||"TH"==n){var r=e.cell(t).index();return[r.row,r.columnVisible,r.column]}return null};this.fnIsOpen=function(t){return this.api(!0).row(t).child.isShown()};this.fnOpen=function(t,e,n){return this.api(!0).row(t).child(e,n).show().child()[0]};this.fnPageChange=function(t,e){var n=this.api(!0).page(t);(e===o||e)&&n.draw(!1)};this.fnSetColumnVis=function(t,e,n){var r=this.api(!0).column(t).visible(e);(n===o||n)&&r.columns.adjust().draw()};this.fnSettings=function(){return Pe(this[Ye.iApiIndex])};this.fnSort=function(t){this.api(!0).order(t).draw()};this.fnSortListener=function(t,e,n){this.api(!0).order.listener(t,e,n)};this.fnUpdate=function(t,e,n,r,i){var a=this.api(!0);n===o||null===n?a.row(e).data(t):a.cell(e,n).data(t);(i===o||i)&&a.columns.adjust();(r===o||r)&&a.draw();return 0};this.fnVersionCheck=Ye.fnVersionCheck;var n=this,i=e===o,c=this.length;i&&(e={});this.oApi=this.internal=Ye.internal;for(var d in $e.ext.internal)d&&(this[d]=Ge(d));this.each(function(){var d,p={},g=c>1?Fe(p,e,!0):e,m=0,v=this.getAttribute("id"),y=!1,S=$e.defaults;if("table"==this.nodeName.toLowerCase()){s(S);l(S.column);r(S,S,!0);r(S.column,S.column,!0);r(S,g);var C=$e.settings;for(m=0,d=C.length;d>m;m++){if(C[m].nTable==this){var T=g.bRetrieve!==o?g.bRetrieve:S.bRetrieve,_=g.bDestroy!==o?g.bDestroy:S.bDestroy;if(i||T)return C[m].oInstance;if(_){C[m].oInstance.fnDestroy();break}He(C[m],0,"Cannot reinitialise DataTable",3);return}if(C[m].sTableId==this.id){C.splice(m,1);break}}if(null===v||""===v){v="DataTables_Table_"+$e.ext._unique++;this.id=v}var k=t.extend(!0,{},$e.models.oSettings,{nTable:this,oApi:n.internal,oInit:g,sDestroyWidth:t(this)[0].style.width,sInstance:v,sTableId:v});C.push(k);k.oInstance=1===n.length?n:t(this).dataTable();s(g);g.oLanguage&&a(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=t.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=Fe(t.extend(!0,{},S),g);Oe(k.oFeatures,g,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]);Oe(k,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);Oe(k.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);Oe(k.oLanguage,g,"fnInfoCallback");We(k,"aoDrawCallback",g.fnDrawCallback,"user");We(k,"aoServerParams",g.fnServerParams,"user");We(k,"aoStateSaveParams",g.fnStateSaveParams,"user");We(k,"aoStateLoadParams",g.fnStateLoadParams,"user");We(k,"aoStateLoaded",g.fnStateLoaded,"user");We(k,"aoRowCallback",g.fnRowCallback,"user");We(k,"aoRowCreatedCallback",g.fnCreatedRow,"user");We(k,"aoHeaderCallback",g.fnHeaderCallback,"user");We(k,"aoFooterCallback",g.fnFooterCallback,"user");We(k,"aoInitComplete",g.fnInitComplete,"user");We(k,"aoPreDrawCallback",g.fnPreDrawCallback,"user");var M=k.oClasses;if(g.bJQueryUI){t.extend(M,$e.ext.oJUIClasses,g.oClasses);g.sDom===S.sDom&&"lfrtip"===S.sDom&&(k.sDom='<"H"lfr>t<"F"ip>');k.renderer?t.isPlainObject(k.renderer)&&!k.renderer.header&&(k.renderer.header="jqueryui"):k.renderer="jqueryui"}else t.extend(M,$e.ext.classes,g.oClasses);t(this).addClass(M.sTable);(""!==k.oScroll.sX||""!==k.oScroll.sY)&&(k.oScroll.iBarWidth=_e());k.oScroll.sX===!0&&(k.oScroll.sX="100%");if(k.iInitDisplayStart===o){k.iInitDisplayStart=g.iDisplayStart;k._iDisplayStart=g.iDisplayStart}if(null!==g.iDeferLoading){k.bDeferLoading=!0;var D=t.isArray(g.iDeferLoading);k._iRecordsDisplay=D?g.iDeferLoading[0]:g.iDeferLoading;k._iRecordsTotal=D?g.iDeferLoading[1]:g.iDeferLoading}if(""!==g.oLanguage.sUrl){k.oLanguage.sUrl=g.oLanguage.sUrl;t.getJSON(k.oLanguage.sUrl,null,function(e){a(e);r(S.oLanguage,e);t.extend(!0,k.oLanguage,g.oLanguage,e);se(k)});y=!0}else t.extend(!0,k.oLanguage,g.oLanguage);null===g.asStripeClasses&&(k.asStripeClasses=[M.sStripeOdd,M.sStripeEven]);var L=k.asStripeClasses,A=t("tbody tr:eq(0)",this);if(-1!==t.inArray(!0,t.map(L,function(t){return A.hasClass(t)}))){t("tbody tr",this).removeClass(L.join(" "));k.asDestroyStripes=L.slice()}var N,E=[],I=this.getElementsByTagName("thead");if(0!==I.length){z(k.aoHeader,I[0]);E=q(k)}if(null===g.aoColumns){N=[];for(m=0,d=E.length;d>m;m++)N.push(null)}else N=g.aoColumns;for(m=0,d=N.length;d>m;m++)f(k,E?E[m]:null);b(k,g.aoColumnDefs,N,function(t,e){h(k,t,e)});if(A.length){var P=function(t,e){return t.getAttribute("data-"+e)?e:null};t.each(j(k,A[0]).cells,function(t,e){var n=k.aoColumns[t];if(n.mData===t){var r=P(e,"sort")||P(e,"order"),i=P(e,"filter")||P(e,"search");if(null!==r||null!==i){n.mData={_:t+".display",sort:null!==r?t+".@data-"+r:o,type:null!==r?t+".@data-"+r:o,filter:null!==i?t+".@data-"+i:o};h(k,t)}}})}var H=k.oFeatures;if(g.bStateSave){H.bStateSave=!0;Ie(k,g);We(k,"aoDrawCallback",je,"state_save")}if(g.aaSorting===o){var O=k.aaSorting;for(m=0,d=O.length;d>m;m++)O[m][1]=k.aoColumns[m].asSorting[0]}Ne(k);H.bSort&&We(k,"aoDrawCallback",function(){if(k.bSorted){var e=ke(k),n={};t.each(e,function(t,e){n[e.src]=e.dir});ze(k,null,"order",[k,e,n]);De(k)}});We(k,"aoDrawCallback",function(){(k.bSorted||"ssp"===Be(k)||H.bDeferRender)&&Ne(k)},"sc");u(k);var F=t(this).children("caption").each(function(){this._captionSide=t(this).css("caption-side")}),R=t(this).children("thead");0===R.length&&(R=t("<thead/>").appendTo(this));k.nTHead=R[0];var W=t(this).children("tbody");0===W.length&&(W=t("<tbody/>").appendTo(this));k.nTBody=W[0];var U=t(this).children("tfoot");0===U.length&&F.length>0&&(""!==k.oScroll.sX||""!==k.oScroll.sY)&&(U=t("<tfoot/>").appendTo(this));if(0===U.length||0===U.children().length)t(this).addClass(M.sNoFooter);else if(U.length>0){k.nTFoot=U[0];z(k.aoFooter,k.nTFoot)}if(g.aaData)for(m=0;m<g.aaData.length;m++)x(k,g.aaData[m]);else(k.bDeferLoading||"dom"==Be(k))&&w(k,t(k.nTBody).children("tr"));k.aiDisplay=k.aiDisplayMaster.slice();k.bInitialised=!0;y===!1&&se(k)}else He(null,0,"Non-table node initialisation ("+this.nodeName+")",2)});n=null;return this};var Tn=[],_n=Array.prototype,kn=function(e){var n,r,i=$e.settings,o=t.map(i,function(t){return t.nTable});if(!e)return[];if(e.nTable&&e.oApi)return[e];if(e.nodeName&&"table"===e.nodeName.toLowerCase()){n=t.inArray(e,o);return-1!==n?[i[n]]:null}if(e&&"function"==typeof e.settings)return e.settings().toArray();"string"==typeof e?r=t(e):e instanceof t&&(r=e);return r?r.map(function(){n=t.inArray(this,o);return-1!==n?i[n]:null}).toArray():void 0};Je=function(e,n){if(!this instanceof Je)throw"DT API must be constructed as a new object";var r=[],i=function(t){var e=kn(t);e&&r.push.apply(r,e)};if(t.isArray(e))for(var o=0,a=e.length;a>o;o++)i(e[o]);else i(e);this.context=vn(r);n&&this.push.apply(this,n.toArray?n.toArray():n);this.selector={rows:null,cols:null,opts:null};Je.extend(this,this,Tn)};$e.Api=Je;Je.prototype={concat:_n.concat,context:[],each:function(t){for(var e=0,n=this.length;n>e;e++)t.call(this,this[e],e,this);return this},eq:function(t){var e=this.context;return e.length>t?new Je(e[t],this[t]):null},filter:function(t){var e=[];if(_n.filter)e=_n.filter.call(this,t,this);else for(var n=0,r=this.length;r>n;n++)t.call(this,this[n],n,this)&&e.push(this[n]);return new Je(this.context,e)},flatten:function(){var t=[];return new Je(this.context,t.concat.apply(t,this.toArray()))},join:_n.join,indexOf:_n.indexOf||function(t,e){for(var n=e||0,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},iterator:function(t,e,n){var r,i,a,s,l,u,c,f,h=[],d=this.context,p=this.selector;if("string"==typeof t){n=e;e=t;t=!1}for(i=0,a=d.length;a>i;i++)if("table"===e){r=n(d[i],i);r!==o&&h.push(r)}else if("columns"===e||"rows"===e){r=n(d[i],this[i],i);r!==o&&h.push(r)}else if("column"===e||"column-rows"===e||"row"===e||"cell"===e){c=this[i];"column-rows"===e&&(u=En(d[i],p.opts));for(s=0,l=c.length;l>s;s++){f=c[s];r="cell"===e?n(d[i],f.row,f.column,i,s):n(d[i],f,i,s,u);r!==o&&h.push(r)}}if(h.length){var g=new Je(d,t?h.concat.apply([],h):h),m=g.selector;m.rows=p.rows;m.cols=p.cols;m.opts=p.opts;return g}return this},lastIndexOf:_n.lastIndexOf||function(){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(t){var e=[];if(_n.map)e=_n.map.call(this,t,this);else for(var n=0,r=this.length;r>n;n++)e.push(t.call(this,this[n],n));return new Je(this.context,e)},pluck:function(t){return this.map(function(e){return e[t]})},pop:_n.pop,push:_n.push,reduce:_n.reduce||function(t,e){return c(this,t,e,0,this.length,1)},reduceRight:_n.reduceRight||function(t,e){return c(this,t,e,this.length-1,-1,-1)},reverse:_n.reverse,selector:null,shift:_n.shift,sort:_n.sort,splice:_n.splice,toArray:function(){return _n.slice.call(this)},to$:function(){return t(this)},toJQuery:function(){return t(this)},unique:function(){return new Je(this.context,vn(this))},unshift:_n.unshift};Je.extend=function(e,n,r){if(n&&(n instanceof Je||n.__dt_wrapper)){var i,o,a,s=function(t,e,n){return function(){var r=e.apply(t,arguments);Je.extend(r,r,n.methodExt);return r}};for(i=0,o=r.length;o>i;i++){a=r[i];n[a.name]="function"==typeof a.val?s(e,a.val,a):t.isPlainObject(a.val)?{}:a.val;n[a.name].__dt_wrapper=!0;Je.extend(e,n[a.name],a.propExt)}}};Je.register=Ke=function(e,n){if(t.isArray(e))for(var r=0,i=e.length;i>r;r++)Je.register(e[r],n);else{var o,a,s,l,u=e.split("."),c=Tn,f=function(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n].name===e)return t[n];return null};for(o=0,a=u.length;a>o;o++){l=-1!==u[o].indexOf("()");s=l?u[o].replace("()",""):u[o];var h=f(c,s);if(!h){h={name:s,val:{},methodExt:[],propExt:[]};c.push(h)}o===a-1?h.val=n:c=l?h.methodExt:h.propExt}}};Je.registerPlural=Ze=function(e,n,r){Je.register(e,r);Je.register(n,function(){var e=r.apply(this,arguments);return e===this?this:e instanceof Je?e.length?t.isArray(e[0])?new Je(e.context,e[0]):e[0]:o:e})};var Mn=function(e,n){if("number"==typeof e)return[n[e]];var r=t.map(n,function(t){return t.nTable});return t(r).filter(e).map(function(){var e=t.inArray(this,r);return n[e]}).toArray()};Ke("tables()",function(t){return t?new Je(Mn(t,this.context)):this});Ke("table()",function(t){var e=this.tables(t),n=e.context;return n.length?new Je(n[0]):e});Ze("tables().nodes()","table().node()",function(){return this.iterator("table",function(t){return t.nTable})});Ze("tables().body()","table().body()",function(){return this.iterator("table",function(t){return t.nTBody})});Ze("tables().header()","table().header()",function(){return this.iterator("table",function(t){return t.nTHead})});Ze("tables().footer()","table().footer()",function(){return this.iterator("table",function(t){return t.nTFoot})});Ze("tables().containers()","table().container()",function(){return this.iterator("table",function(t){return t.nTableWrapper})});Ke("draw()",function(t){return this.iterator("table",function(e){R(e,t===!1)})});Ke("page()",function(t){return t===o?this.page.info().page:this.iterator("table",function(e){he(e,t)})});Ke("page.info()",function(){if(0===this.context.length)return o;var t=this.context[0],e=t._iDisplayStart,n=t._iDisplayLength,r=t.fnRecordsDisplay(),i=-1===n;return{page:i?0:Math.floor(e/n),pages:i?1:Math.ceil(r/n),start:e,end:t.fnDisplayEnd(),length:n,recordsTotal:t.fnRecordsTotal(),recordsDisplay:r}});Ke("page.len()",function(t){return t===o?0!==this.context.length?this.context[0]._iDisplayLength:o:this.iterator("table",function(e){ue(e,t)})});var Dn=function(t,e,n){if("ssp"==Be(t))R(t,e);else{pe(t,!0);U(t,[],function(n){A(t);for(var r=G(t,n),i=0,o=r.length;o>i;i++)x(t,r[i]);R(t,e);pe(t,!1)})}if(n){var r=new Je(t);r.one("draw",function(){n(r.ajax.json())})}};Ke("ajax.json()",function(){var t=this.context;return t.length>0?t[0].json:void 0});Ke("ajax.params()",function(){var t=this.context;return t.length>0?t[0].oAjaxData:void 0});Ke("ajax.reload()",function(t,e){return this.iterator("table",function(n){Dn(n,e===!1,t)})});Ke("ajax.url()",function(e){var n=this.context;if(e===o){if(0===n.length)return o;n=n[0];return n.ajax?t.isPlainObject(n.ajax)?n.ajax.url:n.ajax:n.sAjaxSource}return this.iterator("table",function(n){t.isPlainObject(n.ajax)?n.ajax.url=e:n.ajax=e})});Ke("ajax.url().load()",function(t,e){return this.iterator("table",function(n){Dn(n,e===!1,t)})});var Ln=function(e,n){var r,i,a,s,l,u,c=[];e&&"string"!=typeof e&&e.length!==o||(e=[e]);for(a=0,s=e.length;s>a;a++){i=e[a]&&e[a].split?e[a].split(","):[e[a]];for(l=0,u=i.length;u>l;l++){r=n("string"==typeof i[l]?t.trim(i[l]):i[l]);r&&r.length&&c.push.apply(c,r)}}return c},An=function(t){t||(t={});t.filter&&!t.search&&(t.search=t.filter);return{search:t.search||"none",order:t.order||"current",page:t.page||"all"}},Nn=function(t){for(var e=0,n=t.length;n>e;e++)if(t[e].length>0){t[0]=t[e];t.length=1;t.context=[t.context[e]];return t}t.length=0;return t},En=function(e,n){var r,i,o,a=[],s=e.aiDisplay,l=e.aiDisplayMaster,u=n.search,c=n.order,f=n.page;if("ssp"==Be(e))return"removed"===u?[]:gn(0,l.length);if("current"==f)for(r=e._iDisplayStart,i=e.fnDisplayEnd();i>r;r++)a.push(s[r]);else if("current"==c||"applied"==c)a="none"==u?l.slice():"applied"==u?s.slice():t.map(l,function(e){return-1===t.inArray(e,s)?e:null});else if("index"==c||"original"==c)for(r=0,i=e.aoData.length;i>r;r++)if("none"==u)a.push(r);else{o=t.inArray(r,s);(-1===o&&"removed"==u||o>=0&&"applied"==u)&&a.push(r)}return a},jn=function(e,n,r){return Ln(n,function(n){var i=ln(n);if(null!==i&&!r)return[i];var o=En(e,r);if(null!==i&&-1!==t.inArray(i,o))return[i];if(!n)return o;for(var a=[],s=0,l=o.length;l>s;s++)a.push(e.aoData[o[s]].nTr);return n.nodeName&&-1!==t.inArray(n,a)?[n._DT_RowIndex]:t(a).filter(n).map(function(){return this._DT_RowIndex}).toArray()})};Ke("rows()",function(e,n){if(e===o)e="";else if(t.isPlainObject(e)){n=e;e=""}n=An(n);var r=this.iterator("table",function(t){return jn(t,e,n)});r.selector.rows=e;r.selector.opts=n;return r});Ke("rows().nodes()",function(){return this.iterator("row",function(t,e){return t.aoData[e].nTr||o})});Ke("rows().data()",function(){return this.iterator(!0,"rows",function(t,e){return pn(t.aoData,e,"_aData")})});Ze("rows().cache()","row().cache()",function(t){return this.iterator("row",function(e,n){var r=e.aoData[n];return"search"===t?r._aFilterData:r._aSortData})});Ze("rows().invalidate()","row().invalidate()",function(t){return this.iterator("row",function(e,n){E(e,n,t)})});Ze("rows().indexes()","row().index()",function(){return this.iterator("row",function(t,e){return e})});Ze("rows().remove()","row().remove()",function(){var e=this;return this.iterator("row",function(n,r,i){var o=n.aoData;o.splice(r,1);for(var a=0,s=o.length;s>a;a++)null!==o[a].nTr&&(o[a].nTr._DT_RowIndex=a);t.inArray(r,n.aiDisplay);N(n.aiDisplayMaster,r);N(n.aiDisplay,r);N(e[i],r,!1);qe(n)})});Ke("rows.add()",function(t){var e=this.iterator("table",function(e){var n,r,i,o=[];for(r=0,i=t.length;i>r;r++){n=t[r];o.push(n.nodeName&&"TR"===n.nodeName.toUpperCase()?w(e,n)[0]:x(e,n))}return o}),n=this.rows(-1);n.pop();n.push.apply(n,e.toArray());return n});Ke("row()",function(t,e){return Nn(this.rows(t,e))});Ke("row().data()",function(t){var e=this.context;if(t===o)return e.length&&this.length?e[0].aoData[this[0]]._aData:o;e[0].aoData[this[0]]._aData=t;E(e[0],this[0],"data");return this});Ke("row().node()",function(){var t=this.context;return t.length&&this.length?t[0].aoData[this[0]].nTr||null:null});Ke("row.add()",function(e){e instanceof t&&e.length&&(e=e[0]);var n=this.iterator("table",function(t){return e.nodeName&&"TR"===e.nodeName.toUpperCase()?w(t,e)[0]:x(t,e)});return this.row(n[0])});var In=function(e,n,r,i){var o=[],a=function(n,r){if(n.nodeName&&"tr"===n.nodeName.toLowerCase())o.push(n);else{var i=t("<tr><td/></tr>").addClass(r);t("td",i).addClass(r).html(n)[0].colSpan=m(e);o.push(i[0])}};if(t.isArray(r)||r instanceof t)for(var s=0,l=r.length;l>s;s++)a(r[s],i);else a(r,i);n._details&&n._details.remove();n._details=t(o);n._detailsShow&&n._details.insertAfter(n.nTr)},Pn=function(t){var e=t.context;if(e.length&&t.length){var n=e[0].aoData[t[0]];if(n._details){n._details.remove();n._detailsShow=o;n._details=o}}},Hn=function(t,e){var n=t.context;if(n.length&&t.length){var r=n[0].aoData[t[0]];if(r._details){r._detailsShow=e;e?r._details.insertAfter(r.nTr):r._details.detach();On(n[0])}}},On=function(t){var e=new Je(t),n=".dt.DT_details",r="draw"+n,i="column-visibility"+n,o="destroy"+n,a=t.aoData;e.off(r+" "+i+" "+o);if(dn(a,"_details").length>0){e.on(r,function(n,r){t===r&&e.rows({page:"current"}).eq(0).each(function(t){var e=a[t];e._detailsShow&&e._details.insertAfter(e.nTr)})});e.on(i,function(e,n){if(t===n)for(var r,i=m(n),o=0,s=a.length;s>o;o++){r=a[o];r._details&&r._details.children("td[colspan]").attr("colspan",i)}});e.on(o,function(e,n){if(t===n)for(var r=0,i=a.length;i>r;r++)a[r]._details&&Pn(a[r])})}},Fn="",Rn=Fn+"row().child",Wn=Rn+"()";Ke(Wn,function(t,e){var n=this.context;if(t===o)return n.length&&this.length?n[0].aoData[this[0]]._details:o;t===!0?this.child.show():t===!1?Pn(this):n.length&&this.length&&In(n[0],n[0].aoData[this[0]],t,e);return this});Ke([Rn+".show()",Wn+".show()"],function(){Hn(this,!0);return this});Ke([Rn+".hide()",Wn+".hide()"],function(){Hn(this,!1);return this});Ke([Rn+".remove()",Wn+".remove()"],function(){Pn(this);return this});Ke(Rn+".isShown()",function(){var t=this.context;return t.length&&this.length?t[0].aoData[this[0]]._detailsShow||!1:!1});var zn=/^(.+):(name|visIdx|visible)$/,qn=function(e,n){var r=e.aoColumns,i=dn(r,"sName"),o=dn(r,"nTh");return Ln(n,function(n){var a=ln(n);if(""===n)return gn(r.length);if(null!==a)return[a>=0?a:r.length+a];var s="string"==typeof n?n.match(zn):"";if(!s)return t(o).filter(n).map(function(){return t.inArray(this,o)}).toArray();switch(s[2]){case"visIdx":case"visible":var l=parseInt(s[1],10);if(0>l){var u=t.map(r,function(t,e){return t.bVisible?e:null});return[u[u.length+l]]}return[p(e,l)];case"name":return t.map(i,function(t,e){return t===s[1]?e:null})}})},Un=function(e,n,r,i){var a,s,l,u,c=e.aoColumns,f=c[n],h=e.aoData;if(r===o)return f.bVisible;if(f.bVisible!==r){if(r){var p=t.inArray(!0,dn(c,"bVisible"),n+1);for(s=0,l=h.length;l>s;s++){u=h[s].nTr;a=h[s].anCells;u&&u.insertBefore(a[n],a[p]||null)}}else t(dn(e.aoData,"anCells",n)).detach();f.bVisible=r;O(e,e.aoHeader);O(e,e.aoFooter);if(i===o||i){d(e);(e.oScroll.sX||e.oScroll.sY)&&me(e)}ze(e,null,"column-visibility",[e,n,r]);je(e)}};Ke("columns()",function(e,n){if(e===o)e="";else if(t.isPlainObject(e)){n=e;e=""}n=An(n);var r=this.iterator("table",function(t){return qn(t,e,n)});r.selector.cols=e;r.selector.opts=n;return r});Ze("columns().header()","column().header()",function(){return this.iterator("column",function(t,e){return t.aoColumns[e].nTh})});Ze("columns().footer()","column().footer()",function(){return this.iterator("column",function(t,e){return t.aoColumns[e].nTf})});Ze("columns().data()","column().data()",function(){return this.iterator("column-rows",function(t,e,n,r,i){for(var o=[],a=0,s=i.length;s>a;a++)o.push(T(t,i[a],e,""));return o})});Ze("columns().cache()","column().cache()",function(t){return this.iterator("column-rows",function(e,n,r,i,o){return pn(e.aoData,o,"search"===t?"_aFilterData":"_aSortData",n)})});Ze("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(t,e,n,r,i){return pn(t.aoData,i,"anCells",e)})});Ze("columns().visible()","column().visible()",function(t,e){return this.iterator("column",function(n,r){return t===o?n.aoColumns[r].bVisible:Un(n,r,t,e)})});Ze("columns().indexes()","column().index()",function(t){return this.iterator("column",function(e,n){return"visible"===t?g(e,n):n})});Ke("columns.adjust()",function(){return this.iterator("table",function(t){d(t)})});Ke("column.index()",function(t,e){if(0!==this.context.length){var n=this.context[0];if("fromVisible"===t||"toData"===t)return p(n,e);if("fromData"===t||"toVisible"===t)return g(n,e)}});Ke("column()",function(t,e){return Nn(this.columns(t,e))});var Bn=function(e,n,r){var i,a,s,l,u,c=e.aoData,f=En(e,r),h=pn(c,f,"anCells"),d=t([].concat.apply([],h)),p=e.aoColumns.length;return Ln(n,function(e){if(null===e||e===o){a=[];for(s=0,l=f.length;l>s;s++){i=f[s];for(u=0;p>u;u++)a.push({row:i,column:u})}return a}return t.isPlainObject(e)?[e]:d.filter(e).map(function(e,n){i=n.parentNode._DT_RowIndex;return{row:i,column:t.inArray(n,c[i].anCells)}}).toArray()})};Ke("cells()",function(e,n,r){if(t.isPlainObject(e))if(typeof e.row!==o){r=n;n=null}else{r=e;e=null}if(t.isPlainObject(n)){r=n;n=null}if(null===n||n===o)return this.iterator("table",function(t){return Bn(t,e,An(r))});var i,a,s,l,u,c=this.columns(n,r),f=this.rows(e,r),h=this.iterator("table",function(t,e){i=[];for(a=0,s=f[e].length;s>a;a++)for(l=0,u=c[e].length;u>l;l++)i.push({row:f[e][a],column:c[e][l]});return i});t.extend(h.selector,{cols:n,rows:e,opts:r});return h});Ze("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(t,e,n){return t.aoData[e].anCells[n]})});Ke("cells().data()",function(){return this.iterator("cell",function(t,e,n){return T(t,e,n)})});Ze("cells().cache()","cell().cache()",function(t){t="search"===t?"_aFilterData":"_aSortData";return this.iterator("cell",function(e,n,r){return e.aoData[n][t][r]})});Ze("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(t,e,n){return{row:e,column:n,columnVisible:g(t,n)}})});Ke(["cells().invalidate()","cell().invalidate()"],function(t){var e=this.selector;this.rows(e.rows,e.opts).invalidate(t);return this});Ke("cell()",function(t,e,n){return Nn(this.cells(t,e,n))});Ke("cell().data()",function(t){var e=this.context,n=this[0];if(t===o)return e.length&&n.length?T(e[0],n[0].row,n[0].column):o;_(e[0],n[0].row,n[0].column,t);E(e[0],n[0].row,"data",n[0].column);return this});Ke("order()",function(e,n){var r=this.context;if(e===o)return 0!==r.length?r[0].aaSorting:o;"number"==typeof e?e=[[e,n]]:t.isArray(e[0])||(e=Array.prototype.slice.call(arguments));return this.iterator("table",function(t){t.aaSorting=e.slice()})});Ke("order.listener()",function(t,e,n){return this.iterator("table",function(r){Ae(r,t,e,n)})});Ke(["columns().order()","column().order()"],function(e){var n=this;return this.iterator("table",function(r,i){var o=[];t.each(n[i],function(t,n){o.push([n,e])});r.aaSorting=o})});Ke("search()",function(e,n,r,i){var a=this.context;return e===o?0!==a.length?a[0].oPreviousSearch.sSearch:o:this.iterator("table",function(o){o.oFeatures.bFilter&&Y(o,t.extend({},o.oPreviousSearch,{sSearch:e+"",bRegex:null===n?!1:n,bSmart:null===r?!0:r,bCaseInsensitive:null===i?!0:i}),1)})});Ze("columns().search()","column().search()",function(e,n,r,i){return this.iterator("column",function(a,s){var l=a.aoPreSearchCols;if(e===o)return l[s].sSearch;if(a.oFeatures.bFilter){t.extend(l[s],{sSearch:e+"",bRegex:null===n?!1:n,bSmart:null===r?!0:r,bCaseInsensitive:null===i?!0:i});Y(a,a.oPreviousSearch,1)}})});Ke("state()",function(){return this.context.length?this.context[0].oSavedState:null});Ke("state.clear()",function(){return this.iterator("table",function(t){t.fnStateSaveCallback.call(t.oInstance,t,{})})});Ke("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});Ke("state.save()",function(){return this.iterator("table",function(t){je(t)})});$e.versionCheck=$e.fnVersionCheck=function(t){for(var e,n,r=$e.version.split("."),i=t.split("."),o=0,a=i.length;a>o;o++){e=parseInt(r[o],10)||0;n=parseInt(i[o],10)||0;if(e!==n)return e>n}return!0};$e.isDataTable=$e.fnIsDataTable=function(e){var n=t(e).get(0),r=!1; t.each($e.settings,function(t,e){(e.nTable===n||e.nScrollHead===n||e.nScrollFoot===n)&&(r=!0)});return r};$e.tables=$e.fnTables=function(e){return jQuery.map($e.settings,function(n){return!e||e&&t(n.nTable).is(":visible")?n.nTable:void 0})};$e.camelToHungarian=r;Ke("$()",function(e,n){var r=this.rows(n).nodes(),i=t(r);return t([].concat(i.filter(e).toArray(),i.find(e).toArray()))});t.each(["on","one","off"],function(e,n){Ke(n+"()",function(){var e=Array.prototype.slice.call(arguments);e[0].match(/\.dt\b/)||(e[0]+=".dt");var r=t(this.tables().nodes());r[n].apply(r,e);return this})});Ke("clear()",function(){return this.iterator("table",function(t){A(t)})});Ke("settings()",function(){return new Je(this.context,this.context)});Ke("data()",function(){return this.iterator("table",function(t){return dn(t.aoData,"_aData")}).flatten()});Ke("destroy()",function(e){e=e||!1;return this.iterator("table",function(r){var i,o=r.nTableWrapper.parentNode,a=r.oClasses,s=r.nTable,l=r.nTBody,u=r.nTHead,c=r.nTFoot,f=t(s),h=t(l),d=t(r.nTableWrapper),p=t.map(r.aoData,function(t){return t.nTr});r.bDestroying=!0;ze(r,"aoDestroyCallback","destroy",[r]);e||new Je(r).columns().visible(!0);d.unbind(".DT").find(":not(tbody *)").unbind(".DT");t(n).unbind(".DT-"+r.sInstance);if(s!=u.parentNode){f.children("thead").detach();f.append(u)}if(c&&s!=c.parentNode){f.children("tfoot").detach();f.append(c)}f.detach();d.detach();r.aaSorting=[];r.aaSortingFixed=[];Ne(r);t(p).removeClass(r.asStripeClasses.join(" "));t("th, td",u).removeClass(a.sSortable+" "+a.sSortableAsc+" "+a.sSortableDesc+" "+a.sSortableNone);if(r.bJUI){t("th span."+a.sSortIcon+", td span."+a.sSortIcon,u).detach();t("th, td",u).each(function(){var e=t("div."+a.sSortJUIWrapper,this);t(this).append(e.contents());e.detach()})}!e&&o&&o.insertBefore(s,r.nTableReinsertBefore);h.children().detach();h.append(p);f.css("width",r.sDestroyWidth).removeClass(a.sTable);i=r.asDestroyStripes.length;i&&h.children().each(function(e){t(this).addClass(r.asDestroyStripes[e%i])});var g=t.inArray(r,$e.settings);-1!==g&&$e.settings.splice(g,1)})});$e.version="1.10.2";$e.settings=[];$e.models={};$e.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};$e.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null};$e.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};$e.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(t){try{return JSON.parse((-1===t.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+t.sInstance+"_"+location.pathname))}catch(e){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(t,e){try{(-1===t.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+t.sInstance+"_"+location.pathname,JSON.stringify(e))}catch(n){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:t.extend({},$e.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null};e($e.defaults);$e.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};e($e.defaults.column);$e.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:o,oAjaxData:o,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==Be(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==Be(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var t=this._iDisplayLength,e=this._iDisplayStart,n=e+t,r=this.aiDisplay.length,i=this.oFeatures,o=i.bPaginate;return i.bServerSide?o===!1||-1===t?e+r:Math.min(e+t,this._iRecordsDisplay):!o||n>r||-1===t?r:n},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{}};$e.ext=Ye={classes:{},errMode:"alert",feature:[],search:[],internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:$e.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:$e.version};t.extend(Ye,{afnFiltering:Ye.search,aTypes:Ye.type.detect,ofnSearch:Ye.type.search,oSort:Ye.type.order,afnSortData:Ye.order,aoFeatures:Ye.feature,oApi:Ye.internal,oStdClasses:Ye.classes,oPagination:Ye.pager});t.extend($e.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});(function(){var e="";e="";var n=e+"ui-state-default",r=e+"css_right ui-icon ui-icon-",i=e+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";t.extend($e.ext.oJUIClasses,$e.ext.classes,{sPageButton:"fg-button ui-button "+n,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:n+" sorting_asc",sSortDesc:n+" sorting_desc",sSortable:n+" sorting",sSortableAsc:n+" sorting_asc_disabled",sSortableDesc:n+" sorting_desc_disabled",sSortableNone:n+" sorting_disabled",sSortJUIAsc:r+"triangle-1-n",sSortJUIDesc:r+"triangle-1-s",sSortJUI:r+"carat-2-n-s",sSortJUIAscAllowed:r+"carat-1-n",sSortJUIDescAllowed:r+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+n,sScrollFoot:"dataTables_scrollFoot "+n,sHeaderTH:n,sFooterTH:n,sJUIHeader:i+" ui-corner-tl ui-corner-tr",sJUIFooter:i+" ui-corner-bl ui-corner-br"})})();var Vn=$e.ext.pager;t.extend(Vn,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},simple_numbers:function(t,e){return["previous",Ve(t,e),"next"]},full_numbers:function(t,e){return["first","previous",Ve(t,e),"next","last"]},_numbers:Ve,numbers_length:7});t.extend(!0,$e.ext.renderer,{pageButton:{_:function(e,n,r,o,a,s){var l,u,c=e.oClasses,f=e.oLanguage.oPaginate,h=0,d=function(n,i){var o,p,g,m,v=function(t){he(e,t.data.action,!0)};for(o=0,p=i.length;p>o;o++){m=i[o];if(t.isArray(m)){var y=t("<"+(m.DT_el||"div")+"/>").appendTo(n);d(y,m)}else{l="";u="";switch(m){case"ellipsis":n.append("<span>&hellip;</span>");break;case"first":l=f.sFirst;u=m+(a>0?"":" "+c.sPageButtonDisabled);break;case"previous":l=f.sPrevious;u=m+(a>0?"":" "+c.sPageButtonDisabled);break;case"next":l=f.sNext;u=m+(s-1>a?"":" "+c.sPageButtonDisabled);break;case"last":l=f.sLast;u=m+(s-1>a?"":" "+c.sPageButtonDisabled);break;default:l=m+1;u=a===m?c.sPageButtonActive:""}if(l){g=t("<a>",{"class":c.sPageButton+" "+u,"aria-controls":e.sTableId,"data-dt-idx":h,tabindex:e.iTabIndex,id:0===r&&"string"==typeof m?e.sTableId+"_"+m:null}).html(l).appendTo(n);Re(g,{action:m},v);h++}}}};try{var p=t(i.activeElement).data("dt-idx");d(t(n).empty(),o);null!==p&&t(n).find("[data-dt-idx="+p+"]").focus()}catch(g){}}}});var Xn=function(t,e,n,r){if(!t||"-"===t)return-1/0;e&&(t=un(t,e));if(t.replace){n&&(t=t.replace(n,""));r&&(t=t.replace(r,""))}return 1*t};t.extend(Ye.type.order,{"date-pre":function(t){return Date.parse(t)||0},"html-pre":function(t){return sn(t)?"":t.replace?t.replace(/<.*?>/g,"").toLowerCase():t+""},"string-pre":function(t){return sn(t)?"":"string"==typeof t?t.toLowerCase():t.toString?t.toString():""},"string-asc":function(t,e){return e>t?-1:t>e?1:0},"string-desc":function(t,e){return e>t?1:t>e?-1:0}});Xe("");t.extend($e.ext.type.detect,[function(t,e){var n=e.oLanguage.sDecimal;return cn(t,n)?"num"+n:null},function(t){if(t&&(!nn.test(t)||!rn.test(t)))return null;var e=Date.parse(t);return null!==e&&!isNaN(e)||sn(t)?"date":null},function(t,e){var n=e.oLanguage.sDecimal;return cn(t,n,!0)?"num-fmt"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return hn(t,n)?"html-num"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return hn(t,n,!0)?"html-num-fmt"+n:null},function(t){return sn(t)||"string"==typeof t&&-1!==t.indexOf("<")?"html":null}]);t.extend($e.ext.type.search,{html:function(t){return sn(t)?t:"string"==typeof t?t.replace(tn," ").replace(en,""):""},string:function(t){return sn(t)?t:"string"==typeof t?t.replace(tn," "):t}});t.extend(!0,$e.ext.renderer,{header:{_:function(e,n,r,i){t(e.nTable).on("order.dt.DT",function(t,o,a,s){if(e===o){var l=r.idx;n.removeClass(r.sSortingClass+" "+i.sSortAsc+" "+i.sSortDesc).addClass("asc"==s[l]?i.sSortAsc:"desc"==s[l]?i.sSortDesc:r.sSortingClass)}})},jqueryui:function(e,n,r,i){var o=r.idx;t("<div/>").addClass(i.sSortJUIWrapper).append(n.contents()).append(t("<span/>").addClass(i.sSortIcon+" "+r.sSortingClassJUI)).appendTo(n);t(e.nTable).on("order.dt.DT",function(t,a,s,l){if(e===a){n.removeClass(i.sSortAsc+" "+i.sSortDesc).addClass("asc"==l[o]?i.sSortAsc:"desc"==l[o]?i.sSortDesc:r.sSortingClass);n.find("span."+i.sSortIcon).removeClass(i.sSortJUIAsc+" "+i.sSortJUIDesc+" "+i.sSortJUI+" "+i.sSortJUIAscAllowed+" "+i.sSortJUIDescAllowed).addClass("asc"==l[o]?i.sSortJUIAsc:"desc"==l[o]?i.sSortJUIDesc:r.sSortingClassJUI)}})}}});$e.render={number:function(t,e,n,r){return{display:function(i){var o=0>i?"-":"";i=Math.abs(parseFloat(i));var a=parseInt(i,10),s=n?e+(i-a).toFixed(n).substring(2):"";return o+(r||"")+a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,t)+s}}}};t.extend($e.ext.internal,{_fnExternApiFunc:Ge,_fnBuildAjax:U,_fnAjaxUpdate:B,_fnAjaxParameters:V,_fnAjaxUpdateDraw:X,_fnAjaxDataSrc:G,_fnAddColumn:f,_fnColumnOptions:h,_fnAdjustColumnSizing:d,_fnVisibleToColumnIndex:p,_fnColumnIndexToVisible:g,_fnVisbleColumns:m,_fnGetColumns:v,_fnColumnTypes:y,_fnApplyColumnDefs:b,_fnHungarianMap:e,_fnCamelToHungarian:r,_fnLanguageCompat:a,_fnBrowserDetect:u,_fnAddData:x,_fnAddTr:w,_fnNodeToDataIndex:S,_fnNodeToColumnIndex:C,_fnGetCellData:T,_fnSetCellData:_,_fnSplitObjNotation:k,_fnGetObjectDataFn:M,_fnSetObjectDataFn:D,_fnGetDataMaster:L,_fnClearTable:A,_fnDeleteIndex:N,_fnInvalidateRow:E,_fnGetRowElements:j,_fnCreateTr:I,_fnBuildHead:H,_fnDrawHead:O,_fnDraw:F,_fnReDraw:R,_fnAddOptionsHtml:W,_fnDetectHeader:z,_fnGetUniqueThs:q,_fnFeatureHtmlFilter:$,_fnFilterComplete:Y,_fnFilterCustom:J,_fnFilterColumn:K,_fnFilter:Z,_fnFilterCreateSearch:Q,_fnEscapeRegex:te,_fnFilterData:ee,_fnFeatureHtmlInfo:ie,_fnUpdateInfo:oe,_fnInfoMacros:ae,_fnInitialise:se,_fnInitComplete:le,_fnLengthChange:ue,_fnFeatureHtmlLength:ce,_fnFeatureHtmlPaginate:fe,_fnPageChange:he,_fnFeatureHtmlProcessing:de,_fnProcessingDisplay:pe,_fnFeatureHtmlTable:ge,_fnScrollDraw:me,_fnApplyToChildren:ve,_fnCalculateColumnWidths:ye,_fnThrottle:be,_fnConvertToWidth:xe,_fnScrollingWidthAdjust:we,_fnGetWidestNode:Se,_fnGetMaxLenString:Ce,_fnStringToCss:Te,_fnScrollBarWidth:_e,_fnSortFlatten:ke,_fnSort:Me,_fnSortAria:De,_fnSortListener:Le,_fnSortAttachListener:Ae,_fnSortingClasses:Ne,_fnSortData:Ee,_fnSaveState:je,_fnLoadState:Ie,_fnSettingsFromNode:Pe,_fnLog:He,_fnMap:Oe,_fnBindAction:Re,_fnCallbackReg:We,_fnCallbackFire:ze,_fnLengthOverflow:qe,_fnRenderer:Ue,_fnDataSource:Be,_fnRowAttributes:P,_fnCalculateEnd:function(){}});t.fn.dataTable=$e;t.fn.dataTableSettings=$e.settings;t.fn.dataTableExt=$e.ext;t.fn.DataTable=function(e){return t(this).dataTable(e).api()};t.each($e,function(e,n){t.fn.DataTable[e]=n});return t.fn.dataTable})})(window,document)},{jquery:17}],3:[function(){RegExp.escape=function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")};(function(t){"use strict";t.csv={defaults:{separator:",",delimiter:'"',headers:!0},hooks:{castToScalar:function(t){var e=/\./;if(isNaN(t))return t;if(e.test(t))return parseFloat(t);var n=parseInt(t);return isNaN(n)?null:n}},parsers:{parse:function(t,e){function n(){l=0;u="";if(e.start&&e.state.rowNum<e.start){s=[];e.state.rowNum++;e.state.colNum=1}else{if(void 0===e.onParseEntry)a.push(s);else{var t=e.onParseEntry(s,e.state);t!==!1&&a.push(t)}s=[];e.end&&e.state.rowNum>=e.end&&(c=!0);e.state.rowNum++;e.state.colNum=1}}function r(){if(void 0===e.onParseValue)s.push(u);else{var t=e.onParseValue(u,e.state);t!==!1&&s.push(t)}u="";l=0;e.state.colNum++}var i=e.separator,o=e.delimiter;e.state.rowNum||(e.state.rowNum=1);e.state.colNum||(e.state.colNum=1);var a=[],s=[],l=0,u="",c=!1,f=RegExp.escape(i),h=RegExp.escape(o),d=/(D|S|\n|\r|[^DS\r\n]+)/,p=d.source;p=p.replace(/S/g,f);p=p.replace(/D/g,h);d=RegExp(p,"gm");t.replace(d,function(t){if(!c)switch(l){case 0:if(t===i){u+="";r();break}if(t===o){l=1;break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;u+=t;l=3;break;case 1:if(t===o){l=2;break}u+=t;l=1;break;case 2:if(t===o){u+=t;l=1;break}if(t===i){r();break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;throw new Error("CSVDataError: Illegal State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");case 3:if(t===i){r();break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;if(t===o)throw new Error("CSVDataError: Illegal Quote [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]")}});if(0!==s.length){r();n()}return a},splitLines:function(t,e){function n(){a=0;if(e.start&&e.state.rowNum<e.start){s="";e.state.rowNum++}else{if(void 0===e.onParseEntry)o.push(s);else{var t=e.onParseEntry(s,e.state);t!==!1&&o.push(t)}s="";e.end&&e.state.rowNum>=e.end&&(l=!0);e.state.rowNum++}}var r=e.separator,i=e.delimiter;e.state.rowNum||(e.state.rowNum=1);var o=[],a=0,s="",l=!1,u=RegExp.escape(r),c=RegExp.escape(i),f=/(D|S|\n|\r|[^DS\r\n]+)/,h=f.source;h=h.replace(/S/g,u);h=h.replace(/D/g,c);f=RegExp(h,"gm");t.replace(f,function(t){if(!l)switch(a){case 0:if(t===r){s+=t;a=0;break}if(t===i){s+=t;a=1;break}if("\n"===t){n();break}if(/^\r$/.test(t))break;s+=t;a=3;break;case 1:if(t===i){s+=t;a=2;break}s+=t;a=1;break;case 2:var o=s.substr(s.length-1);if(t===i&&o===i){s+=t;a=1;break}if(t===r){s+=t;a=0;break}if("\n"===t){n();break}if("\r"===t)break;throw new Error("CSVDataError: Illegal state [Row:"+e.state.rowNum+"]");case 3:if(t===r){s+=t;a=0;break}if("\n"===t){n();break}if("\r"===t)break;if(t===i)throw new Error("CSVDataError: Illegal quote [Row:"+e.state.rowNum+"]");throw new Error("CSVDataError: Illegal state [Row:"+e.state.rowNum+"]");default:throw new Error("CSVDataError: Unknown state [Row:"+e.state.rowNum+"]")}});""!==s&&n();return o},parseEntry:function(t,e){function n(){if(void 0===e.onParseValue)o.push(s);else{var t=e.onParseValue(s,e.state);t!==!1&&o.push(t)}s="";a=0;e.state.colNum++}var r=e.separator,i=e.delimiter;e.state.rowNum||(e.state.rowNum=1);e.state.colNum||(e.state.colNum=1);var o=[],a=0,s="";if(!e.match){var l=RegExp.escape(r),u=RegExp.escape(i),c=/(D|S|\n|\r|[^DS\r\n]+)/,f=c.source;f=f.replace(/S/g,l);f=f.replace(/D/g,u);e.match=RegExp(f,"gm")}t.replace(e.match,function(t){switch(a){case 0:if(t===r){s+="";n();break}if(t===i){a=1;break}if("\n"===t||"\r"===t)break;s+=t;a=3;break;case 1:if(t===i){a=2;break}s+=t;a=1;break;case 2:if(t===i){s+=t;a=1;break}if(t===r){n();break}if("\n"===t||"\r"===t)break;throw new Error("CSVDataError: Illegal State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");case 3:if(t===r){n();break}if("\n"===t||"\r"===t)break;if(t===i)throw new Error("CSVDataError: Illegal Quote [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]")}});n();return o}},toArray:function(e,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:t.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:t.csv.defaults.delimiter;var o=void 0!==n.state?n.state:{},n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,state:o},a=t.csv.parsers.parseEntry(e,n);if(!i.callback)return a;i.callback("",a);return void 0},toArrays:function(e,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:t.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:t.csv.defaults.delimiter;var o=[],n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,start:n.start,end:n.end,state:{rowNum:1,colNum:1}};o=t.csv.parsers.parse(e,n);if(!i.callback)return o;i.callback("",o);return void 0},toObjects:function(e,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:t.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:t.csv.defaults.delimiter;i.headers="headers"in n?n.headers:t.csv.defaults.headers;n.start="start"in n?n.start:1;i.headers&&n.start++;n.end&&i.headers&&n.end++;var o=[],a=[],n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,start:n.start,end:n.end,state:{rowNum:1,colNum:1},match:!1},s={delimiter:i.delimiter,separator:i.separator,start:1,end:1,state:{rowNum:1,colNum:1}},l=t.csv.parsers.splitLines(e,s),u=t.csv.toArray(l[0],n),o=t.csv.parsers.splitLines(e,n);n.state.colNum=1;n.state.rowNum=u?2:1;for(var c=0,f=o.length;f>c;c++){var h=t.csv.toArray(o[c],n),d={};for(var p in u)d[u[p]]=h[p];a.push(d);n.state.rowNum++}if(!i.callback)return a;i.callback("",a);return void 0},fromArrays:function(e,n,r){var n=void 0!==n?n:{},o={};o.callback=void 0!==r&&"function"==typeof r?r:!1;o.separator="separator"in n?n.separator:t.csv.defaults.separator;o.delimiter="delimiter"in n?n.delimiter:t.csv.defaults.delimiter;o.escaper="escaper"in n?n.escaper:t.csv.defaults.escaper;o.experimental="experimental"in n?n.experimental:!1;if(!o.experimental)throw new Error("not implemented");var a=[];for(i in e)a.push(e[i]);if(!o.callback)return a;o.callback("",a);return void 0},fromObjects2CSV:function(e,n,r){var n=void 0!==n?n:{},o={};o.callback=void 0!==r&&"function"==typeof r?r:!1;o.separator="separator"in n?n.separator:t.csv.defaults.separator;o.delimiter="delimiter"in n?n.delimiter:t.csv.defaults.delimiter;o.experimental="experimental"in n?n.experimental:!1;if(!o.experimental)throw new Error("not implemented");var a=[];for(i in e)a.push(arrays[i]);if(!o.callback)return a;o.callback("",a);return void 0}};t.csvEntry2Array=t.csv.toArray;t.csv2Array=t.csv.toArrays;t.csv2Dictionary=t.csv.toObjects})(jQuery)},{}],4:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){function e(t,e,r,i){var o=t.getLineHandle(e.line),l=e.ch-1,u=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(r&&c>0!=(l==e.ch))return null;var f=t.getTokenTypeAt(a(e.line,l+1)),h=n(t,a(e.line,l+(c>0?1:0)),c,f||null,i);return null==h?null:{from:a(e.line,l),to:h&&h.pos,match:h&&h.ch==u.charAt(0),forward:c>0}}function n(t,e,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,u=[],c=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(e.line+l,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-l),h=e.line;h!=f;h+=n){var d=t.getLine(h);if(d){var p=n>0?0:d.length-1,g=n>0?d.length:-1;if(!(d.length>o)){h==e.line&&(p=e.ch-(0>n?1:0));for(;p!=g;p+=n){var m=d.charAt(p);if(c.test(m)&&(void 0===r||t.getTokenTypeAt(a(h,p+1))==r)){var v=s[m];if(">"==v.charAt(1)==n>0)u.push(m);else{if(!u.length)return{pos:a(h,p),ch:m};u.pop()}}}}}}return h-n==(n>0?t.lastLine():t.firstLine())?!1:null}function r(t,n,r){for(var i=t.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=t.listSelections(),u=0;u<l.length;u++){var c=l[u].empty()&&e(t,l[u].head,!1,r);if(c&&t.getLine(c.from.line).length<=i){var f=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(t.markText(c.from,a(c.from.line,c.from.ch+1),{className:f}));c.to&&t.getLine(c.to.line).length<=i&&s.push(t.markText(c.to,a(c.to.line,c.to.ch+1),{className:f}))}}if(s.length){o&&t.state.focused&&t.display.input.focus();var h=function(){t.operation(function(){for(var t=0;t<s.length;t++)s[t].clear()})};if(!n)return h;setTimeout(h,800)}}function i(t){t.operation(function(){if(l){l();l=null}l=r(t,!1,t.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=t.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;t.defineOption("matchBrackets",!1,function(e,n,r){r&&r!=t.Init&&e.off("cursorActivity",i);if(n){e.state.matchBrackets="object"==typeof n?n:{};e.on("cursorActivity",i)}});t.defineExtension("matchBrackets",function(){r(this,!0)});t.defineExtension("findMatchingBracket",function(t,n,r){return e(this,t,n,r)});t.defineExtension("scanForBracket",function(t,e,r,i){return n(this,t,e,r,i)})})},{"../../lib/codemirror":9}],5:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.registerHelper("fold","brace",function(e,n){function r(r){for(var i=n.ch,l=0;;){var u=0>=i?-1:s.lastIndexOf(r,i-1);if(-1!=u){if(1==l&&u<n.ch)break;o=e.getTokenTypeAt(t.Pos(a,u+1));if(!/^(comment|string)/.test(o))return u+1;i=u-1}else{if(1==l)break;l=1;i=s.length}}}var i,o,a=n.line,s=e.getLine(a),l="{",u="}",i=r("{");if(null==i){l="[",u="]";i=r("[")}if(null!=i){var c,f,h=1,d=e.lastLine();t:for(var p=a;d>=p;++p)for(var g=e.getLine(p),m=p==a?i:0;;){var v=g.indexOf(l,m),y=g.indexOf(u,m);0>v&&(v=g.length);0>y&&(y=g.length);m=Math.min(v,y);if(m==g.length)break;if(e.getTokenTypeAt(t.Pos(p,m+1))==o)if(m==v)++h;else if(!--h){c=p;f=m;break t}++m}if(null!=c&&(a!=c||f!=i))return{from:t.Pos(a,i),to:t.Pos(c,f)}}});t.registerHelper("fold","import",function(e,n){function r(n){if(n<e.firstLine()||n>e.lastLine())return null;var r=e.getTokenAt(t.Pos(n,1));/\S/.test(r.string)||(r=e.getTokenAt(t.Pos(n,r.end+1)));if("keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(e.lastLine(),n+10);o>=i;++i){var a=e.getLine(i),s=a.indexOf(";");if(-1!=s)return{startCh:r.end,end:t.Pos(i,s)}}}var i,n=n.line,o=r(n);if(!o||r(n-1)||(i=r(n-2))&&i.end.line==n-1)return null;for(var a=o.end;;){var s=r(a.line+1);if(null==s)break;a=s.end}return{from:e.clipPos(t.Pos(n,o.startCh+1)),to:a}});t.registerHelper("fold","include",function(e,n){function r(n){if(n<e.firstLine()||n>e.lastLine())return null;var r=e.getTokenAt(t.Pos(n,1));/\S/.test(r.string)||(r=e.getTokenAt(t.Pos(n,r.end+1)));return"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var n=n.line,i=r(n);if(null==i||null!=r(n-1))return null;for(var o=n;;){var a=r(o+1);if(null==a)break;++o}return{from:t.Pos(n,i+1),to:e.clipPos(t.Pos(o))}})})},{"../../lib/codemirror":9}],6:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";function e(e,i,o,a){function s(t){var n=l(e,i);if(!n||n.to.line-n.from.line<u)return null;for(var r=e.findMarksAt(n.from),o=0;o<r.length;++o)if(r[o].__isFold&&"fold"!==a){if(!t)return null;n.cleared=!0;r[o].clear()}return n}if(o&&o.call){var l=o;o=null}else var l=r(e,o,"rangeFinder");"number"==typeof i&&(i=t.Pos(i,0));var u=r(e,o,"minFoldSize"),c=s(!0);if(r(e,o,"scanUp"))for(;!c&&i.line>e.firstLine();){i=t.Pos(i.line-1,0);c=s(!1)}if(c&&!c.cleared&&"unfold"!==a){var f=n(e,o);t.on(f,"mousedown",function(e){h.clear();t.e_preventDefault(e)});var h=e.markText(c.from,c.to,{replacedWith:f,clearOnEnter:!0,__isFold:!0});h.on("clear",function(n,r){t.signal(e,"unfold",e,n,r)});t.signal(e,"fold",e,c.from,c.to)}}function n(t,e){var n=r(t,e,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span");n.appendChild(i);n.className="CodeMirror-foldmarker"}return n}function r(t,e,n){if(e&&void 0!==e[n])return e[n];var r=t.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}t.newFoldFunction=function(t,n){return function(r,i){e(r,i,{rangeFinder:t,widget:n})}};t.defineExtension("foldCode",function(t,n,r){e(this,t,n,r)});t.defineExtension("isFolded",function(t){for(var e=this.findMarksAt(t),n=0;n<e.length;++n)if(e[n].__isFold)return!0});t.commands.toggleFold=function(t){t.foldCode(t.getCursor())};t.commands.fold=function(t){t.foldCode(t.getCursor(),null,"fold")};t.commands.unfold=function(t){t.foldCode(t.getCursor(),null,"unfold")};t.commands.foldAll=function(e){e.operation(function(){for(var n=e.firstLine(),r=e.lastLine();r>=n;n++)e.foldCode(t.Pos(n,0),null,"fold")})};t.commands.unfoldAll=function(e){e.operation(function(){for(var n=e.firstLine(),r=e.lastLine();r>=n;n++)e.foldCode(t.Pos(n,0),null,"unfold")})};t.registerHelper("fold","combine",function(){var t=Array.prototype.slice.call(arguments,0);return function(e,n){for(var r=0;r<t.length;++r){var i=t[r](e,n);if(i)return i}}});t.registerHelper("fold","auto",function(t,e){for(var n=t.getHelpers(e,"fold"),r=0;r<n.length;r++){var i=n[r](t,e);if(i)return i}});var i={rangeFinder:t.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};t.defineOption("foldOptions",null)})},{"../../lib/codemirror":9}],7:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror"),e("./foldcode")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","./foldcode"],i):i(CodeMirror)})(function(t){"use strict";function e(t){this.options=t;this.from=this.to=0}function n(t){t===!0&&(t={});null==t.gutter&&(t.gutter="CodeMirror-foldgutter");null==t.indicatorOpen&&(t.indicatorOpen="CodeMirror-foldgutter-open");null==t.indicatorFolded&&(t.indicatorFolded="CodeMirror-foldgutter-folded");return t}function r(t,e){for(var n=t.findMarksAt(f(e)),r=0;r<n.length;++r)if(n[r].__isFold&&n[r].find().from.line==e)return!0}function i(t){if("string"==typeof t){var e=document.createElement("div");e.className=t+" CodeMirror-guttermarker-subtle";return e}return t.cloneNode(!0)}function o(e,n,o){var a=e.state.foldGutter.options,s=n;e.eachLine(n,o,function(n){var o=null;if(r(e,s))o=i(a.indicatorFolded);else{var l=f(s,0),u=a.rangeFinder||t.fold.auto,c=u&&u(e,l);c&&c.from.line+1<c.to.line&&(o=i(a.indicatorOpen))}e.setGutterMarker(n,a.gutter,o);++s})}function a(t){var e=t.getViewport(),n=t.state.foldGutter;if(n){t.operation(function(){o(t,e.from,e.to)});n.from=e.from;n.to=e.to}}function s(t,e,n){var r=t.state.foldGutter.options;n==r.gutter&&t.foldCode(f(e,0),r.rangeFinder)}function l(t){var e=t.state.foldGutter,n=t.state.foldGutter.options;e.from=e.to=0;clearTimeout(e.changeUpdate);e.changeUpdate=setTimeout(function(){a(t)},n.foldOnChangeTimeSpan||600)}function u(t){var e=t.state.foldGutter,n=t.state.foldGutter.options;clearTimeout(e.changeUpdate);e.changeUpdate=setTimeout(function(){var n=t.getViewport();e.from==e.to||n.from-e.to>20||e.from-n.to>20?a(t):t.operation(function(){if(n.from<e.from){o(t,n.from,e.from);e.from=n.from}if(n.to>e.to){o(t,e.to,n.to);e.to=n.to}})},n.updateViewportTimeSpan||400)}function c(t,e){var n=t.state.foldGutter,r=e.line;r>=n.from&&r<n.to&&o(t,r,r+1)}t.defineOption("foldGutter",!1,function(r,i,o){if(o&&o!=t.Init){r.clearGutter(r.state.foldGutter.options.gutter);r.state.foldGutter=null;r.off("gutterClick",s);r.off("change",l);r.off("viewportChange",u);r.off("fold",c);r.off("unfold",c);r.off("swapDoc",a)}if(i){r.state.foldGutter=new e(n(i));a(r);r.on("gutterClick",s);r.on("change",l);r.on("viewportChange",u);r.on("fold",c);r.on("unfold",c);r.on("swapDoc",a)}});var f=t.Pos})},{"../../lib/codemirror":9,"./foldcode":6}],8:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";function e(t,e){return t.line-e.line||t.ch-e.ch}function n(t,e,n,r){this.line=e;this.ch=n;this.cm=t;this.text=t.getLine(e);this.min=r?r.from:t.firstLine();this.max=r?r.to-1:t.lastLine()}function r(t,e){var n=t.cm.getTokenTypeAt(h(t.line,e));return n&&/\btag\b/.test(n)}function i(t){if(!(t.line>=t.max)){t.ch=0; t.text=t.cm.getLine(++t.line);return!0}}function o(t){if(!(t.line<=t.min)){t.text=t.cm.getLine(--t.line);t.ch=t.text.length;return!0}}function a(t){for(;;){var e=t.text.indexOf(">",t.ch);if(-1==e){if(i(t))continue;return}if(r(t,e+1)){var n=t.text.lastIndexOf("/",e),o=n>-1&&!/\S/.test(t.text.slice(n+1,e));t.ch=e+1;return o?"selfClose":"regular"}t.ch=e+1}}function s(t){for(;;){var e=t.ch?t.text.lastIndexOf("<",t.ch-1):-1;if(-1==e){if(o(t))continue;return}if(r(t,e+1)){g.lastIndex=e;t.ch=e;var n=g.exec(t.text);if(n&&n.index==e)return n}else t.ch=e}}function l(t){for(;;){g.lastIndex=t.ch;var e=g.exec(t.text);if(!e){if(i(t))continue;return}if(r(t,e.index+1)){t.ch=e.index+e[0].length;return e}t.ch=e.index+1}}function u(t){for(;;){var e=t.ch?t.text.lastIndexOf(">",t.ch-1):-1;if(-1==e){if(o(t))continue;return}if(r(t,e+1)){var n=t.text.lastIndexOf("/",e),i=n>-1&&!/\S/.test(t.text.slice(n+1,e));t.ch=e+1;return i?"selfClose":"regular"}t.ch=e}}function c(t,e){for(var n=[];;){var r,i=l(t),o=t.line,s=t.ch-(i?i[0].length:0);if(!i||!(r=a(t)))return;if("selfClose"!=r)if(i[1]){for(var u=n.length-1;u>=0;--u)if(n[u]==i[2]){n.length=u;break}if(0>u&&(!e||e==i[2]))return{tag:i[2],from:h(o,s),to:h(t.line,t.ch)}}else n.push(i[2])}}function f(t,e){for(var n=[];;){var r=u(t);if(!r)return;if("selfClose"!=r){var i=t.line,o=t.ch,a=s(t);if(!a)return;if(a[1])n.push(a[2]);else{for(var l=n.length-1;l>=0;--l)if(n[l]==a[2]){n.length=l;break}if(0>l&&(!e||e==a[2]))return{tag:a[2],from:h(t.line,t.ch),to:h(i,o)}}}else s(t)}}var h=t.Pos,d="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=d+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+d+"]["+p+"]*)","g");t.registerHelper("fold","xml",function(t,e){for(var r=new n(t,e.line,0);;){var i,o=l(r);if(!o||r.line!=e.line||!(i=a(r)))return;if(!o[1]&&"selfClose"!=i){var e=h(r.line,r.ch),s=c(r,o[2]);return s&&{from:e,to:s.from}}}});t.findMatchingTag=function(t,r,i){var o=new n(t,r.line,r.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var l=a(o),u=l&&h(o.line,o.ch),d=l&&s(o);if(l&&d&&!(e(o,r)>0)){var p={from:h(o.line,o.ch),to:u,tag:d[2]};if("selfClose"==l)return{open:p,close:null,at:"open"};if(d[1])return{open:f(o,d[2]),close:p,at:"close"};o=new n(t,u.line,u.ch,i);return{open:p,close:c(o,d[2]),at:"open"}}}};t.findEnclosingTag=function(t,e,r){for(var i=new n(t,e.line,e.ch,r);;){var o=f(i);if(!o)break;var a=new n(t,e.line,e.ch,r),s=c(a,o.tag);if(s)return{open:o,close:s}}};t.scanForClosingTag=function(t,e,r,i){var o=new n(t,e.line,e.ch,i?{from:0,to:i}:null);return c(o,r)}})},{"../../lib/codemirror":9}],9:[function(e,n,r){(function(e){if("object"==typeof r&&"object"==typeof n)n.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);this.CodeMirror=e()}})(function(){"use strict";function t(n,r){if(!(this instanceof t))return new t(n,r);this.options=r=r?yo(r):{};yo(ja,r,!1);d(r);var i=r.value;"string"==typeof i&&(i=new rs(i,r.mode));this.doc=i;var o=this.display=new e(n,i);o.wrapper.CodeMirror=this;u(this);s(this);r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");r.autofocus&&!ca&&_n(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new co,keySeq:null};Qo&&11>ta&&setTimeout(bo(Tn,this,!0),20);Dn(this);No();Ze(this);this.curOp.forceUpdate=!0;Ni(this,i);r.autofocus&&!ca||Mo()==o.input?setTimeout(bo(Zn,this),20):Qn(this);for(var a in Ia)Ia.hasOwnProperty(a)&&Ia[a](this,r[a],Pa);b(this);for(var l=0;l<Ra.length;++l)Ra[l](this);tn(this)}function e(t,e){var n=this,r=n.input=Co("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");ea?r.style.width="1000px":r.setAttribute("wrap","off");ua&&(r.style.border="1px solid black");r.setAttribute("autocorrect","off");r.setAttribute("autocapitalize","off");r.setAttribute("spellcheck","false");n.inputDiv=Co("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");n.scrollbarH=Co("div",[Co("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.scrollbarV=Co("div",[Co("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");n.scrollbarFiller=Co("div",null,"CodeMirror-scrollbar-filler");n.gutterFiller=Co("div",null,"CodeMirror-gutter-filler");n.lineDiv=Co("div",null,"CodeMirror-code");n.selectionDiv=Co("div",null,null,"position: relative; z-index: 1");n.cursorDiv=Co("div",null,"CodeMirror-cursors");n.measure=Co("div",null,"CodeMirror-measure");n.lineMeasure=Co("div",null,"CodeMirror-measure");n.lineSpace=Co("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");n.mover=Co("div",[Co("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative");n.sizer=Co("div",[n.mover],"CodeMirror-sizer");n.heightForcer=Co("div",null,null,"position: absolute; height: "+ds+"px; width: 1px;");n.gutters=Co("div",null,"CodeMirror-gutters");n.lineGutter=null;n.scroller=Co("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll");n.scroller.setAttribute("tabIndex","-1");n.wrapper=Co("div",[n.inputDiv,n.scrollbarH,n.scrollbarV,n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror");if(Qo&&8>ta){n.gutters.style.zIndex=-1;n.scroller.style.paddingRight=0}ua&&(r.style.width="0px");ea||(n.scroller.draggable=!0);if(aa){n.inputDiv.style.height="1px";n.inputDiv.style.position="absolute"}Qo&&8>ta&&(n.scrollbarH.style.minHeight=n.scrollbarV.style.minWidth="18px");t&&(t.appendChild?t.appendChild(n.wrapper):t(n.wrapper));n.viewFrom=n.viewTo=e.first;n.view=[];n.externalMeasured=null;n.viewOffset=0;n.lastWrapHeight=n.lastWrapWidth=0;n.updateLineNumbers=null;n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null;n.prevInput="";n.alignWidgets=!1;n.pollingFast=!1;n.poll=new co;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null;n.inaccurateSelection=!1;n.maxLine=null;n.maxLineLength=0;n.maxLineChanged=!1;n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null;n.shift=!1;n.selForContextMenu=null}function n(e){e.doc.mode=t.getMode(e.options,e.doc.modeOption);r(e)}function r(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null);t.styles&&(t.styles=null)});t.doc.frontier=t.doc.first;we(t,100);t.state.modeGen++;t.curOp&&pn(t)}function i(t){if(t.options.lineWrapping){Ls(t.display.wrapper,"CodeMirror-wrap");t.display.sizer.style.minWidth=""}else{Ds(t.display.wrapper,"CodeMirror-wrap");h(t)}a(t);pn(t);Re(t);setTimeout(function(){m(t)},100)}function o(t){var e=Je(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/Ke(t.display)-3);return function(i){if(ri(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*e:o+e}}function a(t){var e=t.doc,n=o(t);e.iter(function(t){var e=n(t);e!=t.height&&Pi(t,e)})}function s(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-");Re(t)}function l(t){u(t);pn(t);setTimeout(function(){y(t)},20)}function u(t){var e=t.display.gutters,n=t.options.gutters;To(e);for(var r=0;r<n.length;++r){var i=n[r],o=e.appendChild(Co("div",null,"CodeMirror-gutter "+i));if("CodeMirror-linenumbers"==i){t.display.lineGutter=o;o.style.width=(t.display.lineNumWidth||1)+"px"}}e.style.display=r?"":"none";c(t)}function c(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px";t.display.scrollbarH.style.left=t.options.fixedGutter?e+"px":0}function f(t){if(0==t.height)return 0;for(var e,n=t.text.length,r=t;e=Jr(r);){var i=e.find(0,!0);r=i.from.line;n+=i.from.ch-i.to.ch}r=t;for(;e=Kr(r);){var i=e.find(0,!0);n-=r.text.length-i.from.ch;r=i.to.line;n+=r.text.length-i.to.ch}return n}function h(t){var e=t.display,n=t.doc;e.maxLine=Ei(n,n.first);e.maxLineLength=f(e.maxLine);e.maxLineChanged=!0;n.iter(function(t){var n=f(t);if(n>e.maxLineLength){e.maxLineLength=n;e.maxLine=t}})}function d(t){var e=go(t.gutters,"CodeMirror-linenumbers");if(-1==e&&t.lineNumbers)t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]);else if(e>-1&&!t.lineNumbers){t.gutters=t.gutters.slice(0);t.gutters.splice(e,1)}}function p(t){return t.display.scroller.clientHeight-t.display.wrapper.clientHeight<ds-3}function g(t){var e=t.display.scroller;return{clientHeight:e.clientHeight,barHeight:t.display.scrollbarV.clientHeight,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,hScrollbarTakesSpace:p(t),barWidth:t.display.scrollbarH.clientWidth,docHeight:Math.round(t.doc.height+ke(t.display))}}function m(t,e){e||(e=g(t));var n=t.display,r=jo(n.measure),i=e.docHeight+ds,o=e.scrollWidth>e.clientWidth;o&&e.scrollWidth<=e.clientWidth+1&&r>0&&!e.hScrollbarTakesSpace&&(o=!1);var a=i>e.clientHeight;if(a){n.scrollbarV.style.display="block";n.scrollbarV.style.bottom=o?r+"px":"0";n.scrollbarV.firstChild.style.height=Math.max(0,i-e.clientHeight+(e.barHeight||n.scrollbarV.clientHeight))+"px"}else{n.scrollbarV.style.display="";n.scrollbarV.firstChild.style.height="0"}if(o){n.scrollbarH.style.display="block";n.scrollbarH.style.right=a?r+"px":"0";n.scrollbarH.firstChild.style.width=e.scrollWidth-e.clientWidth+(e.barWidth||n.scrollbarH.clientWidth)+"px"}else{n.scrollbarH.style.display="";n.scrollbarH.firstChild.style.width="0"}if(o&&a){n.scrollbarFiller.style.display="block";n.scrollbarFiller.style.height=n.scrollbarFiller.style.width=r+"px"}else n.scrollbarFiller.style.display="";if(o&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter){n.gutterFiller.style.display="block";n.gutterFiller.style.height=r+"px";n.gutterFiller.style.width=n.gutters.offsetWidth+"px"}else n.gutterFiller.style.display="";if(!t.state.checkedOverlayScrollbar&&e.clientHeight>0){if(0===r){var s=fa&&!sa?"12px":"18px";n.scrollbarV.style.minWidth=n.scrollbarH.style.minHeight=s;var l=function(e){no(e)!=n.scrollbarV&&no(e)!=n.scrollbarH&&un(t,En)(e)};us(n.scrollbarV,"mousedown",l);us(n.scrollbarH,"mousedown",l)}t.state.checkedOverlayScrollbar=!0}}function v(t,e,n){var r=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;r=Math.floor(r-_e(t));var i=n&&null!=n.bottom?n.bottom:r+t.wrapper.clientHeight,o=Oi(e,r),a=Oi(e,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;if(o>s)return{from:s,to:Oi(e,Fi(Ei(e,s))+t.wrapper.clientHeight)};if(Math.min(l,e.lastLine())>=a)return{from:Oi(e,Fi(Ei(e,l))-t.wrapper.clientHeight),to:l}}return{from:o,to:Math.max(a,o+1)}}function y(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=w(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){t.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=r+i+"px")}}function b(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=x(t.options,e.first+e.size-1),r=t.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Co("div",[Co("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a);r.lineNumWidth=r.lineNumInnerWidth+a;r.lineNumChars=r.lineNumInnerWidth?n.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";c(t);return!0}return!1}function x(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function w(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function S(t,e,n){var r=t.display;this.viewport=e;this.visible=v(r,t.doc,e);this.editorIsHidden=!r.wrapper.offsetWidth;this.wrapperHeight=r.wrapper.clientHeight;this.wrapperWidth=r.wrapper.clientWidth;this.oldViewFrom=r.viewFrom;this.oldViewTo=r.viewTo;this.oldScrollerWidth=r.scroller.clientWidth;this.force=n;this.dims=A(t)}function C(t,e){var n=t.display,r=t.doc;if(e.editorIsHidden){mn(t);return!1}if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&0==xn(t))return!1;if(b(t)){mn(t);e.dims=A(t)}var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom));n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo));if(va){o=ei(t.doc,o);a=ni(t.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;bn(t,o,a);n.viewOffset=Fi(Ei(t.doc,n.viewFrom));t.display.mover.style.top=n.viewOffset+"px";var l=xn(t);if(!s&&0==l&&!e.force&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=Mo();l>4&&(n.lineDiv.style.display="none");N(t,n.updateLineNumbers,e.dims);l>4&&(n.lineDiv.style.display="");u&&Mo()!=u&&u.offsetHeight&&u.focus();To(n.cursorDiv);To(n.selectionDiv);if(s){n.lastWrapHeight=e.wrapperHeight;n.lastWrapWidth=e.wrapperWidth;we(t,400)}n.updateLineNumbers=null;return!0}function T(t,e){for(var n=e.force,r=e.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&e.oldScrollerWidth!=t.display.scroller.clientWidth)n=!0;else{n=!1;r&&null!=r.top&&(r={top:Math.min(t.doc.height+ke(t.display)-ds-t.display.scroller.clientHeight,r.top)});e.visible=v(t.display,t.doc,r);if(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break}if(!C(t,e))break;D(t);var o=g(t);ve(t);k(t,o);m(t,o)}io(t,"update",t);(t.display.viewFrom!=e.oldViewFrom||t.display.viewTo!=e.oldViewTo)&&io(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo)}function _(t,e){var n=new S(t,e);if(C(t,n)){D(t);T(t,n);var r=g(t);ve(t);k(t,r);m(t,r)}}function k(t,e){t.display.sizer.style.minHeight=t.display.heightForcer.style.top=e.docHeight+"px";t.display.gutters.style.height=Math.max(e.docHeight,e.clientHeight-ds)+"px"}function M(t,e){if(t.display.sizer.offsetWidth+t.display.gutters.offsetWidth<t.display.scroller.clientWidth-1){t.display.sizer.style.minHeight=t.display.heightForcer.style.top="0px";t.display.gutters.style.height=e.docHeight+"px"}}function D(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r<e.view.length;r++){var i,o=e.view[r];if(!o.hidden){if(Qo&&8>ta){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n;n=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;2>i&&(i=Je(e));if(l>.001||-.001>l){Pi(o.line,i);L(o.line);if(o.rest)for(var u=0;u<o.rest.length;u++)L(o.rest[u])}}}}function L(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e)t.widgets[e].height=t.widgets[e].node.offsetHeight}function A(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){n[t.options.gutters[a]]=o.offsetLeft+o.clientLeft+i;r[t.options.gutters[a]]=o.clientWidth}return{fixedPos:w(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function N(t,e,n){function r(e){var n=e.nextSibling;ea&&fa&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e);return n}for(var i=t.display,o=t.options.lineNumbers,a=i.lineDiv,s=a.firstChild,l=i.view,u=i.viewFrom,c=0;c<l.length;c++){var f=l[c];if(f.hidden);else if(f.node){for(;s!=f.node;)s=r(s);var h=o&&null!=e&&u>=e&&f.lineNumber;if(f.changes){go(f.changes,"gutter")>-1&&(h=!1);E(t,f,u,n)}if(h){To(f.lineNumber);f.lineNumber.appendChild(document.createTextNode(x(t.options,u)))}s=f.node.nextSibling}else{var d=W(t,f,u,n);a.insertBefore(d,s)}u+=f.size}for(;s;)s=r(s)}function E(t,e,n,r){for(var i=0;i<e.changes.length;i++){var o=e.changes[i];"text"==o?H(t,e):"gutter"==o?F(t,e,n,r):"class"==o?O(e):"widget"==o&&R(e,r)}e.changes=null}function j(t){if(t.node==t.text){t.node=Co("div",null,null,"position: relative");t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text);t.node.appendChild(t.text);Qo&&8>ta&&(t.node.style.zIndex=2)}return t.node}function I(t){var e=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;e&&(e+=" CodeMirror-linebackground");if(t.background)if(e)t.background.className=e;else{t.background.parentNode.removeChild(t.background);t.background=null}else if(e){var n=j(t);t.background=n.insertBefore(Co("div",null,e),n.firstChild)}}function P(t,e){var n=t.display.externalMeasured;if(n&&n.line==e.line){t.display.externalMeasured=null;e.measure=n.measure;return n.built}return bi(t,e)}function H(t,e){var n=e.text.className,r=P(t,e);e.text==e.node&&(e.node=r.pre);e.text.parentNode.replaceChild(r.pre,e.text);e.text=r.pre;if(r.bgClass!=e.bgClass||r.textClass!=e.textClass){e.bgClass=r.bgClass;e.textClass=r.textClass;O(e)}else n&&(e.text.className=n)}function O(t){I(t);t.line.wrapClass?j(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var e=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=e||""}function F(t,e,n,r){if(e.gutter){e.node.removeChild(e.gutter);e.gutter=null}var i=e.line.gutterMarkers;if(t.options.lineNumbers||i){var o=j(e),a=e.gutter=o.insertBefore(Co("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.text);e.line.gutterClass&&(a.className+=" "+e.line.gutterClass);!t.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(e.lineNumber=a.appendChild(Co("div",x(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px")));if(i)for(var s=0;s<t.options.gutters.length;++s){var l=t.options.gutters[s],u=i.hasOwnProperty(l)&&i[l];u&&a.appendChild(Co("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function R(t,e){t.alignable&&(t.alignable=null);for(var n,r=t.node.firstChild;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&t.node.removeChild(r)}z(t,e)}function W(t,e,n,r){var i=P(t,e);e.text=e.node=i.pre;i.bgClass&&(e.bgClass=i.bgClass);i.textClass&&(e.textClass=i.textClass);O(e);F(t,e,n,r);z(e,r);return e.node}function z(t,e){q(t.line,t,e,!0);if(t.rest)for(var n=0;n<t.rest.length;n++)q(t.rest[n],t,e,!1)}function q(t,e,n,r){if(t.widgets)for(var i=j(e),o=0,a=t.widgets;o<a.length;++o){var s=a[o],l=Co("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||(l.ignoreEvents=!0);U(s,l,e,n);r&&s.above?i.insertBefore(l,e.gutter||e.text):i.appendChild(l);io(s,"redraw")}}function U(t,e,n,r){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var i=r.wrapperWidth;e.style.left=r.fixedPos+"px";if(!t.coverGutter){i-=r.gutterTotalWidth;e.style.paddingLeft=r.gutterTotalWidth+"px"}e.style.width=i+"px"}if(t.coverGutter){e.style.zIndex=5;e.style.position="relative";t.noHScroll||(e.style.marginLeft=-r.gutterTotalWidth+"px")}}function B(t){return ya(t.line,t.ch)}function V(t,e){return ba(t,e)<0?e:t}function X(t,e){return ba(t,e)<0?t:e}function G(t,e){this.ranges=t;this.primIndex=e}function $(t,e){this.anchor=t;this.head=e}function Y(t,e){var n=t[e];t.sort(function(t,e){return ba(t.from(),e.from())});e=go(t,n);for(var r=1;r<t.length;r++){var i=t[r],o=t[r-1];if(ba(o.to(),i.from())>=0){var a=X(o.from(),i.from()),s=V(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;e>=r&&--e;t.splice(--r,2,new $(l?s:a,l?a:s))}}return new G(t,e)}function J(t,e){return new G([new $(t,e||t)],0)}function K(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function Z(t,e){if(e.line<t.first)return ya(t.first,0);var n=t.first+t.size-1;return e.line>n?ya(n,Ei(t,n).text.length):Q(e,Ei(t,e.line).text.length)}function Q(t,e){var n=t.ch;return null==n||n>e?ya(t.line,e):0>n?ya(t.line,0):t}function te(t,e){return e>=t.first&&e<t.first+t.size}function ee(t,e){for(var n=[],r=0;r<e.length;r++)n[r]=Z(t,e[r]);return n}function ne(t,e,n,r){if(t.cm&&t.cm.display.shift||t.extend){var i=e.anchor;if(r){var o=ba(n,i)<0;if(o!=ba(r,i)<0){i=n;n=r}else o!=ba(n,r)<0&&(n=r)}return new $(i,n)}return new $(r||n,n)}function re(t,e,n,r){ue(t,new G([ne(t,t.sel.primary(),e,n)],0),r)}function ie(t,e,n){for(var r=[],i=0;i<t.sel.ranges.length;i++)r[i]=ne(t,t.sel.ranges[i],e[i],null);var o=Y(r,t.sel.primIndex);ue(t,o,n)}function oe(t,e,n,r){var i=t.sel.ranges.slice(0);i[e]=n;ue(t,Y(i,t.sel.primIndex),r)}function ae(t,e,n,r){ue(t,J(e,n),r)}function se(t,e){var n={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new $(Z(t,e[n].anchor),Z(t,e[n].head))}};fs(t,"beforeSelectionChange",t,n);t.cm&&fs(t.cm,"beforeSelectionChange",t.cm,n);return n.ranges!=e.ranges?Y(n.ranges,n.ranges.length-1):e}function le(t,e,n){var r=t.history.done,i=po(r);if(i&&i.ranges){r[r.length-1]=e;ce(t,e,n)}else ue(t,e,n)}function ue(t,e,n){ce(t,e,n);Xi(t,t.sel,t.cm?t.cm.curOp.id:0/0,n)}function ce(t,e,n){(lo(t,"beforeSelectionChange")||t.cm&&lo(t.cm,"beforeSelectionChange"))&&(e=se(t,e));var r=n&&n.bias||(ba(e.primary().head,t.sel.primary().head)<0?-1:1);fe(t,de(t,e,r,!0));n&&n.scroll===!1||!t.cm||br(t.cm)}function fe(t,e){if(!e.equals(t.sel)){t.sel=e;if(t.cm){t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0;so(t.cm)}io(t,"cursorActivity",t)}}function he(t){fe(t,de(t,t.sel,null,!1),gs)}function de(t,e,n,r){for(var i,o=0;o<e.ranges.length;o++){var a=e.ranges[o],s=pe(t,a.anchor,n,r),l=pe(t,a.head,n,r);if(i||s!=a.anchor||l!=a.head){i||(i=e.ranges.slice(0,o));i[o]=new $(s,l)}}return i?Y(i,e.primIndex):e}function pe(t,e,n,r){var i=!1,o=e,a=n||1;t.cantEdit=!1;t:for(;;){var s=Ei(t,o.line);if(s.markedSpans)for(var l=0;l<s.markedSpans.length;++l){var u=s.markedSpans[l],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(r){fs(c,"beforeCursorEnter");if(c.explicitlyCleared){if(s.markedSpans){--l;continue}break}}if(!c.atomic)continue;var f=c.find(0>a?-1:1);if(0==ba(f,o)){f.ch+=a;f.ch<0?f=f.line>t.first?Z(t,ya(f.line-1)):null:f.ch>s.text.length&&(f=f.line<t.first+t.size-1?ya(f.line+1,0):null);if(!f){if(i){if(!r)return pe(t,e,n,!0);t.cantEdit=!0;return ya(t.first,0)}i=!0;f=e;a=-a}}o=f;continue t}}return o}}function ge(t){for(var e=t.display,n=t.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++){var s=n.sel.ranges[a],l=s.empty();(l||t.options.showCursorWhenSelecting)&&ye(t,s,i);l||be(t,s,o)}if(t.options.moveInputWithCursor){var u=Ve(t,n.sel.primary().head,"div"),c=e.wrapper.getBoundingClientRect(),f=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,u.top+f.top-c.top));r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,u.left+f.left-c.left))}return r}function me(t,e){_o(t.display.cursorDiv,e.cursors);_o(t.display.selectionDiv,e.selection);if(null!=e.teTop){t.display.inputDiv.style.top=e.teTop+"px";t.display.inputDiv.style.left=e.teLeft+"px"}}function ve(t){me(t,ge(t))}function ye(t,e,n){var r=Ve(t,e.head,"div",null,null,!t.options.singleCursorHeightPerLine),i=n.appendChild(Co("div"," ","CodeMirror-cursor"));i.style.left=r.left+"px";i.style.top=r.top+"px";i.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px";if(r.other){var o=n.appendChild(Co("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="";o.style.left=r.other.left+"px";o.style.top=r.other.top+"px";o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function be(t,e,n){function r(t,e,n,r){0>e&&(e=0);e=Math.round(e);r=Math.round(r);s.appendChild(Co("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==n?c-t:n)+"px; height: "+(r-e)+"px"))}function i(e,n,i){function o(n,r){return Be(t,ya(e,n),"div",f,r)}var s,l,f=Ei(a,e),h=f.text.length;Oo(Ri(f),n||0,null==i?h:i,function(t,e,a){var f,d,p,g=o(t,"left");if(t==e){f=g;d=p=g.left}else{f=o(e-1,"right");if("rtl"==a){var m=g;g=f;f=m}d=g.left;p=f.right}null==n&&0==t&&(d=u);if(f.top-g.top>3){r(d,g.top,null,g.bottom);d=u;g.bottom<f.top&&r(d,g.bottom,null,f.top)}null==i&&e==h&&(p=c);(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g);(!l||f.bottom>l.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f);u+1>d&&(d=u);r(d,f.top,p-d,f.bottom)});return{start:s,end:l}}var o=t.display,a=t.doc,s=document.createDocumentFragment(),l=Me(t.display),u=l.left,c=o.lineSpace.offsetWidth-l.right,f=e.from(),h=e.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=Ei(a,f.line),p=Ei(a,h.line),g=Qr(d)==Qr(p),m=i(f.line,f.ch,g?d.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;if(g)if(m.top<v.top-2){r(m.right,m.top,null,m.bottom);r(u,v.top,v.left,v.bottom)}else r(m.right,m.top,v.left-m.right,m.bottom);m.bottom<v.top&&r(u,m.bottom,null,v.top)}n.appendChild(s)}function xe(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="";t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function we(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.viewTo&&t.state.highlight.set(e,bo(Se,t))}function Se(t){var e=t.doc;e.frontier<e.first&&(e.frontier=e.first);if(!(e.frontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,r=za(e.mode,Te(t,e.frontier)),i=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(e.frontier>=t.display.viewFrom){var a=o.styles,s=gi(t,o,r,!0);o.styles=s.styles;var l=o.styleClasses,u=s.classes;u?o.styleClasses=u:l&&(o.styleClasses=null);for(var c=!a||a.length!=o.styles.length||l!=u&&(!l||!u||l.bgClass!=u.bgClass||l.textClass!=u.textClass),f=0;!c&&f<a.length;++f)c=a[f]!=o.styles[f];c&&i.push(e.frontier);o.stateAfter=za(e.mode,r)}else{vi(t,o.text,r);o.stateAfter=e.frontier%5==0?za(e.mode,r):null}++e.frontier;if(+new Date>n){we(t,t.options.workDelay);return!0}});i.length&&ln(t,function(){for(var e=0;e<i.length;e++)gn(t,i[e],"text")})}}function Ce(t,e,n){for(var r,i,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=Ei(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var u=ys(l.text,null,t.options.tabSize);if(null==i||r>u){i=s-1;r=u}}return i}function Te(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return!0;var o=Ce(t,e,n),a=o>r.first&&Ei(r,o-1).stateAfter;a=a?za(r.mode,a):qa(r.mode);r.iter(o,e,function(n){vi(t,n.text,a);var s=o==e-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;n.stateAfter=s?za(r.mode,a):null;++o});n&&(r.frontier=o);return a}function _e(t){return t.lineSpace.offsetTop}function ke(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Me(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=_o(t.measure,Co("pre","x")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r);return r}function De(t,e,n){var r=t.options.lineWrapping,i=r&&t.display.scroller.clientWidth;if(!e.measure.heights||r&&e.measure.width!=i){var o=e.measure.heights=[];if(r){e.measure.width=i;for(var a=e.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],u=a[s+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Le(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;r<t.rest.length;r++)if(t.rest[r]==e)return{map:t.measure.maps[r],cache:t.measure.caches[r]};for(var r=0;r<t.rest.length;r++)if(Hi(t.rest[r])>n)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function Ae(t,e){e=Qr(e);var n=Hi(e),r=t.display.externalMeasured=new hn(t.doc,e,n);r.lineN=n;var i=r.built=bi(t,r);r.text=i.pre;_o(t.display.lineMeasure,i.pre);return r}function Ne(t,e,n,r){return Ie(t,je(t,e),n,r)}function Ee(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[vn(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function je(t,e){var n=Hi(e),r=Ee(t,n);r&&!r.text?r=null:r&&r.changes&&E(t,r,n,A(t));r||(r=Ae(t,e));var i=Le(r,e,n);return{line:e,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ie(t,e,n,r,i){e.before&&(n=-1);var o,a=n+(r||"");if(e.cache.hasOwnProperty(a))o=e.cache[a];else{e.rect||(e.rect=e.view.text.getBoundingClientRect());if(!e.hasHeights){De(t,e.view,e.rect);e.hasHeights=!0}o=Pe(t,e,n,r);o.bogus||(e.cache[a]=o)}return{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function Pe(t,e,n,r){for(var i,o,a,s,l=e.map,u=0;u<l.length;u+=3){var c=l[u],f=l[u+1];if(c>n){o=0;a=1;s="left"}else if(f>n){o=n-c;a=o+1}else if(u==l.length-3||n==f&&l[u+3]>n){a=f-c;o=a-1;n>=f&&(s="right")}if(null!=o){i=l[u+2];c==f&&r==(i.insertLeft?"left":"right")&&(s=r);if("left"==r&&0==o)for(;u&&l[u-2]==l[u-3]&&l[u-1].insertLeft;){i=l[(u-=3)+2];s="left"}if("right"==r&&o==f-c)for(;u<l.length-3&&l[u+3]==l[u+4]&&!l[u+5].insertLeft;){i=l[(u+=3)+2];s="right"}break}}var h;if(3==i.nodeType){for(var u=0;4>u;u++){for(;o&&So(e.line.text.charAt(c+o));)--o;for(;f>c+a&&So(e.line.text.charAt(c+a));)++a;if(Qo&&9>ta&&0==o&&a==f-c)h=i.parentNode.getBoundingClientRect();else if(Qo&&t.options.lineWrapping){var d=ws(i,o,a).getClientRects();h=d.length?d["right"==r?d.length-1:0]:Ca}else h=ws(i,o,a).getBoundingClientRect()||Ca;if(h.left||h.right||0==o)break;a=o;o-=1;s="right"}Qo&&11>ta&&(h=He(t.display.measure,h))}else{o>0&&(s=r="right");var d;h=t.options.lineWrapping&&(d=i.getClientRects()).length>1?d["right"==r?d.length-1:0]:i.getBoundingClientRect()}if(Qo&&9>ta&&!o&&(!h||!h.left&&!h.right)){var p=i.parentNode.getClientRects()[0];h=p?{left:p.left,right:p.left+Ke(t.display),top:p.top,bottom:p.bottom}:Ca}for(var g=h.top-e.rect.top,m=h.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,u=0;u<y.length-1&&!(v<y[u]);u++);var b=u?y[u-1]:0,x=y[u],w={left:("right"==s?h.right:h.left)-e.rect.left,right:("left"==s?h.left:h.right)-e.rect.left,top:b,bottom:x};h.left||h.right||(w.bogus=!0);if(!t.options.singleCursorHeightPerLine){w.rtop=g;w.rbottom=m}return w}function He(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ho(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*r,bottom:e.bottom*r}}function Oe(t){if(t.measure){t.measure.cache={};t.measure.heights=null;if(t.rest)for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}}function Fe(t){t.display.externalMeasure=null;To(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)Oe(t.display.view[e])}function Re(t){Fe(t);t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null;t.options.lineWrapping||(t.display.maxLineChanged=!0);t.display.lineNumChars=null}function We(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ze(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function qe(t,e,n,r){if(e.widgets)for(var i=0;i<e.widgets.length;++i)if(e.widgets[i].above){var o=ai(e.widgets[i]);n.top+=o;n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Fi(e);"local"==r?a+=_e(t.display):a-=t.display.viewOffset;if("page"==r||"window"==r){var s=t.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:ze());var l=s.left+("window"==r?0:We());n.left+=l;n.right+=l}n.top+=a;n.bottom+=a;return n}function Ue(t,e,n){if("div"==n)return e;var r=e.left,i=e.top;if("page"==n){r-=We();i-=ze()}else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();r+=o.left;i+=o.top}var a=t.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Be(t,e,n,r,i){r||(r=Ei(t.doc,e.line));return qe(t,r,Ne(t,r,e.ch,i),n)}function Ve(t,e,n,r,i,o){function a(e,a){var s=Ie(t,i,e,a?"right":"left",o);a?s.left=s.right:s.right=s.left;return qe(t,r,s,n)}function s(t,e){var n=l[e],r=n.level%2;if(t==Fo(n)&&e&&n.level<l[e-1].level){n=l[--e];t=Ro(n)-(n.level%2?0:1);r=!0}else if(t==Ro(n)&&e<l.length-1&&n.level<l[e+1].level){n=l[++e]; t=Fo(n)-n.level%2;r=!1}return r&&t==n.to&&t>n.from?a(t-1):a(t,r)}r=r||Ei(t.doc,e.line);i||(i=je(t,r));var l=Ri(r),u=e.ch;if(!l)return a(u);var c=Xo(l,u),f=s(u,c);null!=Os&&(f.other=s(u,Os));return f}function Xe(t,e){var n=0,e=Z(t.doc,e);t.options.lineWrapping||(n=Ke(t.display)*e.ch);var r=Ei(t.doc,e.line),i=Fi(r)+_e(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Ge(t,e,n,r){var i=ya(t,e);i.xRel=r;n&&(i.outside=!0);return i}function $e(t,e,n){var r=t.doc;n+=t.display.viewOffset;if(0>n)return Ge(r.first,0,!0,-1);var i=Oi(r,n),o=r.first+r.size-1;if(i>o)return Ge(r.first+r.size-1,Ei(r,o).text.length,!0,1);0>e&&(e=0);for(var a=Ei(r,i);;){var s=Ye(t,a,i,e,n),l=Kr(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=Hi(a=u.to.line)}}function Ye(t,e,n,r,i){function o(r){var i=Ve(t,ya(n,r),"line",e,u);s=!0;if(a>i.bottom)return i.left-l;if(a<i.top)return i.left+l;s=!1;return i.left}var a=i-Fi(e),s=!1,l=2*t.display.wrapper.clientWidth,u=je(t,e),c=Ri(e),f=e.text.length,h=Wo(e),d=zo(e),p=o(h),g=s,m=o(d),v=s;if(r>m)return Ge(n,d,v,1);for(;;){if(c?d==h||d==$o(e,h,1):1>=d-h){for(var y=p>r||m-r>=r-p?h:d,b=r-(y==h?p:m);So(e.text.charAt(y));)++y;var x=Ge(n,y,y==h?g:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(f/2),S=h+w;if(c){S=h;for(var C=0;w>C;++C)S=$o(e,S,1)}var T=o(S);if(T>r){d=S;m=T;(v=s)&&(m+=1e3);f=w}else{h=S;p=T;g=s;f-=w}}}function Je(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==xa){xa=Co("pre");for(var e=0;49>e;++e){xa.appendChild(document.createTextNode("x"));xa.appendChild(Co("br"))}xa.appendChild(document.createTextNode("x"))}_o(t.measure,xa);var n=xa.offsetHeight/50;n>3&&(t.cachedTextHeight=n);To(t.measure);return n||1}function Ke(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=Co("span","xxxxxxxxxx"),n=Co("pre",[e]);_o(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;i>2&&(t.cachedCharWidth=i);return i||10}function Ze(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++_a};Ta?Ta.ops.push(t.curOp):t.curOp.ownsGroup=Ta={ops:[t.curOp],delayedCallbacks:[]}}function Qe(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n]();for(var r=0;r<t.ops.length;r++){var i=t.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<e.length)}function tn(t){var e=t.curOp,n=e.ownsGroup;if(n)try{Qe(n)}finally{Ta=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;en(n)}}function en(t){for(var e=t.ops,n=0;n<e.length;n++)nn(e[n]);for(var n=0;n<e.length;n++)rn(e[n]);for(var n=0;n<e.length;n++)on(e[n]);for(var n=0;n<e.length;n++)an(e[n]);for(var n=0;n<e.length;n++)sn(e[n])}function nn(t){var e=t.cm,n=e.display;t.updateMaxLine&&h(e);t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping;t.update=t.mustUpdate&&new S(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function rn(t){t.updatedDisplay=t.mustUpdate&&C(t.cm,t.update)}function on(t){var e=t.cm,n=e.display;t.updatedDisplay&&D(e);t.barMeasure=g(e);if(n.maxLineChanged&&!e.options.lineWrapping){t.adjustWidthTo=Ne(e,n.maxLine,n.maxLine.text.length).left+3;t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo+ds-n.scroller.clientWidth)}(t.updatedDisplay||t.selectionChanged)&&(t.newSelectionNodes=ge(e))}function an(t){var e=t.cm;if(null!=t.adjustWidthTo){e.display.sizer.style.minWidth=t.adjustWidthTo+"px";t.maxScrollLeft<e.doc.scrollLeft&&zn(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0);e.display.maxLineChanged=!1}t.newSelectionNodes&&me(e,t.newSelectionNodes);t.updatedDisplay&&k(e,t.barMeasure);(t.updatedDisplay||t.startHeight!=e.doc.height)&&m(e,t.barMeasure);t.selectionChanged&&xe(e);e.state.focused&&t.updateInput&&Tn(e,t.typing)}function sn(t){var e=t.cm,n=e.display,r=e.doc;null!=t.adjustWidthTo&&Math.abs(t.barMeasure.scrollWidth-e.display.scroller.scrollWidth)>1&&m(e);t.updatedDisplay&&T(e,t.update);null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null);if(null!=t.scrollTop&&(n.scroller.scrollTop!=t.scrollTop||t.forceScroll)){var i=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=i}if(null!=t.scrollLeft&&(n.scroller.scrollLeft!=t.scrollLeft||t.forceScroll)){var o=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,t.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=o;y(e)}if(t.scrollToPos){var a=gr(e,Z(r,t.scrollToPos.from),Z(r,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&pr(e,a)}var s=t.maybeHiddenMarkers,l=t.maybeUnhiddenMarkers;if(s)for(var u=0;u<s.length;++u)s[u].lines.length||fs(s[u],"hide");if(l)for(var u=0;u<l.length;++u)l[u].lines.length&&fs(l[u],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=e.display.scroller.scrollTop);if(t.updatedDisplay&&ea){e.options.lineWrapping&&M(e,t.barMeasure);t.barMeasure.scrollWidth>t.barMeasure.clientWidth&&t.barMeasure.scrollWidth<t.barMeasure.clientWidth+1&&!p(e)&&m(e)}t.changeObjs&&fs(e,"changes",e,t.changeObjs)}function ln(t,e){if(t.curOp)return e();Ze(t);try{return e()}finally{tn(t)}}function un(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Ze(t);try{return e.apply(t,arguments)}finally{tn(t)}}}function cn(t){return function(){if(this.curOp)return t.apply(this,arguments);Ze(this);try{return t.apply(this,arguments)}finally{tn(this)}}}function fn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Ze(e);try{return t.apply(this,arguments)}finally{tn(e)}}}function hn(t,e,n){this.line=e;this.rest=ti(e);this.size=this.rest?Hi(po(this.rest))-n+1:1;this.node=this.text=null;this.hidden=ri(t,e)}function dn(t,e,n){for(var r,i=[],o=e;n>o;o=r){var a=new hn(t.doc,Ei(t.doc,o),o);r=o+a.size;i.push(a)}return i}function pn(t,e,n,r){null==e&&(e=t.doc.first);null==n&&(n=t.doc.first+t.doc.size);r||(r=0);var i=t.display;r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>e)&&(i.updateLineNumbers=e);t.curOp.viewChanged=!0;if(e>=i.viewTo)va&&ei(t.doc,e)<i.viewTo&&mn(t);else if(n<=i.viewFrom)if(va&&ni(t.doc,n+r)>i.viewFrom)mn(t);else{i.viewFrom+=r;i.viewTo+=r}else if(e<=i.viewFrom&&n>=i.viewTo)mn(t);else if(e<=i.viewFrom){var o=yn(t,n,n+r,1);if(o){i.view=i.view.slice(o.index);i.viewFrom=o.lineN;i.viewTo+=r}else mn(t)}else if(n>=i.viewTo){var o=yn(t,e,e,-1);if(o){i.view=i.view.slice(0,o.index);i.viewTo=o.lineN}else mn(t)}else{var a=yn(t,e,e,-1),s=yn(t,n,n+r,1);if(a&&s){i.view=i.view.slice(0,a.index).concat(dn(t,a.lineN,s.lineN)).concat(i.view.slice(s.index));i.viewTo+=r}else mn(t)}var l=i.externalMeasured;l&&(n<l.lineN?l.lineN+=r:e<l.lineN+l.size&&(i.externalMeasured=null))}function gn(t,e,n){t.curOp.viewChanged=!0;var r=t.display,i=t.display.externalMeasured;i&&e>=i.lineN&&e<i.lineN+i.size&&(r.externalMeasured=null);if(!(e<r.viewFrom||e>=r.viewTo)){var o=r.view[vn(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==go(a,n)&&a.push(n)}}}function mn(t){t.display.viewFrom=t.display.viewTo=t.doc.first;t.display.view=[];t.display.viewOffset=0}function vn(t,e){if(e>=t.display.viewTo)return null;e-=t.display.viewFrom;if(0>e)return null;for(var n=t.display.view,r=0;r<n.length;r++){e-=n[r].size;if(0>e)return r}}function yn(t,e,n,r){var i,o=vn(t,e),a=t.display.view;if(!va||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=0,l=t.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=e){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-e;o++}else i=l-e;e+=i;n+=i}for(;ei(t.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size;o+=r}return{index:o,lineN:n}}function bn(t,e,n){var r=t.display,i=r.view;if(0==i.length||e>=r.viewTo||n<=r.viewFrom){r.view=dn(t,e,n);r.viewFrom=e}else{r.viewFrom>e?r.view=dn(t,e,r.viewFrom).concat(r.view):r.viewFrom<e&&(r.view=r.view.slice(vn(t,e)));r.viewFrom=e;r.viewTo<n?r.view=r.view.concat(dn(t,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,vn(t,n)))}r.viewTo=n}function xn(t){for(var e=t.display.view,n=0,r=0;r<e.length;r++){var i=e[r];i.hidden||i.node&&!i.changes||++n}return n}function wn(t){t.display.pollingFast||t.display.poll.set(t.options.pollInterval,function(){Cn(t);t.state.focused&&wn(t)})}function Sn(t){function e(){var r=Cn(t);if(r||n){t.display.pollingFast=!1;wn(t)}else{n=!0;t.display.poll.set(60,e)}}var n=!1;t.display.pollingFast=!0;t.display.poll.set(20,e)}function Cn(t){var e=t.display.input,n=t.display.prevInput,r=t.doc;if(!t.state.focused||js(e)&&!n||Mn(t)||t.options.disableInput||t.state.keySeq)return!1;if(t.state.pasteIncoming&&t.state.fakedLastChar){e.value=e.value.substring(0,e.value.length-1);t.state.fakedLastChar=!1}var i=e.value;if(i==n&&!t.somethingSelected())return!1;if(Qo&&ta>=9&&t.display.inputHasSelection===i||fa&&/[\uf700-\uf7ff]/.test(i)){Tn(t);return!1}var o=!t.curOp;o&&Ze(t);t.display.shift=!1;8203!=i.charCodeAt(0)||r.sel!=t.display.selForContextMenu||n||(n="​");for(var a=0,s=Math.min(n.length,i.length);s>a&&n.charCodeAt(a)==i.charCodeAt(a);)++a;var l=i.slice(a),u=Es(l),c=null;t.state.pasteIncoming&&r.sel.ranges.length>1&&(ka&&ka.join("\n")==l?c=r.sel.ranges.length%ka.length==0&&mo(ka,Es):u.length==r.sel.ranges.length&&(c=mo(u,function(t){return[t]})));for(var f=r.sel.ranges.length-1;f>=0;f--){var h=r.sel.ranges[f],d=h.from(),p=h.to();a<n.length?d=ya(d.line,d.ch-(n.length-a)):t.state.overwrite&&h.empty()&&!t.state.pasteIncoming&&(p=ya(p.line,Math.min(Ei(r,p.line).text.length,p.ch+po(u).length)));var g=t.curOp.updateInput,m={from:d,to:p,text:c?c[f%c.length]:u,origin:t.state.pasteIncoming?"paste":t.state.cutIncoming?"cut":"+input"};sr(t.doc,m);io(t,"inputRead",t,m);if(l&&!t.state.pasteIncoming&&t.options.electricChars&&t.options.smartIndent&&h.head.ch<100&&(!f||r.sel.ranges[f-1].head.line!=h.head.line)){var v=t.getModeAt(h.head),y=Ea(m);if(v.electricChars){for(var b=0;b<v.electricChars.length;b++)if(l.indexOf(v.electricChars.charAt(b))>-1){wr(t,y.line,"smart");break}}else v.electricInput&&v.electricInput.test(Ei(r,y.line).text.slice(0,y.ch))&&wr(t,y.line,"smart")}}br(t);t.curOp.updateInput=g;t.curOp.typing=!0;i.length>1e3||i.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=i;o&&tn(t);t.state.pasteIncoming=t.state.cutIncoming=!1;return!0}function Tn(t,e){var n,r,i=t.doc;if(t.somethingSelected()){t.display.prevInput="";var o=i.sel.primary();n=Is&&(o.to().line-o.from().line>100||(r=t.getSelection()).length>1e3);var a=n?"-":r||t.getSelection();t.display.input.value=a;t.state.focused&&xs(t.display.input);Qo&&ta>=9&&(t.display.inputHasSelection=a)}else if(!e){t.display.prevInput=t.display.input.value="";Qo&&ta>=9&&(t.display.inputHasSelection=null)}t.display.inaccurateSelection=n}function _n(t){"nocursor"==t.options.readOnly||ca&&Mo()==t.display.input||t.display.input.focus()}function kn(t){if(!t.state.focused){_n(t);Zn(t)}}function Mn(t){return t.options.readOnly||t.doc.cantEdit}function Dn(t){function e(){t.state.focused&&setTimeout(bo(_n,t),0)}function n(e){ao(t,e)||ls(e)}function r(e){if(t.somethingSelected()){ka=t.getSelections();if(i.inaccurateSelection){i.prevInput="";i.inaccurateSelection=!1;i.input.value=ka.join("\n");xs(i.input)}}else{for(var n=[],r=[],o=0;o<t.doc.sel.ranges.length;o++){var a=t.doc.sel.ranges[o].head.line,s={anchor:ya(a,0),head:ya(a+1,0)};r.push(s);n.push(t.getRange(s.anchor,s.head))}if("cut"==e.type)t.setSelections(r,null,gs);else{i.prevInput="";i.input.value=n.join("\n");xs(i.input)}ka=n}"cut"==e.type&&(t.state.cutIncoming=!0)}var i=t.display;us(i.scroller,"mousedown",un(t,En));Qo&&11>ta?us(i.scroller,"dblclick",un(t,function(e){if(!ao(t,e)){var n=Nn(t,e);if(n&&!On(t,e)&&!An(t.display,e)){as(e);var r=t.findWordAt(n);re(t.doc,r.anchor,r.head)}}})):us(i.scroller,"dblclick",function(e){ao(t,e)||as(e)});us(i.lineSpace,"selectstart",function(t){An(i,t)||as(t)});ga||us(i.scroller,"contextmenu",function(e){tr(t,e)});us(i.scroller,"scroll",function(){if(i.scroller.clientHeight){Wn(t,i.scroller.scrollTop);zn(t,i.scroller.scrollLeft,!0);fs(t,"scroll",t)}});us(i.scrollbarV,"scroll",function(){i.scroller.clientHeight&&Wn(t,i.scrollbarV.scrollTop)});us(i.scrollbarH,"scroll",function(){i.scroller.clientHeight&&zn(t,i.scrollbarH.scrollLeft)});us(i.scroller,"mousewheel",function(e){qn(t,e)});us(i.scroller,"DOMMouseScroll",function(e){qn(t,e)});us(i.scrollbarH,"mousedown",e);us(i.scrollbarV,"mousedown",e);us(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0});us(i.input,"keyup",function(e){Jn.call(t,e)});us(i.input,"input",function(){Qo&&ta>=9&&t.display.inputHasSelection&&(t.display.inputHasSelection=null);Sn(t)});us(i.input,"keydown",un(t,$n));us(i.input,"keypress",un(t,Kn));us(i.input,"focus",bo(Zn,t));us(i.input,"blur",bo(Qn,t));if(t.options.dragDrop){us(i.scroller,"dragstart",function(e){Rn(t,e)});us(i.scroller,"dragenter",n);us(i.scroller,"dragover",n);us(i.scroller,"drop",un(t,Fn))}us(i.scroller,"paste",function(e){if(!An(i,e)){t.state.pasteIncoming=!0;_n(t);Sn(t)}});us(i.input,"paste",function(){if(ea&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=i.input.selectionStart,n=i.input.selectionEnd;i.input.value+="$";i.input.selectionEnd=n;i.input.selectionStart=e;t.state.fakedLastChar=!0}t.state.pasteIncoming=!0;Sn(t)});us(i.input,"cut",r);us(i.input,"copy",r);aa&&us(i.sizer,"mouseup",function(){Mo()==i.input&&i.input.blur();_n(t)})}function Ln(t){var e=t.display;if(e.lastWrapHeight!=e.wrapper.clientHeight||e.lastWrapWidth!=e.wrapper.clientWidth){e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null;t.setSize()}}function An(t,e){for(var n=no(e);n!=t.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==t.sizer&&n!=t.mover)return!0}function Nn(t,e,n,r){var i=t.display;if(!n){var o=no(e);if(o==i.scrollbarH||o==i.scrollbarV||o==i.scrollbarFiller||o==i.gutterFiller)return null}var a,s,l=i.lineSpace.getBoundingClientRect();try{a=e.clientX-l.left;s=e.clientY-l.top}catch(e){return null}var u,c=$e(t,a,s);if(r&&1==c.xRel&&(u=Ei(t.doc,c.line).text).length==c.ch){var f=ys(u,u.length,t.options.tabSize)-u.length;c=ya(c.line,Math.max(0,Math.round((a-Me(t.display).left)/Ke(t.display))-f))}return c}function En(t){if(!ao(this,t)){var e=this,n=e.display;n.shift=t.shiftKey;if(An(n,t)){if(!ea){n.scroller.draggable=!1;setTimeout(function(){n.scroller.draggable=!0},100)}}else if(!On(e,t)){var r=Nn(e,t);window.focus();switch(ro(t)){case 1:r?jn(e,t,r):no(t)==n.scroller&&as(t);break;case 2:ea&&(e.state.lastMiddleDown=+new Date);r&&re(e.doc,r);setTimeout(bo(_n,e),20);as(t);break;case 3:ga&&tr(e,t)}}}}function jn(t,e,n){setTimeout(bo(kn,t),0);var r,i=+new Date;if(Sa&&Sa.time>i-400&&0==ba(Sa.pos,n))r="triple";else if(wa&&wa.time>i-400&&0==ba(wa.pos,n)){r="double";Sa={time:i,pos:n}}else{r="single";wa={time:i,pos:n}}var o=t.doc.sel,a=fa?e.metaKey:e.ctrlKey;t.options.dragDrop&&Ns&&!Mn(t)&&"single"==r&&o.contains(n)>-1&&o.somethingSelected()?In(t,e,n,a):Pn(t,e,n,r,a)}function In(t,e,n,r){var i=t.display,o=un(t,function(a){ea&&(i.scroller.draggable=!1);t.state.draggingText=!1;cs(document,"mouseup",o);cs(i.scroller,"drop",o);if(Math.abs(e.clientX-a.clientX)+Math.abs(e.clientY-a.clientY)<10){as(a);r||re(t.doc,n);_n(t);Qo&&9==ta&&setTimeout(function(){document.body.focus();_n(t)},20)}});ea&&(i.scroller.draggable=!0);t.state.draggingText=o;i.scroller.dragDrop&&i.scroller.dragDrop();us(document,"mouseup",o);us(i.scroller,"drop",o)}function Pn(t,e,n,r,i){function o(e){if(0!=ba(g,e)){g=e;if("rect"==r){for(var i=[],o=t.options.tabSize,a=ys(Ei(u,n.line).text,n.ch,o),s=ys(Ei(u,e.line).text,e.ch,o),l=Math.min(a,s),d=Math.max(a,s),p=Math.min(n.line,e.line),m=Math.min(t.lastLine(),Math.max(n.line,e.line));m>=p;p++){var v=Ei(u,p).text,y=fo(v,l,o);l==d?i.push(new $(ya(p,y),ya(p,y))):v.length>y&&i.push(new $(ya(p,y),ya(p,fo(v,d,o))))}i.length||i.push(new $(n,n));ue(u,Y(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1});t.scrollIntoView(e)}else{var b=c,x=b.anchor,w=e;if("single"!=r){if("double"==r)var S=t.findWordAt(e);else var S=new $(ya(e.line,0),Z(u,ya(e.line+1,0)));if(ba(S.anchor,x)>0){w=S.head;x=X(b.from(),S.anchor)}else{w=S.anchor;x=V(b.to(),S.head)}}var i=h.ranges.slice(0);i[f]=new $(Z(u,x),w);ue(u,Y(i,f),ms)}}}function a(e){var n=++y,i=Nn(t,e,!0,"rect"==r);if(i)if(0!=ba(i,g)){kn(t);o(i);var s=v(l,u);(i.line>=s.to||i.line<s.from)&&setTimeout(un(t,function(){y==n&&a(e)}),150)}else{var c=e.clientY<m.top?-20:e.clientY>m.bottom?20:0;c&&setTimeout(un(t,function(){if(y==n){l.scroller.scrollTop+=c;a(e)}}),50)}}function s(e){y=1/0;as(e);_n(t);cs(document,"mousemove",b);cs(document,"mouseup",x);u.history.lastSelOrigin=null}var l=t.display,u=t.doc;as(e);var c,f,h=u.sel;if(i&&!e.shiftKey){f=u.sel.contains(n);c=f>-1?u.sel.ranges[f]:new $(n,n)}else c=u.sel.primary();if(e.altKey){r="rect";i||(c=new $(n,n));n=Nn(t,e,!0,!0);f=-1}else if("double"==r){var d=t.findWordAt(n);c=t.display.shift||u.extend?ne(u,c,d.anchor,d.head):d}else if("triple"==r){var p=new $(ya(n.line,0),Z(u,ya(n.line+1,0)));c=t.display.shift||u.extend?ne(u,c,p.anchor,p.head):p}else c=ne(u,c,n);if(i)if(f>-1)oe(u,f,c,ms);else{f=u.sel.ranges.length;ue(u,Y(u.sel.ranges.concat([c]),f),{scroll:!1,origin:"*mouse"})}else{f=0;ue(u,new G([c],0),ms);h=u.sel}var g=n,m=l.wrapper.getBoundingClientRect(),y=0,b=un(t,function(t){ro(t)?a(t):s(t)}),x=un(t,s);us(document,"mousemove",b);us(document,"mouseup",x)}function Hn(t,e,n,r,i){try{var o=e.clientX,a=e.clientY}catch(e){return!1}if(o>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&as(e);var s=t.display,l=s.lineDiv.getBoundingClientRect();if(a>l.bottom||!lo(t,n))return eo(e);a-=l.top-s.viewOffset;for(var u=0;u<t.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var f=Oi(t.doc,a),h=t.options.gutters[u];i(t,n,t,f,h,e);return eo(e)}}}function On(t,e){return Hn(t,e,"gutterClick",!0,io)}function Fn(t){var e=this;if(!ao(e,t)&&!An(e.display,t)){as(t);Qo&&(Ma=+new Date);var n=Nn(e,t,!0),r=t.dataTransfer.files;if(n&&!Mn(e))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(t,r){var s=new FileReader;s.onload=un(e,function(){o[r]=s.result;if(++a==i){n=Z(e.doc,n);var t={from:n,to:n,text:Es(o.join("\n")),origin:"paste"};sr(e.doc,t);le(e.doc,J(n,Ea(t)))}});s.readAsText(t)},l=0;i>l;++l)s(r[l],l);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1){e.state.draggingText(t);setTimeout(bo(_n,e),20);return}try{var o=t.dataTransfer.getData("Text");if(o){if(e.state.draggingText&&!(fa?t.metaKey:t.ctrlKey))var u=e.listSelections();ce(e.doc,J(n,n));if(u)for(var l=0;l<u.length;++l)dr(e.doc,"",u[l].anchor,u[l].head,"drag");e.replaceSelection(o,"around","paste");_n(e)}}catch(t){}}}}function Rn(t,e){if(Qo&&(!t.state.draggingText||+new Date-Ma<100))ls(e);else if(!ao(t,e)&&!An(t.display,e)){e.dataTransfer.setData("Text",t.getSelection());if(e.dataTransfer.setDragImage&&!oa){var n=Co("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(ia){n.width=n.height=1;t.display.wrapper.appendChild(n);n._top=n.offsetTop}e.dataTransfer.setDragImage(n,0,0);ia&&n.parentNode.removeChild(n)}}}function Wn(t,e){if(!(Math.abs(t.doc.scrollTop-e)<2)){t.doc.scrollTop=e;Jo||_(t,{top:e});t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e);t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e);Jo&&_(t);we(t,100)}}function zn(t,e,n){if(!(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth);t.doc.scrollLeft=e;y(t);t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e);t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e)}}function qn(t,e){var n=e.wheelDeltaX,r=e.wheelDeltaY;null==n&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(n=e.detail);null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta);var i=t.display,o=i.scroller;if(n&&o.scrollWidth>o.clientWidth||r&&o.scrollHeight>o.clientHeight){if(r&&fa&&ea)t:for(var a=e.target,s=i.view;a!=o;a=a.parentNode)for(var l=0;l<s.length;l++)if(s[l].node==a){t.display.currentWheelTarget=a;break t}if(!n||Jo||ia||null==La){if(r&&null!=La){var u=r*La,c=t.doc.scrollTop,f=c+i.wrapper.clientHeight;0>u?c=Math.max(0,c+u-50):f=Math.min(t.doc.height,f+u+50);_(t,{top:c,bottom:f})}if(20>Da)if(null==i.wheelStartX){i.wheelStartX=o.scrollLeft;i.wheelStartY=o.scrollTop;i.wheelDX=n;i.wheelDY=r;setTimeout(function(){if(null!=i.wheelStartX){var t=o.scrollLeft-i.wheelStartX,e=o.scrollTop-i.wheelStartY,n=e&&i.wheelDY&&e/i.wheelDY||t&&i.wheelDX&&t/i.wheelDX;i.wheelStartX=i.wheelStartY=null;if(n){La=(La*Da+n)/(Da+1);++Da}}},200)}else{i.wheelDX+=n;i.wheelDY+=r}}else{r&&Wn(t,Math.max(0,Math.min(o.scrollTop+r*La,o.scrollHeight-o.clientHeight)));zn(t,Math.max(0,Math.min(o.scrollLeft+n*La,o.scrollWidth-o.clientWidth)));as(e);i.wheelStartX=null}}}function Un(t,e,n){if("string"==typeof e){e=Ua[e];if(!e)return!1}t.display.pollingFast&&Cn(t)&&(t.display.pollingFast=!1);var r=t.display.shift,i=!1;try{Mn(t)&&(t.state.suppressEdits=!0);n&&(t.display.shift=!1);i=e(t)!=ps}finally{t.display.shift=r;t.state.suppressEdits=!1}return i}function Bn(t,e,n){for(var r=0;r<t.state.keyMaps.length;r++){var i=Va(e,t.state.keyMaps[r],n);if(i)return i}return t.options.extraKeys&&Va(e,t.options.extraKeys,n)||Va(e,t.options.keyMap,n)}function Vn(t,e,n,r){var i=t.state.keySeq;if(i){if(Xa(e))return"handled";Aa.set(50,function(){if(t.state.keySeq==i){t.state.keySeq=null;Tn(t)}});e=i+" "+e}var o=Bn(t,e,r);"multi"==o&&(t.state.keySeq=e);"handled"==o&&io(t,"keyHandled",t,e,n);if("handled"==o||"multi"==o){as(n);xe(t)}if(i&&!o&&/\'$/.test(e)){as(n);return!0}return!!o}function Xn(t,e){var n=Ga(e,!0);return n?e.shiftKey&&!t.state.keySeq?Vn(t,"Shift-"+n,e,function(e){return Un(t,e,!0)})||Vn(t,n,e,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?Un(t,e):void 0}):Vn(t,n,e,function(e){return Un(t,e)}):!1}function Gn(t,e,n){return Vn(t,"'"+n+"'",e,function(e){return Un(t,e,!0)})}function $n(t){var e=this;kn(e);if(!ao(e,t)){Qo&&11>ta&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var r=Xn(e,t);if(ia){Na=r?n:null;!r&&88==n&&!Is&&(fa?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")}18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Yn(e)}}function Yn(t){function e(t){if(18==t.keyCode||!t.altKey){Ds(n,"CodeMirror-crosshair");cs(document,"keyup",e);cs(document,"mouseover",e)}}var n=t.display.lineDiv;Ls(n,"CodeMirror-crosshair");us(document,"keyup",e);us(document,"mouseover",e)}function Jn(t){16==t.keyCode&&(this.doc.sel.shift=!1);ao(this,t)}function Kn(t){var e=this;if(!(ao(e,t)||t.ctrlKey&&!t.altKey||fa&&t.metaKey)){var n=t.keyCode,r=t.charCode;if(ia&&n==Na){Na=null;as(t)}else if(!(ia&&(!t.which||t.which<10)||aa)||!Xn(e,t)){var i=String.fromCharCode(null==r?n:r);if(!Gn(e,t,i)){Qo&&ta>=9&&(e.display.inputHasSelection=null);Sn(e)}}}}function Zn(t){if("nocursor"!=t.options.readOnly){if(!t.state.focused){fs(t,"focus",t);t.state.focused=!0;Ls(t.display.wrapper,"CodeMirror-focused");if(!t.curOp&&t.display.selForContextMenu!=t.doc.sel){Tn(t);ea&&setTimeout(bo(Tn,t,!0),0)}}wn(t);xe(t)}}function Qn(t){if(t.state.focused){fs(t,"blur",t);t.state.focused=!1;Ds(t.display.wrapper,"CodeMirror-focused")}clearInterval(t.display.blinker);setTimeout(function(){t.state.focused||(t.display.shift=!1)},150)}function tr(t,e){function n(){if(null!=i.input.selectionStart){var e=t.somethingSelected(),n=i.input.value="​"+(e?i.input.value:"");i.prevInput=e?"":"​";i.input.selectionStart=1;i.input.selectionEnd=n.length;i.selForContextMenu=t.doc.sel}}function r(){i.inputDiv.style.position="relative";i.input.style.cssText=l;Qo&&9>ta&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=a);wn(t);if(null!=i.input.selectionStart){(!Qo||Qo&&9>ta)&&n();var e=0,r=function(){i.selForContextMenu==t.doc.sel&&0==i.input.selectionStart?un(t,Ua.selectAll)(t):e++<10?i.detectingSelectAll=setTimeout(r,500):Tn(t)};i.detectingSelectAll=setTimeout(r,200)}}if(!ao(t,e,"contextmenu")){var i=t.display;if(!An(i,e)&&!er(t,e)){var o=Nn(t,e),a=i.scroller.scrollTop;if(o&&!ia){var s=t.options.resetSelectionOnContextMenu;s&&-1==t.doc.sel.contains(o)&&un(t,ue)(t.doc,J(o),gs);var l=i.input.style.cssText;i.inputDiv.style.position="absolute";i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(Qo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(ea)var u=window.scrollY;_n(t);ea&&window.scrollTo(null,u);Tn(t);t.somethingSelected()||(i.input.value=i.prevInput=" ");i.selForContextMenu=t.doc.sel;clearTimeout(i.detectingSelectAll);Qo&&ta>=9&&n();if(ga){ls(e);var c=function(){cs(window,"mouseup",c);setTimeout(r,20)};us(window,"mouseup",c)}else setTimeout(r,50)}}}}function er(t,e){return lo(t,"gutterContextMenu")?Hn(t,e,"gutterContextMenu",!1,fs):!1}function nr(t,e){if(ba(t,e.from)<0)return t;if(ba(t,e.to)<=0)return Ea(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;t.line==e.to.line&&(r+=Ea(e).ch-e.to.ch);return ya(n,r)}function rr(t,e){for(var n=[],r=0;r<t.sel.ranges.length;r++){var i=t.sel.ranges[r];n.push(new $(nr(i.anchor,e),nr(i.head,e)))}return Y(n,t.sel.primIndex)}function ir(t,e,n){return t.line==e.line?ya(n.line,t.ch-e.ch+n.ch):ya(n.line+(t.line-e.line),t.ch)}function or(t,e,n){for(var r=[],i=ya(t.first,0),o=i,a=0;a<e.length;a++){var s=e[a],l=ir(s.from,i,o),u=ir(Ea(s),i,o);i=s.to;o=u;if("around"==n){var c=t.sel.ranges[a],f=ba(c.head,c.anchor)<0;r[a]=new $(f?u:l,f?l:u)}else r[a]=new $(l,l)}return new G(r,t.sel.primIndex)}function ar(t,e,n){var r={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};n&&(r.update=function(e,n,r,i){e&&(this.from=Z(t,e));n&&(this.to=Z(t,n));r&&(this.text=r);void 0!==i&&(this.origin=i)});fs(t,"beforeChange",t,r);t.cm&&fs(t.cm,"beforeChange",t.cm,r);return r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function sr(t,e,n){if(t.cm){if(!t.cm.curOp)return un(t.cm,sr)(t,e,n);if(t.cm.state.suppressEdits)return}if(lo(t,"beforeChange")||t.cm&&lo(t.cm,"beforeChange")){e=ar(t,e,!0);if(!e)return}var r=ma&&!n&&Ur(t,e.from,e.to);if(r)for(var i=r.length-1;i>=0;--i)lr(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text});else lr(t,e)}function lr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ba(e.from,e.to)){var n=rr(t,e);Bi(t,e,n,t.cm?t.cm.curOp.id:0/0);fr(t,e,n,Wr(t,e));var r=[];Ai(t,function(t,n){if(!n&&-1==go(r,t.history)){to(t.history,e);r.push(t.history)}fr(t,e,null,Wr(t,e))})}}function ur(t,e,n){if(!t.cm||!t.cm.state.suppressEdits){for(var r,i=t.history,o=t.sel,a="undo"==e?i.done:i.undone,s="undo"==e?i.undone:i.done,l=0;l<a.length;l++){r=a[l];if(n?r.ranges&&!r.equals(t.sel):!r.ranges)break}if(l!=a.length){i.lastOrigin=i.lastSelOrigin=null;for(;;){r=a.pop();if(!r.ranges)break;Gi(r,s);if(n&&!r.equals(t.sel)){ue(t,r,{clearRedo:!1});return}o=r}var u=[];Gi(o,s);s.push({changes:u,generation:i.generation});i.generation=r.generation||++i.maxGeneration;for(var c=lo(t,"beforeChange")||t.cm&&lo(t.cm,"beforeChange"),l=r.changes.length-1;l>=0;--l){var f=r.changes[l];f.origin=e;if(c&&!ar(t,f,!1)){a.length=0;return}u.push(zi(t,f));var h=l?rr(t,f):po(a);fr(t,f,h,qr(t,f));!l&&t.cm&&t.cm.scrollIntoView({from:f.from,to:Ea(f)});var d=[];Ai(t,function(t,e){if(!e&&-1==go(d,t.history)){to(t.history,f);d.push(t.history)}fr(t,f,null,qr(t,f))})}}}}function cr(t,e){if(0!=e){t.first+=e;t.sel=new G(mo(t.sel.ranges,function(t){return new $(ya(t.anchor.line+e,t.anchor.ch),ya(t.head.line+e,t.head.ch))}),t.sel.primIndex);if(t.cm){pn(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;r<n.viewTo;r++)gn(t.cm,r,"gutter")}}}function fr(t,e,n,r){if(t.cm&&!t.cm.curOp)return un(t.cm,fr)(t,e,n,r);if(e.to.line<t.first)cr(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var i=e.text.length-1-(t.first-e.from.line);cr(t,i);e={from:ya(t.first,0),to:ya(e.to.line+i,e.to.ch),text:[po(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:ya(o,Ei(t,o).text.length),text:[e.text[0]],origin:e.origin});e.removed=ji(t,e.from,e.to);n||(n=rr(t,e));t.cm?hr(t.cm,e,r):Mi(t,e,r);ce(t,n,gs)}}function hr(t,e,n){var r=t.doc,i=t.display,a=e.from,s=e.to,l=!1,u=a.line;if(!t.options.lineWrapping){u=Hi(Qr(Ei(r,a.line)));r.iter(u,s.line+1,function(t){if(t==i.maxLine){l=!0;return!0}})}r.sel.contains(e.from,e.to)>-1&&so(t);Mi(r,e,n,o(t));if(!t.options.lineWrapping){r.iter(u,a.line+e.text.length,function(t){var e=f(t);if(e>i.maxLineLength){i.maxLine=t;i.maxLineLength=e;i.maxLineChanged=!0;l=!1}});l&&(t.curOp.updateMaxLine=!0)}r.frontier=Math.min(r.frontier,a.line);we(t,400);var c=e.text.length-(s.line-a.line)-1;a.line!=s.line||1!=e.text.length||ki(t.doc,e)?pn(t,a.line,s.line+1,c):gn(t,a.line,"text");var h=lo(t,"changes"),d=lo(t,"change");if(d||h){var p={from:a,to:s,text:e.text,removed:e.removed,origin:e.origin};d&&io(t,"change",t,p);h&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(p)}t.display.selForContextMenu=null}function dr(t,e,n,r,i){r||(r=n);if(ba(r,n)<0){var o=r;r=n;n=o}"string"==typeof e&&(e=Es(e));sr(t,{from:n,to:r,text:e,origin:i})}function pr(t,e){if(!ao(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(null!=i&&!la){var o=Co("div","​",null,"position: absolute; top: "+(e.top-n.viewOffset-_e(t.display))+"px; height: "+(e.bottom-e.top+ds)+"px; left: "+e.left+"px; width: 2px;");t.display.lineSpace.appendChild(o);o.scrollIntoView(i);t.display.lineSpace.removeChild(o)}}}function gr(t,e,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=Ve(t,e),s=n&&n!=e?Ve(t,n):a,l=vr(t,Math.min(a.left,s.left),Math.min(a.top,s.top)-r,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+r),u=t.doc.scrollTop,c=t.doc.scrollLeft;if(null!=l.scrollTop){Wn(t,l.scrollTop);Math.abs(t.doc.scrollTop-u)>1&&(o=!0)}if(null!=l.scrollLeft){zn(t,l.scrollLeft);Math.abs(t.doc.scrollLeft-c)>1&&(o=!0)}if(!o)return a}}function mr(t,e,n,r,i){var o=vr(t,e,n,r,i);null!=o.scrollTop&&Wn(t,o.scrollTop);null!=o.scrollLeft&&zn(t,o.scrollLeft)}function vr(t,e,n,r,i){var o=t.display,a=Je(t.display);0>n&&(n=0);var s=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:o.scroller.scrollTop,l=o.scroller.clientHeight-ds,u={};i-n>l&&(i=n+l);var c=t.doc.height+ke(o),f=a>n,h=i>c-a;if(s>n)u.scrollTop=f?0:n;else if(i>s+l){var d=Math.min(n,(h?c:i)-l);d!=s&&(u.scrollTop=d)}var p=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:o.scroller.scrollLeft,g=o.scroller.clientWidth-ds-o.gutters.offsetWidth,m=r-e>g;m&&(r=e+g);10>e?u.scrollLeft=0:p>e?u.scrollLeft=Math.max(0,e-(m?0:10)):r>g+p-3&&(u.scrollLeft=r+(m?0:10)-g);return u}function yr(t,e,n){(null!=e||null!=n)&&xr(t);null!=e&&(t.curOp.scrollLeft=(null==t.curOp.scrollLeft?t.doc.scrollLeft:t.curOp.scrollLeft)+e);null!=n&&(t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+n)}function br(t){xr(t);var e=t.getCursor(),n=e,r=e;if(!t.options.lineWrapping){n=e.ch?ya(e.line,e.ch-1):e;r=ya(e.line,e.ch+1)}t.curOp.scrollToPos={from:n,to:r,margin:t.options.cursorScrollMargin,isCursor:!0}}function xr(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=Xe(t,e.from),r=Xe(t,e.to),i=vr(t,Math.min(n.left,r.left),Math.min(n.top,r.top)-e.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+e.margin);t.scrollTo(i.scrollLeft,i.scrollTop)}}function wr(t,e,n,r){var i,o=t.doc; null==n&&(n="add");"smart"==n&&(o.mode.indent?i=Te(t,e):n="prev");var a=t.options.tabSize,s=Ei(o,e),l=ys(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n){u=o.mode.indent(i,s.text.slice(c.length),s.text);if(u==ps||u>150){if(!r)return;n="prev"}}}else{u=0;n="not"}"prev"==n?u=e>o.first?ys(Ei(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n);u=Math.max(0,u);var f="",h=0;if(t.options.indentWithTabs)for(var d=Math.floor(u/a);d;--d){h+=a;f+=" "}u>h&&(f+=ho(u-h));if(f!=c)dr(o,f,ya(e,0),ya(e,c.length),"+input");else for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==e&&p.head.ch<c.length){var h=ya(e,c.length);oe(o,d,new $(h,h));break}}s.stateAfter=null}function Sr(t,e,n,r){var i=e,o=e;"number"==typeof e?o=Ei(t,K(t,e)):i=Hi(e);if(null==i)return null;r(o,i)&&t.cm&&gn(t.cm,i,n);return o}function Cr(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&ba(o.from,po(r).to)<=0;){var a=r.pop();if(ba(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}ln(t,function(){for(var e=r.length-1;e>=0;e--)dr(t.doc,"",r[e].from,r[e].to,"+delete");br(t)})}function Tr(t,e,n,r,i){function o(){var e=s+n;if(e<t.first||e>=t.first+t.size)return f=!1;s=e;return c=Ei(t,e)}function a(t){var e=(i?$o:Yo)(c,l,n,!0);if(null==e){if(t||!o())return f=!1;l=i?(0>n?zo:Wo)(c):0>n?c.text.length:0}else l=e;return!0}var s=e.line,l=e.ch,u=n,c=Ei(t,s),f=!0;if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var h=null,d="group"==r,p=t.cm&&t.cm.getHelper(e,"wordChars"),g=!0;!(0>n)||a(!g);g=!1){var m=c.text.charAt(l)||"\n",v=xo(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";!d||g||v||(v="s");if(h&&h!=v){if(0>n){n=1;a()}break}v&&(h=v);if(n>0&&!a(!g))break}var y=pe(t,ya(s,l),u,!0);f||(y.hitSide=!0);return y}function _r(t,e,n,r){var i,o=t.doc,a=e.left;if("page"==r){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=e.top+n*(s-(0>n?1.5:.5)*Je(t.display))}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;;){var l=$e(t,a,i);if(!l.outside)break;if(0>n?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function kr(e,n,r,i){t.defaults[e]=n;r&&(Ia[e]=i?function(t,e,n){n!=Pa&&r(t,e,n)}:r)}function Mr(t){for(var e,n,r,i,o=t.split(/-(?!$)/),t=o[o.length-1],a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}e&&(t="Alt-"+t);n&&(t="Ctrl-"+t);i&&(t="Cmd-"+t);r&&(t="Shift-"+t);return t}function Dr(t){return"string"==typeof t?Ba[t]:t}function Lr(t,e,n,r,i){if(r&&r.shared)return Ar(t,e,n,r,i);if(t.cm&&!t.cm.curOp)return un(t.cm,Lr)(t,e,n,r,i);var o=new Ya(t,i),a=ba(e,n);r&&yo(r,o,!1);if(a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith){o.collapsed=!0;o.widgetNode=Co("span",[o.replacedWith],"CodeMirror-widget");r.handleMouseEvents||(o.widgetNode.ignoreEvents=!0);r.insertLeft&&(o.widgetNode.insertLeft=!0)}if(o.collapsed){if(Zr(t,e.line,e,n,o)||e.line!=n.line&&Zr(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");va=!0}o.addToHistory&&Bi(t,{from:e,to:n,origin:"markText"},t.sel,0/0);var s,l=e.line,u=t.cm;t.iter(l,n.line+1,function(t){u&&o.collapsed&&!u.options.lineWrapping&&Qr(t)==u.display.maxLine&&(s=!0);o.collapsed&&l!=e.line&&Pi(t,0);Or(t,new Ir(o,l==e.line?e.ch:null,l==n.line?n.ch:null));++l});o.collapsed&&t.iter(e.line,n.line+1,function(e){ri(t,e)&&Pi(e,0)});o.clearOnEnter&&us(o,"beforeCursorEnter",function(){o.clear()});if(o.readOnly){ma=!0;(t.history.done.length||t.history.undone.length)&&t.clearHistory()}if(o.collapsed){o.id=++Ja;o.atomic=!0}if(u){s&&(u.curOp.updateMaxLine=!0);if(o.collapsed)pn(u,e.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var c=e.line;c<=n.line;c++)gn(u,c,"text");o.atomic&&he(u.doc);io(u,"markerAdded",u,o)}return o}function Ar(t,e,n,r,i){r=yo(r);r.shared=!1;var o=[Lr(t,e,n,r,i)],a=o[0],s=r.widgetNode;Ai(t,function(t){s&&(r.widgetNode=s.cloneNode(!0));o.push(Lr(t,Z(t,e),Z(t,n),r,i));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;a=po(o)});return new Ka(o,a)}function Nr(t){return t.findMarks(ya(t.first,0),t.clipPos(ya(t.lastLine())),function(t){return t.parent})}function Er(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.find(),o=t.clipPos(i.from),a=t.clipPos(i.to);if(ba(o,a)){var s=Lr(t,o,a,r.primary,r.primary.type);r.markers.push(s);s.parent=r}}}function jr(t){for(var e=0;e<t.length;e++){var n=t[e],r=[n.primary.doc];Ai(n.primary.doc,function(t){r.push(t)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];if(-1==go(r,o.doc)){o.parent=null;n.markers.splice(i--,1)}}}}function Ir(t,e,n){this.marker=t;this.from=e;this.to=n}function Pr(t,e){if(t)for(var n=0;n<t.length;++n){var r=t[n];if(r.marker==e)return r}}function Hr(t,e){for(var n,r=0;r<t.length;++r)t[r]!=e&&(n||(n=[])).push(t[r]);return n}function Or(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e];e.marker.attachLine(t)}function Fr(t,e,n){if(t)for(var r,i=0;i<t.length;++i){var o=t[i],a=o.marker,s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);if(s||o.from==e&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);(r||(r=[])).push(new Ir(a,o.from,l?null:o.to))}}return r}function Rr(t,e,n){if(t)for(var r,i=0;i<t.length;++i){var o=t[i],a=o.marker,s=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);if(s||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);(r||(r=[])).push(new Ir(a,l?null:o.from-e,null==o.to?null:o.to-e))}}return r}function Wr(t,e){var n=te(t,e.from.line)&&Ei(t,e.from.line).markedSpans,r=te(t,e.to.line)&&Ei(t,e.to.line).markedSpans;if(!n&&!r)return null;var i=e.from.ch,o=e.to.ch,a=0==ba(e.from,e.to),s=Fr(n,i,a),l=Rr(r,o,a),u=1==e.text.length,c=po(e.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=Pr(l,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(l)for(var f=0;f<l.length;++f){var h=l[f];null!=h.to&&(h.to+=c);if(null==h.from){var d=Pr(s,h.marker);if(!d){h.from=c;u&&(s||(s=[])).push(h)}}else{h.from+=c;u&&(s||(s=[])).push(h)}}s&&(s=zr(s));l&&l!=s&&(l=zr(l));var p=[s];if(!u){var g,m=e.text.length-2;if(m>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(g||(g=[])).push(new Ir(s[f].marker,null,null));for(var f=0;m>f;++f)p.push(g);p.push(l)}return p}function zr(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&t.splice(e--,1)}return t.length?t:null}function qr(t,e){var n=Ji(t,e),r=Wr(t,e);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)t:for(var s=0;s<a.length;++s){for(var l=a[s],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue t;o.push(l)}else a&&(n[i]=a)}return n}function Ur(t,e,n){var r=null;t.iter(e.line,n.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||r&&-1!=go(r,n)||(r||(r=[])).push(n)}});if(!r)return null;for(var i=[{from:e,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var u=i[l];if(!(ba(u.to,s.from)<0||ba(u.from,s.to)>0)){var c=[l,1],f=ba(u.from,s.from),h=ba(u.to,s.to);(0>f||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from});(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to});i.splice.apply(i,c);l+=c.length-1}}return i}function Br(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Vr(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function Xr(t){return t.inclusiveLeft?-1:0}function Gr(t){return t.inclusiveRight?1:0}function $r(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var r=t.find(),i=e.find(),o=ba(r.from,i.from)||Xr(t)-Xr(e);if(o)return-o;var a=ba(r.to,i.to)||Gr(t)-Gr(e);return a?a:e.id-t.id}function Yr(t,e){var n,r=va&&t.markedSpans;if(r)for(var i,o=0;o<r.length;++o){i=r[o];i.marker.collapsed&&null==(e?i.from:i.to)&&(!n||$r(n,i.marker)<0)&&(n=i.marker)}return n}function Jr(t){return Yr(t,!0)}function Kr(t){return Yr(t,!1)}function Zr(t,e,n,r,i){var o=Ei(t,e),a=va&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var u=l.marker.find(0),c=ba(u.from,n)||Xr(l.marker)-Xr(i),f=ba(u.to,r)||Gr(l.marker)-Gr(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(ba(u.to,n)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(ba(u.from,r)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function Qr(t){for(var e;e=Jr(t);)t=e.find(-1,!0).line;return t}function ti(t){for(var e,n;e=Kr(t);){t=e.find(1,!0).line;(n||(n=[])).push(t)}return n}function ei(t,e){var n=Ei(t,e),r=Qr(n);return n==r?e:Hi(r)}function ni(t,e){if(e>t.lastLine())return e;var n,r=Ei(t,e);if(!ri(t,r))return e;for(;n=Kr(r);)r=n.find(1,!0).line;return Hi(r)+1}function ri(t,e){var n=va&&e.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&ii(t,e,r))return!0}}}function ii(t,e,n){if(null==n.to){var r=n.marker.find(1,!0);return ii(t,r.line,Pr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var i,o=0;o<e.markedSpans.length;++o){i=e.markedSpans[o];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ii(t,e,i))return!0}}function oi(t,e,n){Fi(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&yr(t,null,n)}function ai(t){if(null!=t.height)return t.height;if(!ko(document.body,t.node)){var e="position: relative;";t.coverGutter&&(e+="margin-left: -"+t.cm.getGutterElement().offsetWidth+"px;");_o(t.cm.display.measure,Co("div",[t.node],null,e))}return t.height=t.node.offsetHeight}function si(t,e,n,r){var i=new Za(t,n,r);i.noHScroll&&(t.display.alignWidgets=!0);Sr(t.doc,e,"widget",function(e){var n=e.widgets||(e.widgets=[]);null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i);i.line=e;if(!ri(t.doc,e)){var r=Fi(e)<t.doc.scrollTop;Pi(e,e.height+ai(i));r&&yr(t,null,i.height);t.curOp.forceUpdate=!0}return!0});return i}function li(t,e,n,r){t.text=e;t.stateAfter&&(t.stateAfter=null);t.styles&&(t.styles=null);null!=t.order&&(t.order=null);Br(t);Vr(t,n);var i=r?r(t):1;i!=t.height&&Pi(t,i)}function ui(t){t.parent=null;Br(t)}function ci(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==e[r]?e[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(e[r])||(e[r]+=" "+n[2])}return t}function fi(e,n){if(e.blankLine)return e.blankLine(n);if(e.innerMode){var r=t.innerMode(e,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function hi(e,n,r,i){for(var o=0;10>o;o++){i&&(i[0]=t.innerMode(e,r).mode);var a=e.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+e.name+" failed to advance stream.")}function di(t,e,n,r){function i(t){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:t?za(a.mode,c):c}}var o,a=t.doc,s=a.mode;e=Z(a,e);var l,u=Ei(a,e.line),c=Te(t,e.line,n),f=new $a(u.text,t.options.tabSize);r&&(l=[]);for(;(r||f.pos<e.ch)&&!f.eol();){f.start=f.pos;o=hi(s,f,c);r&&l.push(i(!0))}return r?l:i()}function pi(t,e,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var l,u=0,c=null,f=new $a(e,t.options.tabSize),h=t.options.addModeClass&&[null];""==e&&ci(fi(n,r),o);for(;!f.eol();){if(f.pos>t.options.maxHighlightLength){s=!1;a&&vi(t,e,r,f.pos);f.pos=e.length;l=null}else l=ci(hi(n,f,r,h),o);if(h){var d=h[0].name;d&&(l="m-"+(l?d+" "+l:d))}if(!s||c!=l){u<f.start&&i(f.start,c);u=f.start;c=l}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e4);i(p,c);u=p}}function gi(t,e,n,r){var i=[t.state.modeGen],o={};pi(t,e.text,t.doc.mode,n,function(t,e){i.push(t,e)},o,r);for(var a=0;a<t.state.overlays.length;++a){var s=t.state.overlays[a],l=1,u=0;pi(t,e.text,s.mode,!0,function(t,e){for(var n=l;t>u;){var r=i[l];r>t&&i.splice(l,1,t,i[l+1],r);l+=2;u=Math.min(t,r)}if(e)if(s.opaque){i.splice(n,l-n,t,"cm-overlay "+e);l=n+2}else for(;l>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+e}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function mi(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var r=gi(t,e,e.stateAfter=Te(t,Hi(e)));e.styles=r.styles;r.classes?e.styleClasses=r.classes:e.styleClasses&&(e.styleClasses=null);n===t.doc.frontier&&t.doc.frontier++}return e.styles}function vi(t,e,n,r){var i=t.doc.mode,o=new $a(e,t.options.tabSize);o.start=o.pos=r||0;""==e&&fi(i,n);for(;!o.eol()&&o.pos<=t.options.maxHighlightLength;){hi(i,o,n);o.start=o.pos}}function yi(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?es:ts;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function bi(t,e){var n=Co("span",null,null,ea?"padding-right: .1px":null),r={pre:Co("pre",[n]),content:n,col:0,pos:0,cm:t};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o,a=i?e.rest[i-1]:e.line;r.pos=0;r.addToken=wi;(Qo||ea)&&t.getOption("lineWrapping")&&(r.addToken=Si(r.addToken));Po(t.display.measure)&&(o=Ri(a))&&(r.addToken=Ci(r.addToken,o));r.map=[];var s=e!=t.display.externalMeasured&&Hi(a);_i(a,r,mi(t,a,s));if(a.styleClasses){a.styleClasses.bgClass&&(r.bgClass=Lo(a.styleClasses.bgClass,r.bgClass||""));a.styleClasses.textClass&&(r.textClass=Lo(a.styleClasses.textClass,r.textClass||""))}0==r.map.length&&r.map.push(0,0,r.content.appendChild(Io(t.display.measure)));if(0==i){e.measure.map=r.map;e.measure.cache={}}else{(e.measure.maps||(e.measure.maps=[])).push(r.map);(e.measure.caches||(e.measure.caches=[])).push({})}}ea&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack");fs(t,"renderLine",t,e.line,r.pre);r.pre.className&&(r.textClass=Lo(r.pre.className,r.textClass||""));return r}function xi(t){var e=Co("span","•","cm-invalidchar");e.title="\\u"+t.charCodeAt(0).toString(16);return e}function wi(t,e,n,r,i,o){if(e){var a=t.cm.options.specialChars,s=!1;if(a.test(e))for(var l=document.createDocumentFragment(),u=0;;){a.lastIndex=u;var c=a.exec(e),f=c?c.index-u:e.length-u;if(f){var h=document.createTextNode(e.slice(u,u+f));l.appendChild(Qo&&9>ta?Co("span",[h]):h);t.map.push(t.pos,t.pos+f,h);t.col+=f;t.pos+=f}if(!c)break;u+=f+1;if(" "==c[0]){var d=t.cm.options.tabSize,p=d-t.col%d,h=l.appendChild(Co("span",ho(p),"cm-tab"));t.col+=p}else{var h=t.cm.options.specialCharPlaceholder(c[0]);l.appendChild(Qo&&9>ta?Co("span",[h]):h);t.col+=1}t.map.push(t.pos,t.pos+1,h);t.pos++}else{t.col+=e.length;var l=document.createTextNode(e);t.map.push(t.pos,t.pos+e.length,l);Qo&&9>ta&&(s=!0);t.pos+=e.length}if(n||r||i||s){var g=n||"";r&&(g+=r);i&&(g+=i);var m=Co("span",[l],g);o&&(m.title=o);return t.content.appendChild(m)}t.content.appendChild(l)}}function Si(t){function e(t){for(var e=" ",n=0;n<t.length-2;++n)e+=n%2?" ":" ";e+=" ";return e}return function(n,r,i,o,a,s){t(n,r.replace(/ {3,}/g,e),i,o,a,s)}}function Ci(t,e){return function(n,r,i,o,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var l=n.pos,u=l+r.length;;){for(var c=0;c<e.length;c++){var f=e[c];if(f.to>l&&f.from<=l)break}if(f.to>=u)return t(n,r,i,o,a,s);t(n,r.slice(0,f.to-l),i,o,null,s);o=null;r=r.slice(f.to-l);l=f.to}}}function Ti(t,e,n,r){var i=!r&&n.widgetNode;if(i){t.map.push(t.pos,t.pos+e,i);t.content.appendChild(i)}t.pos+=e}function _i(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,u,c,f,h=i.length,d=0,p=1,g="",m=0;;){if(m==d){s=l=u=c="";f=null;m=1/0;for(var v=[],y=0;y<r.length;++y){var b=r[y],x=b.marker;if(b.from<=d&&(null==b.to||b.to>d)){if(null!=b.to&&m>b.to){m=b.to;l=""}x.className&&(s+=" "+x.className);x.startStyle&&b.from==d&&(u+=" "+x.startStyle);x.endStyle&&b.to==m&&(l+=" "+x.endStyle);x.title&&!c&&(c=x.title);x.collapsed&&(!f||$r(f.marker,x)<0)&&(f=b)}else b.from>d&&m>b.from&&(m=b.from);"bookmark"==x.type&&b.from==d&&x.widgetNode&&v.push(x)}if(f&&(f.from||0)==d){Ti(e,(null==f.to?h+1:f.to)-d,f.marker,null==f.from);if(null==f.to)return}if(!f&&v.length)for(var y=0;y<v.length;++y)Ti(e,0,v[y])}if(d>=h)break;for(var w=Math.min(h,m);;){if(g){var S=d+g.length;if(!f){var C=S>w?g.slice(0,w-d):g;e.addToken(e,C,a?a+s:s,u,d+C.length==m?l:"",c)}if(S>=w){g=g.slice(w-d);d=w;break}d=S;u=""}g=i.slice(o,o=n[p++]);a=yi(n[p++],e.cm.options)}}else for(var p=1;p<n.length;p+=2)e.addToken(e,i.slice(o,o=n[p]),yi(n[p+1],e.cm.options))}function ki(t,e){return 0==e.from.ch&&0==e.to.ch&&""==po(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Mi(t,e,n,r){function i(t){return n?n[t]:null}function o(t,n,i){li(t,n,i,r);io(t,"change",t,e)}var a=e.from,s=e.to,l=e.text,u=Ei(t,a.line),c=Ei(t,s.line),f=po(l),h=i(l.length-1),d=s.line-a.line;if(ki(t,e)){for(var p=0,g=[];p<l.length-1;++p)g.push(new Qa(l[p],i(p),r));o(c,c.text,h);d&&t.remove(a.line,d);g.length&&t.insert(a.line,g)}else if(u==c)if(1==l.length)o(u,u.text.slice(0,a.ch)+f+u.text.slice(s.ch),h);else{for(var g=[],p=1;p<l.length-1;++p)g.push(new Qa(l[p],i(p),r));g.push(new Qa(f+u.text.slice(s.ch),h,r));o(u,u.text.slice(0,a.ch)+l[0],i(0));t.insert(a.line+1,g)}else if(1==l.length){o(u,u.text.slice(0,a.ch)+l[0]+c.text.slice(s.ch),i(0));t.remove(a.line+1,d)}else{o(u,u.text.slice(0,a.ch)+l[0],i(0));o(c,f+c.text.slice(s.ch),h);for(var p=1,g=[];p<l.length-1;++p)g.push(new Qa(l[p],i(p),r));d>1&&t.remove(a.line+1,d-1);t.insert(a.line+1,g)}io(t,"change",t,e)}function Di(t){this.lines=t;this.parent=null;for(var e=0,n=0;e<t.length;++e){t[e].parent=this;n+=t[e].height}this.height=n}function Li(t){this.children=t;for(var e=0,n=0,r=0;r<t.length;++r){var i=t[r];e+=i.chunkSize();n+=i.height;i.parent=this}this.size=e;this.height=n;this.parent=null}function Ai(t,e,n){function r(t,i,o){if(t.linked)for(var a=0;a<t.linked.length;++a){var s=t.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;if(!n||l){e(s.doc,l);r(s.doc,t,l)}}}}r(t,null,!0)}function Ni(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e;e.cm=t;a(t);n(t);t.options.lineWrapping||h(t);t.options.mode=e.modeOption;pn(t)}function Ei(t,e){e-=t.first;if(0>e||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>e){n=i;break}e-=o}return n.lines[e]}function ji(t,e,n){var r=[],i=e.line;t.iter(e.line,n.line+1,function(t){var o=t.text;i==n.line&&(o=o.slice(0,n.ch));i==e.line&&(o=o.slice(e.ch));r.push(o);++i});return r}function Ii(t,e,n){var r=[];t.iter(e,n,function(t){r.push(t.text)});return r}function Pi(t,e){var n=e-t.height;if(n)for(var r=t;r;r=r.parent)r.height+=n}function Hi(t){if(null==t.parent)return null;for(var e=t.parent,n=go(e.lines,t),r=e.parent;r;e=r,r=r.parent)for(var i=0;r.children[i]!=e;++i)n+=r.children[i].chunkSize();return n+e.first}function Oi(t,e){var n=t.first;t:do{for(var r=0;r<t.children.length;++r){var i=t.children[r],o=i.height;if(o>e){t=i;continue t}e-=o;n+=i.chunkSize()}return n}while(!t.lines);for(var r=0;r<t.lines.length;++r){var a=t.lines[r],s=a.height;if(s>e)break;e-=s}return n+r}function Fi(t){t=Qr(t);for(var e=0,n=t.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==t)break;e+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var r=0;r<o.children.length;++r){var a=o.children[r];if(a==n)break;e+=a.height}return e}function Ri(t){var e=t.order;null==e&&(e=t.order=Fs(t.text));return e}function Wi(t){this.done=[];this.undone=[];this.undoDepth=1/0;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=t||1}function zi(t,e){var n={from:B(e.from),to:Ea(e),text:ji(t,e.from,e.to)};$i(t,n,e.from.line,e.to.line+1);Ai(t,function(t){$i(t,n,e.from.line,e.to.line+1)},!0);return n}function qi(t){for(;t.length;){var e=po(t);if(!e.ranges)break;t.pop()}}function Ui(t,e){if(e){qi(t.done);return po(t.done)}if(t.done.length&&!po(t.done).ranges)return po(t.done);if(t.done.length>1&&!t.done[t.done.length-2].ranges){t.done.pop();return po(t.done)}}function Bi(t,e,n,r){var i=t.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&i.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(o=Ui(i,i.lastOp==r))){var s=po(o.changes);0==ba(e.from,e.to)&&0==ba(e.from,s.to)?s.to=Ea(e):o.changes.push(zi(t,e))}else{var l=po(i.done);l&&l.ranges||Gi(t.sel,i.done);o={changes:[zi(t,e)],generation:i.generation};i.done.push(o);for(;i.done.length>i.undoDepth;){i.done.shift();i.done[0].ranges||i.done.shift()}}i.done.push(n);i.generation=++i.maxGeneration;i.lastModTime=i.lastSelTime=a;i.lastOp=i.lastSelOp=r;i.lastOrigin=i.lastSelOrigin=e.origin;s||fs(t,"historyAdded")}function Vi(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Xi(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Vi(t,o,po(i.done),e))?i.done[i.done.length-1]=e:Gi(e,i.done);i.lastSelTime=+new Date;i.lastSelOrigin=o;i.lastSelOp=n;r&&r.clearRedo!==!1&&qi(i.undone)}function Gi(t,e){var n=po(e);n&&n.ranges&&n.equals(t)||e.push(t)}function $i(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans);++o})}function Yi(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function Ji(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var r=0,i=[];r<e.text.length;++r)i.push(Yi(n[r]));return i}function Ki(t,e,n){for(var r=0,i=[];r<t.length;++r){var o=t[r];if(o.ranges)i.push(n?G.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];i.push({changes:s});for(var l=0;l<a.length;++l){var u,c=a[l];s.push({from:c.from,to:c.to,text:c.text});if(e)for(var f in c)if((u=f.match(/^spans_(\d+)$/))&&go(e,Number(u[1]))>-1){po(s)[f]=c[f];delete c[f]}}}}return i}function Zi(t,e,n,r){if(n<t.line)t.line+=r;else if(e<t.line){t.line=e;t.ch=0}}function Qi(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i],a=!0;if(o.ranges){if(!o.copied){o=t[i]=o.deepCopy();o.copied=!0}for(var s=0;s<o.ranges.length;s++){Zi(o.ranges[s].anchor,e,n,r);Zi(o.ranges[s].head,e,n,r)}}else{for(var s=0;s<o.changes.length;++s){var l=o.changes[s];if(n<l.from.line){l.from=ya(l.from.line+r,l.from.ch);l.to=ya(l.to.line+r,l.to.ch)}else if(e<=l.to.line){a=!1;break}}if(!a){t.splice(0,i+1);i=0}}}}function to(t,e){var n=e.from.line,r=e.to.line,i=e.text.length-(r-n)-1;Qi(t.done,n,r,i);Qi(t.undone,n,r,i)}function eo(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function no(t){return t.target||t.srcElement}function ro(t){var e=t.which;null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2));fa&&t.ctrlKey&&1==e&&(e=3);return e}function io(t,e){function n(t){return function(){t.apply(null,o)}}var r=t._handlers&&t._handlers[e];if(r){var i,o=Array.prototype.slice.call(arguments,2);if(Ta)i=Ta.delayedCallbacks;else if(hs)i=hs;else{i=hs=[];setTimeout(oo,0)}for(var a=0;a<r.length;++a)i.push(n(r[a]))}}function oo(){var t=hs;hs=null;for(var e=0;e<t.length;++e)t[e]()}function ao(t,e,n){"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}});fs(t,n||e.type,t,e);return eo(e)||e.codemirrorIgnore}function so(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),r=0;r<e.length;++r)-1==go(n,e[r])&&n.push(e[r])}function lo(t,e){var n=t._handlers&&t._handlers[e];return n&&n.length>0}function uo(t){t.prototype.on=function(t,e){us(this,t,e)};t.prototype.off=function(t,e){cs(this,t,e)}}function co(){this.id=null}function fo(t,e,n){for(var r=0,i=0;;){var o=t.indexOf(" ",r);-1==o&&(o=t.length);var a=o-r;if(o==t.length||i+a>=e)return r+Math.min(a,e-i);i+=o-r;i+=n-i%n;r=o+1;if(i>=e)return r}}function ho(t){for(;bs.length<=t;)bs.push(po(bs)+" ");return bs[t]}function po(t){return t[t.length-1]}function go(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}function mo(t,e){for(var n=[],r=0;r<t.length;r++)n[r]=e(t[r],r);return n}function vo(t,e){var n;if(Object.create)n=Object.create(t);else{var r=function(){};r.prototype=t;n=new r}e&&yo(e,n);return n}function yo(t,e,n){e||(e={});for(var r in t)!t.hasOwnProperty(r)||n===!1&&e.hasOwnProperty(r)||(e[r]=t[r]);return e}function bo(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function xo(t,e){return e?e.source.indexOf("\\w")>-1&&Cs(t)?!0:e.test(t):Cs(t)}function wo(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function So(t){return t.charCodeAt(0)>=768&&Ts.test(t)}function Co(t,e,n,r){var i=document.createElement(t);n&&(i.className=n);r&&(i.style.cssText=r);if("string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)i.appendChild(e[o]);return i}function To(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function _o(t,e){return To(t).appendChild(e)}function ko(t,e){if(t.contains)return t.contains(e);for(;e=e.parentNode;)if(e==t)return!0}function Mo(){return document.activeElement}function Do(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function Lo(t,e){for(var n=t.split(" "),r=0;r<n.length;r++)n[r]&&!Do(n[r]).test(e)&&(e+=" "+n[r]);return e}function Ao(t){if(document.body.getElementsByClassName)for(var e=document.body.getElementsByClassName("CodeMirror"),n=0;n<e.length;n++){var r=e[n].CodeMirror;r&&t(r)}}function No(){if(!As){Eo();As=!0}}function Eo(){var t;us(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null;_s=null;Ao(Ln)},100))});us(window,"blur",function(){Ao(Qn)})}function jo(t){if(null!=_s)return _s;var e=Co("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");_o(t,e);e.offsetWidth&&(_s=e.offsetHeight-e.clientHeight);return _s||0}function Io(t){if(null==ks){var e=Co("span","​");_o(t,Co("span",[e,document.createTextNode("x")]));0!=t.firstChild.offsetHeight&&(ks=e.offsetWidth<=1&&e.offsetHeight>2&&!(Qo&&8>ta))}return ks?Co("span","​"):Co("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Po(t){if(null!=Ms)return Ms;var e=_o(t,document.createTextNode("AخA")),n=ws(e,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=ws(e,1,2).getBoundingClientRect();return Ms=r.right-n.right<3}function Ho(t){if(null!=Ps)return Ps;var e=_o(t,Co("span","x")),n=e.getBoundingClientRect(),r=ws(e,0,1).getBoundingClientRect();return Ps=Math.abs(n.left-r.left)>1}function Oo(t,e,n,r){if(!t)return r(e,n,"ltr");for(var i=!1,o=0;o<t.length;++o){var a=t[o];if(a.from<n&&a.to>e||e==n&&a.to==e){r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr");i=!0}}i||r(e,n,"ltr")}function Fo(t){return t.level%2?t.to:t.from}function Ro(t){return t.level%2?t.from:t.to}function Wo(t){var e=Ri(t);return e?Fo(e[0]):0}function zo(t){var e=Ri(t);return e?Ro(po(e)):t.text.length}function qo(t,e){var n=Ei(t.doc,e),r=Qr(n);r!=n&&(e=Hi(r));var i=Ri(r),o=i?i[0].level%2?zo(r):Wo(r):0;return ya(e,o)}function Uo(t,e){for(var n,r=Ei(t.doc,e);n=Kr(r);){r=n.find(1,!0).line;e=null}var i=Ri(r),o=i?i[0].level%2?Wo(r):zo(r):r.text.length;return ya(null==e?Hi(r):e,o)}function Bo(t,e){var n=qo(t,e.line),r=Ei(t.doc,n.line),i=Ri(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return ya(n.line,a?0:o)}return n}function Vo(t,e,n){var r=t[0].level;return e==r?!0:n==r?!1:n>e}function Xo(t,e){Os=null;for(var n,r=0;r<t.length;++r){var i=t[r];if(i.from<e&&i.to>e)return r;if(i.from==e||i.to==e){if(null!=n){if(Vo(t,i.level,t[n].level)){i.from!=i.to&&(Os=n);return r}i.from!=i.to&&(Os=r);return n}n=r}}return n}function Go(t,e,n,r){if(!r)return e+n;do e+=n;while(e>0&&So(t.text.charAt(e)));return e}function $o(t,e,n,r){var i=Ri(t);if(!i)return Yo(t,e,n,r);for(var o=Xo(i,e),a=i[o],s=Go(t,e,a.level%2?-n:n,r);;){if(s>a.from&&s<a.to)return s;if(s==a.from||s==a.to){if(Xo(i,s)==o)return s;a=i[o+=n];return n>0==a.level%2?a.to:a.from}a=i[o+=n];if(!a)return null;s=n>0==a.level%2?Go(t,a.to,-1,r):Go(t,a.from,1,r)}}function Yo(t,e,n,r){var i=e+n;if(r)for(;i>0&&So(t.text.charAt(i));)i+=n;return 0>i||i>t.text.length?null:i}var Jo=/gecko\/\d/i.test(navigator.userAgent),Ko=/MSIE \d/.test(navigator.userAgent),Zo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qo=Ko||Zo,ta=Qo&&(Ko?document.documentMode||6:Zo[1]),ea=/WebKit\//.test(navigator.userAgent),na=ea&&/Qt\/\d+\.\d+/.test(navigator.userAgent),ra=/Chrome\//.test(navigator.userAgent),ia=/Opera\//.test(navigator.userAgent),oa=/Apple Computer/.test(navigator.vendor),aa=/KHTML\//.test(navigator.userAgent),sa=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),la=/PhantomJS/.test(navigator.userAgent),ua=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ca=ua||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),fa=ua||/Mac/.test(navigator.platform),ha=/win/i.test(navigator.platform),da=ia&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);da&&(da=Number(da[1]));if(da&&da>=15){ia=!1;ea=!0}var pa=fa&&(na||ia&&(null==da||12.11>da)),ga=Jo||Qo&&ta>=9,ma=!1,va=!1,ya=t.Pos=function(t,e){if(!(this instanceof ya))return new ya(t,e);this.line=t;this.ch=e},ba=t.cmpPos=function(t,e){return t.line-e.line||t.ch-e.ch};G.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],r=t.ranges[e];if(0!=ba(n.anchor,r.anchor)||0!=ba(n.head,r.head))return!1}return!0},deepCopy:function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new $(B(this.ranges[e].anchor),B(this.ranges[e].head));return new G(t,this.primIndex)},somethingSelected:function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},contains:function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ba(e,r.from())>=0&&ba(t,r.to())<=0)return n}return-1}};$.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return V(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var xa,wa,Sa,Ca={left:0,right:0,top:0,bottom:0},Ta=null,_a=0,ka=null,Ma=0,Da=0,La=null;Qo?La=-.53:Jo?La=15:ra?La=-.7:oa&&(La=-1/3);var Aa=new co,Na=null,Ea=t.changeEnd=function(t){return t.text?ya(t.from.line+t.text.length-1,po(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.prototype={constructor:t,focus:function(){window.focus();_n(this);Sn(this)},setOption:function(t,e){var n=this.options,r=n[t];if(n[t]!=e||"mode"==t){n[t]=e;Ia.hasOwnProperty(t)&&un(this,Ia[t])(this,e,r)}},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](Dr(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t){e.splice(n,1);return!0}},addOverlay:cn(function(e,n){var r=e.token?e:t.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:e,opaque:n&&n.opaque});this.state.modeGen++;pn(this)}),removeOverlay:cn(function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var r=e[n].modeSpec;if(r==t||"string"==typeof t&&r.name==t){e.splice(n,1);this.state.modeGen++;pn(this);return}}}),indentLine:cn(function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract");te(this.doc,t)&&wr(this,t,e,n) }),indentSelection:cn(function(t){for(var e=this.doc.sel.ranges,n=-1,r=0;r<e.length;r++){var i=e[r];if(i.empty()){if(i.head.line>n){wr(this,i.head.line,t,!0);n=i.head.line;r==this.doc.sel.primIndex&&br(this)}}else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;n>l;++l)wr(this,l,t);var u=this.doc.sel.ranges;0==o.ch&&e.length==u.length&&u[r].from().ch>0&&oe(this.doc,r,new $(o,u[r].to()),gs)}}}),getTokenAt:function(t,e){return di(this,t,e)},getLineTokens:function(t,e){return di(this,ya(t),e,!0)},getTokenTypeAt:function(t){t=Z(this.doc,t);var e,n=mi(this,Ei(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){e=n[2*a+2];break}r=a+1}}var s=e?e.indexOf("cm-overlay "):-1;return 0>s?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var n=[];if(!Wa.hasOwnProperty(e))return Wa;var r=Wa[e],i=this.getModeAt(t);if("string"==typeof i[e])r[i[e]]&&n.push(r[i[e]]);else if(i[e])for(var o=0;o<i[e].length;o++){var a=r[i[e][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var o=0;o<r._global.length;o++){var s=r._global[o];s.pred(i,this)&&-1==go(n,s.val)&&n.push(s.val)}return n},getStateAfter:function(t,e){var n=this.doc;t=K(n,null==t?n.first+n.size-1:t);return Te(this,t+1,e)},cursorCoords:function(t,e){var n,r=this.doc.sel.primary();n=null==t?r.head:"object"==typeof t?Z(this.doc,t):t?r.from():r.to();return Ve(this,n,e||"page")},charCoords:function(t,e){return Be(this,Z(this.doc,t),e||"page")},coordsChar:function(t,e){t=Ue(this,t,e||"page");return $e(this,t.left,t.top)},lineAtHeight:function(t,e){t=Ue(this,{top:t,left:0},e||"page").top;return Oi(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e){var n=!1,r=this.doc.first+this.doc.size-1;if(t<this.doc.first)t=this.doc.first;else if(t>r){t=r;n=!0}var i=Ei(this.doc,t);return qe(this,i,{top:0,left:0},e||"page").top+(n?this.doc.height-Fi(i):0)},defaultTextHeight:function(){return Je(this.display)},defaultCharWidth:function(){return Ke(this.display)},setGutterMarker:cn(function(t,e,n){return Sr(this.doc,t,"gutter",function(t){var r=t.gutterMarkers||(t.gutterMarkers={});r[e]=n;!n&&wo(r)&&(t.gutterMarkers=null);return!0})}),clearGutter:cn(function(t){var e=this,n=e.doc,r=n.first;n.iter(function(n){if(n.gutterMarkers&&n.gutterMarkers[t]){n.gutterMarkers[t]=null;gn(e,r,"gutter");wo(n.gutterMarkers)&&(n.gutterMarkers=null)}++r})}),addLineWidget:cn(function(t,e,n){return si(this,t,e,n)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!te(this.doc,t))return null;var e=t;t=Ei(this.doc,t);if(!t)return null}else{var e=Hi(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o=this.display;t=Ve(this,Z(this.doc,t));var a=t.bottom,s=t.left;e.style.position="absolute";o.sizer.appendChild(e);if("over"==r)a=t.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom);s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px";e.style.left=e.style.right="";if("right"==i){s=o.sizer.clientWidth-e.offsetWidth;e.style.right="0px"}else{"left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2);e.style.left=s+"px"}n&&mr(this,s,a,s+e.offsetWidth,a+e.offsetHeight)},triggerOnKeyDown:cn($n),triggerOnKeyPress:cn(Kn),triggerOnKeyUp:Jn,execCommand:function(t){return Ua.hasOwnProperty(t)?Ua[t](this):void 0},findPosH:function(t,e,n,r){var i=1;if(0>e){i=-1;e=-e}for(var o=0,a=Z(this.doc,t);e>o;++o){a=Tr(this.doc,a,i,n,r);if(a.hitSide)break}return a},moveH:cn(function(t,e){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Tr(n.doc,r.head,t,e,n.options.rtlMoveVisually):0>t?r.from():r.to()},vs)}),deleteH:cn(function(t,e){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Cr(this,function(n){var i=Tr(r,n.head,t,e,!1);return 0>t?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(t,e,n,r){var i=1,o=r;if(0>e){i=-1;e=-e}for(var a=0,s=Z(this.doc,t);e>a;++a){var l=Ve(this,s,"div");null==o?o=l.left:l.left=o;s=_r(this,l,i,n);if(s.hitSide)break}return s},moveV:cn(function(t,e){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();r.extendSelectionsBy(function(a){if(o)return 0>t?a.from():a.to();var s=Ve(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn);i.push(s.left);var l=_r(n,s,t,e);"page"==e&&a==r.sel.primary()&&yr(n,null,Be(n,l,"div").top-s.top);return l},vs);if(i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(t){var e=this.doc,n=Ei(e,t.line).text,r=t.ch,i=t.ch;if(n){var o=this.getHelper(t,"wordChars");(t.xRel<0||i==n.length)&&r?--r:++i;for(var a=n.charAt(r),s=xo(a,o)?function(t){return xo(t,o)}:/\s/.test(a)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!xo(t)};r>0&&s(n.charAt(r-1));)--r;for(;i<n.length&&s(n.charAt(i));)++i}return new $(ya(t.line,r),ya(t.line,i))},toggleOverwrite:function(t){if(null==t||t!=this.state.overwrite){(this.state.overwrite=!this.state.overwrite)?Ls(this.display.cursorDiv,"CodeMirror-overwrite"):Ds(this.display.cursorDiv,"CodeMirror-overwrite");fs(this,"overwriteToggle",this,this.state.overwrite)}},hasFocus:function(){return Mo()==this.display.input},scrollTo:cn(function(t,e){(null!=t||null!=e)&&xr(this);null!=t&&(this.curOp.scrollLeft=t);null!=e&&(this.curOp.scrollTop=e)}),getScrollInfo:function(){var t=this.display.scroller,e=ds;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:cn(function(t,e){if(null==t){t={from:this.doc.sel.primary().head,to:null};null==e&&(e=this.options.cursorScrollMargin)}else"number"==typeof t?t={from:ya(t,0),to:null}:null==t.from&&(t={from:t,to:null});t.to||(t.to=t.from);t.margin=e||0;if(null!=t.from.line){xr(this);this.curOp.scrollToPos=t}else{var n=vr(this,Math.min(t.from.left,t.to.left),Math.min(t.from.top,t.to.top)-t.margin,Math.max(t.from.right,t.to.right),Math.max(t.from.bottom,t.to.bottom)+t.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:cn(function(t,e){function n(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}var r=this;null!=t&&(r.display.wrapper.style.width=n(t));null!=e&&(r.display.wrapper.style.height=n(e));r.options.lineWrapping&&Fe(this);var i=r.display.viewFrom;r.doc.iter(i,r.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){gn(r,i,"widget");break}++i});r.curOp.forceUpdate=!0;fs(r,"refresh",this)}),operation:function(t){return ln(this,t)},refresh:cn(function(){var t=this.display.cachedTextHeight;pn(this);this.curOp.forceUpdate=!0;Re(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);c(this);(null==t||Math.abs(t-Je(this.display))>.5)&&a(this);fs(this,"refresh",this)}),swapDoc:cn(function(t){var e=this.doc;e.cm=null;Ni(this,t);Re(this);Tn(this);this.scrollTo(t.scrollLeft,t.scrollTop);this.curOp.forceScroll=!0;io(this,"swapDoc",this,e);return e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};uo(t);var ja=t.defaults={},Ia=t.optionHandlers={},Pa=t.Init={toString:function(){return"CodeMirror.Init"}};kr("value","",function(t,e){t.setValue(e)},!0);kr("mode",null,function(t,e){t.doc.modeOption=e;n(t)},!0);kr("indentUnit",2,n,!0);kr("indentWithTabs",!1);kr("smartIndent",!0);kr("tabSize",4,function(t){r(t);Re(t);pn(t)},!0);kr("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e){t.options.specialChars=new RegExp(e.source+(e.test(" ")?"":"| "),"g");t.refresh()},!0);kr("specialCharPlaceholder",xi,function(t){t.refresh()},!0);kr("electricChars",!0);kr("rtlMoveVisually",!ha);kr("wholeLineUpdateBefore",!0);kr("theme","default",function(t){s(t);l(t)},!0);kr("keyMap","default",function(e,n,r){var i=Dr(n),o=r!=t.Init&&Dr(r);o&&o.detach&&o.detach(e,i);i.attach&&i.attach(e,o||null)});kr("extraKeys",null);kr("lineWrapping",!1,i,!0);kr("gutters",[],function(t){d(t.options);l(t)},!0);kr("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?w(t.display)+"px":"0";t.refresh()},!0);kr("coverGutterNextToScrollbar",!1,m,!0);kr("lineNumbers",!1,function(t){d(t.options);l(t)},!0);kr("firstLineNumber",1,l,!0);kr("lineNumberFormatter",function(t){return t},l,!0);kr("showCursorWhenSelecting",!1,ve,!0);kr("resetSelectionOnContextMenu",!0);kr("readOnly",!1,function(t,e){if("nocursor"==e){Qn(t);t.display.input.blur();t.display.disabled=!0}else{t.display.disabled=!1;e||Tn(t)}});kr("disableInput",!1,function(t,e){e||Tn(t)},!0);kr("dragDrop",!0);kr("cursorBlinkRate",530);kr("cursorScrollMargin",0);kr("cursorHeight",1,ve,!0);kr("singleCursorHeightPerLine",!0,ve,!0);kr("workTime",100);kr("workDelay",100);kr("flattenSpans",!0,r,!0);kr("addModeClass",!1,r,!0);kr("pollInterval",100);kr("undoDepth",200,function(t,e){t.doc.history.undoDepth=e});kr("historyEventDelay",1250);kr("viewportMargin",10,function(t){t.refresh()},!0);kr("maxHighlightLength",1e4,r,!0);kr("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)});kr("tabindex",null,function(t,e){t.display.input.tabIndex=e||""});kr("autofocus",null);var Ha=t.modes={},Oa=t.mimeModes={};t.defineMode=function(e,n){t.defaults.mode||"null"==e||(t.defaults.mode=e);arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2));Ha[e]=n};t.defineMIME=function(t,e){Oa[t]=e};t.resolveMode=function(e){if("string"==typeof e&&Oa.hasOwnProperty(e))e=Oa[e];else if(e&&"string"==typeof e.name&&Oa.hasOwnProperty(e.name)){var n=Oa[e.name];"string"==typeof n&&(n={name:n});e=vo(n,e);e.name=n.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}};t.getMode=function(e,n){var n=t.resolveMode(n),r=Ha[n.name];if(!r)return t.getMode(e,"text/plain");var i=r(e,n);if(Fa.hasOwnProperty(n.name)){var o=Fa[n.name];for(var a in o)if(o.hasOwnProperty(a)){i.hasOwnProperty(a)&&(i["_"+a]=i[a]);i[a]=o[a]}}i.name=n.name;n.helperType&&(i.helperType=n.helperType);if(n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i};t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}});t.defineMIME("text/plain","null");var Fa=t.modeExtensions={};t.extendMode=function(t,e){var n=Fa.hasOwnProperty(t)?Fa[t]:Fa[t]={};yo(e,n)};t.defineExtension=function(e,n){t.prototype[e]=n};t.defineDocExtension=function(t,e){rs.prototype[t]=e};t.defineOption=kr;var Ra=[];t.defineInitHook=function(t){Ra.push(t)};var Wa=t.helpers={};t.registerHelper=function(e,n,r){Wa.hasOwnProperty(e)||(Wa[e]=t[e]={_global:[]});Wa[e][n]=r};t.registerGlobalHelper=function(e,n,r,i){t.registerHelper(e,n,i);Wa[e]._global.push({pred:r,val:i})};var za=t.copyState=function(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([]));n[r]=i}return n},qa=t.startState=function(t,e,n){return t.startState?t.startState(e,n):!0};t.innerMode=function(t,e){for(;t.innerMode;){var n=t.innerMode(e);if(!n||n.mode==t)break;e=n.state;t=n.mode}return n||{mode:t,state:e}};var Ua=t.commands={selectAll:function(t){t.setSelection(ya(t.firstLine(),0),ya(t.lastLine()),gs)},singleSelection:function(t){t.setSelection(t.getCursor("anchor"),t.getCursor("head"),gs)},killLine:function(t){Cr(t,function(e){if(e.empty()){var n=Ei(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:ya(e.head.line+1,0)}:{from:e.head,to:ya(e.head.line,n)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){Cr(t,function(e){return{from:ya(e.from().line,0),to:Z(t.doc,ya(e.to().line+1,0))}})},delLineLeft:function(t){Cr(t,function(t){return{from:ya(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){Cr(t,function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return{from:r,to:e.from()}})},delWrappedLineRight:function(t){Cr(t,function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:r}})},undo:function(t){t.undo()},redo:function(t){t.redo()},undoSelection:function(t){t.undoSelection()},redoSelection:function(t){t.redoSelection()},goDocStart:function(t){t.extendSelection(ya(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(ya(t.lastLine()))},goLineStart:function(t){t.extendSelectionsBy(function(e){return qo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){t.extendSelectionsBy(function(e){return Bo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){t.extendSelectionsBy(function(e){return Uo(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},vs)},goLineLeft:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},vs)},goLineLeftSmart:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return r.ch<t.getLine(r.line).search(/\S/)?Bo(t,e.head):r},vs)},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goGroupRight:function(t){t.moveH(1,"group")},goGroupLeft:function(t){t.moveH(-1,"group")},goWordRight:function(t){t.moveH(1,"word")},delCharBefore:function(t){t.deleteH(-1,"char")},delCharAfter:function(t){t.deleteH(1,"char")},delWordBefore:function(t){t.deleteH(-1,"word")},delWordAfter:function(t){t.deleteH(1,"word")},delGroupBefore:function(t){t.deleteH(-1,"group")},delGroupAfter:function(t){t.deleteH(1,"group")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection(" ")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),r=t.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=ys(t.getLine(o.line),o.ch,r);e.push(new Array(r-a%r+1).join(" "))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){ln(t,function(){for(var e=t.listSelections(),n=[],r=0;r<e.length;r++){var i=e[r].head,o=Ei(t.doc,i.line).text;if(o){i.ch==o.length&&(i=new ya(i.line,i.ch-1));if(i.ch>0){i=new ya(i.line,i.ch+1);t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ya(i.line,i.ch-2),i,"+transpose")}else if(i.line>t.doc.first){var a=Ei(t.doc,i.line-1).text;a&&t.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),ya(i.line-1,a.length-1),ya(i.line,1),"+transpose")}}n.push(new $(i,i))}t.setSelections(n)})},newlineAndIndent:function(t){ln(t,function(){for(var e=t.listSelections().length,n=0;e>n;n++){var r=t.listSelections()[n];t.replaceRange("\n",r.anchor,r.head,"+input");t.indentLine(r.from().line+1,null,!0);br(t)}})},toggleOverwrite:function(t){t.toggleOverwrite()}},Ba=t.keyMap={};Ba.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};Ba.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};Ba.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};Ba.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};Ba["default"]=fa?Ba.macDefault:Ba.pcDefault;t.normalizeKeyMap=function(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete t[n];continue}for(var i=mo(n.split(" "),Mr),o=0;o<i.length;o++){var a,s;if(o==i.length-1){s=n;a=r}else{s=i.slice(0,o+1).join(" ");a="..."}var l=e[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else e[s]=a}delete t[n]}for(var u in e)t[u]=e[u];return t};var Va=t.lookupKey=function(t,e,n){e=Dr(e);var r=e.call?e.call(t):e[t];if(r===!1)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Va(t,e.fallthrough,n);for(var i=0;i<e.fallthrough.length;i++){var o=Va(t,e.fallthrough[i],n);if(o)return o}}},Xa=t.isModifierKey=function(t){var e="string"==typeof t?t:Hs[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e},Ga=t.keyName=function(t,e){if(ia&&34==t.keyCode&&t["char"])return!1;var n=Hs[t.keyCode],r=n;if(null==r||t.altGraphKey)return!1;t.altKey&&"Alt"!=n&&(r="Alt-"+r);(pa?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r);(pa?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(r="Cmd-"+r);!e&&t.shiftKey&&"Shift"!=n&&(r="Shift-"+r);return r};t.fromTextArea=function(e,n){function r(){e.value=u.getValue()}n||(n={});n.value=e.value;!n.tabindex&&e.tabindex&&(n.tabindex=e.tabindex);!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder);if(null==n.autofocus){var i=Mo();n.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}if(e.form){us(e.form,"submit",r);if(!n.leaveSubmitMethodAlone){var o=e.form,a=o.submit;try{var s=o.submit=function(){r();o.submit=a;o.submit();o.submit=s}}catch(l){}}}e.style.display="none";var u=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},n);u.save=r;u.getTextArea=function(){return e};u.toTextArea=function(){u.toTextArea=isNaN;r();e.parentNode.removeChild(u.getWrapperElement());e.style.display="";if(e.form){cs(e.form,"submit",r);"function"==typeof e.form.submit&&(e.form.submit=a)}};return u};var $a=t.StringStream=function(t,e){this.pos=this.start=0;this.string=t;this.tabSize=e||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0};$a.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var n=e==t;else var n=e&&(t.test?t.test(e):t(e));if(n){++this.pos;return e}},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);if(e>-1){this.pos=e;return!0}},backUp:function(t){this.pos-=t},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=ys(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?ys(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return ys(this.string,null,this.tabSize)-(this.lineStart?ys(this.string,this.lineStart,this.tabSize):0)},match:function(t,e,n){if("string"!=typeof t){var r=this.string.slice(this.pos).match(t);if(r&&r.index>0)return null;r&&e!==!1&&(this.pos+=r[0].length);return r}var i=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(i(o)==i(t)){e!==!1&&(this.pos+=t.length);return!0}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}}};var Ya=t.TextMarker=function(t,e){this.lines=[];this.type=e;this.doc=t};uo(Ya);Ya.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;e&&Ze(t);if(lo(this,"clear")){var n=this.find();n&&io(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=Pr(a.markedSpans,this);if(t&&!this.collapsed)gn(t,Hi(a),"text");else if(t){null!=s.to&&(i=Hi(a));null!=s.from&&(r=Hi(a))}a.markedSpans=Hr(a.markedSpans,s);null==s.from&&this.collapsed&&!ri(this.doc,a)&&t&&Pi(a,Je(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=Qr(this.lines[o]),u=f(l);if(u>t.display.maxLineLength){t.display.maxLine=l;t.display.maxLineLength=u;t.display.maxLineChanged=!0}}null!=r&&t&&this.collapsed&&pn(t,r,i+1);this.lines.length=0;this.explicitlyCleared=!0;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=!1;t&&he(t.doc)}t&&io(t,"markerCleared",t,this);e&&tn(t);this.parent&&this.parent.clear()}};Ya.prototype.find=function(t,e){null==t&&"bookmark"==this.type&&(t=1);for(var n,r,i=0;i<this.lines.length;++i){var o=this.lines[i],a=Pr(o.markedSpans,this);if(null!=a.from){n=ya(e?o:Hi(o),a.from);if(-1==t)return n}if(null!=a.to){r=ya(e?o:Hi(o),a.to);if(1==t)return r}}return n&&{from:n,to:r}};Ya.prototype.changed=function(){var t=this.find(-1,!0),e=this,n=this.doc.cm;t&&n&&ln(n,function(){var r=t.line,i=Hi(t.line),o=Ee(n,i);if(o){Oe(o);n.curOp.selectionChanged=n.curOp.forceUpdate=!0}n.curOp.updateMaxLine=!0;if(!ri(e.doc,r)&&null!=e.height){var a=e.height;e.height=null;var s=ai(e)-a;s&&Pi(r,r.height+s)}})};Ya.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=go(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)};Ya.prototype.detachLine=function(t){this.lines.splice(go(this.lines,t),1);if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}};var Ja=0,Ka=t.SharedTextMarker=function(t,e){this.markers=t;this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};uo(Ka);Ka.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();io(this,"clear")}};Ka.prototype.find=function(t,e){return this.primary.find(t,e)};var Za=t.LineWidget=function(t,e,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=t;this.node=e};uo(Za);Za.prototype.clear=function(){var t=this.cm,e=this.line.widgets,n=this.line,r=Hi(n);if(null!=r&&e){for(var i=0;i<e.length;++i)e[i]==this&&e.splice(i--,1);e.length||(n.widgets=null);var o=ai(this);ln(t,function(){oi(t,n,-o);gn(t,r,"widget");Pi(n,Math.max(0,n.height-o))})}};Za.prototype.changed=function(){var t=this.height,e=this.cm,n=this.line;this.height=null;var r=ai(this)-t;r&&ln(e,function(){e.curOp.forceUpdate=!0;oi(e,n,r);Pi(n,n.height+r)})};var Qa=t.Line=function(t,e,n){this.text=t;Vr(this,e);this.height=n?n(this):1};uo(Qa);Qa.prototype.lineNo=function(){return Hi(this)};var ts={},es={};Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,r=t+e;r>n;++n){var i=this.lines[n];this.height-=i.height;ui(i);io(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n;this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=this},iterN:function(t,e,n){for(var r=t+e;r>t;++t)if(n(this.lines[t]))return!0}};Li.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(i>t){var o=Math.min(e,i-t),a=r.height;r.removeInner(t,o);this.height-=a-r.height;if(i==o){this.children.splice(n--,1);r.parent=null}if(0==(e-=o))break;t=0}else t-=i}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var s=[];this.collapse(s);this.children=[new Di(s)];this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length;this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>=t){i.insertInner(t,e,n);if(i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Di(a);i.height-=s.height;this.children.splice(r+1,0,s);s.parent=this}this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),n=new Li(e);if(t.parent){t.size-=n.size;t.height-=n.height;var r=go(t.parent.children,t);t.parent.children.splice(r+1,0,n)}else{var i=new Li(t.children);i.parent=t;t.children=[i,n];t=i}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>t){var a=Math.min(e,o-t);if(i.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=o}}};var ns=0,rs=t.Doc=function(t,e,n){if(!(this instanceof rs))return new rs(t,e,n);null==n&&(n=0);Li.call(this,[new Di([new Qa("",null)])]);this.first=n;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=n;var r=ya(n,0);this.sel=J(r);this.history=new Wi(null);this.id=++ns;this.modeOption=e;"string"==typeof t&&(t=Es(t));Mi(this,{from:r,to:r,text:t});ue(this,J(r),gs)};rs.prototype=vo(Li.prototype,{constructor:rs,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,r=0;r<e.length;++r)n+=e[r].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Ii(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:fn(function(t){var e=ya(this.first,0),n=this.first+this.size-1;sr(this,{from:e,to:ya(n,Ei(this,n).text.length),text:Es(t),origin:"setValue"},!0);ue(this,J(e))}),replaceRange:function(t,e,n,r){e=Z(this,e);n=n?Z(this,n):e;dr(this,t,e,n,r)},getRange:function(t,e,n){var r=ji(this,Z(this,t),Z(this,e));return n===!1?r:r.join(n||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){return te(this,t)?Ei(this,t):void 0},getLineNumber:function(t){return Hi(t)},getLineHandleVisualStart:function(t){"number"==typeof t&&(t=Ei(this,t));return Qr(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return Z(this,t)},getCursor:function(t){var e,n=this.sel.primary();e=null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||t===!1?n.to():n.from();return e},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:fn(function(t,e,n){ae(this,Z(this,"number"==typeof t?ya(t,e||0):t),null,n)}),setSelection:fn(function(t,e,n){ae(this,Z(this,t),Z(this,e||t),n)}),extendSelection:fn(function(t,e,n){re(this,Z(this,t),e&&Z(this,e),n)}),extendSelections:fn(function(t,e){ie(this,ee(this,t,e))}),extendSelectionsBy:fn(function(t,e){ie(this,mo(this.sel.ranges,t),e)}),setSelections:fn(function(t,e,n){if(t.length){for(var r=0,i=[];r<t.length;r++)i[r]=new $(Z(this,t[r].anchor),Z(this,t[r].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex));ue(this,Y(i,e),n)}}),addSelection:fn(function(t,e,n){var r=this.sel.ranges.slice(0);r.push(new $(Z(this,t),Z(this,e||t)));ue(this,Y(r,r.length-1),n)}),getSelection:function(t){for(var e,n=this.sel.ranges,r=0;r<n.length;r++){var i=ji(this,n[r].from(),n[r].to());e=e?e.concat(i):i}return t===!1?e:e.join(t||"\n")},getSelections:function(t){for(var e=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=ji(this,n[r].from(),n[r].to());t!==!1&&(i=i.join(t||"\n"));e[r]=i}return e},replaceSelection:function(t,e,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=t;this.replaceSelections(r,e,n||"+input")},replaceSelections:fn(function(t,e,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:Es(t[o]),origin:n}}for(var s=e&&"end"!=e&&or(this,r,e),o=r.length-1;o>=0;o--)sr(this,r[o]);s?le(this,s):this.cm&&br(this.cm)}),undo:fn(function(){ur(this,"undo")}),redo:fn(function(){ur(this,"redo")}),undoSelection:fn(function(){ur(this,"undo",!0)}),redoSelection:fn(function(){ur(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r<t.done.length;r++)t.done[r].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){this.history=new Wi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Ki(this.history.done),undone:Ki(this.history.undone)}},setHistory:function(t){var e=this.history=new Wi(this.history.maxGeneration);e.done=Ki(t.done.slice(0),null,!0);e.undone=Ki(t.undone.slice(0),null,!0)},addLineClass:fn(function(t,e,n){return Sr(this,t,"gutter"==e?"gutter":"class",function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[r]){if(Do(n).test(t[r]))return!1;t[r]+=" "+n}else t[r]=n;return!0})}),removeLineClass:fn(function(t,e,n){return Sr(this,t,"class",function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",i=t[r]; if(!i)return!1;if(null==n)t[r]=null;else{var o=i.match(Do(n));if(!o)return!1;var a=o.index+o[0].length;t[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),markText:function(t,e,n){return Lr(this,Z(this,t),Z(this,e),n,"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared};t=Z(this,t);return Lr(this,t,t,n,"bookmark")},findMarksAt:function(t){t=Z(this,t);var e=[],n=Ei(this,t.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=Z(this,t);e=Z(this,e);var r=[],i=t.line;this.iter(t.line,e.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];i==t.line&&t.ch>l.to||null==l.from&&i!=t.line||i==e.line&&l.from>e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i});return r},getAllMarks:function(){var t=[];this.iter(function(e){var n=e.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&t.push(n[r].marker)});return t},posFromIndex:function(t){var e,n=this.first;this.iter(function(r){var i=r.text.length+1;if(i>t){e=t;return!0}t-=i;++n});return Z(this,ya(n,e))},indexFromPos:function(t){t=Z(this,t);var e=t.ch;if(t.line<this.first||t.ch<0)return 0;this.iter(this.first,t.line,function(t){e+=t.text.length+1});return e},copy:function(t){var e=new rs(Ii(this,this.first,this.first+this.size),this.modeOption,this.first);e.scrollTop=this.scrollTop;e.scrollLeft=this.scrollLeft;e.sel=this.sel;e.extend=!1;if(t){e.history.undoDepth=this.history.undoDepth;e.setHistory(this.getHistory())}return e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from);null!=t.to&&t.to<n&&(n=t.to);var r=new rs(Ii(this,e,n),t.mode||this.modeOption,e);t.sharedHist&&(r.history=this.history);(this.linked||(this.linked=[])).push({doc:r,sharedHist:t.sharedHist});r.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}];Er(r,Nr(this));return r},unlinkDoc:function(e){e instanceof t&&(e=e.doc);if(this.linked)for(var n=0;n<this.linked.length;++n){var r=this.linked[n];if(r.doc==e){this.linked.splice(n,1);e.unlinkDoc(this);jr(Nr(this));break}}if(e.history==this.history){var i=[e.id];Ai(e,function(t){i.push(t.id)},!0);e.history=new Wi(null);e.history.done=Ki(this.history.done,i);e.history.undone=Ki(this.history.undone,i)}},iterLinkedDocs:function(t){Ai(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});rs.prototype.eachLine=rs.prototype.iter;var is="iter insert remove copy getEditor".split(" ");for(var os in rs.prototype)rs.prototype.hasOwnProperty(os)&&go(is,os)<0&&(t.prototype[os]=function(t){return function(){return t.apply(this.doc,arguments)}}(rs.prototype[os]));uo(rs);var as=t.e_preventDefault=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},ss=t.e_stopPropagation=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},ls=t.e_stop=function(t){as(t);ss(t)},us=t.on=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var r=t._handlers||(t._handlers={}),i=r[e]||(r[e]=[]);i.push(n)}},cs=t.off=function(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var r=t._handlers&&t._handlers[e];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},fs=t.signal=function(t,e){var n=t._handlers&&t._handlers[e];if(n)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)},hs=null,ds=30,ps=t.Pass={toString:function(){return"CodeMirror.Pass"}},gs={scroll:!1},ms={origin:"*mouse"},vs={origin:"+move"};co.prototype.set=function(t,e){clearTimeout(this.id);this.id=setTimeout(e,t)};var ys=t.countColumn=function(t,e,n,r,i){if(null==e){e=t.search(/[^\s\u00a0]/);-1==e&&(e=t.length)}for(var o=r||0,a=i||0;;){var s=t.indexOf(" ",o);if(0>s||s>=e)return a+(e-o);a+=s-o;a+=n-a%n;o=s+1}},bs=[""],xs=function(t){t.select()};ua?xs=function(t){t.selectionStart=0;t.selectionEnd=t.value.length}:Qo&&(xs=function(t){try{t.select()}catch(e){}});[].indexOf&&(go=function(t,e){return t.indexOf(e)});[].map&&(mo=function(t,e){return t.map(e)});var ws,Ss=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Cs=t.isWordChar=function(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ss.test(t))},Ts=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;ws=document.createRange?function(t,e,n){var r=document.createRange();r.setEnd(t,n);r.setStart(t,e);return r}:function(t,e,n){var r=document.body.createTextRange();try{r.moveToElementText(t.parentNode)}catch(i){return r}r.collapse(!0);r.moveEnd("character",n);r.moveStart("character",e);return r};Qo&&11>ta&&(Mo=function(){try{return document.activeElement}catch(t){return document.body}});var _s,ks,Ms,Ds=t.rmClass=function(t,e){var n=t.className,r=Do(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}},Ls=t.addClass=function(t,e){var n=t.className;Do(e).test(n)||(t.className+=(n?" ":"")+e)},As=!1,Ns=function(){if(Qo&&9>ta)return!1;var t=Co("div");return"draggable"in t||"dragDrop"in t}(),Es=t.splitLines=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;r>=e;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");if(-1!=a){n.push(o.slice(0,a));e+=a+1}else{n.push(o);e=i+1}}return n}:function(t){return t.split(/\r\n?|\n/)},js=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(n){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},Is=function(){var t=Co("div");if("oncopy"in t)return!0;t.setAttribute("oncopy","return;");return"function"==typeof t.oncopy}(),Ps=null,Hs={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};t.keyNames=Hs;(function(){for(var t=0;10>t;t++)Hs[t+48]=Hs[t+96]=String(t);for(var t=65;90>=t;t++)Hs[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)Hs[t+111]=Hs[t+63235]="F"+t})();var Os,Fs=function(){function t(t){return 247>=t?n.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1773>=t?r.charAt(t-1536):t>=1774&&2220>=t?"r":t>=8192&&8203>=t?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t;this.from=e;this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,u="L";return function(n){if(!i.test(n))return!1;for(var r,c=n.length,f=[],h=0;c>h;++h)f.push(r=t(n.charCodeAt(h)));for(var h=0,d=u;c>h;++h){var r=f[h];"m"==r?f[h]=d:d=r}for(var h=0,p=u;c>h;++h){var r=f[h];if("1"==r&&"r"==p)f[h]="n";else if(a.test(r)){p=r;"r"==r&&(f[h]="R")}}for(var h=1,d=f[0];c-1>h;++h){var r=f[h];"+"==r&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=r||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d);d=r}for(var h=0;c>h;++h){var r=f[h];if(","==r)f[h]="N";else if("%"==r){for(var g=h+1;c>g&&"%"==f[g];++g);for(var m=h&&"!"==f[h-1]||c>g&&"1"==f[g]?"1":"N",v=h;g>v;++v)f[v]=m;h=g-1}}for(var h=0,p=u;c>h;++h){var r=f[h];"L"==p&&"1"==r?f[h]="L":a.test(r)&&(p=r)}for(var h=0;c>h;++h)if(o.test(f[h])){for(var g=h+1;c>g&&o.test(f[g]);++g);for(var y="L"==(h?f[h-1]:u),b="L"==(c>g?f[g]:u),m=y||b?"L":"R",v=h;g>v;++v)f[v]=m;h=g-1}for(var x,w=[],h=0;c>h;)if(s.test(f[h])){var S=h;for(++h;c>h&&s.test(f[h]);++h);w.push(new e(0,S,h))}else{var C=h,T=w.length;for(++h;c>h&&"L"!=f[h];++h);for(var v=C;h>v;)if(l.test(f[v])){v>C&&w.splice(T,0,new e(1,C,v));var _=v;for(++v;h>v&&l.test(f[v]);++v);w.splice(T,0,new e(2,_,v));C=v}else++v;h>C&&w.splice(T,0,new e(1,C,h))}if(1==w[0].level&&(x=n.match(/^\s+/))){w[0].from=x[0].length;w.unshift(new e(0,0,x[0].length))}if(1==po(w).level&&(x=n.match(/\s+$/))){po(w).to-=x[0].length;w.push(new e(0,c-x[0].length,c))}w[0].level!=po(w).level&&w.push(new e(w[0].level,c,c));return w}}();t.version="4.8.0";return t})},{}],10:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(e,n){function r(t){for(var e,n=!1,r=!1;null!=(e=t.next());){if(!n){if("/"==e&&!r)return;"["==e?r=!0:r&&"]"==e&&(r=!1)}n=!n&&"\\"==e}}function i(t,e,n){pe=t;ge=n;return e}function o(t,e){var n=t.next();if('"'==n||"'"==n){e.tokenize=a(n);return e.tokenize(t,e)}if("."==n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==n&&t.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return i(n);if("="==n&&t.eat(">"))return i("=>","operator");if("0"==n&&t.eat(/x/i)){t.eatWhile(/[\da-f]/i);return i("number","number")}if(/\d/.test(n)){t.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return i("number","number")}if("/"==n){if(t.eat("*")){e.tokenize=s;return s(t,e)}if(t.eat("/")){t.skipToEnd();return i("comment","comment")}if("operator"==e.lastType||"keyword c"==e.lastType||"sof"==e.lastType||/^[\[{}\(,;:]$/.test(e.lastType)){r(t);t.eatWhile(/[gimy]/);return i("regexp","string-2")}t.eatWhile(Ce);return i("operator","operator",t.current())}if("`"==n){e.tokenize=l;return l(t,e)}if("#"==n){t.skipToEnd();return i("error","error")}if(Ce.test(n)){t.eatWhile(Ce);return i("operator","operator",t.current())}if(we.test(n)){t.eatWhile(we);var o=t.current(),u=Se.propertyIsEnumerable(o)&&Se[o];return u&&"."!=e.lastType?i(u.type,u.style,o):i("variable","variable",o)}}function a(t){return function(e,n){var r,a=!1;if(ye&&"@"==e.peek()&&e.match(Te)){n.tokenize=o;return i("jsonld-keyword","meta")}for(;null!=(r=e.next())&&(r!=t||a);)a=!a&&"\\"==r;a||(n.tokenize=o);return i("string","string")}}function s(t,e){for(var n,r=!1;n=t.next();){if("/"==n&&r){e.tokenize=o;break}r="*"==n}return i("comment","comment")}function l(t,e){for(var n,r=!1;null!=(n=t.next());){if(!r&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",t.current())}function u(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(0>n)){for(var r=0,i=!1,o=n-1;o>=0;--o){var a=t.string.charAt(o),s=_e.indexOf(a);if(s>=0&&3>s){if(!r){++o;break}if(0==--r)break}else if(s>=3&&6>s)++r;else if(we.test(a))i=!0;else if(i&&!r){++o;break}}i&&!r&&(e.fatArrowAt=o)}}function c(t,e,n,r,i,o){this.indented=t;this.column=e;this.type=n;this.prev=i;this.info=o;null!=r&&(this.align=r)}function f(t,e){for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var r=t.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==e)return!0}function h(t,e,n,r,i){var o=t.cc;Me.state=t;Me.stream=i;Me.marked=null,Me.cc=o;Me.style=e;t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);for(;;){var a=o.length?o.pop():be?S:w;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Me.marked?Me.marked:"variable"==n&&f(t,r)?"variable-2":e}}}function d(){for(var t=arguments.length-1;t>=0;t--)Me.cc.push(arguments[t])}function p(){d.apply(null,arguments);return!0}function g(t){function e(e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}var r=Me.state;if(r.context){Me.marked="def";if(e(r.localVars))return;r.localVars={name:t,next:r.localVars}}else{if(e(r.globalVars))return;n.globalVars&&(r.globalVars={name:t,next:r.globalVars})}}function m(){Me.state.context={prev:Me.state.context,vars:Me.state.localVars};Me.state.localVars=De}function v(){Me.state.localVars=Me.state.context.vars;Me.state.context=Me.state.context.prev}function y(t,e){var n=function(){var n=Me.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new c(r,Me.stream.column(),t,null,n.lexical,e)};n.lex=!0;return n}function b(){var t=Me.state;if(t.lexical.prev){")"==t.lexical.type&&(t.indented=t.lexical.indented);t.lexical=t.lexical.prev}}function x(t){function e(n){return n==t?p():";"==t?d():p(e)}return e}function w(t,e){if("var"==t)return p(y("vardef",e.length),U,x(";"),b);if("keyword a"==t)return p(y("form"),S,w,b);if("keyword b"==t)return p(y("form"),w,b);if("{"==t)return p(y("}"),W,b);if(";"==t)return p();if("if"==t){"else"==Me.state.lexical.info&&Me.state.cc[Me.state.cc.length-1]==b&&Me.state.cc.pop()();return p(y("form"),S,w,b,$)}return"function"==t?p(te):"for"==t?p(y("form"),Y,w,b):"variable"==t?p(y("stat"),j):"switch"==t?p(y("form"),S,y("}","switch"),x("{"),W,b,b):"case"==t?p(S,x(":")):"default"==t?p(x(":")):"catch"==t?p(y("form"),m,x("("),ee,x(")"),w,b,v):"module"==t?p(y("form"),m,ae,v,b):"class"==t?p(y("form"),ne,b):"export"==t?p(y("form"),se,b):"import"==t?p(y("form"),le,b):d(y("stat"),S,x(";"),b)}function S(t){return T(t,!1)}function C(t){return T(t,!0)}function T(t,e){if(Me.state.fatArrowAt==Me.stream.start){var n=e?E:N;if("("==t)return p(m,y(")"),F(B,")"),b,x("=>"),n,v);if("variable"==t)return d(m,B,x("=>"),n,v)}var r=e?D:M;return ke.hasOwnProperty(t)?p(r):"function"==t?p(te,r):"keyword c"==t?p(e?k:_):"("==t?p(y(")"),_,de,x(")"),b,r):"operator"==t||"spread"==t?p(e?C:S):"["==t?p(y("]"),fe,b,r):"{"==t?R(P,"}",null,r):"quasi"==t?d(L,r):p()}function _(t){return t.match(/[;\}\)\],]/)?d():d(S)}function k(t){return t.match(/[;\}\)\],]/)?d():d(C)}function M(t,e){return","==t?p(S):D(t,e,!1)}function D(t,e,n){var r=0==n?M:D,i=0==n?S:C;return"=>"==t?p(m,n?E:N,v):"operator"==t?/\+\+|--/.test(e)?p(r):"?"==e?p(S,x(":"),i):p(i):"quasi"==t?d(L,r):";"!=t?"("==t?R(C,")","call",r):"."==t?p(I,r):"["==t?p(y("]"),_,x("]"),b,r):void 0:void 0}function L(t,e){return"quasi"!=t?d():"${"!=e.slice(e.length-2)?p(L):p(S,A)}function A(t){if("}"==t){Me.marked="string-2";Me.state.tokenize=l;return p(L)}}function N(t){u(Me.stream,Me.state);return d("{"==t?w:S)}function E(t){u(Me.stream,Me.state);return d("{"==t?w:C)}function j(t){return":"==t?p(b,w):d(M,x(";"),b)}function I(t){if("variable"==t){Me.marked="property";return p()}}function P(t,e){if("variable"==t||"keyword"==Me.style){Me.marked="property";return p("get"==e||"set"==e?H:O)}if("number"==t||"string"==t){Me.marked=ye?"property":Me.style+" property";return p(O)}return"jsonld-keyword"==t?p(O):"["==t?p(S,x("]"),O):void 0}function H(t){if("variable"!=t)return d(O);Me.marked="property";return p(te)}function O(t){return":"==t?p(C):"("==t?d(te):void 0}function F(t,e){function n(r){if(","==r){var i=Me.state.lexical;"call"==i.info&&(i.pos=(i.pos||0)+1);return p(t,n)}return r==e?p():p(x(e))}return function(r){return r==e?p():d(t,n)}}function R(t,e,n){for(var r=3;r<arguments.length;r++)Me.cc.push(arguments[r]);return p(y(e,n),F(t,e),b)}function W(t){return"}"==t?p():d(w,W)}function z(t){return xe&&":"==t?p(q):void 0}function q(t){if("variable"==t){Me.marked="variable-3";return p()}}function U(){return d(B,z,X,G)}function B(t,e){if("variable"==t){g(e);return p()}return"["==t?R(B,"]"):"{"==t?R(V,"}"):void 0}function V(t,e){if("variable"==t&&!Me.stream.match(/^\s*:/,!1)){g(e);return p(X)}"variable"==t&&(Me.marked="property");return p(x(":"),B,X)}function X(t,e){return"="==e?p(C):void 0}function G(t){return","==t?p(U):void 0}function $(t,e){return"keyword b"==t&&"else"==e?p(y("form","else"),w,b):void 0}function Y(t){return"("==t?p(y(")"),J,x(")"),b):void 0}function J(t){return"var"==t?p(U,x(";"),Z):";"==t?p(Z):"variable"==t?p(K):d(S,x(";"),Z)}function K(t,e){if("in"==e||"of"==e){Me.marked="keyword";return p(S)}return p(M,Z)}function Z(t,e){if(";"==t)return p(Q);if("in"==e||"of"==e){Me.marked="keyword";return p(S)}return d(S,x(";"),Q)}function Q(t){")"!=t&&p(S)}function te(t,e){if("*"==e){Me.marked="keyword";return p(te)}if("variable"==t){g(e);return p(te)}return"("==t?p(m,y(")"),F(ee,")"),b,w,v):void 0}function ee(t){return"spread"==t?p(ee):d(B,z)}function ne(t,e){if("variable"==t){g(e);return p(re)}}function re(t,e){return"extends"==e?p(S,re):"{"==t?p(y("}"),ie,b):void 0}function ie(t,e){if("variable"==t||"keyword"==Me.style){Me.marked="property";return"get"==e||"set"==e?p(oe,te,ie):p(te,ie)}if("*"==e){Me.marked="keyword";return p(ie)}return";"==t?p(ie):"}"==t?p():void 0}function oe(t){if("variable"!=t)return d();Me.marked="property";return p()}function ae(t,e){if("string"==t)return p(w);if("variable"==t){g(e);return p(ce)}}function se(t,e){if("*"==e){Me.marked="keyword";return p(ce,x(";"))}if("default"==e){Me.marked="keyword";return p(S,x(";"))}return d(w)}function le(t){return"string"==t?p():d(ue,ce)}function ue(t,e){if("{"==t)return R(ue,"}");"variable"==t&&g(e);return p()}function ce(t,e){if("from"==e){Me.marked="keyword";return p(S)}}function fe(t){return"]"==t?p():d(C,he)}function he(t){return"for"==t?d(de,x("]")):","==t?p(F(k,"]")):d(F(C,"]"))}function de(t){return"for"==t?p(Y,de):"if"==t?p(S,de):void 0}var pe,ge,me=e.indentUnit,ve=n.statementIndent,ye=n.jsonld,be=n.json||ye,xe=n.typescript,we=n.wordCharacters||/[\w$\xa1-\uffff]/,Se=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),r=t("keyword c"),i=t("operator"),o={type:"atom",style:"atom"},a={"if":t("if"),"while":e,"with":e,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"debugger":r,"var":t("var"),"const":t("var"),let:t("var"),"function":t("function"),"catch":t("catch"),"for":t("for"),"switch":t("switch"),"case":t("case"),"default":t("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":t("this"),module:t("module"),"class":t("class"),"super":t("atom"),"yield":r,"export":t("export"),"import":t("import"),"extends":r};if(xe){var s={type:"variable",style:"variable-3"},l={"interface":t("interface"),"extends":t("extends"),constructor:t("constructor"),"public":t("public"),"private":t("private"),"protected":t("protected"),"static":t("static"),string:s,number:s,bool:s,any:s};for(var u in l)a[u]=l[u]}return a}(),Ce=/[+\-*&%=<>!?|~^]/,Te=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,_e="([{}])",ke={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Me={state:null,column:null,marked:null,cc:null},De={name:"this",next:{name:"arguments"}};b.lex=!0;return{startState:function(t){var e={tokenize:o,lastType:"sof",cc:[],lexical:new c((t||0)-me,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars);return e},token:function(t,e){if(t.sol()){e.lexical.hasOwnProperty("align")||(e.lexical.align=!1);e.indented=t.indentation();u(t,e)}if(e.tokenize!=s&&t.eatSpace())return null;var n=e.tokenize(t,e);if("comment"==pe)return n;e.lastType="operator"!=pe||"++"!=ge&&"--"!=ge?pe:"incdec";return h(e,n,pe,ge,t)},indent:function(e,r){if(e.tokenize==s)return t.Pass;if(e.tokenize!=o)return 0;var i=r&&r.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(r))for(var l=e.cc.length-1;l>=0;--l){var u=e.cc[l];if(u==b)a=a.prev;else if(u!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev);ve&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,f=i==c;return"vardef"==c?a.indented+("operator"==e.lastType||","==e.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+me:"stat"==c?a.indented+("operator"==e.lastType||","==e.lastType?ve||me:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:me):a.indented+(/^(?:case|default)\b/.test(r)?me:2*me)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:be?null:"/*",blockCommentEnd:be?null:"*/",lineComment:be?null:"//",fold:"brace",helperType:be?"json":"javascript",jsonldMode:ye,jsonMode:be}});t.registerHelper("wordChars","javascript",/[\w$]/);t.defineMIME("text/javascript","javascript");t.defineMIME("text/ecmascript","javascript");t.defineMIME("application/javascript","javascript");t.defineMIME("application/x-javascript","javascript");t.defineMIME("application/ecmascript","javascript");t.defineMIME("application/json",{name:"javascript",json:!0});t.defineMIME("application/x-json",{name:"javascript",json:!0});t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});t.defineMIME("text/typescript",{name:"javascript",typescript:!0});t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},{"../../lib/codemirror":9}],11:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.defineMode("xml",function(e,n){function r(t,e){function n(n){e.tokenize=n;return n(t,e)}var r=t.next();if("<"==r){if(t.eat("!")){if(t.eat("["))return t.match("CDATA[")?n(a("atom","]]>")):null;if(t.match("--"))return n(a("comment","-->"));if(t.match("DOCTYPE",!0,!0)){t.eatWhile(/[\w\._\-]/);return n(s(1))}return null}if(t.eat("?")){t.eatWhile(/[\w\._\-]/);e.tokenize=a("meta","?>");return"meta"}C=t.eat("/")?"closeTag":"openTag";e.tokenize=i;return"tag bracket"}if("&"==r){var o;o=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return o?"atom":"error"}t.eatWhile(/[^&<]/);return null}function i(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">")){e.tokenize=r;C=">"==n?"endTag":"selfcloseTag";return"tag bracket"}if("="==n){C="equals";return null}if("<"==n){e.tokenize=r;e.state=f;e.tagName=e.tagStart=null;var i=e.tokenize(t,e);return i?i+" tag error":"tag error"}if(/[\'\"]/.test(n)){e.tokenize=o(n);e.stringStartCol=t.column();return e.tokenize(t,e)}t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function o(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=i;break}return"string"};e.isInAttribute=!0;return e}function a(t,e){return function(n,i){for(;!n.eol();){if(n.match(e)){i.tokenize=r;break}n.next()}return t}}function s(t){return function(e,n){for(var i;null!=(i=e.next());){if("<"==i){n.tokenize=s(t+1);return n.tokenize(e,n)}if(">"==i){if(1==t){n.tokenize=r;break}n.tokenize=s(t-1);return n.tokenize(e,n)}}return"meta"}}function l(t,e,n){this.prev=t.context;this.tagName=e;this.indent=t.indented;this.startOfLine=n;(_.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function u(t){t.context&&(t.context=t.context.prev)}function c(t,e){for(var n;;){if(!t.context)return;n=t.context.tagName;if(!_.contextGrabbers.hasOwnProperty(n)||!_.contextGrabbers[n].hasOwnProperty(e))return;u(t)}}function f(t,e,n){if("openTag"==t){n.tagStart=e.column();return h}return"closeTag"==t?d:f}function h(t,e,n){if("word"==t){n.tagName=e.current();T="tag";return m}T="error";return h}function d(t,e,n){if("word"==t){var r=e.current();n.context&&n.context.tagName!=r&&_.implicitlyClosed.hasOwnProperty(n.context.tagName)&&u(n);if(n.context&&n.context.tagName==r){T="tag";return p}T="tag error";return g}T="error";return g}function p(t,e,n){if("endTag"!=t){T="error";return p}u(n);return f}function g(t,e,n){T="error";return p(t,e,n)}function m(t,e,n){if("word"==t){T="attribute";return v}if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,i=n.tagStart;n.tagName=n.tagStart=null;if("selfcloseTag"==t||_.autoSelfClosers.hasOwnProperty(r))c(n,r);else{c(n,r);n.context=new l(n,r,i==n.indented)}return f}T="error";return m}function v(t,e,n){if("equals"==t)return y;_.allowMissing||(T="error");return m(t,e,n)}function y(t,e,n){if("string"==t)return b;if("word"==t&&_.allowUnquoted){T="string";return m}T="error";return m(t,e,n)}function b(t,e,n){return"string"==t?b:m(t,e,n)}var x=e.indentUnit,w=n.multilineTagIndentFactor||1,S=n.multilineTagIndentPastTag;null==S&&(S=!0);var C,T,_=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},k=n.alignCDATA;return{startState:function(){return{tokenize:r,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(t,e){!e.tagName&&t.sol()&&(e.indented=t.indentation());if(t.eatSpace())return null;C=null;var n=e.tokenize(t,e);if((n||C)&&"comment"!=n){T=null;e.state=e.state(C||n,t,e);T&&(n="error"==T?n+" error":T)}return n},indent:function(e,n,o){var a=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+x;if(a&&a.noIndent)return t.Pass;if(e.tokenize!=i&&e.tokenize!=r)return o?o.match(/^(\s*)/)[0].length:0;if(e.tagName)return S?e.tagStart+e.tagName.length+2:e.tagStart+x*w;if(k&&/<!\[CDATA\[/.test(n))return 0;var s=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(s&&s[1])for(;a;){if(a.tagName==s[2]){a=a.prev;break}if(!_.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(s)for(;a;){var l=_.contextGrabbers[a.tagName];if(!l||!l.hasOwnProperty(s[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+x:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}});t.defineMIME("text/xml","xml");t.defineMIME("application/xml","xml");t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":9}],12:[function(e,n){!function(){function e(t,e){return e>t?-1:t>e?1:t>=e?0:0/0}function r(t){return null===t?0/0:+t}function i(t){return!isNaN(t)}function o(t){return{left:function(e,n,r,i){arguments.length<3&&(r=0);arguments.length<4&&(i=e.length);for(;i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){arguments.length<3&&(r=0);arguments.length<4&&(i=e.length);for(;i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function a(t){return t.length}function s(t){for(var e=1;t*e%1;)e*=10;return e}function l(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function u(){this._=Object.create(null)}function c(t){return(t+="")===hs||t[0]===ds?ds+t:t}function f(t){return(t+="")[0]===ds?t.slice(1):t}function h(t){return c(t)in this._}function d(t){return(t=c(t))in this._&&delete this._[t]}function p(){var t=[];for(var e in this._)t.push(f(e));return t}function g(){var t=0;for(var e in this._)++t;return t}function m(){for(var t in this._)return!1;return!0}function v(){this._=Object.create(null)}function y(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function b(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ps.length;r>n;++n){var i=ps[n]+e;if(i in t)return i}}function x(){}function w(){}function S(t){function e(){for(var e,r=n,i=-1,o=r.length;++i<o;)(e=r[i].on)&&e.apply(this,arguments);return t}var n=[],r=new u;e.on=function(e,i){var o,a=r.get(e);if(arguments.length<2)return a&&a.on;if(a){a.on=null;n=n.slice(0,o=n.indexOf(a)).concat(n.slice(o+1));r.remove(e)}i&&n.push(r.set(e,{on:i}));return t};return e}function C(){Ka.event.preventDefault()}function T(){for(var t,e=Ka.event;t=e.sourceEvent;)e=t;return e}function _(t){for(var e=new w,n=0,r=arguments.length;++n<r;)e[arguments[n]]=S(e);e.of=function(n,r){return function(i){try{var o=i.sourceEvent=Ka.event;i.target=t;Ka.event=i;e[i.type].apply(n,r)}finally{Ka.event=o}}};return e}function k(t){ms(t,ws);return t}function M(t){return"function"==typeof t?t:function(){return vs(t,this)}}function D(t){return"function"==typeof t?t:function(){return ys(t,this)}}function L(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function s(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}t=Ka.ns.qualify(t);return null==e?t.local?r:n:"function"==typeof e?t.local?s:a:t.local?o:i}function A(t){return t.trim().replace(/\s+/g," ")}function N(t){return new RegExp("(?:^|\\s+)"+Ka.requote(t)+"(?:\\s+|$)","g")}function E(t){return(t+"").trim().split(/^|\s+/)}function j(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=E(t).map(I);var i=t.length;return"function"==typeof e?r:n}function I(t){var e=N(t);return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);var i=n.getAttribute("class")||"";if(r){e.lastIndex=0;e.test(i)||n.setAttribute("class",A(i+" "+t))}else n.setAttribute("class",A(i.replace(e," ")))}}function P(t,e,n){function r(){this.style.removeProperty(t) }function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}return null==e?r:"function"==typeof e?o:i}function H(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return null==e?n:"function"==typeof e?i:r}function O(t){return"function"==typeof t?t:(t=Ka.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,t)}}function F(t){return{__data__:t}}function R(t){return function(){return xs(this,t)}}function W(t){arguments.length||(t=e);return function(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}}function z(t,e){for(var n=0,r=t.length;r>n;n++)for(var i,o=t[n],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,n);return t}function q(t){ms(t,Cs);return t}function U(t){var e,n;return function(r,i,o){var a,s=t[o].update,l=s.length;o!=n&&(n=o,e=0);i>=e&&(e=i+1);for(;!(a=s[e])&&++e<l;);return a}}function B(){var t=this.__transition__;t&&++t.active}function V(t,e,n){function r(){var e=this[a];if(e){this.removeEventListener(t,e,e.$);delete this[a]}}function i(){var i=l(e,Qa(arguments));r.call(this);this.addEventListener(t,this[a]=i,i.$=n);i._=e}function o(){var e,n=new RegExp("^__on([^.]+)"+Ka.requote(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i.$);delete this[r]}}var a="__on"+t,s=t.indexOf("."),l=X;s>0&&(t=t.slice(0,s));var u=_s.get(t);u&&(t=u,l=G);return s?e?i:r:e?x:o}function X(t,e){return function(n){var r=Ka.event;Ka.event=n;e[0]=this.__data__;try{t.apply(this,e)}finally{Ka.event=r}}}function G(t,e){var n=X(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(){var t=".dragsuppress-"+ ++Ms,e="click"+t,n=Ka.select(ns).on("touchmove"+t,C).on("dragstart"+t,C).on("selectstart"+t,C);if(ks){var r=es.style,i=r[ks];r[ks]="none"}return function(o){function a(){n.on(e,null)}n.on(t,null);ks&&(r[ks]=i);if(o){n.on(e,function(){C();a()},!0);setTimeout(a,0)}}}function Y(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>Ds&&(ns.scrollX||ns.scrollY)){n=Ka.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ds=!(i.f||i.e);n.remove()}Ds?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY);r=r.matrixTransform(t.getScreenCTM().inverse());return[r.x,r.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function J(){return Ka.event.changedTouches[0].identifier}function K(){return Ka.event.target}function Z(){return ns}function Q(t){return t>0?1:0>t?-1:0}function te(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function ee(t){return t>1?0:-1>t?Ls:Math.acos(t)}function ne(t){return t>1?Ns:-1>t?-Ns:Math.asin(t)}function re(t){return((t=Math.exp(t))-1/t)/2}function ie(t){return((t=Math.exp(t))+1/t)/2}function oe(t){return((t=Math.exp(2*t))-1)/(t+1)}function ae(t){return(t=Math.sin(t/2))*t}function se(){}function le(t,e,n){return this instanceof le?void(this.h=+t,this.s=+e,this.l=+n):arguments.length<2?t instanceof le?new le(t.h,t.s,t.l):Se(""+t,Ce,le):new le(t,e,n)}function ue(t,e,n){function r(t){t>360?t-=360:0>t&&(t+=360);return 60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*r(t))}var o,a;t=isNaN(t)?0:(t%=360)<0?t+360:t;e=isNaN(e)?0:0>e?0:e>1?1:e;n=0>n?0:n>1?1:n;a=.5>=n?n*(1+e):n+e-n*e;o=2*n-a;return new ye(i(t+120),i(t),i(t-120))}function ce(t,e,n){return this instanceof ce?void(this.h=+t,this.c=+e,this.l=+n):arguments.length<2?t instanceof ce?new ce(t.h,t.c,t.l):t instanceof he?pe(t.l,t.a,t.b):pe((t=Te((t=Ka.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ce(t,e,n)}function fe(t,e,n){isNaN(t)&&(t=0);isNaN(e)&&(e=0);return new he(n,Math.cos(t*=Is)*e,Math.sin(t)*e)}function he(t,e,n){return this instanceof he?void(this.l=+t,this.a=+e,this.b=+n):arguments.length<2?t instanceof he?new he(t.l,t.a,t.b):t instanceof ce?fe(t.h,t.c,t.l):Te((t=ye(t)).r,t.g,t.b):new he(t,e,n)}function de(t,e,n){var r=(t+16)/116,i=r+e/500,o=r-n/200;i=ge(i)*Vs;r=ge(r)*Xs;o=ge(o)*Gs;return new ye(ve(3.2404542*i-1.5371385*r-.4985314*o),ve(-.969266*i+1.8760108*r+.041556*o),ve(.0556434*i-.2040259*r+1.0572252*o))}function pe(t,e,n){return t>0?new ce(Math.atan2(n,e)*Ps,Math.sqrt(e*e+n*n),t):new ce(0/0,0/0,t)}function ge(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function me(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ve(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ye(t,e,n){return this instanceof ye?void(this.r=~~t,this.g=~~e,this.b=~~n):arguments.length<2?t instanceof ye?new ye(t.r,t.g,t.b):Se(""+t,ye,ue):new ye(t,e,n)}function be(t){return new ye(t>>16,t>>8&255,255&t)}function xe(t){return be(t)+""}function we(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Se(t,e,n){var r,i,o,a=0,s=0,l=0;r=/([a-z]+)\((.*)\)/i.exec(t);if(r){i=r[2].split(",");switch(r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(ke(i[0]),ke(i[1]),ke(i[2]))}}if(o=Js.get(t))return e(o.r,o.g,o.b);if(null!=t&&"#"===t.charAt(0)&&!isNaN(o=parseInt(t.slice(1),16)))if(4===t.length){a=(3840&o)>>4;a=a>>4|a;s=240&o;s=s>>4|s;l=15&o;l=l<<4|l}else if(7===t.length){a=(16711680&o)>>16;s=(65280&o)>>8;l=255&o}return e(a,s,l)}function Ce(t,e,n){var r,i,o=Math.min(t/=255,e/=255,n/=255),a=Math.max(t,e,n),s=a-o,l=(a+o)/2;if(s){i=.5>l?s/(a+o):s/(2-a-o);r=t==a?(e-n)/s+(n>e?6:0):e==a?(n-t)/s+2:(t-e)/s+4;r*=60}else{r=0/0;i=l>0&&1>l?0:r}return new le(r,i,l)}function Te(t,e,n){t=_e(t);e=_e(e);n=_e(n);var r=me((.4124564*t+.3575761*e+.1804375*n)/Vs),i=me((.2126729*t+.7151522*e+.072175*n)/Xs),o=me((.0193339*t+.119192*e+.9503041*n)/Gs);return he(116*i-16,500*(r-i),200*(i-o))}function _e(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ke(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Me(t){return"function"==typeof t?t:function(){return t}}function De(t){return t}function Le(t){return function(e,n,r){2===arguments.length&&"function"==typeof n&&(r=n,n=null);return Ae(e,n,t,r)}}function Ae(t,e,n,r){function i(){var t,e=l.status;if(!e&&Ee(l)||e>=200&&300>e||304===e){try{t=n.call(o,l)}catch(r){a.error.call(o,r);return}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=Ka.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;!ns.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest);"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()};l.onprogress=function(t){var e=Ka.event;Ka.event=t;try{a.progress.call(o,l)}finally{Ka.event=e}};o.header=function(t,e){t=(t+"").toLowerCase();if(arguments.length<2)return s[t];null==e?delete s[t]:s[t]=e+"";return o};o.mimeType=function(t){if(!arguments.length)return e;e=null==t?null:t+"";return o};o.responseType=function(t){if(!arguments.length)return u;u=t;return o};o.response=function(t){n=t;return o};["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(Qa(arguments)))}});o.send=function(n,r,i){2===arguments.length&&"function"==typeof r&&(i=r,r=null);l.open(n,t,!0);null==e||"accept"in s||(s.accept=e+",*/*");if(l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);null!=e&&l.overrideMimeType&&l.overrideMimeType(e);null!=u&&(l.responseType=u);null!=i&&o.on("error",i).on("load",function(t){i(null,t)});a.beforesend.call(o,l);l.send(null==r?null:r);return o};o.abort=function(){l.abort();return o};Ka.rebind(o,a,"on");return null==r?o:o.get(Ne(r))}function Ne(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Ee(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function je(){var t=Ie(),e=Pe()-t;if(e>24){if(isFinite(e)){clearTimeout(tl);tl=setTimeout(je,e)}Qs=0}else{Qs=1;nl(je)}}function Ie(){var t=Date.now();el=Ks;for(;el;){t>=el.t&&(el.f=el.c(t-el.t));el=el.n}return t}function Pe(){for(var t,e=Ks,n=1/0;e;)if(e.f)e=t?t.n=e.n:Ks=e.n;else{e.t<n&&(n=e.t);e=(t=e).n}Zs=t;return n}function He(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Oe(t,e){var n=Math.pow(10,3*fs(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Fe(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,o=r&&n?function(t,e){for(var i=t.length,o=[],a=0,s=r[0],l=0;i>0&&s>0;){l+s+1>e&&(s=Math.max(1,e-l));o.push(t.substring(i-=s,i+s));if((l+=s+1)>e)break;s=r[a=(a+1)%r.length]}return o.reverse().join(n)}:De;return function(t){var n=il.exec(t),r=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,g="",m="",v=!1,y=!0;h&&(h=+h.substring(1));if(u||"0"===r&&"="===a){u=r="0";a="="}switch(d){case"n":f=!0;d="g";break;case"%":p=100;m="%";d="f";break;case"p":p=100;m="%";d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0;h=0;break;case"s":p=-1;d="r"}"$"===l&&(g=i[0],m=i[1]);"r"!=d||h||(d="g");null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):("e"==d||"f"==d)&&(h=Math.max(0,Math.min(20,h))));d=ol.get(d)||Re;var b=u&&f;return function(t){var n=m;if(v&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=Ka.formatPrefix(t,h);t=l.scale(t);n=l.symbol+m}else t*=p;t=d(t,h);var x,w,S=t.lastIndexOf(".");if(0>S){var C=y?t.lastIndexOf("e"):-1;0>C?(x=t,w=""):(x=t.substring(0,C),w=t.substring(C))}else{x=t.substring(0,S);w=e+t.substring(S+1)}!u&&f&&(x=o(x,1/0));var T=g.length+x.length+w.length+(b?0:i.length),_=c>T?new Array(T=c-T+1).join(r):"";b&&(x=o(_+x,_.length?c-w.length:1/0));i+=g;t=x+w;return("<"===a?i+t+_:">"===a?_+i+t:"^"===a?_.substring(0,T>>=1)+i+t+_.substring(T):i+(b?t:_+t))+n}}}function Re(t){return t+""}function We(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ze(t,e,n){function r(e){var n=t(e),r=o(n,1);return r-e>e-n?n:r}function i(n){e(n=t(new sl(n-1)),1);return n}function o(t,n){e(t=new sl(+t),n);return t}function a(t,r,o){var a=i(t),s=[];if(o>1)for(;r>a;){n(a)%o||s.push(new Date(+a));e(a,1)}else for(;r>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,n){try{sl=We;var r=new We;r._=t;return a(r,e,n)}finally{sl=Date}}t.floor=t;t.round=r;t.ceil=i;t.offset=o;t.range=a;var l=t.utc=qe(t);l.floor=l;l.round=qe(r);l.ceil=qe(i);l.offset=qe(o);l.range=s;return t}function qe(t){return function(e,n){try{sl=We;var r=new We;r._=e;return t(r,n)._}finally{sl=Date}}}function Ue(t){function e(t){function e(e){for(var n,i,o,a=[],s=-1,l=0;++s<r;)if(37===t.charCodeAt(s)){a.push(t.slice(l,s));null!=(i=ul[n=t.charAt(++s)])&&(n=t.charAt(++s));(o=D[n])&&(n=o(e,null==i?"e"===n?" ":"0":i));a.push(n);l=s+1}a.push(t.slice(l,s));return a.join("")}var r=t.length;e.parse=function(e){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=n(r,t,e,0);if(i!=e.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var o=null!=r.Z&&sl!==We,a=new(o?We:sl);if("j"in r)a.setFullYear(r.y,0,r.j);else if("w"in r&&("W"in r||"U"in r)){a.setFullYear(r.y,0,1);a.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(a.getDay()+5)%7:r.w+7*r.U-(a.getDay()+6)%7)}else a.setFullYear(r.y,r.m,r.d);a.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L);return o?a._:a};e.toString=function(){return t};return e}function n(t,e,n,r){for(var i,o,a,s=0,l=e.length,u=n.length;l>s;){if(r>=u)return-1;i=e.charCodeAt(s++);if(37===i){a=e.charAt(s++);o=L[a in ul?e.charAt(s++):a];if(!o||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){S.lastIndex=0;var r=S.exec(e.slice(n));return r?(t.w=C.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){x.lastIndex=0;var r=x.exec(e.slice(n));return r?(t.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){k.lastIndex=0;var r=k.exec(e.slice(n));return r?(t.m=M.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=_.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,D.c.toString(),e,r)}function l(t,e,r){return n(t,D.x.toString(),e,r)}function u(t,e,r){return n(t,D.X.toString(),e,r)}function c(t,e,n){var r=b.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{sl=We;var e=new sl;e._=t;return r(e)}finally{sl=Date}}var r=e(t);n.parse=function(t){try{sl=We;var e=r.parse(t);return e&&e._}finally{sl=Date}};n.toString=r.toString;return n};e.multi=e.utc.multi=cn;var b=Ka.map(),x=Ve(g),w=Xe(g),S=Ve(m),C=Xe(m),T=Ve(v),_=Xe(v),k=Ve(y),M=Xe(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var D={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Be(t.getDate(),e,2)},e:function(t,e){return Be(t.getDate(),e,2)},H:function(t,e){return Be(t.getHours(),e,2)},I:function(t,e){return Be(t.getHours()%12||12,e,2)},j:function(t,e){return Be(1+al.dayOfYear(t),e,3)},L:function(t,e){return Be(t.getMilliseconds(),e,3)},m:function(t,e){return Be(t.getMonth()+1,e,2)},M:function(t,e){return Be(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Be(t.getSeconds(),e,2)},U:function(t,e){return Be(al.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Be(al.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Be(t.getFullYear()%100,e,2)},Y:function(t,e){return Be(t.getFullYear()%1e4,e,4)},Z:ln,"%":function(){return"%"}},L={a:r,A:i,b:o,B:a,c:s,d:en,e:en,H:rn,I:rn,j:nn,L:sn,m:tn,M:on,p:c,S:an,U:$e,w:Ge,W:Ye,x:l,X:u,y:Ke,Y:Je,Z:Ze,"%":un};return e}function Be(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(e)+i:i)}function Ve(t){return new RegExp("^(?:"+t.map(Ka.requote).join("|")+")","i")}function Xe(t){for(var e=new u,n=-1,r=t.length;++n<r;)e.set(t[n].toLowerCase(),n);return e}function Ge(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $e(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n));return r?(t.U=+r[0],n+r[0].length):-1}function Ye(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n));return r?(t.W=+r[0],n+r[0].length):-1}function Je(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ke(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.y=Qe(+r[0]),n+r[0].length):-1}function Ze(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function Qe(t){return t+(t>68?1900:2e3)}function tn(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function en(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function nn(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function rn(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function on(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function an(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function sn(t,e,n){cl.lastIndex=0;var r=cl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ln(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=fs(e)/60|0,i=fs(e)%60;return n+Be(r,"0",2)+Be(i,"0",2)}function un(t,e,n){fl.lastIndex=0;var r=fl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function cn(t){for(var e=t.length,n=-1;++n<e;)t[n][0]=this(t[n][0]);return function(e){for(var n=0,r=t[n];!r[1](e);)r=t[++n];return r[0](e)}}function fn(){}function hn(t,e,n){var r=n.s=t+e,i=r-t,o=r-i;n.t=t-o+(e-i)}function dn(t,e){t&&gl.hasOwnProperty(t.type)&&gl[t.type](t,e)}function pn(t,e,n){var r,i=-1,o=t.length-n;e.lineStart();for(;++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function gn(t,e){var n=-1,r=t.length;e.polygonStart();for(;++n<r;)pn(t[n],e,1);e.polygonEnd()}function mn(){function t(t,e){t*=Is;e=e*Is/2+Ls/4;var n=t-r,a=n>=0?1:-1,s=a*n,l=Math.cos(e),u=Math.sin(e),c=o*u,f=i*l+c*Math.cos(s),h=c*a*Math.sin(s);vl.add(Math.atan2(h,f));r=t,i=l,o=u}var e,n,r,i,o;yl.point=function(a,s){yl.point=t;r=(e=a)*Is,i=Math.cos(s=(n=s)*Is/2+Ls/4),o=Math.sin(s)};yl.lineEnd=function(){t(e,n)}}function vn(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function yn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function bn(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xn(t,e){t[0]+=e[0];t[1]+=e[1];t[2]+=e[2]}function wn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Sn(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e;t[1]/=e;t[2]/=e}function Cn(t){return[Math.atan2(t[1],t[0]),ne(t[2])]}function Tn(t,e){return fs(t[0]-e[0])<Es&&fs(t[1]-e[1])<Es}function _n(t,e){t*=Is;var n=Math.cos(e*=Is);kn(n*Math.cos(t),n*Math.sin(t),Math.sin(e))}function kn(t,e,n){++bl;wl+=(t-wl)/bl;Sl+=(e-Sl)/bl;Cl+=(n-Cl)/bl}function Mn(){function t(t,i){t*=Is;var o=Math.cos(i*=Is),a=o*Math.cos(t),s=o*Math.sin(t),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-e*l)*u+(u=e*s-n*a)*u),e*a+n*s+r*l);xl+=u;Tl+=u*(e+(e=a));_l+=u*(n+(n=s));kl+=u*(r+(r=l));kn(e,n,r)}var e,n,r;Al.point=function(i,o){i*=Is;var a=Math.cos(o*=Is);e=a*Math.cos(i);n=a*Math.sin(i);r=Math.sin(o);Al.point=t;kn(e,n,r)}}function Dn(){Al.point=_n}function Ln(){function t(t,e){t*=Is;var n=Math.cos(e*=Is),a=n*Math.cos(t),s=n*Math.sin(t),l=Math.sin(e),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,h=Math.sqrt(u*u+c*c+f*f),d=r*a+i*s+o*l,p=h&&-ee(d)/h,g=Math.atan2(h,d);Ml+=p*u;Dl+=p*c;Ll+=p*f;xl+=g;Tl+=g*(r+(r=a));_l+=g*(i+(i=s));kl+=g*(o+(o=l));kn(r,i,o)}var e,n,r,i,o;Al.point=function(a,s){e=a,n=s;Al.point=t;a*=Is;var l=Math.cos(s*=Is);r=l*Math.cos(a);i=l*Math.sin(a);o=Math.sin(s);kn(r,i,o)};Al.lineEnd=function(){t(e,n);Al.lineEnd=Dn;Al.point=_n}}function An(){return!0}function Nn(t,e,n,r,i){var o=[],a=[];t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n=t[0],r=t[e];if(Tn(n,r)){i.lineStart();for(var s=0;e>s;++s)i.point((n=t[s])[0],n[1]);i.lineEnd()}else{var l=new jn(n,t,null,!0),u=new jn(n,null,l,!1);l.o=u;o.push(l);a.push(u);l=new jn(r,t,null,!1);u=new jn(r,null,l,!0);l.o=u;o.push(l);a.push(u)}}});a.sort(e);En(o);En(a);if(o.length){for(var s=0,l=n,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,f,h=o[0];;){for(var d=h,p=!0;d.v;)if((d=d.n)===h)return;c=d.z;i.lineStart();do{d.v=d.o.v=!0;if(d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o;c=d.z;p=!p}while(!d.v);i.lineEnd()}}}function En(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;){i.n=n=t[r];n.p=i;i=n}i.n=n=t[0];n.p=i}}function jn(t,e,n,r){this.x=t;this.z=e;this.o=n;this.e=r;this.v=!1;this.n=this.p=null}function In(t,e,n,r){return function(i,o){function a(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function s(t,e){var n=i(t,e);m.point(n[0],n[1])}function l(){y.point=s;m.lineStart()}function u(){y.point=a;m.lineEnd()}function c(t,e){g.push([t,e]);var n=i(t,e);x.point(n[0],n[1])}function f(){x.lineStart();g=[]}function h(){c(g[0][0],g[0][1]);x.lineEnd();var t,e=x.clean(),n=b.buffer(),r=n.length;g.pop();p.push(g);g=null;if(r)if(1&e){t=n[0];var i,r=t.length-1,a=-1;if(r>0){w||(o.polygonStart(),w=!0);o.lineStart();for(;++a<r;)o.point((i=t[a])[0],i[1]);o.lineEnd()}}else{r>1&&2&e&&n.push(n.pop().concat(n.shift()));d.push(n.filter(Pn))}}var d,p,g,m=e(o),v=i.invert(r[0],r[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c;y.lineStart=f;y.lineEnd=h;d=[];p=[]},polygonEnd:function(){y.point=a;y.lineStart=l;y.lineEnd=u;d=Ka.merge(d);var t=zn(v,p);if(d.length){w||(o.polygonStart(),w=!0);Nn(d,On,t,n,o)}else if(t){w||(o.polygonStart(),w=!0);o.lineStart();n(null,null,1,o);o.lineEnd()}w&&(o.polygonEnd(),w=!1);d=p=null},sphere:function(){o.polygonStart();o.lineStart();n(null,null,1,o);o.lineEnd();o.polygonEnd()}},b=Hn(),x=e(b),w=!1;return y}}function Pn(t){return t.length>1}function Hn(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:x,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function On(t,e){return((t=t.x)[0]<0?t[1]-Ns-Es:Ns-t[1])-((e=e.x)[0]<0?e[1]-Ns-Es:Ns-e[1])}function Fn(t){var e,n=0/0,r=0/0,i=0/0;return{lineStart:function(){t.lineStart();e=1},point:function(o,a){var s=o>0?Ls:-Ls,l=fs(o-n);if(fs(l-Ls)<Es){t.point(n,r=(r+a)/2>0?Ns:-Ns);t.point(i,r);t.lineEnd();t.lineStart();t.point(s,r);t.point(o,r);e=0}else if(i!==s&&l>=Ls){fs(n-i)<Es&&(n-=i*Es);fs(o-s)<Es&&(o-=s*Es);r=Rn(n,r,o,a);t.point(i,r);t.lineEnd();t.lineStart();t.point(s,r);e=0}t.point(n=o,r=a);i=s},lineEnd:function(){t.lineEnd();n=r=0/0},clean:function(){return 2-e}}}function Rn(t,e,n,r){var i,o,a=Math.sin(t-n);return fs(a)>Es?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+r)/2}function Wn(t,e,n,r){var i;if(null==t){i=n*Ns;r.point(-Ls,i);r.point(0,i);r.point(Ls,i);r.point(Ls,0);r.point(Ls,-i);r.point(0,-i);r.point(-Ls,-i);r.point(-Ls,0);r.point(-Ls,i)}else if(fs(t[0]-e[0])>Es){var o=t[0]<e[0]?Ls:-Ls;i=n*o/2;r.point(-o,i);r.point(0,i);r.point(o,i)}else r.point(e[0],e[1])}function zn(t,e){var n=t[0],r=t[1],i=[Math.sin(n),-Math.cos(n),0],o=0,a=0;vl.reset();for(var s=0,l=e.length;l>s;++s){var u=e[s],c=u.length;if(c)for(var f=u[0],h=f[0],d=f[1]/2+Ls/4,p=Math.sin(d),g=Math.cos(d),m=1;;){m===c&&(m=0);t=u[m];var v=t[0],y=t[1]/2+Ls/4,b=Math.sin(y),x=Math.cos(y),w=v-h,S=w>=0?1:-1,C=S*w,T=C>Ls,_=p*b;vl.add(Math.atan2(_*S*Math.sin(C),g*x+_*Math.cos(C)));o+=T?w+S*As:w;if(T^h>=n^v>=n){var k=bn(vn(f),vn(t));Sn(k);var M=bn(i,k);Sn(M);var D=(T^w>=0?-1:1)*ne(M[2]);(r>D||r===D&&(k[0]||k[1]))&&(a+=T^w>=0?1:-1)}if(!m++)break;h=v,p=b,g=x,f=t}}return(-Es>o||Es>o&&0>vl)^1&a}function qn(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function n(t){var n,o,l,u,c;return{lineStart:function(){u=l=!1;c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=a?g?0:i(f,h):g?i(f+(0>f?Ls:-Ls),h):0;!n&&(u=l=g)&&t.lineStart();if(g!==l){d=r(n,p);if(Tn(n,d)||Tn(p,d)){p[0]+=Es;p[1]+=Es;g=e(p[0],p[1])}}if(g!==l){c=0;if(g){t.lineStart();d=r(p,n);t.point(d[0],d[1])}else{d=r(n,p);t.point(d[0],d[1]);t.lineEnd()}n=d}else if(s&&n&&a^g){var v;if(!(m&o)&&(v=r(p,n,!0))){c=0;if(a){t.lineStart();t.point(v[0][0],v[0][1]);t.point(v[1][0],v[1][1]);t.lineEnd()}else{t.point(v[1][0],v[1][1]);t.lineEnd();t.lineStart();t.point(v[0][0],v[0][1])}}}!g||n&&Tn(n,p)||t.point(p[0],p[1]);n=p,l=g,o=m},lineEnd:function(){l&&t.lineEnd();n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=vn(t),i=vn(e),a=[1,0,0],s=bn(r,i),l=yn(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=o*l/c,h=-o*u/c,d=bn(a,s),p=wn(a,f),g=wn(s,h);xn(p,g);var m=d,v=yn(p,m),y=yn(m,m),b=v*v-y*(yn(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),w=wn(m,(-v-x)/y);xn(w,p);w=Cn(w);if(!n)return w;var S,C=t[0],T=e[0],_=t[1],k=e[1];C>T&&(S=C,C=T,T=S);var M=T-C,D=fs(M-Ls)<Es,L=D||Es>M;!D&&_>k&&(S=_,_=k,k=S);if(L?D?_+k>0^w[1]<(fs(w[0]-C)<Es?_:k):_<=w[1]&&w[1]<=k:M>Ls^(C<=w[0]&&w[0]<=T)){var A=wn(m,(-v+x)/y);xn(A,p);return[w,Cn(A)]}}}function i(e,n){var r=a?t:Ls-t,i=0;-r>e?i|=1:e>r&&(i|=2);-r>n?i|=4:n>r&&(i|=8);return i}var o=Math.cos(t),a=o>0,s=fs(o)>Es,l=mr(t,6*Is);return In(e,n,l,a?[0,-t]:[-Ls,t-Ls])}function Un(t,e,n,r){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;o=t-l;if(p||!(o>0)){o/=p;if(0>p){if(h>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>h&&(h=o)}o=n-l;if(p||!(0>o)){o/=p;if(0>p){if(o>d)return;o>h&&(h=o)}else if(p>0){if(h>o)return;d>o&&(d=o)}o=e-u;if(g||!(o>0)){o/=g;if(0>g){if(h>o)return;d>o&&(d=o)}else if(g>0){if(o>d)return;o>h&&(h=o)}o=r-u;if(g||!(0>o)){o/=g;if(0>g){if(o>d)return;o>h&&(h=o)}else if(g>0){if(h>o)return;d>o&&(d=o)}h>0&&(i.a={x:l+h*p,y:u+h*g});1>d&&(i.b={x:l+d*p,y:u+d*g});return i}}}}}}function Bn(t,e,n,r){function i(r,i){return fs(r[0]-t)<Es?i>0?0:3:fs(r[0]-n)<Es?i>0?2:1:fs(r[1]-e)<Es?i>0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=m.length,r=t[1],i=0;n>i;++i)for(var o,a=1,s=m[i],l=s.length,u=s[0];l>a;++a){o=s[a];u[1]<=r?o[1]>r&&te(u,o,t)>0&&++e:o[1]<=r&&te(u,o,t)<0&&--e;u=o}return 0!==e}function u(o,s,l,u){var c=0,f=0;if(null==o||(c=i(o,l))!==(f=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&n>=i&&o>=e&&r>=o}function f(t,e){c(t,e)&&s.point(t,e)}function h(){L.point=p;m&&m.push(v=[]);T=!0;C=!1;w=S=0/0}function d(){if(g){p(y,b);x&&C&&M.rejoin();g.push(M.buffer())}L.point=f;C&&s.lineEnd()}function p(t,e){t=Math.max(-El,Math.min(El,t));e=Math.max(-El,Math.min(El,e));var n=c(t,e);m&&v.push([t,e]);if(T){y=t,b=e,x=n;T=!1;if(n){s.lineStart();s.point(t,e)}}else if(n&&C)s.point(t,e);else{var r={a:{x:w,y:S},b:{x:t,y:e}};if(D(r)){if(!C){s.lineStart();s.point(r.a.x,r.a.y)}s.point(r.b.x,r.b.y);n||s.lineEnd();_=!1}else if(n){s.lineStart();s.point(t,e);_=!1}}w=t,S=e,C=n}var g,m,v,y,b,x,w,S,C,T,_,k=s,M=Hn(),D=Un(t,e,n,r),L={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=M;g=[];m=[];_=!0},polygonEnd:function(){s=k;g=Ka.merge(g);var e=l([t,r]),n=_&&e,i=g.length;if(n||i){s.polygonStart();if(n){s.lineStart();u(null,null,1,s);s.lineEnd()}i&&Nn(g,o,e,u,s);s.polygonEnd()}g=m=v=null}};return L}}function Vn(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}t.invert&&e.invert&&(n.invert=function(n,r){return n=e.invert(n,r),n&&t.invert(n[0],n[1])});return n}function Xn(t){var e=0,n=Ls/3,r=lr(t),i=r(e,n);i.parallels=function(t){return arguments.length?r(e=t[0]*Ls/180,n=t[1]*Ls/180):[e/Ls*180,n/Ls*180]};return i}function Gn(t,e){function n(t,e){var n=Math.sqrt(o-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),a-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,o=1+r*(2*i-r),a=Math.sqrt(o)/i;n.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,ne((o-(t*t+n*n)*i*i)/(2*i))]};return n}function $n(){function t(t,e){Il+=i*t-r*e;r=t,i=e}var e,n,r,i;Rl.point=function(o,a){Rl.point=t;e=r=o,n=i=a};Rl.lineEnd=function(){t(e,n)}}function Yn(t,e){Pl>t&&(Pl=t);t>Ol&&(Ol=t);Hl>e&&(Hl=e);e>Fl&&(Fl=e)}function Jn(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e);s.point=n}function n(t,e){a.push("L",t,",",e)}function r(){s.point=t}function i(){a.push("Z")}var o=Kn(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r;s.point=t},pointRadius:function(t){o=Kn(t);return s},result:function(){if(a.length){var t=a.join("");a=[];return t}}};return s}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Zn(t,e){wl+=t;Sl+=e;++Cl}function Qn(){function t(t,r){var i=t-e,o=r-n,a=Math.sqrt(i*i+o*o);Tl+=a*(e+t)/2;_l+=a*(n+r)/2;kl+=a;Zn(e=t,n=r)}var e,n;zl.point=function(r,i){zl.point=t;Zn(e=r,n=i)}}function tr(){zl.point=Zn}function er(){function t(t,e){var n=t-r,o=e-i,a=Math.sqrt(n*n+o*o);Tl+=a*(r+t)/2;_l+=a*(i+e)/2;kl+=a;a=i*t-r*e;Ml+=a*(r+t);Dl+=a*(i+e);Ll+=3*a;Zn(r=t,i=e)}var e,n,r,i;zl.point=function(o,a){zl.point=t;Zn(e=r=o,n=i=a)};zl.lineEnd=function(){t(e,n)}}function nr(t){function e(e,n){t.moveTo(e,n);t.arc(e,n,a,0,As)}function n(e,n){t.moveTo(e,n);s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i;s.point=e},pointRadius:function(t){a=t;return s},result:x};return s}function rr(t){function e(t){return(s?r:n)(t)}function n(e){return ar(e,function(n,r){n=t(n,r);e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r);e.point(n[0],n[1])}function r(){b=0/0;T.point=o;e.lineStart()}function o(n,r){var o=vn([n,r]),a=t(n,r);i(b,x,y,w,S,C,b=a[0],x=a[1],y=n,w=o[0],S=o[1],C=o[2],s,e);e.point(b,x)}function a(){T.point=n;e.lineEnd()}function l(){r();T.point=u;T.lineEnd=c}function u(t,e){o(f=t,h=e),d=b,p=x,g=w,m=S,v=C;T.point=o}function c(){i(b,x,y,w,S,C,d,p,f,g,m,v,s,e);T.lineEnd=a;a()}var f,h,d,p,g,m,v,y,b,x,w,S,C,T={point:n,lineStart:r,lineEnd:a,polygonStart:function(){e.polygonStart();T.lineStart=l},polygonEnd:function(){e.polygonEnd();T.lineStart=r}};return T}function i(e,n,r,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-n,x=y*y+b*b;if(x>4*o&&m--){var w=s+d,S=l+p,C=u+g,T=Math.sqrt(w*w+S*S+C*C),_=Math.asin(C/=T),k=fs(fs(C)-1)<Es||fs(r-h)<Es?(r+h)/2:Math.atan2(S,w),M=t(k,_),D=M[0],L=M[1],A=D-e,N=L-n,E=b*A-y*N;if(E*E/x>o||fs((y*A+b*N)/x-.5)>.3||a>s*d+l*p+u*g){i(e,n,r,s,l,u,D,L,k,w/=T,S/=T,C,m,v);v.point(D,L);i(D,L,k,w,S,C,c,f,h,d,p,g,m,v)}}}var o=.5,a=Math.cos(30*Is),s=16;e.precision=function(t){if(!arguments.length)return Math.sqrt(o);s=(o=t*t)>0&&16;return e};return e}function ir(t){var e=rr(function(e,n){return t([e*Ps,n*Ps])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){t=s(t[0]*Is,t[1]*Is);return[t[0]*h+l,u-t[1]*h]}function n(t){t=s.invert((t[0]-l)/h,(u-t[1])/h);return t&&[t[0]*Ps,t[1]*Ps]}function r(){s=Vn(a=hr(v,y,b),o);var t=o(g,m);l=d-t[0]*h;u=p+t[1]*h;return i()}function i(){c&&(c.valid=!1,c=null);return e}var o,a,s,l,u,c,f=rr(function(t,e){t=o(t,e);return[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,x=Nl,w=De,S=null,C=null;e.stream=function(t){c&&(c.valid=!1);c=ur(x(a,f(w(t))));c.valid=!0;return c};e.clipAngle=function(t){if(!arguments.length)return S;x=null==t?(S=t,Nl):qn((S=+t)*Is);return i()};e.clipExtent=function(t){if(!arguments.length)return C;C=t;w=t?Bn(t[0][0],t[0][1],t[1][0],t[1][1]):De;return i()};e.scale=function(t){if(!arguments.length)return h;h=+t;return r()};e.translate=function(t){if(!arguments.length)return[d,p];d=+t[0];p=+t[1];return r()};e.center=function(t){if(!arguments.length)return[g*Ps,m*Ps];g=t[0]%360*Is;m=t[1]%360*Is;return r()};e.rotate=function(t){if(!arguments.length)return[v*Ps,y*Ps,b*Ps];v=t[0]%360*Is;y=t[1]%360*Is;b=t.length>2?t[2]%360*Is:0;return r()};Ka.rebind(e,f,"precision");return function(){o=t.apply(this,arguments);e.invert=o.invert&&n;return r()}}function ur(t){return ar(t,function(e,n){t.point(e*Is,n*Is)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Ls?t-As:-Ls>t?t+As:t,e]}function hr(t,e,n){return t?e||n?Vn(pr(t),gr(e,n)):pr(t):e||n?gr(e,n):fr}function dr(t){return function(e,n){return e+=t,[e>Ls?e-As:-Ls>e?e+As:e,n]}}function pr(t){var e=dr(t);e.invert=dr(-t);return e}function gr(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*o-c*a,s*r-u*i),ne(c*o+l*a)]}var r=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*r+c*i),ne(c*r-s*i)]};return n}function mr(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,o,a,s){var l=a*e;if(null!=i){i=vr(n,i);o=vr(n,o);(a>0?o>i:i>o)&&(i+=a*As)}else{i=t+a*As;o=t-.5*l}for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Cn([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function vr(t,e){var n=vn(e);n[0]-=t;Sn(n);var r=ee(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Es)%(2*Math.PI)}function yr(t,e,n){var r=Ka.range(t,e-Es,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function br(t,e,n){var r=Ka.range(t,e-Es,n).concat(e); return function(t){return r.map(function(e){return[e,t]})}}function xr(t){return t.source}function wr(t){return t.target}function Sr(t,e,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(r),s=Math.sin(r),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(n),f=a*Math.sin(n),h=2*Math.asin(Math.sqrt(ae(r-e)+i*a*ae(n-t))),d=1/Math.sin(h),p=h?function(t){var e=Math.sin(t*=h)*d,n=Math.sin(h-t)*d,r=n*l+e*c,i=n*u+e*f,a=n*o+e*s;return[Math.atan2(i,r)*Ps,Math.atan2(a,Math.sqrt(r*r+i*i))*Ps]}:function(){return[t*Ps,e*Ps]};p.distance=h;return p}function Cr(){function t(t,i){var o=Math.sin(i*=Is),a=Math.cos(i),s=fs((t*=Is)-e),l=Math.cos(s);ql+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=r*o-n*a*l)*s),n*o+r*a*l);e=t,n=o,r=a}var e,n,r;Ul.point=function(i,o){e=i*Is,n=Math.sin(o*=Is),r=Math.cos(o);Ul.point=t};Ul.lineEnd=function(){Ul.point=Ul.lineEnd=x}}function Tr(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),o=t(r*i);return[o*i*Math.sin(e),o*Math.sin(n)]}n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&n*o/r)]};return n}function _r(t,e){function n(t,e){a>0?-Ns+Es>e&&(e=-Ns+Es):e>Ns-Es&&(e=Ns-Es);var n=a/Math.pow(i(e),o);return[n*Math.sin(o*t),a-n*Math.cos(o*t)]}var r=Math.cos(t),i=function(t){return Math.tan(Ls/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),a=r*Math.pow(i(t),o)/o;if(!o)return Mr;n.invert=function(t,e){var n=a-e,r=Q(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(a/r,1/o))-Ns]};return n}function kr(t,e){function n(t,e){var n=o-e;return[n*Math.sin(i*t),o-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/i+t;if(fs(i)<Es)return cr;n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,o-Q(i)*Math.sqrt(t*t+n*n)]};return n}function Mr(t,e){return[t,Math.log(Math.tan(Ls/4+e/2))]}function Dr(t){var e,n=sr(t),r=n.scale,i=n.translate,o=n.clipExtent;n.scale=function(){var t=r.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t};n.translate=function(){var t=i.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t};n.clipExtent=function(t){var a=o.apply(n,arguments);if(a===n){if(e=null==t){var s=Ls*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(a=null);return a};return n.clipExtent(null)}function Lr(t,e){return[Math.log(Math.tan(Ls/4+e/2)),-t]}function Ar(t){return t[0]}function Nr(t){return t[1]}function Er(t){for(var e=t.length,n=[0,1],r=2,i=2;e>i;i++){for(;r>1&&te(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function jr(t,e){return t[0]-e[0]||t[1]-e[1]}function Ir(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Pr(t,e,n,r){var i=t[0],o=n[0],a=e[0]-i,s=r[0]-o,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-o))/(f*a-s*c);return[i+h*a,l+h*c]}function Hr(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Or(){ii(this);this.edge=this.site=this.circle=null}function Fr(t){var e=eu.pop()||new Or;e.site=t;return e}function Rr(t){Yr(t);Zl.remove(t);eu.push(t);ii(t)}function Wr(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},o=t.P,a=t.N,s=[t];Rr(t);for(var l=o;l.circle&&fs(n-l.circle.x)<Es&&fs(r-l.circle.cy)<Es;){o=l.P;s.unshift(l);Rr(l);l=o}s.unshift(l);Yr(l);for(var u=a;u.circle&&fs(n-u.circle.x)<Es&&fs(r-u.circle.cy)<Es;){a=u.N;s.push(u);Rr(u);u=a}s.push(u);Yr(u);var c,f=s.length;for(c=1;f>c;++c){u=s[c];l=s[c-1];ei(u.edge,l.site,u.site,i)}l=s[0];u=s[f-1];u.edge=Qr(l.site,u.site,null,i);$r(l);$r(u)}function zr(t){for(var e,n,r,i,o=t.x,a=t.y,s=Zl._;s;){r=qr(s,a)-o;if(r>Es)s=s.L;else{i=o-Ur(s,a);if(!(i>Es)){if(r>-Es){e=s.P;n=s}else if(i>-Es){e=s;n=s.N}else e=n=s;break}if(!s.R){e=s;break}s=s.R}}var l=Fr(t);Zl.insert(e,l);if(e||n)if(e!==n)if(n){Yr(e);Yr(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,g=p.x-c,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+f};ei(n.edge,u,p,x);l.edge=Qr(u,t,null,x);n.edge=Qr(t,p,null,x);$r(e);$r(n)}else l.edge=Qr(e.site,l.site);else{Yr(e);n=Fr(e.site);Zl.insert(l,n);l.edge=n.edge=Qr(e.site,l.site);$r(e);$r(n)}}function qr(t,e){var n=t.site,r=n.x,i=n.y,o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;n=a.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/o-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-o/2)))/f+r:(r+s)/2}function Ur(t,e){var n=t.N;if(n)return qr(n,e);var r=t.site;return r.y===e?r.x:1/0}function Br(t){this.site=t;this.edges=[]}function Vr(t){for(var e,n,r,i,o,a,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=Kl,m=g.length;m--;){o=g[m];if(o&&o.prepare()){s=o.edges;l=s.length;a=0;for(;l>a;){c=s[a].end(),r=c.x,i=c.y;u=s[++a%l].start(),e=u.x,n=u.y;if(fs(r-e)>Es||fs(i-n)>Es){s.splice(a,0,new ni(ti(o.site,c,fs(r-f)<Es&&p-i>Es?{x:f,y:fs(e-f)<Es?n:p}:fs(i-p)<Es&&h-r>Es?{x:fs(n-p)<Es?e:h,y:p}:fs(r-h)<Es&&i-d>Es?{x:h,y:fs(e-h)<Es?n:d}:fs(i-d)<Es&&r-f>Es?{x:fs(n-d)<Es?e:f,y:d}:null),o.site,null));++l}}}}}function Xr(t,e){return e.angle-t.angle}function Gr(){ii(this);this.x=this.y=this.arc=this.site=this.cy=null}function $r(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,h=2*(l*f-u*c);if(!(h>=-js)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=nu.pop()||new Gr;v.arc=t;v.site=i;v.x=g+a;v.y=f+Math.sqrt(g*g+m*m);v.cy=f;t.circle=v;for(var y=null,b=tu._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}tu.insert(y,v);y||(Ql=v)}}}}function Yr(t){var e=t.circle;if(e){e.P||(Ql=e.N);tu.remove(e);nu.push(e);ii(e);t.circle=null}}function Jr(t){for(var e,n=Jl,r=Un(t[0][0],t[0][1],t[1][0],t[1][1]),i=n.length;i--;){e=n[i];if(!Kr(e,t)||!r(e)||fs(e.a.x-e.b.x)<Es&&fs(e.a.y-e.b.y)<Es){e.a=e.b=null;n.splice(i,1)}}}function Kr(t,e){var n=t.b;if(n)return!0;var r,i,o=t.a,a=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,f=t.r,h=c.x,d=c.y,p=f.x,g=f.y,m=(h+p)/2,v=(d+g)/2;if(g===d){if(a>m||m>=s)return;if(h>p){if(o){if(o.y>=u)return}else o={x:m,y:l};n={x:m,y:u}}else{if(o){if(o.y<l)return}else o={x:m,y:u};n={x:m,y:l}}}else{r=(h-p)/(g-d);i=v-r*m;if(-1>r||r>1)if(h>p){if(o){if(o.y>=u)return}else o={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(o){if(o.y<l)return}else o={x:(u-i)/r,y:u};n={x:(l-i)/r,y:l}}else if(g>d){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:r*s+i};n={x:a,y:r*a+i}}}t.a=o;t.b=n;return!0}function Zr(t,e){this.l=t;this.r=e;this.a=this.b=null}function Qr(t,e,n,r){var i=new Zr(t,e);Jl.push(i);n&&ei(i,t,e,n);r&&ei(i,e,t,r);Kl[t.i].edges.push(new ni(i,t,e));Kl[e.i].edges.push(new ni(i,e,t));return i}function ti(t,e,n){var r=new Zr(t,null);r.a=e;r.b=n;Jl.push(r);return r}function ei(t,e,n,r){if(t.a||t.b)t.l===n?t.b=r:t.a=r;else{t.a=r;t.l=e;t.r=n}}function ni(t,e,n){var r=t.a,i=t.b;this.edge=t;this.site=e;this.angle=n?Math.atan2(n.y-e.y,n.x-e.x):t.l===e?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function ri(){this._=null}function ii(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function oi(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r;r.U=i;n.U=r;n.R=r.L;n.R&&(n.R.U=n);r.L=n}function ai(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r;r.U=i;n.U=r;n.L=r.R;n.L&&(n.L.U=n);r.R=n}function si(t){for(;t.L;)t=t.L;return t}function li(t,e){var n,r,i,o=t.sort(ui).pop();Jl=[];Kl=new Array(t.length);Zl=new ri;tu=new ri;for(;;){i=Ql;if(o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x)){if(o.x!==n||o.y!==r){Kl[o.i]=new Br(o);zr(o);n=o.x,r=o.y}o=t.pop()}else{if(!i)break;Wr(i.arc)}}e&&(Jr(e),Vr(e));var a={cells:Kl,edges:Jl};Zl=tu=Jl=Kl=null;return a}function ui(t,e){return e.y-t.y||e.x-t.x}function ci(t,e,n){return(t.x-n.x)*(e.y-t.y)-(t.x-e.x)*(n.y-t.y)}function fi(t){return t.x}function hi(t){return t.y}function di(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function pi(t,e,n,r,i,o){if(!t(e,n,r,i,o)){var a=.5*(n+i),s=.5*(r+o),l=e.nodes;l[0]&&pi(t,l[0],n,r,a,s);l[1]&&pi(t,l[1],a,r,i,s);l[2]&&pi(t,l[2],n,s,a,o);l[3]&&pi(t,l[3],a,s,i,o)}}function gi(t,e){t=Ka.rgb(t);e=Ka.rgb(e);var n=t.r,r=t.g,i=t.b,o=e.r-n,a=e.g-r,s=e.b-i;return function(t){return"#"+we(Math.round(n+o*t))+we(Math.round(r+a*t))+we(Math.round(i+s*t))}}function mi(t,e){var n,r={},i={};for(n in t)n in e?r[n]=bi(t[n],e[n]):i[n]=t[n];for(n in e)n in t||(i[n]=e[n]);return function(t){for(n in r)i[n]=r[n](t);return i}}function vi(t,e){t=+t,e=+e;return function(n){return t*(1-n)+e*n}}function yi(t,e){var n,r,i,o=iu.lastIndex=ou.lastIndex=0,a=-1,s=[],l=[];t+="",e+="";for(;(n=iu.exec(t))&&(r=ou.exec(e));){if((i=r.index)>o){i=e.slice(o,i);s[a]?s[a]+=i:s[++a]=i}if((n=n[0])===(r=r[0]))s[a]?s[a]+=r:s[++a]=r;else{s[++a]=null;l.push({i:a,x:vi(n,r)})}o=ou.lastIndex}if(o<e.length){i=e.slice(o);s[a]?s[a]+=i:s[++a]=i}return s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var n,r=0;e>r;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function bi(t,e){for(var n,r=Ka.interpolators.length;--r>=0&&!(n=Ka.interpolators[r](t,e)););return n}function xi(t,e){var n,r=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(n=0;s>n;++n)r.push(bi(t[n],e[n]));for(;o>n;++n)i[n]=t[n];for(;a>n;++n)i[n]=e[n];return function(t){for(n=0;s>n;++n)i[n]=r[n](t);return i}}function wi(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function Si(t){return function(e){return 1-t(1-e)}}function Ci(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Ti(t){return t*t}function _i(t){return t*t*t}function ki(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)}function Mi(t){return function(e){return Math.pow(e,t)}}function Di(t){return 1-Math.cos(t*Ns)}function Li(t){return Math.pow(2,10*(t-1))}function Ai(t){return 1-Math.sqrt(1-t*t)}function Ni(t,e){var n;arguments.length<2&&(e=.45);arguments.length?n=e/As*Math.asin(1/t):(t=1,n=e/4);return function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*As/e)}}function Ei(t){t||(t=1.70158);return function(e){return e*e*((t+1)*e-t)}}function ji(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Ii(t,e){t=Ka.hcl(t);e=Ka.hcl(e);var n=t.h,r=t.c,i=t.l,o=e.h-n,a=e.c-r,s=e.l-i;isNaN(a)&&(a=0,r=isNaN(r)?e.c:r);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360);return function(t){return fe(n+o*t,r+a*t,i+s*t)+""}}function Pi(t,e){t=Ka.hsl(t);e=Ka.hsl(e);var n=t.h,r=t.s,i=t.l,o=e.h-n,a=e.s-r,s=e.l-i;isNaN(a)&&(a=0,r=isNaN(r)?e.s:r);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360);return function(t){return ue(n+o*t,r+a*t,i+s*t)+""}}function Hi(t,e){t=Ka.lab(t);e=Ka.lab(e);var n=t.l,r=t.a,i=t.b,o=e.l-n,a=e.a-r,s=e.b-i;return function(t){return de(n+o*t,r+a*t,i+s*t)+""}}function Oi(t,e){e-=t;return function(n){return Math.round(t+e*n)}}function Fi(t){var e=[t.a,t.b],n=[t.c,t.d],r=Wi(e),i=Ri(e,n),o=Wi(zi(n,e,-i))||0;if(e[0]*n[1]<n[0]*e[1]){e[0]*=-1;e[1]*=-1;r*=-1;i*=-1}this.rotate=(r?Math.atan2(e[1],e[0]):Math.atan2(-n[0],n[1]))*Ps;this.translate=[t.e,t.f];this.scale=[r,o];this.skew=o?Math.atan2(i,o)*Ps:0}function Ri(t,e){return t[0]*e[0]+t[1]*e[1]}function Wi(t){var e=Math.sqrt(Ri(t,t));if(e){t[0]/=e;t[1]/=e}return e}function zi(t,e,n){t[0]+=n*e[0];t[1]+=n*e[1];return t}function qi(t,e){var n,r=[],i=[],o=Ka.transform(t),a=Ka.transform(e),s=o.translate,l=a.translate,u=o.rotate,c=a.rotate,f=o.skew,h=a.skew,d=o.scale,p=a.scale;if(s[0]!=l[0]||s[1]!=l[1]){r.push("translate(",null,",",null,")");i.push({i:1,x:vi(s[0],l[0])},{i:3,x:vi(s[1],l[1])})}else r.push(l[0]||l[1]?"translate("+l+")":"");if(u!=c){u-c>180?c+=360:c-u>180&&(u+=360);i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:vi(u,c)})}else c&&r.push(r.pop()+"rotate("+c+")");f!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:vi(f,h)}):h&&r.push(r.pop()+"skewX("+h+")");if(d[0]!=p[0]||d[1]!=p[1]){n=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:n-4,x:vi(d[0],p[0])},{i:n-2,x:vi(d[1],p[1])})}else(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")");n=i.length;return function(t){for(var e,o=-1;++o<n;)r[(e=i[o]).i]=e.x(t);return r.join("")}}function Ui(t,e){e=(e-=t=+t)||1/e;return function(n){return(n-t)/e}}function Bi(t,e){e=(e-=t=+t)||1/e;return function(n){return Math.max(0,Math.min(1,(n-t)/e))}}function Vi(t){for(var e=t.source,n=t.target,r=Gi(e,n),i=[e];e!==r;){e=e.parent;i.push(e)}for(var o=i.length;n!==r;){i.splice(o,0,n);n=n.parent}return i}function Xi(t){for(var e=[],n=t.parent;null!=n;){e.push(t);t=n;n=n.parent}e.push(t);return e}function Gi(t,e){if(t===e)return t;for(var n=Xi(t),r=Xi(e),i=n.pop(),o=r.pop(),a=null;i===o;){a=i;i=n.pop();o=r.pop()}return a}function $i(t){t.fixed|=2}function Yi(t){t.fixed&=-7}function Ji(t){t.fixed|=4;t.px=t.x,t.py=t.y}function Ki(t){t.fixed&=-5}function Zi(t,e,n){var r=0,i=0;t.charge=0;if(!t.leaf)for(var o,a=t.nodes,s=a.length,l=-1;++l<s;){o=a[l];if(null!=o){Zi(o,e,n);t.charge+=o.charge;r+=o.charge*o.cx;i+=o.charge*o.cy}}if(t.point){if(!t.leaf){t.point.x+=Math.random()-.5;t.point.y+=Math.random()-.5}var u=e*n[t.point.index];t.charge+=t.pointCharge=u;r+=u*t.point.x;i+=u*t.point.y}t.cx=r/t.charge;t.cy=i/t.charge}function Qi(t,e){Ka.rebind(t,e,"sort","children","value");t.nodes=t;t.links=oo;return t}function to(t,e){for(var n=[t];null!=(t=n.pop());){e(t);if((i=t.children)&&(r=i.length))for(var r,i;--r>=0;)n.push(i[r])}}function eo(t,e){for(var n=[t],r=[];null!=(t=n.pop());){r.push(t);if((o=t.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)n.push(o[a])}for(;null!=(t=r.pop());)e(t)}function no(t){return t.children}function ro(t){return t.value}function io(t,e){return e.value-t.value}function oo(t){return Ka.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function ao(t){return t.x}function so(t){return t.y}function lo(t,e,n){t.y0=e;t.y=n}function uo(t){return Ka.range(t.length)}function co(t){for(var e=-1,n=t[0].length,r=[];++e<n;)r[e]=0;return r}function fo(t){for(var e,n=1,r=0,i=t[0][1],o=t.length;o>n;++n)if((e=t[n][1])>i){r=n;i=e}return r}function ho(t){return t.reduce(po,0)}function po(t,e){return t+e[1]}function go(t,e){return mo(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function mo(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,o=[];++n<=e;)o[n]=i*n+r;return o}function vo(t){return[Ka.min(t),Ka.max(t)]}function yo(t,e){return t.value-e.value}function bo(t,e){var n=t._pack_next;t._pack_next=e;e._pack_prev=t;e._pack_next=n;n._pack_prev=e}function xo(t,e){t._pack_next=e;e._pack_prev=t}function wo(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function So(t){function e(t){c=Math.min(t.x-t.r,c);f=Math.max(t.x+t.r,f);h=Math.min(t.y-t.r,h);d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,o,a,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;n.forEach(Co);r=n[0];r.x=-r.r;r.y=0;e(r);if(u>1){i=n[1];i.x=i.r;i.y=0;e(i);if(u>2){o=n[2];ko(r,i,o);e(o);bo(r,o);r._pack_prev=o;bo(o,i);i=r._pack_next;for(a=3;u>a;a++){ko(r,i,o=n[a]);var p=0,g=1,m=1;for(s=i._pack_next;s!==i;s=s._pack_next,g++)if(wo(s,o)){p=1;break}if(1==p)for(l=r._pack_prev;l!==s._pack_prev&&!wo(l,o);l=l._pack_prev,m++);if(p){m>g||g==m&&i.r<r.r?xo(r,i=s):xo(r=l,i);a--}else{bo(r,o);i=o;e(o)}}}}var v=(c+f)/2,y=(h+d)/2,b=0;for(a=0;u>a;a++){o=n[a];o.x-=v;o.y-=y;b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y))}t.r=b;n.forEach(To)}}function Co(t){t._pack_next=t._pack_prev=t}function To(t){delete t._pack_next;delete t._pack_prev}function _o(t,e,n,r){var i=t.children;t.x=e+=r*t.x;t.y=n+=r*t.y;t.r*=r;if(i)for(var o=-1,a=i.length;++o<a;)_o(i[o],e,n,r)}function ko(t,e,n){var r=t.r+n.r,i=e.x-t.x,o=e.y-t.y;if(r&&(i||o)){var a=e.r+n.r,s=i*i+o*o;a*=a;r*=r;var l=.5+(r-a)/(2*s),u=Math.sqrt(Math.max(0,2*a*(r+s)-(r-=s)*r-a*a))/(2*s);n.x=t.x+l*i+u*o;n.y=t.y+l*o-u*i}else{n.x=t.x+r;n.y=t.y}}function Mo(t,e){return t.parent==e.parent?1:2}function Do(t){var e=t.children;return e.length?e[0]:t.t}function Lo(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function Ao(t,e,n){var r=n/(e.i-t.i);e.c-=r;e.s+=n;t.c+=r;e.z+=n;e.m+=n}function No(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;){e=i[o];e.z+=n;e.m+=n;n+=e.s+(r+=e.c)}}function Eo(t,e,n){return t.a.parent===e.parent?t.a:n}function jo(t){return 1+Ka.max(t,function(t){return t.y})}function Io(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Po(t){var e=t.children;return e&&e.length?Po(e[0]):t}function Ho(t){var e,n=t.children;return n&&(e=n.length)?Ho(n[e-1]):t}function Oo(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Fo(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];if(0>i){n+=i/2;i=0}if(0>o){r+=o/2;o=0}return{x:n,y:r,dx:i,dy:o}}function Ro(t){var e=t[0],n=t[t.length-1];return n>e?[e,n]:[n,e]}function Wo(t){return t.rangeExtent?t.rangeExtent():Ro(t.range())}function zo(t,e,n,r){var i=n(t[0],t[1]),o=r(e[0],e[1]);return function(t){return o(i(t))}}function qo(t,e){var n,r=0,i=t.length-1,o=t[r],a=t[i];if(o>a){n=r,r=i,i=n;n=o,o=a,a=n}t[r]=e.floor(o);t[i]=e.ceil(a);return t}function Uo(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:mu}function Bo(t,e,n,r){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;if(t[s]<t[0]){t=t.slice().reverse();e=e.slice().reverse()}for(;++a<=s;){i.push(n(t[a-1],t[a]));o.push(r(e[a-1],e[a]))}return function(e){var n=Ka.bisect(t,e,1,s)-1;return o[n](i[n](e))}}function Vo(t,e,n,r){function i(){var i=Math.min(t.length,e.length)>2?Bo:zo,l=r?Bi:Ui;a=i(t,e,l,n);s=i(e,t,l,bi);return o}function o(t){return a(t)}var a,s;o.invert=function(t){return s(t)};o.domain=function(e){if(!arguments.length)return t;t=e.map(Number);return i()};o.range=function(t){if(!arguments.length)return e;e=t;return i()};o.rangeRound=function(t){return o.range(t).interpolate(Oi)};o.clamp=function(t){if(!arguments.length)return r;r=t;return i()};o.interpolate=function(t){if(!arguments.length)return n;n=t;return i()};o.ticks=function(e){return Yo(t,e)};o.tickFormat=function(e,n){return Jo(t,e,n)};o.nice=function(e){Go(t,e);return i()};o.copy=function(){return Vo(t,e,n,r)};return i()}function Xo(t,e){return Ka.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Go(t,e){return qo(t,Uo($o(t,e)[2]))}function $o(t,e){null==e&&(e=10);var n=Ro(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*i;.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2);n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+.5*i;n[2]=i;return n}function Yo(t,e){return Ka.range.apply(Ka,$o(t,e))}function Jo(t,e,n){var r=$o(t,e);if(n){var i=il.exec(n);i.shift();if("s"===i[8]){var o=Ka.formatPrefix(Math.max(fs(r[0]),fs(r[1])));i[7]||(i[7]="."+Ko(o.scale(r[2])));i[8]="f";n=Ka.format(i.join(""));return function(t){return n(o.scale(t))+o.symbol}}i[7]||(i[7]="."+Zo(i[8],r));n=i.join("")}else n=",."+Ko(r[2])+"f";return Ka.format(n)}function Ko(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function Zo(t,e){var n=Ko(e[2]);return t in vu?Math.abs(n-Ko(Math.max(fs(e[0]),fs(e[1]))))+ +("e"!==t):n-2*("%"===t)}function Qo(t,e,n,r){function i(t){return(n?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}a.invert=function(e){return o(t.invert(e))};a.domain=function(e){if(!arguments.length)return r;n=e[0]>=0;t.domain((r=e.map(Number)).map(i));return a};a.base=function(n){if(!arguments.length)return e;e=+n;t.domain(r.map(i));return a};a.nice=function(){var e=qo(r.map(i),n?Math:bu);t.domain(e);r=e.map(o);return a};a.ticks=function(){var t=Ro(r),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var h=1;f>h;h++)a.push(o(u)*h);a.push(o(u))}else{a.push(o(u));for(;u++<c;)for(var h=f-1;h>0;h--)a.push(o(u)*h)}for(u=0;a[u]<s;u++);for(c=a.length;a[c-1]>l;c--);a=a.slice(u,c)}return a};a.tickFormat=function(t,e){if(!arguments.length)return yu;arguments.length<2?e=yu:"function"!=typeof e&&(e=Ka.format(e));var r,s=Math.max(.1,t/a.ticks().length),l=n?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(t){return t/o(l(i(t)+r))<=s?e(t):""}};a.copy=function(){return Qo(t.copy(),e,n,r)};return Xo(a,t)}function ta(t,e,n){function r(e){return t(i(e))}var i=ea(e),o=ea(1/e);r.invert=function(e){return o(t.invert(e))};r.domain=function(e){if(!arguments.length)return n;t.domain((n=e.map(Number)).map(i));return r};r.ticks=function(t){return Yo(n,t)};r.tickFormat=function(t,e){return Jo(n,t,e)};r.nice=function(t){return r.domain(Go(n,t))};r.exponent=function(a){if(!arguments.length)return e;i=ea(e=a);o=ea(1/e);t.domain(n.map(i));return r};r.copy=function(){return ta(t.copy(),e,n)};return Xo(r,t)}function ea(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function na(t,e){function n(n){return o[((i.get(n)||("range"===e.t?i.set(n,t.push(n)):0/0))-1)%o.length]}function r(e,n){return Ka.range(t.length).map(function(t){return e+n*t})}var i,o,a;n.domain=function(r){if(!arguments.length)return t;t=[];i=new u;for(var o,a=-1,s=r.length;++a<s;)i.has(o=r[a])||i.set(o,t.push(o));return n[e.t].apply(n,e.a)};n.range=function(t){if(!arguments.length)return o;o=t;a=0;e={t:"range",a:arguments};return n};n.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=(u-l)/(Math.max(1,t.length-1)+s);o=r(t.length<2?(l+u)/2:l+c*s/2,c);a=0;e={t:"rangePoints",a:arguments};return n};n.rangeBands=function(i,s,l){arguments.length<2&&(s=0);arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],f=i[1-u],h=(f-c)/(t.length-s+2*l);o=r(c+h*l,h);u&&o.reverse();a=h*(1-s);e={t:"rangeBands",a:arguments};return n};n.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0);arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],f=i[1-u],h=Math.floor((f-c)/(t.length-s+2*l)),d=f-c-(t.length-s)*h;o=r(c+Math.round(d/2),h);u&&o.reverse();a=Math.round(h*(1-s));e={t:"rangeRoundBands",a:arguments};return n};n.rangeBand=function(){return a};n.rangeExtent=function(){return Ro(e.a[0])};n.copy=function(){return na(t,e)};return n.domain(t)}function ra(t,n){function o(){var e=0,r=n.length;s=[];for(;++e<r;)s[e-1]=Ka.quantile(t,e/r);return a}function a(t){return isNaN(t=+t)?void 0:n[Ka.bisect(s,t)]}var s;a.domain=function(n){if(!arguments.length)return t;t=n.map(r).filter(i).sort(e);return o()};a.range=function(t){if(!arguments.length)return n;n=t;return o()};a.quantiles=function(){return s};a.invertExtent=function(e){e=n.indexOf(e);return 0>e?[0/0,0/0]:[e>0?s[e-1]:t[0],e<s.length?s[e]:t[t.length-1]]};a.copy=function(){return ra(t,n)};return o()}function ia(t,e,n){function r(e){return n[Math.max(0,Math.min(a,Math.floor(o*(e-t))))]}function i(){o=n.length/(e-t);a=n.length-1;return r}var o,a;r.domain=function(n){if(!arguments.length)return[t,e];t=+n[0];e=+n[n.length-1];return i()};r.range=function(t){if(!arguments.length)return n;n=t;return i()};r.invertExtent=function(e){e=n.indexOf(e);e=0>e?0/0:e/o+t;return[e,e+1/o]};r.copy=function(){return ia(t,e,n)};return i()}function oa(t,e){function n(n){return n>=n?e[Ka.bisect(t,n)]:void 0}n.domain=function(e){if(!arguments.length)return t;t=e;return n};n.range=function(t){if(!arguments.length)return e;e=t;return n};n.invertExtent=function(n){n=e.indexOf(n);return[t[n-1],t[n]]};n.copy=function(){return oa(t,e)};return n}function aa(t){function e(t){return+t}e.invert=e;e.domain=e.range=function(n){if(!arguments.length)return t;t=n.map(e);return e};e.ticks=function(e){return Yo(t,e)};e.tickFormat=function(e,n){return Jo(t,e,n)};e.copy=function(){return aa(t)};return e}function sa(t){return t.innerRadius}function la(t){return t.outerRadius}function ua(t){return t.startAngle}function ca(t){return t.endAngle}function fa(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Me(n),p=Me(r);++f<h;)if(i.call(this,l=e[f],f))c.push([+d.call(this,l,f),+p.call(this,l,f)]);else if(c.length){a();c=[]}c.length&&a();return u.length?u.join(""):null}var n=Ar,r=Nr,i=An,o=ha,a=o.key,s=.7;e.x=function(t){if(!arguments.length)return n;n=t;return e};e.y=function(t){if(!arguments.length)return r;r=t;return e};e.defined=function(t){if(!arguments.length)return i;i=t;return e};e.interpolate=function(t){if(!arguments.length)return a;a="function"==typeof t?o=t:(o=ku.get(t)||ha).key;return e};e.tension=function(t){if(!arguments.length)return s;s=t;return e};return e}function ha(t){return t.join("L")}function da(t){return ha(t)+"Z"}function pa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r[0]+(r=t[e])[0])/2,"V",r[1]);n>1&&i.push("H",r[0]);return i.join("")}function ga(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("V",(r=t[e])[1],"H",r[0]);return i.join("")}function ma(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r=t[e])[0],"V",r[1]);return i.join("")}function va(t,e){return t.length<4?ha(t):t[1]+xa(t.slice(1,t.length-1),wa(t,e))}function ya(t,e){return t.length<3?ha(t):t[0]+xa((t.push(t[0]),t),wa([t[t.length-2]].concat(t,[t[1]]),e))}function ba(t,e){return t.length<3?ha(t):t[0]+xa(t,wa(t,e))}function xa(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return ha(t);var n=t.length!=e.length,r="",i=t[0],o=t[1],a=e[0],s=a,l=1;if(n){r+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1];i=t[1];l=2}if(e.length>1){s=e[1];o=t[l];l++;r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u<e.length;u++,l++){o=t[l];s=e[u];r+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}}if(n){var c=t[l];r+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+c[0]+","+c[1]}return r}function wa(t,e){for(var n,r=[],i=(1-e)/2,o=t[0],a=t[1],s=1,l=t.length;++s<l;){n=o;o=a;a=t[s];r.push([i*(a[0]-n[0]),i*(a[1]-n[1])])}return r}function Sa(t){if(t.length<3)return ha(t);var e=1,n=t.length,r=t[0],i=r[0],o=r[1],a=[i,i,i,(r=t[1])[0]],s=[o,o,o,r[1]],l=[i,",",o,"L",ka(Lu,a),",",ka(Lu,s)];t.push(t[n-1]);for(;++e<=n;){r=t[e];a.shift();a.push(r[0]);s.shift();s.push(r[1]);Ma(l,a,s)}t.pop();l.push("L",r);return l.join("")}function Ca(t){if(t.length<4)return ha(t);for(var e,n=[],r=-1,i=t.length,o=[0],a=[0];++r<3;){e=t[r];o.push(e[0]);a.push(e[1])}n.push(ka(Lu,o)+","+ka(Lu,a));--r;for(;++r<i;){e=t[r];o.shift();o.push(e[0]);a.shift();a.push(e[1]);Ma(n,o,a)}return n.join("")}function Ta(t){for(var e,n,r=-1,i=t.length,o=i+4,a=[],s=[];++r<4;){n=t[r%i];a.push(n[0]);s.push(n[1])}e=[ka(Lu,a),",",ka(Lu,s)];--r;for(;++r<o;){n=t[r%i];a.shift();a.push(n[0]);s.shift();s.push(n[1]);Ma(e,a,s)}return e.join("")}function _a(t,e){var n=t.length-1;if(n)for(var r,i,o=t[0][0],a=t[0][1],s=t[n][0]-o,l=t[n][1]-a,u=-1;++u<=n;){r=t[u];i=u/n;r[0]=e*r[0]+(1-e)*(o+i*s);r[1]=e*r[1]+(1-e)*(a+i*l)}return Sa(t)}function ka(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ma(t,e,n){t.push("C",ka(Mu,e),",",ka(Mu,n),",",ka(Du,e),",",ka(Du,n),",",ka(Lu,e),",",ka(Lu,n))}function Da(t,e){return(e[1]-t[1])/(e[0]-t[0])}function La(t){for(var e=0,n=t.length-1,r=[],i=t[0],o=t[1],a=r[0]=Da(i,o);++e<n;)r[e]=(a+(a=Da(i=o,o=t[e+1])))/2;r[e]=a;return r}function Aa(t){for(var e,n,r,i,o=[],a=La(t),s=-1,l=t.length-1;++s<l;){e=Da(t[s],t[s+1]);if(fs(e)<Es)a[s]=a[s+1]=0;else{n=a[s]/e;r=a[s+1]/e;i=n*n+r*r;if(i>9){i=3*e/Math.sqrt(i);a[s]=i*n;a[s+1]=i*r}}}s=-1;for(;++s<=l;){i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s]));o.push([i||0,a[s]*i||0])}return o}function Na(t){return t.length<3?ha(t):t[0]+xa(t,Aa(t))}function Ea(t){for(var e,n,r,i=-1,o=t.length;++i<o;){e=t[i];n=e[0];r=e[1]+Tu;e[0]=n*Math.cos(r);e[1]=n*Math.sin(r)}return t}function ja(t){function e(e){function l(){g.push("M",s(t(v),f),c,u(t(m.reverse()),f),"Z")}for(var h,d,p,g=[],m=[],v=[],y=-1,b=e.length,x=Me(n),w=Me(i),S=n===r?function(){return d}:Me(r),C=i===o?function(){return p}:Me(o);++y<b;)if(a.call(this,h=e[y],y)){m.push([d=+x.call(this,h,y),p=+w.call(this,h,y)]);v.push([+S.call(this,h,y),+C.call(this,h,y)])}else if(m.length){l();m=[];v=[]}m.length&&l();return g.length?g.join(""):null}var n=Ar,r=Ar,i=0,o=Nr,a=An,s=ha,l=s.key,u=s,c="L",f=.7;e.x=function(t){if(!arguments.length)return r;n=r=t;return e};e.x0=function(t){if(!arguments.length)return n;n=t;return e};e.x1=function(t){if(!arguments.length)return r;r=t;return e};e.y=function(t){if(!arguments.length)return o;i=o=t;return e};e.y0=function(t){if(!arguments.length)return i;i=t;return e};e.y1=function(t){if(!arguments.length)return o;o=t;return e};e.defined=function(t){if(!arguments.length)return a;a=t;return e};e.interpolate=function(t){if(!arguments.length)return l;l="function"==typeof t?s=t:(s=ku.get(t)||ha).key;u=s.reverse||s;c=s.closed?"M":"L";return e};e.tension=function(t){if(!arguments.length)return f;f=t;return e};return e}function Ia(t){return t.radius}function Pa(t){return[t.x,t.y]}function Ha(t){return function(){var e=t.apply(this,arguments),n=e[0],r=e[1]+Tu;return[n*Math.cos(r),n*Math.sin(r)]}}function Oa(){return 64}function Fa(){return"circle"}function Ra(t){var e=Math.sqrt(t/Ls);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Wa(t,e){ms(t,Pu);t.id=e;return t}function za(t,e,n,r){var i=t.id;return z(t,"function"==typeof n?function(t,o,a){t.__transition__[i].tween.set(e,r(n.call(t,t.__data__,o,a)))}:(n=r(n),function(t){t.__transition__[i].tween.set(e,n)}))}function qa(t){null==t&&(t="");return function(){this.textContent=t}}function Ua(t,e,n,r){var i=t.__transition__||(t.__transition__={active:0,count:0}),o=i[n];if(!o){var a=r.time;o=i[n]={tween:new u,time:a,ease:r.ease,delay:r.delay,duration:r.duration};++i.count;Ka.timer(function(r){function s(r){if(i.active>n)return u();i.active=n;o.event&&o.event.start.call(t,c,e);o.tween.forEach(function(n,r){(r=r.call(t,c,e))&&g.push(r)});Ka.timer(function(){p.c=l(r||1)?An:l;return 1},0,a)}function l(r){if(i.active!==n)return u();for(var a=r/d,s=f(a),l=g.length;l>0;)g[--l].call(t,s);if(a>=1){o.event&&o.event.end.call(t,c,e);return u()}}function u(){--i.count?delete i[n]:delete t.__transition__;return 1}var c=t.__data__,f=o.ease,h=o.delay,d=o.duration,p=el,g=[];p.t=h+a;if(r>=h)return s(r-h);p.c=s;return void 0},0,a)}}function Ba(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function Va(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function Xa(t){return t.toISOString()}function Ga(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,o=Ka.bisect(Bu,i);return o==Bu.length?[e.year,$o(t.map(function(t){return t/31536e6}),n)[2]]:o?e[i/Bu[o-1]<Bu[o]/i?o-1:o]:[Gu,$o(t,n)[2]]}r.invert=function(e){return $a(t.invert(e))};r.domain=function(e){if(!arguments.length)return t.domain().map($a);t.domain(e);return r};r.nice=function(t,e){function n(n){return!isNaN(n)&&!t.range(n,$a(+n+1),e).length}var o=r.domain(),a=Ro(o),s=null==t?i(a,10):"number"==typeof t&&i(a,t);s&&(t=s[0],e=s[1]);return r.domain(qo(o,e>1?{floor:function(e){for(;n(e=t.floor(e));)e=$a(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=$a(+e+1);return e}}:t))};r.ticks=function(t,e){var n=Ro(r.domain()),o=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];o&&(t=o[0],e=o[1]);return t.range(n[0],$a(+n[1]+1),1>e?1:e)};r.tickFormat=function(){return n};r.copy=function(){return Ga(t.copy(),e,n)};return Xo(r,t)}function $a(t){return new Date(t)}function Ya(t){return JSON.parse(t.responseText)}function Ja(t){var e=ts.createRange();e.selectNode(ts.body);return e.createContextualFragment(t.responseText)}var Ka={version:"3.4.13"};Date.now||(Date.now=function(){return+new Date});var Za=[].slice,Qa=function(t){return Za.call(t)},ts=document,es=ts.documentElement,ns=window;try{Qa(es.childNodes)[0].nodeType}catch(rs){Qa=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}try{ts.createElement("div").style.setProperty("opacity",0,"")}catch(is){var os=ns.Element.prototype,as=os.setAttribute,ss=os.setAttributeNS,ls=ns.CSSStyleDeclaration.prototype,us=ls.setProperty;os.setAttribute=function(t,e){as.call(this,t,e+"")};os.setAttributeNS=function(t,e,n){ss.call(this,t,e,n+"")};ls.setProperty=function(t,e,n){us.call(this,t,e+"",n)}}Ka.ascending=e;Ka.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:0/0};Ka.min=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o&&!(null!=(n=t[i])&&n>=n);)n=void 0; for(;++i<o;)null!=(r=t[i])&&n>r&&(n=r)}else{for(;++i<o&&!(null!=(n=e.call(t,t[i],i))&&n>=n);)n=void 0;for(;++i<o;)null!=(r=e.call(t,t[i],i))&&n>r&&(n=r)}return n};Ka.max=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o&&!(null!=(n=t[i])&&n>=n);)n=void 0;for(;++i<o;)null!=(r=t[i])&&r>n&&(n=r)}else{for(;++i<o&&!(null!=(n=e.call(t,t[i],i))&&n>=n);)n=void 0;for(;++i<o;)null!=(r=e.call(t,t[i],i))&&r>n&&(n=r)}return n};Ka.extent=function(t,e){var n,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o<a&&!(null!=(n=i=t[o])&&n>=n);)n=i=void 0;for(;++o<a;)if(null!=(r=t[o])){n>r&&(n=r);r>i&&(i=r)}}else{for(;++o<a&&!(null!=(n=i=e.call(t,t[o],o))&&n>=n);)n=void 0;for(;++o<a;)if(null!=(r=e.call(t,t[o],o))){n>r&&(n=r);r>i&&(i=r)}}return[n,i]};Ka.sum=function(t,e){var n,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)i(n=+t[a])&&(r+=n);else for(;++a<o;)i(n=+e.call(t,t[a],a))&&(r+=n);return r};Ka.mean=function(t,e){var n,o=0,a=t.length,s=-1,l=a;if(1===arguments.length)for(;++s<a;)i(n=r(t[s]))?o+=n:--l;else for(;++s<a;)i(n=r(e.call(t,t[s],s)))?o+=n:--l;return l?o/l:void 0};Ka.quantile=function(t,e){var n=(t.length-1)*e+1,r=Math.floor(n),i=+t[r-1],o=n-r;return o?i+o*(t[r]-i):i};Ka.median=function(t,n){var o,a=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)i(o=r(t[l]))&&a.push(o);else for(;++l<s;)i(o=r(n.call(t,t[l],l)))&&a.push(o);return a.length?Ka.quantile(a.sort(e),.5):void 0};var cs=o(e);Ka.bisectLeft=cs.left;Ka.bisect=Ka.bisectRight=cs.right;Ka.bisector=function(t){return o(1===t.length?function(n,r){return e(t(n),r)}:t)};Ka.shuffle=function(t){for(var e,n,r=t.length;r;){n=Math.random()*r--|0;e=t[r],t[r]=t[n],t[n]=e}return t};Ka.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r};Ka.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],o=new Array(0>r?0:r);r>n;)o[n]=[e=i,i=t[++n]];return o};Ka.zip=function(){if(!(r=arguments.length))return[];for(var t=-1,e=Ka.min(arguments,a),n=new Array(e);++t<e;)for(var r,i=-1,o=n[t]=new Array(r);++i<r;)o[i]=arguments[i][t];return n};Ka.transpose=function(t){return Ka.zip.apply(Ka,t)};Ka.keys=function(t){var e=[];for(var n in t)e.push(n);return e};Ka.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e};Ka.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e};Ka.merge=function(t){for(var e,n,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;n=new Array(a);for(;--i>=0;){r=t[i];e=r.length;for(;--e>=0;)n[--a]=r[e]}return n};var fs=Math.abs;Ka.range=function(t,e,n){if(arguments.length<3){n=1;if(arguments.length<2){e=t;t=0}}if((e-t)/n===1/0)throw new Error("infinite range");var r,i=[],o=s(fs(n)),a=-1;t*=o,e*=o,n*=o;if(0>n)for(;(r=t+n*++a)>e;)i.push(r/o);else for(;(r=t+n*++a)<e;)i.push(r/o);return i};Ka.map=function(t){var e=new u;if(t instanceof u)t.forEach(function(t,n){e.set(t,n)});else for(var n in t)e.set(n,t[n]);return e};var hs="__proto__",ds="\x00";l(u,{has:h,get:function(t){return this._[c(t)]},set:function(t,e){return this._[c(t)]=e},remove:d,keys:p,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:f(e),value:this._[e]});return t},size:g,empty:m,forEach:function(t){for(var e in this._)t.call(this,f(e),this._[e])}});Ka.nest=function(){function t(e,a,s){if(s>=o.length)return r?r.call(i,a):n?a.sort(n):a;for(var l,c,f,h,d=-1,p=a.length,g=o[s++],m=new u;++d<p;)(h=m.get(l=g(c=a[d])))?h.push(c):m.set(l,[c]);if(e){c=e();f=function(n,r){c.set(n,t(e,r,s))}}else{c={};f=function(n,r){c[n]=t(e,r,s)}}m.forEach(f);return c}function e(t,n){if(n>=o.length)return t;var r=[],i=a[n++];t.forEach(function(t,i){r.push({key:t,values:e(i,n)})});return i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},o=[],a=[];i.map=function(e,n){return t(n,e,0)};i.entries=function(n){return e(t(Ka.map,n,0),0)};i.key=function(t){o.push(t);return i};i.sortKeys=function(t){a[o.length-1]=t;return i};i.sortValues=function(t){n=t;return i};i.rollup=function(t){r=t;return i};return i};Ka.set=function(t){var e=new v;if(t)for(var n=0,r=t.length;r>n;++n)e.add(t[n]);return e};l(v,{has:h,add:function(t){this._[c(t+="")]=!0;return t},remove:d,values:p,size:g,empty:m,forEach:function(t){for(var e in this._)t.call(this,f(e))}});Ka.behavior={};Ka.rebind=function(t,e){for(var n,r=1,i=arguments.length;++r<i;)t[n=arguments[r]]=y(t,e,e[n]);return t};var ps=["webkit","ms","moz","Moz","o","O"];Ka.dispatch=function(){for(var t=new w,e=-1,n=arguments.length;++e<n;)t[arguments[e]]=S(t);return t};w.prototype.on=function(t,e){var n=t.indexOf("."),r="";if(n>=0){r=t.slice(n+1);t=t.slice(0,n)}if(t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}};Ka.event=null;Ka.requote=function(t){return t.replace(gs,"\\$&")};var gs=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ms={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},vs=function(t,e){return e.querySelector(t)},ys=function(t,e){return e.querySelectorAll(t)},bs=es.matches||es[b(es,"matchesSelector")],xs=function(t,e){return bs.call(t,e)};if("function"==typeof Sizzle){vs=function(t,e){return Sizzle(t,e)[0]||null};ys=Sizzle;xs=Sizzle.matchesSelector}Ka.selection=function(){return Ts};var ws=Ka.selection.prototype=[];ws.select=function(t){var e,n,r,i,o=[];t=M(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]);e.parentNode=(r=this[a]).parentNode;for(var l=-1,u=r.length;++l<u;)if(i=r[l]){e.push(n=t.call(i,i.__data__,l,a));n&&"__data__"in i&&(n.__data__=i.__data__)}else e.push(null)}return k(o)};ws.selectAll=function(t){var e,n,r=[];t=D(t);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],s=-1,l=a.length;++s<l;)if(n=a[s]){r.push(e=Qa(t.call(n,n.__data__,s,i)));e.parentNode=n}return k(r)};var Ss={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Ka.ns={prefix:Ss,qualify:function(t){var e=t.indexOf(":"),n=t;if(e>=0){n=t.slice(0,e);t=t.slice(e+1)}return Ss.hasOwnProperty(n)?{space:Ss[n],local:t}:t}};ws.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();t=Ka.ns.qualify(t);return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(L(e,t[e]));return this}return this.each(L(t,e))};ws.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=E(t)).length,i=-1;if(e=n.classList){for(;++i<r;)if(!e.contains(t[i]))return!1}else{e=n.getAttribute("class");for(;++i<r;)if(!N(t[i]).test(e))return!1}return!0}for(e in t)this.each(j(e,t[e]));return this}return this.each(j(t,e))};ws.style=function(t,e,n){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(e="");for(n in t)this.each(P(n,t[n],e));return this}if(2>r)return ns.getComputedStyle(this.node(),null).getPropertyValue(t);n=""}return this.each(P(t,e,n))};ws.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(H(e,t[e]));return this}return this.each(H(t,e))};ws.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent};ws.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML};ws.append=function(t){t=O(t);return this.select(function(){return this.appendChild(t.apply(this,arguments))})};ws.insert=function(t,e){t=O(t);e=M(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})};ws.remove=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})};ws.data=function(t,e){function n(t,n){var r,i,o,a=t.length,f=n.length,h=Math.min(a,f),d=new Array(f),p=new Array(f),g=new Array(a);if(e){var m,v=new u,y=new Array(a);for(r=-1;++r<a;){v.has(m=e.call(i=t[r],i.__data__,r))?g[r]=i:v.set(m,i);y[r]=m}for(r=-1;++r<f;){if(i=v.get(m=e.call(n,o=n[r],r))){if(i!==!0){d[r]=i;i.__data__=o}}else p[r]=F(o);v.set(m,!0)}for(r=-1;++r<a;)v.get(y[r])!==!0&&(g[r]=t[r])}else{for(r=-1;++r<h;){i=t[r];o=n[r];if(i){i.__data__=o;d[r]=i}else p[r]=F(o)}for(;f>r;++r)p[r]=F(n[r]);for(;a>r;++r)g[r]=t[r]}p.update=d;p.parentNode=d.parentNode=g.parentNode=t.parentNode;s.push(p);l.push(d);c.push(g)}var r,i,o=-1,a=this.length;if(!arguments.length){t=new Array(a=(r=this[0]).length);for(;++o<a;)(i=r[o])&&(t[o]=i.__data__);return t}var s=q([]),l=k([]),c=k([]);if("function"==typeof t)for(;++o<a;)n(r=this[o],t.call(r,r.parentNode.__data__,o));else for(;++o<a;)n(r=this[o],t);l.enter=function(){return s};l.exit=function(){return c};return l};ws.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")};ws.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=R(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);e.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return k(i)};ws.order=function(){for(var t=-1,e=this.length;++t<e;)for(var n,r=this[t],i=r.length-1,o=r[i];--i>=0;)if(n=r[i]){o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o);o=n}return this};ws.sort=function(t){t=W.apply(this,arguments);for(var e=-1,n=this.length;++e<n;)this[e].sort(t);return this.order()};ws.each=function(t){return z(this,function(e,n,r){t.call(e,e.__data__,n,r)})};ws.call=function(t){var e=Qa(arguments);t.apply(e[0]=this,e);return this};ws.empty=function(){return!this.node()};ws.node=function(){for(var t=0,e=this.length;e>t;t++)for(var n=this[t],r=0,i=n.length;i>r;r++){var o=n[r];if(o)return o}return null};ws.size=function(){var t=0;z(this,function(){++t});return t};var Cs=[];Ka.selection.enter=q;Ka.selection.enter.prototype=Cs;Cs.append=ws.append;Cs.empty=ws.empty;Cs.node=ws.node;Cs.call=ws.call;Cs.size=ws.size;Cs.select=function(t){for(var e,n,r,i,o,a=[],s=-1,l=this.length;++s<l;){r=(i=this[s]).update;a.push(e=[]);e.parentNode=i.parentNode;for(var u=-1,c=i.length;++u<c;)if(o=i[u]){e.push(r[u]=n=t.call(i.parentNode,o.__data__,u,s));n.__data__=o.__data__}else e.push(null)}return k(a)};Cs.insert=function(t,e){arguments.length<2&&(e=U(this));return ws.insert.call(this,t,e)};ws.transition=function(){for(var t,e,n=Nu||++Hu,r=[],i=Eu||{time:Date.now(),ease:ki,delay:0,duration:250},o=-1,a=this.length;++o<a;){r.push(t=[]);for(var s=this[o],l=-1,u=s.length;++l<u;){(e=s[l])&&Ua(e,l,n,i);t.push(e)}}return Wa(r,n)};ws.interrupt=function(){return this.each(B)};Ka.select=function(t){var e=["string"==typeof t?vs(t,ts):t];e.parentNode=es;return k([e])};Ka.selectAll=function(t){var e=Qa("string"==typeof t?ys(t,ts):t);e.parentNode=es;return k([e])};var Ts=Ka.select(es);ws.on=function(t,e,n){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(e=!1);for(n in t)this.each(V(n,t[n],e));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;n=!1}return this.each(V(t,e,n))};var _s=Ka.map({mouseenter:"mouseover",mouseleave:"mouseout"});_s.forEach(function(t){"on"+t in ts&&_s.remove(t)});var ks="onselectstart"in ts?null:b(es.style,"userSelect"),Ms=0;Ka.mouse=function(t){return Y(t,T())};var Ds=/WebKit/.test(ns.navigator.userAgent)?-1:0;Ka.touch=function(t,e,n){arguments.length<3&&(n=e,e=T().changedTouches);if(e)for(var r,i=0,o=e.length;o>i;++i)if((r=e[i]).identifier===n)return Y(t,r)};Ka.behavior.drag=function(){function t(){this.on("mousedown.drag",i).on("touchstart.drag",o)}function e(t,e,i,o,a){return function(){function s(){var t,n,r=e(h,g);if(r){t=r[0]-b[0];n=r[1]-b[1];p|=t|n;b=r;d({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:t,dy:n})}}function l(){if(e(h,g)){v.on(o+m,null).on(a+m,null);y(p&&Ka.event.target===f);d({type:"dragend"})}}var u,c=this,f=Ka.event.target,h=c.parentNode,d=n.of(c,arguments),p=0,g=t(),m=".drag"+(null==g?"":"-"+g),v=Ka.select(i()).on(o+m,s).on(a+m,l),y=$(),b=e(h,g);if(r){u=r.apply(c,arguments);u=[u.x-b[0],u.y-b[1]]}else u=[0,0];d({type:"dragstart"})}}var n=_(t,"drag","dragstart","dragend"),r=null,i=e(x,Ka.mouse,Z,"mousemove","mouseup"),o=e(J,Ka.touch,K,"touchmove","touchend");t.origin=function(e){if(!arguments.length)return r;r=e;return t};return Ka.rebind(t,n,"on")};Ka.touches=function(t,e){arguments.length<2&&(e=T().touches);return e?Qa(e).map(function(e){var n=Y(t,e);n.identifier=e.identifier;return n}):[]};var Ls=Math.PI,As=2*Ls,Ns=Ls/2,Es=1e-6,js=Es*Es,Is=Ls/180,Ps=180/Ls,Hs=Math.SQRT2,Os=2,Fs=4;Ka.interpolateZoom=function(t,e){function n(t){var e=t*y;if(v){var n=ie(g),a=o/(Os*h)*(n*oe(Hs*e+g)-re(g));return[r+a*u,i+a*c,o*n/ie(Hs*e+g)]}return[r+t*u,i+t*c,o*Math.exp(Hs*e)]}var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2],u=a-r,c=s-i,f=u*u+c*c,h=Math.sqrt(f),d=(l*l-o*o+Fs*f)/(2*o*Os*h),p=(l*l-o*o-Fs*f)/(2*l*Os*h),g=Math.log(Math.sqrt(d*d+1)-d),m=Math.log(Math.sqrt(p*p+1)-p),v=m-g,y=(v||Math.log(l/o))/Hs;n.duration=1e3*y;return n};Ka.behavior.zoom=function(){function t(t){t.on(M,u).on(zs+".zoom",f).on("dblclick.zoom",h).on(A,c)}function e(t){return[(t[0]-S.x)/S.k,(t[1]-S.y)/S.k]}function n(t){return[t[0]*S.k+S.x,t[1]*S.k+S.y]}function r(t){S.k=Math.max(k[0],Math.min(k[1],t))}function i(t,e){e=n(e);S.x+=t[0]-e[0];S.y+=t[1]-e[1]}function o(){b&&b.domain(y.range().map(function(t){return(t-S.x)/S.k}).map(y.invert));w&&w.domain(x.range().map(function(t){return(t-S.y)/S.k}).map(x.invert))}function a(t){t({type:"zoomstart"})}function s(t){o();t({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function l(t){t({type:"zoomend"})}function u(){function t(){c=1;i(Ka.mouse(r),h);s(u)}function n(){f.on(D,null).on(L,null);d(c&&Ka.event.target===o);l(u)}var r=this,o=Ka.event.target,u=N.of(r,arguments),c=0,f=Ka.select(ns).on(D,t).on(L,n),h=e(Ka.mouse(r)),d=$();B.call(r);a(u)}function c(){function t(){var t=Ka.touches(d);h=S.k;t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))});return t}function n(){var e=Ka.event.target;Ka.select(e).on(b,o).on(x,f);w.push(e);for(var n=Ka.event.changedTouches,a=0,l=n.length;l>a;++a)g[n[a].identifier]=null;var u=t(),c=Date.now();if(1===u.length){if(500>c-v){var h=u[0],d=g[h.identifier];r(2*S.k);i(h,d);C();s(p)}v=c}else if(u.length>1){var h=u[0],y=u[1],T=h[0]-y[0],_=h[1]-y[1];m=T*T+_*_}}function o(){for(var t,e,n,o,a=Ka.touches(d),l=0,u=a.length;u>l;++l,o=null){n=a[l];if(o=g[n.identifier]){if(e)break;t=n,e=o}}if(o){var c=(c=n[0]-t[0])*c+(c=n[1]-t[1])*c,f=m&&Math.sqrt(c/m);t=[(t[0]+n[0])/2,(t[1]+n[1])/2];e=[(e[0]+o[0])/2,(e[1]+o[1])/2];r(f*h)}v=null;i(t,e);s(p)}function f(){if(Ka.event.touches.length){for(var e=Ka.event.changedTouches,n=0,r=e.length;r>n;++n)delete g[e[n].identifier];for(var i in g)return void t()}Ka.selectAll(w).on(y,null);T.on(M,u).on(A,c);_();l(p)}var h,d=this,p=N.of(d,arguments),g={},m=0,y=".zoom-"+Ka.event.changedTouches[0].identifier,b="touchmove"+y,x="touchend"+y,w=[],T=Ka.select(d),_=$();B.call(d);n();a(p);T.on(M,null).on(A,n)}function f(){var t=N.of(this,arguments);m?clearTimeout(m):(d=e(p=g||Ka.mouse(this)),B.call(this),a(t));m=setTimeout(function(){m=null;l(t)},50);C();r(Math.pow(2,.002*Rs())*S.k);i(p,d);s(t)}function h(){var t=N.of(this,arguments),n=Ka.mouse(this),o=e(n),u=Math.log(S.k)/Math.LN2;a(t);r(Math.pow(2,Ka.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1));i(n,o);s(t);l(t)}var d,p,g,m,v,y,b,x,w,S={x:0,y:0,k:1},T=[960,500],k=Ws,M="mousedown.zoom",D="mousemove.zoom",L="mouseup.zoom",A="touchstart.zoom",N=_(t,"zoomstart","zoom","zoomend");t.event=function(t){t.each(function(){var t=N.of(this,arguments),e=S;if(Nu)Ka.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1};a(t)}).tween("zoom:zoom",function(){var n=T[0],r=T[1],i=n/2,o=r/2,a=Ka.interpolateZoom([(i-S.x)/S.k,(o-S.y)/S.k,n/S.k],[(i-e.x)/e.k,(o-e.y)/e.k,n/e.k]);return function(e){var r=a(e),l=n/r[2];this.__chart__=S={x:i-r[0]*l,y:o-r[1]*l,k:l};s(t)}}).each("end.zoom",function(){l(t)});else{this.__chart__=S;a(t);s(t);l(t)}})};t.translate=function(e){if(!arguments.length)return[S.x,S.y];S={x:+e[0],y:+e[1],k:S.k};o();return t};t.scale=function(e){if(!arguments.length)return S.k;S={x:S.x,y:S.y,k:+e};o();return t};t.scaleExtent=function(e){if(!arguments.length)return k;k=null==e?Ws:[+e[0],+e[1]];return t};t.center=function(e){if(!arguments.length)return g;g=e&&[+e[0],+e[1]];return t};t.size=function(e){if(!arguments.length)return T;T=e&&[+e[0],+e[1]];return t};t.x=function(e){if(!arguments.length)return b;b=e;y=e.copy();S={x:0,y:0,k:1};return t};t.y=function(e){if(!arguments.length)return w;w=e;x=e.copy();S={x:0,y:0,k:1};return t};return Ka.rebind(t,N,"on")};var Rs,Ws=[0,1/0],zs="onwheel"in ts?(Rs=function(){return-Ka.event.deltaY*(Ka.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ts?(Rs=function(){return Ka.event.wheelDelta},"mousewheel"):(Rs=function(){return-Ka.event.detail},"MozMousePixelScroll");Ka.color=se;se.prototype.toString=function(){return this.rgb()+""};Ka.hsl=le;var qs=le.prototype=new se;qs.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);return new le(this.h,this.s,this.l/t)};qs.darker=function(t){t=Math.pow(.7,arguments.length?t:1);return new le(this.h,this.s,t*this.l)};qs.rgb=function(){return ue(this.h,this.s,this.l)};Ka.hcl=ce;var Us=ce.prototype=new se;Us.brighter=function(t){return new ce(this.h,this.c,Math.min(100,this.l+Bs*(arguments.length?t:1)))};Us.darker=function(t){return new ce(this.h,this.c,Math.max(0,this.l-Bs*(arguments.length?t:1)))};Us.rgb=function(){return fe(this.h,this.c,this.l).rgb()};Ka.lab=he;var Bs=18,Vs=.95047,Xs=1,Gs=1.08883,$s=he.prototype=new se;$s.brighter=function(t){return new he(Math.min(100,this.l+Bs*(arguments.length?t:1)),this.a,this.b)};$s.darker=function(t){return new he(Math.max(0,this.l-Bs*(arguments.length?t:1)),this.a,this.b)};$s.rgb=function(){return de(this.l,this.a,this.b)};Ka.rgb=ye;var Ys=ye.prototype=new se;Ys.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;if(!e&&!n&&!r)return new ye(i,i,i);e&&i>e&&(e=i);n&&i>n&&(n=i);r&&i>r&&(r=i);return new ye(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,r/t))};Ys.darker=function(t){t=Math.pow(.7,arguments.length?t:1);return new ye(t*this.r,t*this.g,t*this.b)};Ys.hsl=function(){return Ce(this.r,this.g,this.b)};Ys.toString=function(){return"#"+we(this.r)+we(this.g)+we(this.b)};var Js=Ka.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Js.forEach(function(t,e){Js.set(t,be(e))});Ka.functor=Me;Ka.xhr=Le(De);Ka.dsv=function(t,e){function n(t,n,o){arguments.length<3&&(o=n,n=null);var a=Ae(t,e,null==n?r:i(n),o);a.row=function(t){return arguments.length?a.response(null==(n=t)?r:i(t)):n};return a}function r(t){return n.parse(t.responseText)}function i(t){return function(e){return n.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);n.parse=function(t,e){var r;return n.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,n){return e(i(t),n)}:i})};n.parseRows=function(t,e){function n(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++<u;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}c=n+2;var r=t.charCodeAt(n+1);if(13===r){i=!0;10===t.charCodeAt(n+2)&&++c}else 10===r&&(i=!0);return t.slice(e+1,n).replace(/""/g,'"')}for(;u>c;){var r=t.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r){i=!0;10===t.charCodeAt(c)&&(++c,++s)}else if(r!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var r,i,o={},a={},s=[],u=t.length,c=0,f=0;(r=n())!==a;){for(var h=[];r!==o&&r!==a;){h.push(r);r=n()}e&&null==(h=e(h,f++))||s.push(h)}return s};n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var r=new v,i=[];e.forEach(function(t){for(var e in t)r.has(e)||i.push(r.add(e))});return[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")};n.formatRows=function(t){return t.map(o).join("\n")};return n};Ka.csv=Ka.dsv(",","text/csv");Ka.tsv=Ka.dsv(" ","text/tab-separated-values");var Ks,Zs,Qs,tl,el,nl=ns[b(ns,"requestAnimationFrame")]||function(t){setTimeout(t,17)};Ka.timer=function(t,e,n){var r=arguments.length;2>r&&(e=0);3>r&&(n=Date.now());var i=n+e,o={c:t,t:i,f:!1,n:null};Zs?Zs.n=o:Ks=o;Zs=o;if(!Qs){tl=clearTimeout(tl);Qs=1;nl(je)}};Ka.timer.flush=function(){Ie();Pe()};Ka.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var rl=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Oe);Ka.formatPrefix=function(t,e){var n=0;if(t){0>t&&(t*=-1);e&&(t=Ka.round(t,He(t,e)));n=1+Math.floor(1e-12+Math.log(t)/Math.LN10);n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))}return rl[8+n/3]};var il=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ol=Ka.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=Ka.round(t,He(t,e))).toFixed(Math.max(0,Math.min(20,He(t*(1+1e-15),e))))}}),al=Ka.time={},sl=Date;We.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ll.setUTCDate.apply(this._,arguments)},setDay:function(){ll.setUTCDay.apply(this._,arguments)},setFullYear:function(){ll.setUTCFullYear.apply(this._,arguments)},setHours:function(){ll.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ll.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ll.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ll.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ll.setUTCSeconds.apply(this._,arguments)},setTime:function(){ll.setTime.apply(this._,arguments)}};var ll=Date.prototype;al.year=ze(function(t){t=al.day(t);t.setMonth(0,1);return t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()});al.years=al.year.range;al.years.utc=al.year.utc.range;al.day=ze(function(t){var e=new sl(2e3,0);e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate());return e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1});al.days=al.day.range;al.days.utc=al.day.utc.range;al.dayOfYear=function(t){var e=al.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)};["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=al[t]=ze(function(t){(t=al.day(t)).setDate(t.getDate()-(t.getDay()+e)%7);return t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=al.year(t).getDay();return Math.floor((al.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});al[t+"s"]=n.range;al[t+"s"].utc=n.utc.range;al[t+"OfYear"]=function(t){var n=al.year(t).getDay();return Math.floor((al.dayOfYear(t)+(n+e)%7)/7)}});al.week=al.sunday;al.weeks=al.sunday.range;al.weeks.utc=al.sunday.utc.range;al.weekOfYear=al.sundayOfYear;var ul={"-":"",_:" ",0:"0"},cl=/^\s*\d+/,fl=/^%/;Ka.locale=function(t){return{numberFormat:Fe(t),timeFormat:Ue(t)}};var hl=Ka.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Ka.format=hl.numberFormat;Ka.geo={};fn.prototype={s:0,t:0,add:function(t){hn(t,this.t,dl);hn(dl.s,this.s,this);this.s?this.t+=dl.t:this.s=dl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var dl=new fn;Ka.geo.stream=function(t,e){t&&pl.hasOwnProperty(t.type)?pl[t.type](t,e):dn(t,e)};var pl={Feature:function(t,e){dn(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)dn(n[r].geometry,e)}},gl={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates;e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){pn(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)pn(n[r],e,0)},Polygon:function(t,e){gn(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)gn(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)dn(n[r],e)}};Ka.geo.area=function(t){ml=0;Ka.geo.stream(t,yl);return ml};var ml,vl=new fn,yl={sphere:function(){ml+=4*Ls},point:x,lineStart:x,lineEnd:x,polygonStart:function(){vl.reset();yl.lineStart=mn},polygonEnd:function(){var t=2*vl;ml+=0>t?4*Ls+t:t;yl.lineStart=yl.lineEnd=yl.point=x}};Ka.geo.bounds=function(){function t(t,e){b.push(x=[c=t,h=t]);f>e&&(f=e);e>d&&(d=e)}function e(e,n){var r=vn([e*Is,n*Is]);if(v){var i=bn(v,r),o=[i[1],-i[0],0],a=bn(o,i);Sn(a);a=Cn(a);var l=e-p,u=l>0?1:-1,g=a[0]*Ps*u,m=fs(l)>180;if(m^(g>u*p&&u*e>g)){var y=a[1]*Ps;y>d&&(d=y)}else if(g=(g+360)%360-180,m^(g>u*p&&u*e>g)){var y=-a[1]*Ps;f>y&&(f=y)}else{f>n&&(f=n);n>d&&(d=n)}if(m)p>e?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e);else if(h>=c){c>e&&(c=e);e>h&&(h=e)}else e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);v=r,p=e}function n(){w.point=e}function r(){x[0]=c,x[1]=h;w.point=t;v=null}function i(t,n){if(v){var r=t-p;y+=fs(r)>180?r+(r>0?360:-360):r}else g=t,m=n;yl.point(t,n);e(t,n)}function o(){yl.lineStart()}function a(){i(g,m);yl.lineEnd();fs(y)>Es&&(c=-(h=180));x[0]=c,x[1]=h;v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var c,f,h,d,p,g,m,v,y,b,x,w={point:t,lineStart:n,lineEnd:r,polygonStart:function(){w.point=i;w.lineStart=o;w.lineEnd=a;y=0;yl.polygonStart()},polygonEnd:function(){yl.polygonEnd();w.point=t;w.lineStart=n;w.lineEnd=r;0>vl?(c=-(h=180),f=-(d=90)):y>Es?d=90:-Es>y&&(f=-90);x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0);b=[];Ka.geo.stream(t,w);var e=b.length;if(e){b.sort(l);for(var n,r=1,i=b[0],o=[i];e>r;++r){n=b[r];if(u(n[0],i)||u(n[1],i)){s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]);s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])}else o.push(i=n)}for(var a,n,p=-1/0,e=o.length-1,r=0,i=o[e];e>=r;i=n,++r){n=o[r];(a=s(i[1],n[0]))>p&&(p=a,c=n[0],h=i[1])}}b=x=null;return 1/0===c||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[c,f],[h,d]]}}();Ka.geo.centroid=function(t){bl=xl=wl=Sl=Cl=Tl=_l=kl=Ml=Dl=Ll=0;Ka.geo.stream(t,Al);var e=Ml,n=Dl,r=Ll,i=e*e+n*n+r*r;if(js>i){e=Tl,n=_l,r=kl;Es>xl&&(e=wl,n=Sl,r=Cl);i=e*e+n*n+r*r;if(js>i)return[0/0,0/0]}return[Math.atan2(n,e)*Ps,ne(r/Math.sqrt(i))*Ps]};var bl,xl,wl,Sl,Cl,Tl,_l,kl,Ml,Dl,Ll,Al={sphere:x,point:_n,lineStart:Mn,lineEnd:Dn,polygonStart:function(){Al.lineStart=Ln},polygonEnd:function(){Al.lineStart=Mn}},Nl=In(An,Fn,Wn,[-Ls,-Ls/2]),El=1e9;Ka.geo.clipExtent=function(){var t,e,n,r,i,o,a={stream:function(t){i&&(i.valid=!1);i=o(t);i.valid=!0;return i},extent:function(s){if(!arguments.length)return[[t,e],[n,r]];o=Bn(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]);i&&(i.valid=!1,i=null);return a}};return a.extent([[0,0],[960,500]])};(Ka.geo.conicEqualArea=function(){return Xn(Gn)}).raw=Gn;Ka.geo.albers=function(){return Ka.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)};Ka.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];e=null;(n(o,a),e)||(r(o,a),e)||i(o,a);return e}var e,n,r,i,o=Ka.geo.albers(),a=Ka.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Ka.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){e=[t,n]}};t.invert=function(t){var e=o.scale(),n=o.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:o).invert(t)};t.stream=function(t){var e=o.stream(t),n=a.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i);n.point(t,i);r.point(t,i)},sphere:function(){e.sphere();n.sphere();r.sphere()},lineStart:function(){e.lineStart();n.lineStart();r.lineStart()},lineEnd:function(){e.lineEnd();n.lineEnd();r.lineEnd()},polygonStart:function(){e.polygonStart();n.polygonStart();r.polygonStart()},polygonEnd:function(){e.polygonEnd();n.polygonEnd();r.polygonEnd()}}};t.precision=function(e){if(!arguments.length)return o.precision();o.precision(e);a.precision(e);s.precision(e);return t};t.scale=function(e){if(!arguments.length)return o.scale(); o.scale(e);a.scale(.35*e);s.scale(e);return t.translate(o.translate())};t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],f=+e[1];n=o.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point;r=a.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Es,f+.12*u+Es],[c-.214*u-Es,f+.234*u-Es]]).stream(l).point;i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Es,f+.166*u+Es],[c-.115*u-Es,f+.234*u-Es]]).stream(l).point;return t};return t.scale(1070)};var jl,Il,Pl,Hl,Ol,Fl,Rl={point:x,lineStart:x,lineEnd:x,polygonStart:function(){Il=0;Rl.lineStart=$n},polygonEnd:function(){Rl.lineStart=Rl.lineEnd=Rl.point=x;jl+=fs(Il/2)}},Wl={point:Yn,lineStart:x,lineEnd:x,polygonStart:x,polygonEnd:x},zl={point:Zn,lineStart:Qn,lineEnd:tr,polygonStart:function(){zl.lineStart=er},polygonEnd:function(){zl.point=Zn;zl.lineStart=Qn;zl.lineEnd=tr}};Ka.geo.path=function(){function t(t){if(t){"function"==typeof s&&o.pointRadius(+s.apply(this,arguments));a&&a.valid||(a=i(o));Ka.geo.stream(t,a)}return o.result()}function e(){a=null;return t}var n,r,i,o,a,s=4.5;t.area=function(t){jl=0;Ka.geo.stream(t,i(Rl));return jl};t.centroid=function(t){wl=Sl=Cl=Tl=_l=kl=Ml=Dl=Ll=0;Ka.geo.stream(t,i(zl));return Ll?[Ml/Ll,Dl/Ll]:kl?[Tl/kl,_l/kl]:Cl?[wl/Cl,Sl/Cl]:[0/0,0/0]};t.bounds=function(t){Ol=Fl=-(Pl=Hl=1/0);Ka.geo.stream(t,i(Wl));return[[Pl,Hl],[Ol,Fl]]};t.projection=function(t){if(!arguments.length)return n;i=(n=t)?t.stream||ir(t):De;return e()};t.context=function(t){if(!arguments.length)return r;o=null==(r=t)?new Jn:new nr(t);"function"!=typeof s&&o.pointRadius(s);return e()};t.pointRadius=function(e){if(!arguments.length)return s;s="function"==typeof e?e:(o.pointRadius(+e),+e);return t};return t.projection(Ka.geo.albersUsa()).context(null)};Ka.geo.transform=function(t){return{stream:function(e){var n=new or(e);for(var r in t)n[r]=t[r];return n}}};or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};Ka.geo.projection=sr;Ka.geo.projectionMutator=lr;(Ka.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr;Ka.geo.rotation=function(t){function e(e){e=t(e[0]*Is,e[1]*Is);return e[0]*=Ps,e[1]*=Ps,e}t=hr(t[0]%360*Is,t[1]*Is,t.length>2?t[2]*Is:0);e.invert=function(e){e=t.invert(e[0]*Is,e[1]*Is);return e[0]*=Ps,e[1]*=Ps,e};return e};fr.invert=cr;Ka.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hr(-t[0]*Is,-t[1]*Is,0).invert,i=[];n(null,null,1,{point:function(t,n){i.push(t=e(t,n));t[0]*=Ps,t[1]*=Ps}});return{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;t.origin=function(e){if(!arguments.length)return r;r=e;return t};t.angle=function(r){if(!arguments.length)return e;n=mr((e=+r)*Is,i*Is);return t};t.precision=function(r){if(!arguments.length)return i;n=mr(e*Is,(i=+r)*Is);return t};return t.angle(90)};Ka.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Is,i=t[1]*Is,o=e[1]*Is,a=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)};Ka.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return Ka.range(Math.ceil(o/m)*m,i,m).map(h).concat(Ka.range(Math.ceil(u/v)*v,l,v).map(d)).concat(Ka.range(Math.ceil(r/p)*p,n,p).filter(function(t){return fs(t%m)>Es}).map(c)).concat(Ka.range(Math.ceil(s/g)*g,a,g).filter(function(t){return fs(t%v)>Es}).map(f))}var n,r,i,o,a,s,l,u,c,f,h,d,p=10,g=p,m=90,v=360,y=2.5;t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})};t.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}};t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()};t.majorExtent=function(e){if(!arguments.length)return[[o,u],[i,l]];o=+e[0][0],i=+e[1][0];u=+e[0][1],l=+e[1][1];o>i&&(e=o,o=i,i=e);u>l&&(e=u,u=l,l=e);return t.precision(y)};t.minorExtent=function(e){if(!arguments.length)return[[r,s],[n,a]];r=+e[0][0],n=+e[1][0];s=+e[0][1],a=+e[1][1];r>n&&(e=r,r=n,n=e);s>a&&(e=s,s=a,a=e);return t.precision(y)};t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()};t.majorStep=function(e){if(!arguments.length)return[m,v];m=+e[0],v=+e[1];return t};t.minorStep=function(e){if(!arguments.length)return[p,g];p=+e[0],g=+e[1];return t};t.precision=function(e){if(!arguments.length)return y;y=+e;c=yr(s,a,90);f=br(r,n,y);h=yr(u,l,90);d=br(o,i,y);return t};return t.majorExtent([[-180,-90+Es],[180,90-Es]]).minorExtent([[-180,-80-Es],[180,80+Es]])};Ka.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=xr,i=wr;t.distance=function(){return Ka.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))};t.source=function(n){if(!arguments.length)return r;r=n,e="function"==typeof n?null:n;return t};t.target=function(e){if(!arguments.length)return i;i=e,n="function"==typeof e?null:e;return t};t.precision=function(){return arguments.length?t:0};return t};Ka.geo.interpolate=function(t,e){return Sr(t[0]*Is,t[1]*Is,e[0]*Is,e[1]*Is)};Ka.geo.length=function(t){ql=0;Ka.geo.stream(t,Ul);return ql};var ql,Ul={sphere:x,point:x,lineStart:Cr,lineEnd:x,polygonStart:x,polygonEnd:x},Bl=Tr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Ka.geo.azimuthalEqualArea=function(){return sr(Bl)}).raw=Bl;var Vl=Tr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},De);(Ka.geo.azimuthalEquidistant=function(){return sr(Vl)}).raw=Vl;(Ka.geo.conicConformal=function(){return Xn(_r)}).raw=_r;(Ka.geo.conicEquidistant=function(){return Xn(kr)}).raw=kr;var Xl=Tr(function(t){return 1/t},Math.atan);(Ka.geo.gnomonic=function(){return sr(Xl)}).raw=Xl;Mr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ns]};(Ka.geo.mercator=function(){return Dr(Mr)}).raw=Mr;var Gl=Tr(function(){return 1},Math.asin);(Ka.geo.orthographic=function(){return sr(Gl)}).raw=Gl;var $l=Tr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Ka.geo.stereographic=function(){return sr($l)}).raw=$l;Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ns]};(Ka.geo.transverseMercator=function(){var t=Dr(Lr),e=t.center,n=t.rotate;t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])};t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])};return n([0,0,90])}).raw=Lr;Ka.geom={};Ka.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Me(n),o=Me(r),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);s.sort(jr);for(e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Er(s),c=Er(l),f=c[0]===u[0],h=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e<c.length-h;++e)d.push(t[s[c[e]][2]]);return d}var n=Ar,r=Nr;if(arguments.length)return e(t);e.x=function(t){return arguments.length?(n=t,e):n};e.y=function(t){return arguments.length?(r=t,e):r};return e};Ka.geom.polygon=function(t){ms(t,Yl);return t};var Yl=Ka.geom.polygon.prototype=[];Yl.area=function(){for(var t,e=-1,n=this.length,r=this[n-1],i=0;++e<n;){t=r;r=this[e];i+=t[1]*r[0]-t[0]*r[1]}return.5*i};Yl.centroid=function(t){var e,n,r=-1,i=this.length,o=0,a=0,s=this[i-1];arguments.length||(t=-1/(6*this.area()));for(;++r<i;){e=s;s=this[r];n=e[0]*s[1]-s[0]*e[1];o+=(e[0]+s[0])*n;a+=(e[1]+s[1])*n}return[o*t,a*t]};Yl.clip=function(t){for(var e,n,r,i,o,a,s=Hr(t),l=-1,u=this.length-Hr(this),c=this[u-1];++l<u;){e=t.slice();t.length=0;i=this[l];o=e[(r=e.length-s)-1];n=-1;for(;++n<r;){a=e[n];if(Ir(a,c,i)){Ir(o,c,i)||t.push(Pr(o,a,c,i));t.push(a)}else Ir(o,c,i)&&t.push(Pr(o,a,c,i));o=a}s&&t.push(t[0]);c=i}return t};var Jl,Kl,Zl,Ql,tu,eu=[],nu=[];Br.prototype.prepare=function(){for(var t,e=this.edges,n=e.length;n--;){t=e[n].edge;t.b&&t.a||e.splice(n,1)}e.sort(Xr);return e.length};ni.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}};ri.prototype={insert:function(t,e){var n,r,i;if(t){e.P=t;e.N=t.N;t.N&&(t.N.P=e);t.N=e;if(t.R){t=t.R;for(;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else if(this._){t=si(this._);e.P=null;e.N=t;t.P=t.L=e;n=t}else{e.P=e.N=null;this._=e;n=null}e.L=e.R=null;e.U=n;e.C=!0;t=e;for(;n&&n.C;){r=n.U;if(n===r.L){i=r.R;if(i&&i.C){n.C=i.C=!1;r.C=!0;t=r}else{if(t===n.R){oi(this,n);t=n;n=t.U}n.C=!1;r.C=!0;ai(this,r)}}else{i=r.L;if(i&&i.C){n.C=i.C=!1;r.C=!0;t=r}else{if(t===n.L){ai(this,n);t=n;n=t.U}n.C=!1;r.C=!0;oi(this,r)}}n=t.U}this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P);t.P&&(t.P.N=t.N);t.N=t.P=null;var e,n,r,i=t.U,o=t.L,a=t.R;n=o?a?si(a):o:a;i?i.L===t?i.L=n:i.R=n:this._=n;if(o&&a){r=n.C;n.C=t.C;n.L=o;o.U=n;if(n!==a){i=n.U;n.U=t.U;t=n.R;i.L=t;n.R=a;a.U=n}else{n.U=i;i=n;t=n.R}}else{r=t.C;t=n}t&&(t.U=i);if(!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){e=i.R;if(e.C){e.C=!1;i.C=!0;oi(this,i);e=i.R}if(e.L&&e.L.C||e.R&&e.R.C){if(!e.R||!e.R.C){e.L.C=!1;e.C=!0;ai(this,e);e=i.R}e.C=i.C;i.C=e.R.C=!1;oi(this,i);t=this._;break}}else{e=i.L;if(e.C){e.C=!1;i.C=!0;ai(this,i);e=i.L}if(e.L&&e.L.C||e.R&&e.R.C){if(!e.L||!e.L.C){e.R.C=!1;e.C=!0;oi(this,e);e=i.L}e.C=i.C;i.C=e.L.C=!1;ai(this,i);t=this._;break}}e.C=!0;t=i;i=i.U}while(!t.C);t&&(t.C=!1)}}};Ka.geom.voronoi=function(t){function e(t){var e=new Array(t.length),r=s[0][0],i=s[0][1],o=s[1][0],a=s[1][1];li(n(t),s).cells.forEach(function(n,s){var l=n.edges,u=n.site,c=e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=r&&u.x<=o&&u.y>=i&&u.y<=a?[[r,a],[o,a],[o,i],[r,i]]:[];c.point=t[s]});return e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Es)*Es,y:Math.round(a(t,e)/Es)*Es,i:e}})}var r=Ar,i=Nr,o=r,a=i,s=ru;if(t)return e(t);e.links=function(t){return li(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})};e.triangles=function(t){var e=[];li(n(t)).cells.forEach(function(n,r){for(var i,o,a=n.site,s=n.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===a?c.r:c.l;++l<u;){i=c;o=f;c=s[l].edge;f=c.l===a?c.r:c.l;r<o.i&&r<f.i&&ci(a,o,f)<0&&e.push([t[r],t[o.i],t[f.i]])}});return e};e.x=function(t){return arguments.length?(o=Me(r=t),e):r};e.y=function(t){return arguments.length?(a=Me(i=t),e):i};e.clipExtent=function(t){if(!arguments.length)return s===ru?null:s;s=null==t?ru:t;return e};e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===ru?null:s&&s[1]};return e};var ru=[[-1e6,-1e6],[1e6,1e6]];Ka.geom.delaunay=function(t){return Ka.geom.voronoi().triangles(t)};Ka.geom.quadtree=function(t,e,n,r,i){function o(t){function o(t,e,n,r,i,o,a,s){if(!isNaN(n)&&!isNaN(r))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(fs(l-n)+fs(c-r)<.01)u(t,e,n,r,i,o,a,s);else{var f=t.point;t.x=t.y=t.point=null;u(t,f,l,c,i,o,a,s);u(t,e,n,r,i,o,a,s)}else t.x=n,t.y=r,t.point=e}else u(t,e,n,r,i,o,a,s)}function u(t,e,n,r,i,a,s,l){var u=.5*(i+s),c=.5*(a+l),f=n>=u,h=r>=c,d=(h<<1)+f;t.leaf=!1;t=t.nodes[d]||(t.nodes[d]=di());f?i=u:s=u;h?a=c:l=c;o(t,e,n,r,i,a,s,l)}var c,f,h,d,p,g,m,v,y,b=Me(s),x=Me(l);if(null!=e)g=e,m=n,v=r,y=i;else{v=y=-(g=m=1/0);f=[],h=[];p=t.length;if(a)for(d=0;p>d;++d){c=t[d];c.x<g&&(g=c.x);c.y<m&&(m=c.y);c.x>v&&(v=c.x);c.y>y&&(y=c.y);f.push(c.x);h.push(c.y)}else for(d=0;p>d;++d){var w=+b(c=t[d],d),S=+x(c,d);g>w&&(g=w);m>S&&(m=S);w>v&&(v=w);S>y&&(y=S);f.push(w);h.push(S)}}var C=v-g,T=y-m;C>T?y=m+C:v=g+T;var _=di();_.add=function(t){o(_,t,+b(t,++d),+x(t,d),g,m,v,y)};_.visit=function(t){pi(t,_,g,m,v,y)};d=-1;if(null==e){for(;++d<p;)o(_,t[d],f[d],h[d],g,m,v,y);--d}else t.forEach(_.add);f=h=t=c=null;return _}var a,s=Ar,l=Nr;if(a=arguments.length){s=fi;l=hi;if(3===a){i=n;r=e;n=e=0}return o(t)}o.x=function(t){return arguments.length?(s=t,o):s};o.y=function(t){return arguments.length?(l=t,o):l};o.extent=function(t){if(!arguments.length)return null==e?null:[[e,n],[r,i]];null==t?e=n=r=i=null:(e=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]);return o};o.size=function(t){if(!arguments.length)return null==e?null:[r-e,i-n];null==t?e=n=r=i=null:(e=n=0,r=+t[0],i=+t[1]);return o};return o};Ka.interpolateRgb=gi;Ka.interpolateObject=mi;Ka.interpolateNumber=vi;Ka.interpolateString=yi;var iu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ou=new RegExp(iu.source,"g");Ka.interpolate=bi;Ka.interpolators=[function(t,e){var n=typeof e;return("string"===n?Js.has(e)||/^(#|rgb\(|hsl\()/.test(e)?gi:yi:e instanceof se?gi:Array.isArray(e)?xi:"object"===n&&isNaN(e)?mi:vi)(t,e)}];Ka.interpolateArray=xi;var au=function(){return De},su=Ka.map({linear:au,poly:Mi,quad:function(){return Ti},cubic:function(){return _i},sin:function(){return Di},exp:function(){return Li},circle:function(){return Ai},elastic:Ni,back:Ei,bounce:function(){return ji}}),lu=Ka.map({"in":De,out:Si,"in-out":Ci,"out-in":function(t){return Ci(Si(t))}});Ka.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";n=su.get(n)||au;r=lu.get(r)||De;return wi(r(n.apply(null,Za.call(arguments,1))))};Ka.interpolateHcl=Ii;Ka.interpolateHsl=Pi;Ka.interpolateLab=Hi;Ka.interpolateRound=Oi;Ka.transform=function(t){var e=ts.createElementNS(Ka.ns.prefix.svg,"g");return(Ka.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Fi(n?n.matrix:uu)})(t)};Fi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var uu={a:1,b:0,c:0,d:1,e:0,f:0};Ka.interpolateTransform=qi;Ka.layout={};Ka.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n<r;)e.push(Vi(t[n]));return e}};Ka.layout.chord=function(){function t(){var t,u,f,h,d,p={},g=[],m=Ka.range(o),v=[];n=[];r=[];t=0,h=-1;for(;++h<o;){u=0,d=-1;for(;++d<o;)u+=i[h][d];g.push(u);v.push(Ka.range(o));t+=u}a&&m.sort(function(t,e){return a(g[t],g[e])});s&&v.forEach(function(t,e){t.sort(function(t,n){return s(i[e][t],i[e][n])})});t=(As-c*o)/t;u=0,h=-1;for(;++h<o;){f=u,d=-1;for(;++d<o;){var y=m[h],b=v[y][d],x=i[y][b],w=u,S=u+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:w,endAngle:S,value:x}}r[y]={index:y,startAngle:f,endAngle:u,value:(u-f)/t};u+=c}h=-1;for(;++h<o;){d=h-1;for(;++d<o;){var C=p[h+"-"+d],T=p[d+"-"+h];(C.value||T.value)&&n.push(C.value<T.value?{source:T,target:C}:{source:C,target:T})}}l&&e()}function e(){n.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var n,r,i,o,a,s,l,u={},c=0;u.matrix=function(t){if(!arguments.length)return i;o=(i=t)&&i.length;n=r=null;return u};u.padding=function(t){if(!arguments.length)return c;c=t;n=r=null;return u};u.sortGroups=function(t){if(!arguments.length)return a;a=t;n=r=null;return u};u.sortSubgroups=function(t){if(!arguments.length)return s;s=t;n=null;return u};u.sortChords=function(t){if(!arguments.length)return l;l=t;n&&e();return u};u.chords=function(){n||t();return n};u.groups=function(){r||t();return r};return u};Ka.layout.force=function(){function t(t){return function(e,n,r,i){if(e.point!==t){var o=e.cx-t.x,a=e.cy-t.y,s=i-n,l=o*o+a*a;if(l>s*s/m){if(p>l){var u=e.charge/l;t.px-=o*u;t.py-=a*u}return!0}if(e.point&&l&&p>l){var u=e.pointCharge/l;t.px-=o*u;t.py-=a*u}}return!e.charge}}function e(t){t.px=Ka.event.x,t.py=Ka.event.y;s.resume()}var n,r,i,o,a,s={},l=Ka.dispatch("start","tick","end"),u=[1,1],c=.9,f=cu,h=fu,d=-30,p=hu,g=.1,m=.64,v=[],y=[];s.tick=function(){if((r*=.99)<.005){l.end({type:"end",alpha:r=0});return!0}var e,n,s,f,h,p,m,b,x,w=v.length,S=y.length;for(n=0;S>n;++n){s=y[n];f=s.source;h=s.target;b=h.x-f.x;x=h.y-f.y;if(p=b*b+x*x){p=r*o[n]*((p=Math.sqrt(p))-i[n])/p;b*=p;x*=p;h.x-=b*(m=f.weight/(h.weight+f.weight));h.y-=x*m;f.x+=b*(m=1-m);f.y+=x*m}}if(m=r*g){b=u[0]/2;x=u[1]/2;n=-1;if(m)for(;++n<w;){s=v[n];s.x+=(b-s.x)*m;s.y+=(x-s.y)*m}}if(d){Zi(e=Ka.geom.quadtree(v),r,a);n=-1;for(;++n<w;)(s=v[n]).fixed||e.visit(t(s))}n=-1;for(;++n<w;){s=v[n];if(s.fixed){s.x=s.px;s.y=s.py}else{s.x-=(s.px-(s.px=s.x))*c;s.y-=(s.py-(s.py=s.y))*c}}l.tick({type:"tick",alpha:r})};s.nodes=function(t){if(!arguments.length)return v;v=t;return s};s.links=function(t){if(!arguments.length)return y;y=t;return s};s.size=function(t){if(!arguments.length)return u;u=t;return s};s.linkDistance=function(t){if(!arguments.length)return f;f="function"==typeof t?t:+t;return s};s.distance=s.linkDistance;s.linkStrength=function(t){if(!arguments.length)return h;h="function"==typeof t?t:+t;return s};s.friction=function(t){if(!arguments.length)return c;c=+t;return s};s.charge=function(t){if(!arguments.length)return d;d="function"==typeof t?t:+t;return s};s.chargeDistance=function(t){if(!arguments.length)return Math.sqrt(p);p=t*t;return s};s.gravity=function(t){if(!arguments.length)return g;g=+t;return s};s.theta=function(t){if(!arguments.length)return Math.sqrt(m);m=t*t;return s};s.alpha=function(t){if(!arguments.length)return r;t=+t;if(r)r=t>0?t:0;else if(t>0){l.start({type:"start",alpha:r=t});Ka.timer(s.tick)}return s};s.start=function(){function t(t,r){if(!n){n=new Array(l);for(s=0;l>s;++s)n[s]=[];for(s=0;u>s;++s){var i=y[s];n[i.source.index].push(i.target);n[i.target.index].push(i.source)}}for(var o,a=n[e],s=-1,u=a.length;++s<u;)if(!isNaN(o=a[s][t]))return o;return Math.random()*r}var e,n,r,l=v.length,c=y.length,p=u[0],g=u[1];for(e=0;l>e;++e){(r=v[e]).index=e;r.weight=0}for(e=0;c>e;++e){r=y[e];"number"==typeof r.source&&(r.source=v[r.source]);"number"==typeof r.target&&(r.target=v[r.target]);++r.source.weight;++r.target.weight}for(e=0;l>e;++e){r=v[e];isNaN(r.x)&&(r.x=t("x",p));isNaN(r.y)&&(r.y=t("y",g));isNaN(r.px)&&(r.px=r.x);isNaN(r.py)&&(r.py=r.y)}i=[];if("function"==typeof f)for(e=0;c>e;++e)i[e]=+f.call(this,y[e],e);else for(e=0;c>e;++e)i[e]=f;o=[];if("function"==typeof h)for(e=0;c>e;++e)o[e]=+h.call(this,y[e],e);else for(e=0;c>e;++e)o[e]=h;a=[];if("function"==typeof d)for(e=0;l>e;++e)a[e]=+d.call(this,v[e],e);else for(e=0;l>e;++e)a[e]=d;return s.resume()};s.resume=function(){return s.alpha(.1)};s.stop=function(){return s.alpha(0)};s.drag=function(){n||(n=Ka.behavior.drag().origin(De).on("dragstart.force",$i).on("drag.force",e).on("dragend.force",Yi));if(!arguments.length)return n;this.on("mouseover.force",Ji).on("mouseout.force",Ki).call(n);return void 0};return Ka.rebind(s,l,"on")};var cu=20,fu=1,hu=1/0;Ka.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];i.depth=0;for(;null!=(o=a.pop());){s.push(o);if((u=n.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;){a.push(c=u[l]);c.parent=o;c.depth=o.depth+1}r&&(o.value=0);o.children=u}else{r&&(o.value=+r.call(t,o,o.depth)||0);delete o.children}}eo(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e);r&&(i=t.parent)&&(i.value+=t.value)});return s}var e=io,n=no,r=ro;t.sort=function(n){if(!arguments.length)return e;e=n;return t};t.children=function(e){if(!arguments.length)return n;n=e;return t};t.value=function(e){if(!arguments.length)return r;r=e;return t};t.revalue=function(e){if(r){to(e,function(t){t.children&&(t.value=0)});eo(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0);(n=e.parent)&&(n.value+=e.value)})}return e};return t};Ka.layout.partition=function(){function t(e,n,r,i){var o=e.children;e.x=n;e.y=e.depth*i;e.dx=r;e.dy=i;if(o&&(a=o.length)){var a,s,l,u=-1;r=e.value?r/e.value:0;for(;++u<a;){t(s=o[u],n,l=s.value*r,i);n+=l}}}function e(t){var n=t.children,r=0;if(n&&(i=n.length))for(var i,o=-1;++o<i;)r=Math.max(r,e(n[o]));return 1+r}function n(n,o){var a=r.call(this,n,o);t(a[0],0,i[0],i[1]/e(a[0]));return a}var r=Ka.layout.hierarchy(),i=[1,1];n.size=function(t){if(!arguments.length)return i;i=t;return n};return Qi(n,r)};Ka.layout.pie=function(){function t(o){var a=o.map(function(n,r){return+e.call(t,n,r)}),s=+("function"==typeof r?r.apply(this,arguments):r),l=(("function"==typeof i?i.apply(this,arguments):i)-s)/Ka.sum(a),u=Ka.range(o.length);null!=n&&u.sort(n===du?function(t,e){return a[e]-a[t]}:function(t,e){return n(o[t],o[e])});var c=[];u.forEach(function(t){var e;c[t]={data:o[t],value:e=a[t],startAngle:s,endAngle:s+=e*l}});return c}var e=Number,n=du,r=0,i=As;t.value=function(n){if(!arguments.length)return e;e=n;return t};t.sort=function(e){if(!arguments.length)return n;n=e;return t};t.startAngle=function(e){if(!arguments.length)return r;r=e;return t};t.endAngle=function(e){if(!arguments.length)return i;i=e;return t};return t};var du={};Ka.layout.stack=function(){function t(s,l){if(!(h=s.length))return s;var u=s.map(function(n,r){return e.call(t,n,r)}),c=u.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),a.call(t,e,n)]})}),f=n.call(t,c,l);u=Ka.permute(u,f);c=Ka.permute(c,f);var h,d,p,g,m=r.call(t,c,l),v=u[0].length;for(p=0;v>p;++p){i.call(t,u[0][p],g=m[p],c[0][p][1]);for(d=1;h>d;++d)i.call(t,u[d][p],g+=c[d-1][p][1],c[d][p][1])}return s}var e=De,n=uo,r=co,i=lo,o=ao,a=so;t.values=function(n){if(!arguments.length)return e;e=n;return t};t.order=function(e){if(!arguments.length)return n;n="function"==typeof e?e:pu.get(e)||uo;return t};t.offset=function(e){if(!arguments.length)return r;r="function"==typeof e?e:gu.get(e)||co;return t};t.x=function(e){if(!arguments.length)return o;o=e;return t};t.y=function(e){if(!arguments.length)return a;a=e;return t};t.out=function(e){if(!arguments.length)return i;i=e;return t};return t};var pu=Ka.map({"inside-out":function(t){var e,n,r=t.length,i=t.map(fo),o=t.map(ho),a=Ka.range(r).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;r>e;++e){n=a[e];if(l>s){s+=o[n];u.push(n)}else{l+=o[n];c.push(n)}}return c.reverse().concat(u)},reverse:function(t){return Ka.range(t.length).reverse()},"default":uo}),gu=Ka.map({silhouette:function(t){var e,n,r,i=t.length,o=t[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];r>s&&(s=r);a.push(r)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(t){var e,n,r,i,o,a,s,l,u,c=t.length,f=t[0],h=f.length,d=[];d[0]=l=u=0;for(n=1;h>n;++n){for(e=0,i=0;c>e;++e)i+=t[e][n][1];for(e=0,o=0,s=f[n][0]-f[n-1][0];c>e;++e){for(r=0,a=(t[e][n][1]-t[e][n-1][1])/(2*s);e>r;++r)a+=(t[r][n][1]-t[r][n-1][1])/s;o+=a*t[e][n][1]}d[n]=l-=i?o/i*s:0;u>l&&(u=l)}for(n=0;h>n;++n)d[n]-=u;return d},expand:function(t){var e,n,r,i=t.length,o=t[0].length,a=1/i,s=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];if(r)for(e=0;i>e;e++)t[e][n][1]/=r;else for(e=0;i>e;e++)t[e][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:co});Ka.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(n,this),c=r.call(this,u,o),f=i.call(this,c,u,o),o=-1,h=u.length,d=f.length-1,p=e?1:1/h;++o<d;){a=l[o]=[];a.dx=f[o+1]-(a.x=f[o]);a.y=0}if(d>0){o=-1;for(;++o<h;){s=u[o];if(s>=c[0]&&s<=c[1]){a=l[Ka.bisect(f,s,1,d)-1];a.y+=p;a.push(t[o])}}}return l}var e=!0,n=Number,r=vo,i=go;t.value=function(e){if(!arguments.length)return n;n=e;return t};t.range=function(e){if(!arguments.length)return r;r=Me(e);return t};t.bins=function(e){if(!arguments.length)return i;i="number"==typeof e?function(t){return mo(t,e)}:Me(e);return t};t.frequency=function(n){if(!arguments.length)return e;e=!!n;return t};return t};Ka.layout.pack=function(){function t(t,o){var a=n.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};s.x=s.y=0;eo(s,function(t){t.r=+c(t.value)});eo(s,So);if(r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;eo(s,function(t){t.r+=f});eo(s,So);eo(s,function(t){t.r-=f})}_o(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u));return a}var e,n=Ka.layout.hierarchy().sort(yo),r=0,i=[1,1];t.size=function(e){if(!arguments.length)return i;i=e;return t};t.radius=function(n){if(!arguments.length)return e;e=null==n||"function"==typeof n?n:+n;return t};t.padding=function(e){if(!arguments.length)return r;r=+e;return t};return Qi(t,n)};Ka.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),f=c[0],h=e(f);eo(h,n),h.parent.m=-h.z;to(h,r);if(u)to(f,o);else{var d=f,p=f,g=f;to(f,function(t){t.x<d.x&&(d=t);t.x>p.x&&(p=t);t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);to(f,function(t){t.x=(t.x+m)*v;t.y=t.depth*y})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)r.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){No(t);var o=(e[0].z+e[e.length-1].z)/2;if(r){t.z=r.z+s(t._,r._);t.m=t.z-o}else t.z=o}else r&&(t.z=r.z+s(t._,r._));t.parent.A=i(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m;t.m+=t.parent.m}function i(t,e,n){if(e){for(var r,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,f=a.m,h=l.m;a=Lo(a),i=Do(i),a&&i;){l=Do(l);o=Lo(o);o.a=t;r=a.z+f-i.z-u+s(a._,i._);if(r>0){Ao(Eo(a,t,n),t,r);u+=r;c+=r}f+=a.m;u+=i.m;h+=l.m;c+=o.m}if(a&&!Lo(o)){o.t=a;o.m+=f-c}if(i&&!Do(l)){l.t=i;l.m+=u-h;n=t}}return n}function o(t){t.x*=l[0];t.y=t.depth*l[1]}var a=Ka.layout.hierarchy().sort(null).value(null),s=Mo,l=[1,1],u=null;t.separation=function(e){if(!arguments.length)return s;s=e;return t};t.size=function(e){if(!arguments.length)return u?null:l;u=null==(l=e)?o:null;return t};t.nodeSize=function(e){if(!arguments.length)return u?l:null;u=null==(l=e)?null:o;return t};return Qi(t,a)};Ka.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;eo(l,function(t){var e=t.children;if(e&&e.length){t.x=Io(e);t.y=jo(e)}else{t.x=a?u+=n(t,a):0;t.y=0;a=t}});var c=Po(l),f=Ho(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;eo(l,i?function(t){t.x=(t.x-l.x)*r[0];t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0];t.y=(1-(l.y?t.y/l.y:1))*r[1]});return s}var e=Ka.layout.hierarchy().sort(null).value(null),n=Mo,r=[1,1],i=!1;t.separation=function(e){if(!arguments.length)return n;n=e;return t};t.size=function(e){if(!arguments.length)return i?null:r;i=null==(r=e);return t};t.nodeSize=function(e){if(!arguments.length)return i?r:null;i=null!=(r=e);return t};return Qi(t,e)};Ka.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,o=t.length;++i<o;){r=(n=t[i]).value*(0>e?0:e);n.area=isNaN(r)||0>=r?0:r}}function e(n){var o=n.children;if(o&&o.length){var a,s,l,u=f(n),c=[],h=o.slice(),p=1/0,g="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);t(h,u.dx*u.dy/n.value);c.area=0;for(;(l=h.length)>0;){c.push(a=h[l-1]);c.area+=a.area;if("squarify"!==d||(s=r(c,g))<=p){h.pop();p=s}else{c.area-=c.pop().area;i(c,g,u,!1);g=Math.min(u.dx,u.dy);c.length=c.area=0;p=1/0}}if(c.length){i(c,g,u,!0);c.length=c.area=0}o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,a=f(e),s=r.slice(),l=[];t(s,a.dx*a.dy/e.value);l.area=0;for(;o=s.pop();){l.push(o);l.area+=o.area;if(null!=o.z){i(l,o.z?a.dx:a.dy,a,!s.length);l.length=l.area=0}}r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,o=1/0,a=-1,s=t.length;++a<s;)if(n=t[a].area){o>n&&(o=n);n>i&&(i=n)}r*=r;e*=e;return r?Math.max(e*i*p/r,r/(e*o*p)):1/0}function i(t,e,n,r){var i,o=-1,a=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){(r||c>n.dy)&&(c=n.dy);for(;++o<a;){i=t[o];i.x=s;i.y=u;i.dy=c;s+=i.dx=Math.min(n.x+n.dx-s,c?l(i.area/c):0)}i.z=!0;i.dx+=n.x+n.dx-s;n.y+=c;n.dy-=c}else{(r||c>n.dx)&&(c=n.dx);for(;++o<a;){i=t[o];i.x=s;i.y=u;i.dx=c;u+=i.dy=Math.min(n.y+n.dy-u,c?l(i.area/c):0)}i.z=!1;i.dy+=n.y+n.dy-u;n.x+=c;n.dx-=c}}function o(r){var i=a||s(r),o=i[0];o.x=0;o.y=0;o.dx=u[0];o.dy=u[1];a&&s.revalue(o);t([o],o.dx*o.dy/o.value);(a?n:e)(o);h&&(a=i);return i}var a,s=Ka.layout.hierarchy(),l=Math.round,u=[1,1],c=null,f=Oo,h=!1,d="squarify",p=.5*(1+Math.sqrt(5));o.size=function(t){if(!arguments.length)return u;u=t;return o};o.padding=function(t){function e(e){var n=t.call(o,e,e.depth);return null==n?Oo(e):Fo(e,"number"==typeof n?[n,n,n,n]:n)}function n(e){return Fo(e,t)}if(!arguments.length)return c;var r;f=null==(c=t)?Oo:"function"==(r=typeof t)?e:"number"===r?(t=[t,t,t,t],n):n;return o};o.round=function(t){if(!arguments.length)return l!=Number;l=t?Math.round:Number;return o};o.sticky=function(t){if(!arguments.length)return h;h=t;a=null;return o};o.ratio=function(t){if(!arguments.length)return p;p=t;return o};o.mode=function(t){if(!arguments.length)return d;d=t+"";return o};return Qi(o,s)};Ka.random={normal:function(t,e){var n=arguments.length;2>n&&(e=1);1>n&&(t=0);return function(){var n,r,i;do{n=2*Math.random()-1;r=2*Math.random()-1;i=n*n+r*r}while(!i||i>1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=Ka.random.normal.apply(Ka,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=Ka.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}};Ka.scale={};var mu={floor:De,ceil:De};Ka.scale.linear=function(){return Vo([0,1],[0,1],bi,!1)};var vu={s:1,g:1,p:1,r:1,e:1};Ka.scale.log=function(){return Qo(Ka.scale.linear().domain([0,1]),10,!0,[1,10])};var yu=Ka.format(".0e"),bu={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};Ka.scale.pow=function(){return ta(Ka.scale.linear(),1,[0,1])};Ka.scale.sqrt=function(){return Ka.scale.pow().exponent(.5)};Ka.scale.ordinal=function(){return na([],{t:"range",a:[[]]})};Ka.scale.category10=function(){return Ka.scale.ordinal().range(xu)};Ka.scale.category20=function(){return Ka.scale.ordinal().range(wu)};Ka.scale.category20b=function(){return Ka.scale.ordinal().range(Su)};Ka.scale.category20c=function(){return Ka.scale.ordinal().range(Cu)};var xu=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xe),wu=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xe),Su=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xe),Cu=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xe);Ka.scale.quantile=function(){return ra([],[])};Ka.scale.quantize=function(){return ia(0,1,[0,1])};Ka.scale.threshold=function(){return oa([.5],[0,1])};Ka.scale.identity=function(){return aa([0,1])};Ka.svg={};Ka.svg.arc=function(){function t(){var t=e.apply(this,arguments),o=n.apply(this,arguments),a=r.apply(this,arguments)+Tu,s=i.apply(this,arguments)+Tu,l=(a>s&&(l=a,a=s,s=l),s-a),u=Ls>l?"0":"1",c=Math.cos(a),f=Math.sin(a),h=Math.cos(s),d=Math.sin(s);return l>=_u?t?"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"Z":t?"M"+o*c+","+o*f+"A"+o+","+o+" 0 "+u+",1 "+o*h+","+o*d+"L"+t*h+","+t*d+"A"+t+","+t+" 0 "+u+",0 "+t*c+","+t*f+"Z":"M"+o*c+","+o*f+"A"+o+","+o+" 0 "+u+",1 "+o*h+","+o*d+"L0,0Z"}var e=sa,n=la,r=ua,i=ca;t.innerRadius=function(n){if(!arguments.length)return e;e=Me(n);return t};t.outerRadius=function(e){if(!arguments.length)return n;n=Me(e);return t};t.startAngle=function(e){if(!arguments.length)return r;r=Me(e);return t};t.endAngle=function(e){if(!arguments.length)return i;i=Me(e);return t};t.centroid=function(){var t=(e.apply(this,arguments)+n.apply(this,arguments))/2,o=(r.apply(this,arguments)+i.apply(this,arguments))/2+Tu;return[Math.cos(o)*t,Math.sin(o)*t]};return t};var Tu=-Ns,_u=As-Es;Ka.svg.line=function(){return fa(De)};var ku=Ka.map({linear:ha,"linear-closed":da,step:pa,"step-before":ga,"step-after":ma,basis:Sa,"basis-open":Ca,"basis-closed":Ta,bundle:_a,cardinal:ba,"cardinal-open":va,"cardinal-closed":ya,monotone:Na});ku.forEach(function(t,e){e.key=t;e.closed=/-closed$/.test(t)});var Mu=[0,2/3,1/3,0],Du=[0,1/3,2/3,0],Lu=[0,1/6,2/3,1/6]; Ka.svg.line.radial=function(){var t=fa(Ea);t.radius=t.x,delete t.x;t.angle=t.y,delete t.y;return t};ga.reverse=ma;ma.reverse=ga;Ka.svg.area=function(){return ja(De)};Ka.svg.area.radial=function(){var t=ja(Ea);t.radius=t.x,delete t.x;t.innerRadius=t.x0,delete t.x0;t.outerRadius=t.x1,delete t.x1;t.angle=t.y,delete t.y;t.startAngle=t.y0,delete t.y0;t.endAngle=t.y1,delete t.y1;return t};Ka.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,n,r){var i=e.call(t,n,r),o=s.call(t,i,r),a=l.call(t,i,r)+Tu,c=u.call(t,i,r)+Tu;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Ls)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var o=xr,a=wr,s=Ia,l=ua,u=ca;t.radius=function(e){if(!arguments.length)return s;s=Me(e);return t};t.source=function(e){if(!arguments.length)return o;o=Me(e);return t};t.target=function(e){if(!arguments.length)return a;a=Me(e);return t};t.startAngle=function(e){if(!arguments.length)return l;l=Me(e);return t};t.endAngle=function(e){if(!arguments.length)return u;u=Me(e);return t};return t};Ka.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=n.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];l=l.map(r);return"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,n=wr,r=Pa;t.source=function(n){if(!arguments.length)return e;e=Me(n);return t};t.target=function(e){if(!arguments.length)return n;n=Me(e);return t};t.projection=function(e){if(!arguments.length)return r;r=e;return t};return t};Ka.svg.diagonal.radial=function(){var t=Ka.svg.diagonal(),e=Pa,n=t.projection;t.projection=function(t){return arguments.length?n(Ha(e=t)):e};return t};Ka.svg.symbol=function(){function t(t,r){return(Au.get(e.call(this,t,r))||Ra)(n.call(this,t,r))}var e=Fa,n=Oa;t.type=function(n){if(!arguments.length)return e;e=Me(n);return t};t.size=function(e){if(!arguments.length)return n;n=Me(e);return t};return t};var Au=Ka.map({circle:Ra,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Iu)),n=e*Iu;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/ju),n=e*ju/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ju),n=e*ju/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});Ka.svg.symbolTypes=Au.keys();var Nu,Eu,ju=Math.sqrt(3),Iu=Math.tan(30*Is),Pu=[],Hu=0;Pu.call=ws.call;Pu.empty=ws.empty;Pu.node=ws.node;Pu.size=ws.size;Ka.transition=function(t){return arguments.length?Nu?t.transition():t:Ts.transition()};Ka.transition.prototype=Pu;Pu.select=function(t){var e,n,r,i=this.id,o=[];t=M(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]);for(var l=this[a],u=-1,c=l.length;++u<c;)if((r=l[u])&&(n=t.call(r,r.__data__,u,a))){"__data__"in r&&(n.__data__=r.__data__);Ua(n,u,i,r.__transition__[i]);e.push(n)}else e.push(null)}return Wa(o,i)};Pu.selectAll=function(t){var e,n,r,i,o,a=this.id,s=[];t=D(t);for(var l=-1,u=this.length;++l<u;)for(var c=this[l],f=-1,h=c.length;++f<h;)if(r=c[f]){o=r.__transition__[a];n=t.call(r,r.__data__,f,l);s.push(e=[]);for(var d=-1,p=n.length;++d<p;){(i=n[d])&&Ua(i,d,a,o);e.push(i)}}return Wa(s,a)};Pu.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=R(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);for(var n=this[o],s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return Wa(i,this.id)};Pu.tween=function(t,e){var n=this.id;return arguments.length<2?this.node().__transition__[n].tween.get(t):z(this,null==e?function(e){e.__transition__[n].tween.remove(t)}:function(r){r.__transition__[n].tween.set(t,e)})};Pu.attr=function(t,e){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(s);return n!==t&&(e=a(n,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(s.space,s.local);return n!==t&&(e=a(n,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?qi:bi,s=Ka.ns.qualify(t);return za(this,"attr."+t,e,s.local?o:i)};Pu.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=Ka.ns.qualify(t);return this.tween("attr."+t,i.local?r:n)};Pu.style=function(t,e,n){function r(){this.style.removeProperty(t)}function i(e){return null==e?r:(e+="",function(){var r,i=ns.getComputedStyle(this,null).getPropertyValue(t);return i!==e&&(r=bi(i,e),function(e){this.style.setProperty(t,r(e),n)})})}var o=arguments.length;if(3>o){if("string"!=typeof t){2>o&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return za(this,"style."+t,e,i)};Pu.styleTween=function(t,e,n){function r(r,i){var o=e.call(this,r,i,ns.getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}}arguments.length<3&&(n="");return this.tween("style."+t,r)};Pu.text=function(t){return za(this,"text",t,qa)};Pu.remove=function(){return this.each("end.transition",function(){var t;this.__transition__.count<2&&(t=this.parentNode)&&t.removeChild(this)})};Pu.ease=function(t){var e=this.id;if(arguments.length<1)return this.node().__transition__[e].ease;"function"!=typeof t&&(t=Ka.ease.apply(Ka,arguments));return z(this,function(n){n.__transition__[e].ease=t})};Pu.delay=function(t){var e=this.id;return arguments.length<1?this.node().__transition__[e].delay:z(this,"function"==typeof t?function(n,r,i){n.__transition__[e].delay=+t.call(n,n.__data__,r,i)}:(t=+t,function(n){n.__transition__[e].delay=t}))};Pu.duration=function(t){var e=this.id;return arguments.length<1?this.node().__transition__[e].duration:z(this,"function"==typeof t?function(n,r,i){n.__transition__[e].duration=Math.max(1,t.call(n,n.__data__,r,i))}:(t=Math.max(1,t),function(n){n.__transition__[e].duration=t}))};Pu.each=function(t,e){var n=this.id;if(arguments.length<2){var r=Eu,i=Nu;Nu=n;z(this,function(e,r,i){Eu=e.__transition__[n];t.call(e,e.__data__,r,i)});Eu=r;Nu=i}else z(this,function(r){var i=r.__transition__[n];(i.event||(i.event=Ka.dispatch("start","end"))).on(t,e)});return this};Pu.transition=function(){for(var t,e,n,r,i=this.id,o=++Hu,a=[],s=0,l=this.length;l>s;s++){a.push(t=[]);for(var e=this[s],u=0,c=e.length;c>u;u++){if(n=e[u]){r=Object.create(n.__transition__[i]);r.delay+=r.duration;Ua(n,u,o,r)}t.push(n)}}return Wa(a,o)};Ka.svg.axis=function(){function t(t){t.each(function(){var t,u=Ka.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),h=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,d=null==e?f.tickFormat?f.tickFormat.apply(f,s):De:e,p=u.selectAll(".tick").data(h,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Es),m=Ka.transition(p.exit()).style("opacity",Es).remove(),v=Ka.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=Wo(f),x=u.selectAll(".domain").data([0]),w=(x.enter().append("path").attr("class","domain"),Ka.transition(x));g.append("line");g.append("text");var S,C,T,_,k=g.select("line"),M=v.select("line"),D=p.select("text").text(d),L=g.select("text"),A=v.select("text"),N="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r){t=Ba,S="x",T="y",C="x2",_="y2";D.attr("dy",0>N?"0em":".71em").style("text-anchor","middle");w.attr("d","M"+b[0]+","+N*o+"V0H"+b[1]+"V"+N*o)}else{t=Va,S="y",T="x",C="y2",_="x2";D.attr("dy",".32em").style("text-anchor",0>N?"end":"start");w.attr("d","M"+N*o+","+b[0]+"H0V"+b[1]+"H"+N*o)}k.attr(_,N*i);L.attr(T,N*y);M.attr(C,0).attr(_,N*i);A.attr(S,0).attr(T,N*y);if(f.rangeBand){var E=f,j=E.rangeBand()/2;c=f=function(t){return E(t)+j}}else c.rangeBand?c=f:m.call(t,f,c);g.call(t,c,f);v.call(t,f,f)})}var e,n=Ka.scale.linear(),r=Ou,i=6,o=6,a=3,s=[10],l=null;t.scale=function(e){if(!arguments.length)return n;n=e;return t};t.orient=function(e){if(!arguments.length)return r;r=e in Fu?e+"":Ou;return t};t.ticks=function(){if(!arguments.length)return s;s=arguments;return t};t.tickValues=function(e){if(!arguments.length)return l;l=e;return t};t.tickFormat=function(n){if(!arguments.length)return e;e=n;return t};t.tickSize=function(e){var n=arguments.length;if(!n)return i;i=+e;o=+arguments[n-1];return t};t.innerTickSize=function(e){if(!arguments.length)return i;i=+e;return t};t.outerTickSize=function(e){if(!arguments.length)return o;o=+e;return t};t.tickPadding=function(e){if(!arguments.length)return a;a=+e;return t};t.tickSubdivide=function(){return arguments.length&&t};return t};var Ou="bottom",Fu={top:1,right:1,bottom:1,left:1};Ka.svg.brush=function(){function t(o){o.each(function(){var o=Ka.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),a=o.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=o.selectAll(".resize").data(p,De);s.exit().remove();s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ru[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");s.style("display",t.empty()?"none":null);var c,f=Ka.transition(o),h=Ka.transition(a);if(l){c=Wo(l);h.attr("x",c[0]).attr("width",c[1]-c[0]);n(f)}if(u){c=Wo(u);h.attr("y",c[0]).attr("height",c[1]-c[0]);r(f)}e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+c[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",c[0]);t.selectAll(".extent,.n>rect,.s>rect").attr("width",c[1]-c[0])}function r(t){t.select(".extent").attr("y",f[0]);t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){if(32==Ka.event.keyCode){if(!D){y=null;A[0]-=c[1];A[1]-=f[1];D=2}C()}}function p(){if(32==Ka.event.keyCode&&2==D){A[0]+=c[1];A[1]+=f[1];D=0;C()}}function g(){var t=Ka.mouse(x),i=!1;if(b){t[0]+=b[0];t[1]+=b[1]}if(!D)if(Ka.event.altKey){y||(y=[(c[0]+c[1])/2,(f[0]+f[1])/2]);A[0]=c[+(t[0]<y[0])];A[1]=f[+(t[1]<y[1])]}else y=null;if(k&&m(t,l,0)){n(T);i=!0}if(M&&m(t,u,1)){r(T);i=!0}if(i){e(T);S({type:"brush",mode:D?"move":"resize"})}}function m(t,e,n){var r,i,s=Wo(e),l=s[0],u=s[1],p=A[n],g=n?f:c,m=g[1]-g[0];if(D){l-=p;u-=m+p}r=(n?d:h)?Math.max(l,Math.min(u,t[n])):t[n];if(D)i=(r+=p)+m;else{y&&(p=Math.max(l,Math.min(u,2*y[n]-r)));if(r>p){i=r;r=p}else i=p}if(g[0]!=r||g[1]!=i){n?a=null:o=null;g[0]=r;g[1]=i;return!0}}function v(){g();T.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null);Ka.select("body").style("cursor",null);N.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);L();S({type:"brushend"})}var y,b,x=this,w=Ka.select(Ka.event.target),S=s.of(x,arguments),T=Ka.select(x),_=w.datum(),k=!/^(n|s)$/.test(_)&&l,M=!/^(e|w)$/.test(_)&&u,D=w.classed("extent"),L=$(),A=Ka.mouse(x),N=Ka.select(ns).on("keydown.brush",i).on("keyup.brush",p);Ka.event.changedTouches?N.on("touchmove.brush",g).on("touchend.brush",v):N.on("mousemove.brush",g).on("mouseup.brush",v);T.interrupt().selectAll("*").interrupt();if(D){A[0]=c[0]-A[0];A[1]=f[0]-A[1]}else if(_){var E=+/w$/.test(_),j=+/^n/.test(_);b=[c[1-E]-A[0],f[1-j]-A[1]];A[0]=c[E];A[1]=f[j]}else Ka.event.altKey&&(y=A.slice());T.style("pointer-events","none").selectAll(".resize").style("display",null);Ka.select("body").style("cursor",w.style("cursor"));S({type:"brushstart"});g()}var o,a,s=_(t,"brushstart","brush","brushend"),l=null,u=null,c=[0,0],f=[0,0],h=!0,d=!0,p=Wu[0];t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:c,y:f,i:o,j:a},n=this.__chart__||e;this.__chart__=e;if(Nu)Ka.select(this).transition().each("start.brush",function(){o=n.i;a=n.j;c=n.x;f=n.y;t({type:"brushstart"})}).tween("brush:brush",function(){var n=xi(c,e.x),r=xi(f,e.y);o=a=null;return function(i){c=e.x=n(i);f=e.y=r(i);t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i;a=e.j;t({type:"brush",mode:"resize"});t({type:"brushend"})});else{t({type:"brushstart"});t({type:"brush",mode:"resize"});t({type:"brushend"})}})};t.x=function(e){if(!arguments.length)return l;l=e;p=Wu[!l<<1|!u];return t};t.y=function(e){if(!arguments.length)return u;u=e;p=Wu[!l<<1|!u];return t};t.clamp=function(e){if(!arguments.length)return l&&u?[h,d]:l?h:u?d:null;l&&u?(h=!!e[0],d=!!e[1]):l?h=!!e:u&&(d=!!e);return t};t.extent=function(e){var n,r,i,s,h;if(!arguments.length){if(l)if(o)n=o[0],r=o[1];else{n=c[0],r=c[1];l.invert&&(n=l.invert(n),r=l.invert(r));n>r&&(h=n,n=r,r=h)}if(u)if(a)i=a[0],s=a[1];else{i=f[0],s=f[1];u.invert&&(i=u.invert(i),s=u.invert(s));i>s&&(h=i,i=s,s=h)}return l&&u?[[n,i],[r,s]]:l?[n,r]:u&&[i,s]}if(l){n=e[0],r=e[1];u&&(n=n[0],r=r[0]);o=[n,r];l.invert&&(n=l(n),r=l(r));n>r&&(h=n,n=r,r=h);(n!=c[0]||r!=c[1])&&(c=[n,r])}if(u){i=e[0],s=e[1];l&&(i=i[1],s=s[1]);a=[i,s];u.invert&&(i=u(i),s=u(s));i>s&&(h=i,i=s,s=h);(i!=f[0]||s!=f[1])&&(f=[i,s])}return t};t.clear=function(){if(!t.empty()){c=[0,0],f=[0,0];o=a=null}return t};t.empty=function(){return!!l&&c[0]==c[1]||!!u&&f[0]==f[1]};return Ka.rebind(t,s,"on")};var Ru={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Wu=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],zu=al.format=hl.timeFormat,qu=zu.utc,Uu=qu("%Y-%m-%dT%H:%M:%S.%LZ");zu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Xa:Uu;Xa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e};Xa.toString=Uu.toString;al.second=ze(function(t){return new sl(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()});al.seconds=al.second.range;al.seconds.utc=al.second.utc.range;al.minute=ze(function(t){return new sl(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()});al.minutes=al.minute.range;al.minutes.utc=al.minute.utc.range;al.hour=ze(function(t){var e=t.getTimezoneOffset()/60;return new sl(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()});al.hours=al.hour.range;al.hours.utc=al.hour.utc.range;al.month=ze(function(t){t=al.day(t);t.setDate(1);return t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()});al.months=al.month.range;al.months.utc=al.month.utc.range;var Bu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vu=[[al.second,1],[al.second,5],[al.second,15],[al.second,30],[al.minute,1],[al.minute,5],[al.minute,15],[al.minute,30],[al.hour,1],[al.hour,3],[al.hour,6],[al.hour,12],[al.day,1],[al.day,2],[al.week,1],[al.month,1],[al.month,3],[al.year,1]],Xu=zu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",An]]),Gu={range:function(t,e,n){return Ka.range(Math.ceil(t/n)*n,+e,n).map($a)},floor:De,ceil:De};Vu.year=al.year;al.scale=function(){return Ga(Ka.scale.linear(),Vu,Xu)};var $u=Vu.map(function(t){return[t[0].utc,t[1]]}),Yu=qu.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",An]]);$u.year=al.year.utc;al.scale.utc=function(){return Ga(Ka.scale.linear(),$u,Yu)};Ka.text=Le(function(t){return t.responseText});Ka.json=function(t,e){return Ae(t,"application/json",Ya,e)};Ka.html=function(t,e){return Ae(t,"text/html",Ja,e)};Ka.xml=Le(function(t){return t.responseXML});"function"==typeof t&&t.amd?t(Ka):"object"==typeof n&&n.exports&&(n.exports=Ka);this.d3=Ka}()},{}],13:[function(t){var e=t("jquery");(function(t,e){function n(e,n){var i,o,a,s=e.nodeName.toLowerCase();if("area"===s){i=e.parentNode;o=i.name;if(!e.href||!o||"map"!==i.nodeName.toLowerCase())return!1;a=t("img[usemap=#"+o+"]")[0];return!!a&&r(a)}return(/input|select|textarea|button|object/.test(s)?!e.disabled:"a"===s?e.href||n:n)&&r(e)}function r(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var i=0,o=/^ui-id-\d+$/;t.ui=t.ui||{};t.extend(t.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});t.fn.extend({focus:function(e){return function(n,r){return"number"==typeof n?this.each(function(){var e=this;setTimeout(function(){t(e).focus();r&&r.call(e)},n)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0);return/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var r,i,o=t(this[0]);o.length&&o[0]!==document;){r=o.css("position");if("absolute"===r||"relative"===r||"fixed"===r){i=parseInt(o.css("zIndex"),10);if(!isNaN(i)&&0!==i)return i}o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}});t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,r){return!!t.data(e,r[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var r=t.attr(e,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(e,!i)}});t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(n,r){function i(e,n,r,i){t.each(o,function(){n-=parseFloat(t.css(e,"padding"+this))||0;r&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0);i&&(n-=parseFloat(t.css(e,"margin"+this))||0)});return n}var o="Width"===r?["Left","Right"]:["Top","Bottom"],a=r.toLowerCase(),s={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+r]=function(n){return n===e?s["inner"+r].call(this):this.each(function(){t(this).css(a,i(this,n)+"px")})};t.fn["outer"+r]=function(e,n){return"number"!=typeof e?s["outer"+r].call(this,e):this.each(function(){t(this).css(a,i(this,e,!0,n)+"px")})}});t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))});t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData));t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());t.support.selectstart="onselectstart"in document.createElement("div");t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});t.extend(t.ui,{plugin:{add:function(e,n,r){var i,o=t.ui[e].prototype;for(i in r){o.plugins[i]=o.plugins[i]||[];o.plugins[i].push([n,r[i]])}},call:function(t,e,n){var r,i=t.plugins[e];if(i&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(r=0;r<i.length;r++)t.options[i[r][0]]&&i[r][1].apply(t.element,n)}},hasScroll:function(e,n){if("hidden"===t(e).css("overflow"))return!1;var r=n&&"left"===n?"scrollLeft":"scrollTop",i=!1;if(e[r]>0)return!0;e[r]=1;i=e[r]>0;e[r]=0;return i}})})(e)},{jquery:17}],14:[function(t){var e=t("jquery");t("./widget");(function(t){var e=!1;t(document).mouseup(function(){e=!1});t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(n){if(!0===t.data(n.target,e.widgetName+".preventClickEvent")){t.removeData(n.target,e.widgetName+".preventClickEvent");n.stopImmediatePropagation();return!1}});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(n){if(!e){this._mouseStarted&&this._mouseUp(n);this._mouseDownEvent=n;var r=this,i=1===n.which,o="string"==typeof this.options.cancel&&n.target.nodeName?t(n.target).closest(this.options.cancel).length:!1;if(!i||o||!this._mouseCapture(n))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(n)&&this._mouseDelayMet(n)){this._mouseStarted=this._mouseStart(n)!==!1;if(!this._mouseStarted){n.preventDefault();return!0}}!0===t.data(n.target,this.widgetName+".preventClickEvent")&&t.removeData(n.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(t){return r._mouseMove(t)};this._mouseUpDelegate=function(t){return r._mouseUp(t)};t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);n.preventDefault();e=!0;return!0}},_mouseMove:function(e){if(t.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(this._mouseStarted){this._mouseDrag(e);return e.preventDefault()}if(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1;this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)}return!this._mouseStarted},_mouseUp:function(e){t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=!1;e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0);this._mouseStop(e)}return!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(e)},{"./widget":16,jquery:17}],15:[function(t){var e=t("jquery");t("./core");t("./mouse");t("./widget");(function(t){function e(t,e,n){return t>e&&e+n>t}function n(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?"x"===t.axis||n(this.items[0].item):!1;this.offset=this.element.offset();this._mouseInit();this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,n){if("disabled"===e){this.options[e]=n;this.widget().toggleClass("ui-sortable-disabled",!!n)}else t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,n){var r=null,i=!1,o=this;if(this.reverting)return!1;if(this.options.disabled||"static"===this.options.type)return!1;this._refreshItems(e);t(e.target).parents().each(function(){if(t.data(this,o.widgetName+"-item")===o){r=t(this);return!1}});t.data(e.target,o.widgetName+"-item")===o&&(r=t(e.target));if(!r)return!1;if(this.options.handle&&!n){t(this.options.handle,r).find("*").addBack().each(function(){this===e.target&&(i=!0)});if(!i)return!1}this.currentItem=r;this._removeCurrentsFromItems();return!0},_mouseStart:function(e,n,r){var i,o,a=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!==this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();a.containment&&this._setContainment();if(a.cursor&&"auto"!==a.cursor){o=this.document.find("body");this.storedCursor=o.css("cursor");o.css("cursor",a.cursor);this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)}if(a.opacity){this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity"));this.helper.css("opacity",a.opacity)}if(a.zIndex){this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex"));this.helper.css("zIndex",a.zIndex)}this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());this._trigger("start",e,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",e,this._uiHash(this));t.ui.ddmanager&&(t.ui.ddmanager.current=this);t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return!0},_mouseDrag:function(e){var n,r,i,o,a=this.options,s=!1;this.position=this._generatePosition(e);this.positionAbs=this._convertPositionTo("absolute");this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){if(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName){this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop-a.scrollSpeed);this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft-a.scrollSpeed)}else{e.pageY-t(document).scrollTop()<a.scrollSensitivity?s=t(document).scrollTop(t(document).scrollTop()-a.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<a.scrollSensitivity&&(s=t(document).scrollTop(t(document).scrollTop()+a.scrollSpeed));e.pageX-t(document).scrollLeft()<a.scrollSensitivity?s=t(document).scrollLeft(t(document).scrollLeft()-a.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<a.scrollSensitivity&&(s=t(document).scrollLeft(t(document).scrollLeft()+a.scrollSpeed))}s!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)}this.positionAbs=this._convertPositionTo("absolute");this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px");this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px");for(n=this.items.length-1;n>=0;n--){r=this.items[n];i=r.item[0];o=this._intersectsWithPointer(r);if(o&&r.instance===this.currentContainer&&i!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==i&&!t.contains(this.placeholder[0],i)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],i):!0)){this.direction=1===o?"down":"up";if("pointer"!==this.options.tolerance&&!this._intersectsWithSides(r))break;this._rearrange(e,r);this._trigger("change",e,this._uiHash());break}}this._contactContainers(e);t.ui.ddmanager&&t.ui.ddmanager.drag(this,e);this._trigger("sort",e,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(e,n){if(e){t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e);if(this.options.revert){var r=this,i=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft));o&&"y"!==o||(a.top=i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop));this.reverting=!0;t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){r._clear(e)})}else this._clear(e,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--){this.containers[e]._trigger("deactivate",null,this._uiHash(this));if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",null,this._uiHash(this));this.containers[e].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove();t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null});this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(e){var n=this._getItemsAsjQuery(e&&e.connected),r=[];e=e||{};t(n).each(function(){var n=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);n&&r.push((e.key||n[1]+"[]")+"="+(e.key&&e.expression?n[1]:n[2])) });!r.length&&e.key&&r.push(e.key+"=");return r.join("&")},toArray:function(e){var n=this._getItemsAsjQuery(e&&e.connected),r=[];e=e||{};n.each(function(){r.push(t(e.item||this).attr(e.attribute||"id")||"")});return r},_intersectsWith:function(t){var e=this.positionAbs.left,n=e+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,o=t.left,a=o+t.width,s=t.top,l=s+t.height,u=this.offset.click.top,c=this.offset.click.left,f="x"===this.options.axis||r+u>s&&l>r+u,h="y"===this.options.axis||e+c>o&&a>e+c,d=f&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?d:o<e+this.helperProportions.width/2&&n-this.helperProportions.width/2<a&&s<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var n="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),r="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),i=n&&r,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return i?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(t){var n=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),r=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&r||"left"===o&&!r:i&&("down"===i&&n||"up"===i&&!n)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){this._refreshItems(t);this.refreshPositions();return this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function n(){s.push(this)}var r,i,o,a,s=[],l=[],u=this._connectWith();if(u&&e)for(r=u.length-1;r>=0;r--){o=t(u[r]);for(i=o.length-1;i>=0;i--){a=t.data(o[i],this.widgetFullName);a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a])}}l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(r=l.length-1;r>=0;r--)l[r][0].each(n);return t(s)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var n=0;n<e.length;n++)if(e[n]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[];this.containers=[this];var n,r,i,o,a,s,l,u,c=this.items,f=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--){i=t(h[n]);for(r=i.length-1;r>=0;r--){o=t.data(i[r],this.widgetFullName);if(o&&o!==this&&!o.options.disabled){f.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]);this.containers.push(o)}}}for(n=f.length-1;n>=0;n--){a=f[n][1];s=f[n][0];for(r=0,u=s.length;u>r;r++){l=t(s[r]);l.data(this.widgetName+"-item",a);c.push({item:l,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,o;for(n=this.items.length-1;n>=0;n--){r=this.items[n];if(r.instance===this.currentContainer||!this.currentContainer||r.item[0]===this.currentItem[0]){i=this.options.toleranceElement?t(this.options.toleranceElement,r.item):r.item;if(!e){r.width=i.outerWidth();r.height=i.outerHeight()}o=i.offset();r.left=o.left;r.top=o.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--){o=this.containers[n].element.offset();this.containers[n].containerCache.left=o.left;this.containers[n].containerCache.top=o.top;this.containers[n].containerCache.width=this.containers[n].element.outerWidth();this.containers[n].containerCache.height=this.containers[n].element.outerHeight()}return this},_createPlaceholder:function(e){e=e||this;var n,r=e.options;if(!r.placeholder||r.placeholder.constructor===String){n=r.placeholder;r.placeholder={element:function(){var r=e.currentItem[0].nodeName.toLowerCase(),i=t("<"+r+">",e.document[0]).addClass(n||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");"tr"===r?e.currentItem.children().each(function(){t("<td>&#160;</td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)}):"img"===r&&i.attr("src",e.currentItem.attr("src"));n||i.css("visibility","hidden");return i},update:function(t,i){if(!n||r.forcePlaceholderSize){i.height()||i.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10));i.width()||i.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10))}}}}e.placeholder=t(r.placeholder.element.call(e.element,e.currentItem));e.currentItem.after(e.placeholder);r.placeholder.update(e,e.placeholder)},_contactContainers:function(r){var i,o,a,s,l,u,c,f,h,d,p=null,g=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(p&&t.contains(this.containers[i].element[0],p.element[0]))continue;p=this.containers[i];g=i}else if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",r,this._uiHash(this));this.containers[i].containerCache.over=0}if(p)if(1===this.containers.length){if(!this.containers[g].containerCache.over){this.containers[g]._trigger("over",r,this._uiHash(this));this.containers[g].containerCache.over=1}}else{a=1e4;s=null;d=p.floating||n(this.currentItem);l=d?"left":"top";u=d?"width":"height";c=this.positionAbs[l]+this.offset.click[l];for(o=this.items.length-1;o>=0;o--)if(t.contains(this.containers[g].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!d||e(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))){f=this.items[o].item.offset()[l];h=!1;if(Math.abs(f-c)>Math.abs(f+this.items[o][u]-c)){h=!0;f+=this.items[o][u]}if(Math.abs(f-c)<a){a=Math.abs(f-c);s=this.items[o];this.direction=h?"up":"down"}}if(!s&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[g])return;s?this._rearrange(r,s,null,!0):this._rearrange(r,null,this.containers[g].element,!0);this._trigger("change",r,this._uiHash());this.containers[g]._trigger("change",r,this._uiHash(this));this.currentContainer=this.containers[g];this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[g]._trigger("over",r,this._uiHash(this));this.containers[g].containerCache.over=1}},_createHelper:function(e){var n=this.options,r=t.isFunction(n.helper)?t(n.helper.apply(this.element[0],[e,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;r.parents("body").length||t("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]);r[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")});(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width());(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height());return r},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" "));t.isArray(e)&&(e={left:+e[0],top:+e[1]||0});"left"in e&&(this.offset.click.left=e.left+this.margins.left);"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left);"top"in e&&(this.offset.click.top=e.top+this.margins.top);"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();if("absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])){e.left+=this.scrollParent.scrollLeft();e.top+=this.scrollParent.scrollTop()}(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0});return{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,n,r,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode);("document"===i.containment||"window"===i.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===i.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===i.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]);if(!/^(document|window|parent)$/.test(i.containment)){e=t(i.containment)[0];n=t(i.containment).offset();r="hidden"!==t(e).css("overflow");this.containment=[n.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(e,n){n||(n=this.position);var r="absolute"===e?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:i.scrollLeft())*r}},_generatePosition:function(e){var n,r,i=this.options,o=e.pageX,a=e.pageY,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(s[0].tagName);"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset());if(this.originalPosition){if(this.containment){e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left);e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top);e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left);e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)}if(i.grid){n=this.originalPageY+Math.round((a-this.originalPageY)/i.grid[1])*i.grid[1];a=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n;r=this.originalPageX+Math.round((o-this.originalPageX)/i.grid[0])*i.grid[0];o=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r}}return{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:s.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:s.scrollLeft())}},_rearrange:function(t,e,n,r){n?n[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(t,e){function n(t,e,n){return function(r){n._trigger(t,r,e._uiHash(e))}}this.reverting=!1;var r,i=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(r in this._storedCSS)("auto"===this._storedCSS[r]||"static"===this._storedCSS[r])&&(this._storedCSS[r]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!e&&i.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))});!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||i.push(function(t){this._trigger("update",t,this._uiHash())});if(this!==this.currentContainer&&!e){i.push(function(t){this._trigger("remove",t,this._uiHash())});i.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer));i.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer))}for(r=this.containers.length-1;r>=0;r--){e||i.push(n("deactivate",this,this.containers[r]));if(this.containers[r].containerCache.over){i.push(n("out",this,this.containers[r]));this.containers[r].containerCache.over=0}}if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",t,this._uiHash());for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}this.fromOutside=!1;return!1}e||this._trigger("beforeStop",t,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!==this.currentItem[0]&&this.helper.remove();this.helper=null;if(!e){for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var n=e||this;return{helper:n.helper,placeholder:n.placeholder||t([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:e?e.element:null}}})})(e)},{"./core":13,"./mouse":14,"./widget":16,jquery:17}],16:[function(t){var e=t("jquery");(function(t,e){var n=0,r=Array.prototype.slice,i=t.cleanData;t.cleanData=function(e){for(var n,r=0;null!=(n=e[r]);r++)try{t(n).triggerHandler("remove")}catch(o){}i(e)};t.widget=function(e,n,r){var i,o,a,s,l={},u=e.split(".")[0];e=e.split(".")[1];i=u+"-"+e;if(!r){r=n;n=t.Widget}t.expr[":"][i.toLowerCase()]=function(e){return!!t.data(e,i)};t[u]=t[u]||{};o=t[u][e];a=t[u][e]=function(t,e){if(!this._createWidget)return new a(t,e);arguments.length&&this._createWidget(t,e);return void 0};t.extend(a,o,{version:r.version,_proto:t.extend({},r),_childConstructors:[]});s=new n;s.options=t.widget.extend({},s.options);t.each(r,function(e,r){l[e]=t.isFunction(r)?function(){var t=function(){return n.prototype[e].apply(this,arguments)},i=function(t){return n.prototype[e].apply(this,t)};return function(){var e,n=this._super,o=this._superApply;this._super=t;this._superApply=i;e=r.apply(this,arguments);this._super=n;this._superApply=o;return e}}():r});a.prototype=t.widget.extend(s,{widgetEventPrefix:o?s.widgetEventPrefix||e:e},l,{constructor:a,namespace:u,widgetName:e,widgetFullName:i});if(o){t.each(o._childConstructors,function(e,n){var r=n.prototype;t.widget(r.namespace+"."+r.widgetName,a,n._proto)});delete o._childConstructors}else n._childConstructors.push(a);t.widget.bridge(e,a)};t.widget.extend=function(n){for(var i,o,a=r.call(arguments,1),s=0,l=a.length;l>s;s++)for(i in a[s]){o=a[s][i];a[s].hasOwnProperty(i)&&o!==e&&(n[i]=t.isPlainObject(o)?t.isPlainObject(n[i])?t.widget.extend({},n[i],o):t.widget.extend({},o):o)}return n};t.widget.bridge=function(n,i){var o=i.prototype.widgetFullName||n;t.fn[n]=function(a){var s="string"==typeof a,l=r.call(arguments,1),u=this;a=!s&&l.length?t.widget.extend.apply(null,[a].concat(l)):a;this.each(s?function(){var r,i=t.data(this,o);if(!i)return t.error("cannot call methods on "+n+" prior to initialization; attempted to call method '"+a+"'");if(!t.isFunction(i[a])||"_"===a.charAt(0))return t.error("no such method '"+a+"' for "+n+" widget instance");r=i[a].apply(i,l);if(r!==i&&r!==e){u=r&&r.jquery?u.pushStack(r.get()):r;return!1}}:function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new i(a,this))});return u}};t.Widget=function(){};t.Widget._childConstructors=[];t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,r){r=t(r||this.defaultElement||this)[0];this.element=t(r);this.uuid=n++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=t.widget.extend({},this.options,this._getCreateOptions(),e);this.bindings=t();this.hoverable=t();this.focusable=t();if(r!==this){t.data(r,this.widgetFullName,this);this._on(!0,this.element,{remove:function(t){t.target===r&&this.destroy()}});this.document=t(r.style?r.ownerDocument:r.document||r);this.window=t(this.document[0].defaultView||this.document[0].parentWindow)}this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(n,r){var i,o,a,s=n;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof n){s={};i=n.split(".");n=i.shift();if(i.length){o=s[n]=t.widget.extend({},this.options[n]);for(a=0;a<i.length-1;a++){o[i[a]]=o[i[a]]||{};o=o[i[a]]}n=i.pop();if(1===arguments.length)return o[n]===e?null:o[n];o[n]=r}else{if(1===arguments.length)return this.options[n]===e?null:this.options[n];s[n]=r}}this._setOptions(s);return this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){this.options[t]=e;if("disabled"===t){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(e,n,r){var i,o=this;if("boolean"!=typeof e){r=n;n=e;e=!1}if(r){n=i=t(n);this.bindings=this.bindings.add(n)}else{r=n;n=this.element;i=this.widget()}t.each(r,function(r,a){function s(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(s.guid=a.guid=a.guid||s.guid||t.guid++);var l=r.match(/^(\w+)\s*(.*)$/),u=l[1]+o.eventNamespace,c=l[2];c?i.delegate(c,u,s):n.bind(u,s)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;t.unbind(e).undelegate(e)},_delay:function(t,e){function n(){return("string"==typeof t?r[t]:t).apply(r,arguments)}var r=this;return setTimeout(n,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e);this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e);this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,n,r){var i,o,a=this.options[e];r=r||{};n=t.Event(n);n.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();n.target=this.element[0];o=n.originalEvent;if(o)for(i in o)i in n||(n[i]=o[i]);this.element.trigger(n,r);return!(t.isFunction(a)&&a.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}};t.each({show:"fadeIn",hide:"fadeOut"},function(e,n){t.Widget.prototype["_"+e]=function(r,i,o){"string"==typeof i&&(i={effect:i});var a,s=i?i===!0||"number"==typeof i?n:i.effect||n:e;i=i||{};"number"==typeof i&&(i={duration:i});a=!t.isEmptyObject(i);i.complete=o;i.delay&&r.delay(i.delay);a&&t.effects&&t.effects.effect[s]?r[e](i):s!==e&&r[s]?r[s](i.duration,i.easing,o):r.queue(function(n){t(this)[e]();o&&o.call(r[0]);n()})}})})(e)},{jquery:17}],17:[function(e,n){(function(t,e){"object"==typeof n&&"object"==typeof n.exports?n.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)})("undefined"!=typeof window?window:this,function(e,n){function r(t){var e=t.length,n=oe.type(t);return"function"===n||oe.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function i(t,e,n){if(oe.isFunction(e))return oe.grep(t,function(t,r){return!!e.call(t,r,t)!==n});if(e.nodeType)return oe.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(de.test(e))return oe.filter(e,t,n);e=oe.filter(e,t)}return oe.grep(t,function(t){return oe.inArray(t,e)>=0!==n})}function o(t,e){do t=t[e];while(t&&1!==t.nodeType);return t}function a(t){var e=we[t]={};oe.each(t.match(xe)||[],function(t,n){e[n]=!0});return e}function s(){if(ge.addEventListener){ge.removeEventListener("DOMContentLoaded",l,!1);e.removeEventListener("load",l,!1)}else{ge.detachEvent("onreadystatechange",l);e.detachEvent("onload",l)}}function l(){if(ge.addEventListener||"load"===event.type||"complete"===ge.readyState){s();oe.ready()}}function u(t,e,n){if(void 0===n&&1===t.nodeType){var r="data-"+e.replace(ke,"-$1").toLowerCase();n=t.getAttribute(r);if("string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:_e.test(n)?oe.parseJSON(n):n}catch(i){}oe.data(t,e,n)}else n=void 0}return n}function c(t){var e;for(e in t)if(("data"!==e||!oe.isEmptyObject(t[e]))&&"toJSON"!==e)return!1;return!0}function f(t,e,n,r){if(oe.acceptData(t)){var i,o,a=oe.expando,s=t.nodeType,l=s?oe.cache:t,u=s?t[a]:t[a]&&a;if(u&&l[u]&&(r||l[u].data)||void 0!==n||"string"!=typeof e){u||(u=s?t[a]=Y.pop()||oe.guid++:a);l[u]||(l[u]=s?{}:{toJSON:oe.noop});("object"==typeof e||"function"==typeof e)&&(r?l[u]=oe.extend(l[u],e):l[u].data=oe.extend(l[u].data,e));o=l[u];if(!r){o.data||(o.data={});o=o.data}void 0!==n&&(o[oe.camelCase(e)]=n);if("string"==typeof e){i=o[e];null==i&&(i=o[oe.camelCase(e)])}else i=o;return i}}}function h(t,e,n){if(oe.acceptData(t)){var r,i,o=t.nodeType,a=o?oe.cache:t,s=o?t[oe.expando]:oe.expando;if(a[s]){if(e){r=n?a[s]:a[s].data;if(r){if(oe.isArray(e))e=e.concat(oe.map(e,oe.camelCase));else if(e in r)e=[e];else{e=oe.camelCase(e);e=e in r?[e]:e.split(" ")}i=e.length;for(;i--;)delete r[e[i]];if(n?!c(r):!oe.isEmptyObject(r))return}}if(!n){delete a[s].data;if(!c(a[s]))return}o?oe.cleanData([t],!0):re.deleteExpando||a!=a.window?delete a[s]:a[s]=null}}}function d(){return!0}function p(){return!1}function g(){try{return ge.activeElement}catch(t){}}function m(t){var e=Oe.split("|"),n=t.createDocumentFragment();if(n.createElement)for(;e.length;)n.createElement(e.pop());return n}function v(t,e){var n,r,i=0,o=typeof t.getElementsByTagName!==Te?t.getElementsByTagName(e||"*"):typeof t.querySelectorAll!==Te?t.querySelectorAll(e||"*"):void 0;if(!o)for(o=[],n=t.childNodes||t;null!=(r=n[i]);i++)!e||oe.nodeName(r,e)?o.push(r):oe.merge(o,v(r,e));return void 0===e||e&&oe.nodeName(t,e)?oe.merge([t],o):o}function y(t){Ne.test(t.type)&&(t.defaultChecked=t.checked)}function b(t,e){return oe.nodeName(t,"table")&&oe.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function x(t){t.type=(null!==oe.find.attr(t,"type"))+"/"+t.type;return t}function w(t){var e=$e.exec(t.type);e?t.type=e[1]:t.removeAttribute("type");return t}function S(t,e){for(var n,r=0;null!=(n=t[r]);r++)oe._data(n,"globalEval",!e||oe._data(e[r],"globalEval"))}function C(t,e){if(1===e.nodeType&&oe.hasData(t)){var n,r,i,o=oe._data(t),a=oe._data(e,o),s=o.events;if(s){delete a.handle;a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)oe.event.add(e,n,s[n][r])}a.data&&(a.data=oe.extend({},a.data))}}function T(t,e){var n,r,i;if(1===e.nodeType){n=e.nodeName.toLowerCase();if(!re.noCloneEvent&&e[oe.expando]){i=oe._data(e);for(r in i.events)oe.removeEvent(e,r,i.handle);e.removeAttribute(oe.expando)}if("script"===n&&e.text!==t.text){x(e).text=t.text;w(e)}else if("object"===n){e.parentNode&&(e.outerHTML=t.outerHTML);re.html5Clone&&t.innerHTML&&!oe.trim(e.innerHTML)&&(e.innerHTML=t.innerHTML)}else if("input"===n&&Ne.test(t.type)){e.defaultChecked=e.checked=t.checked;e.value!==t.value&&(e.value=t.value)}else"option"===n?e.defaultSelected=e.selected=t.defaultSelected:("input"===n||"textarea"===n)&&(e.defaultValue=t.defaultValue)}}function _(t,n){var r,i=oe(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:oe.css(i[0],"display");i.detach();return o}function k(t){var e=ge,n=tn[t];if(!n){n=_(t,e);if("none"===n||!n){Qe=(Qe||oe("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement);e=(Qe[0].contentWindow||Qe[0].contentDocument).document;e.write();e.close();n=_(t,e);Qe.detach()}tn[t]=n}return n}function M(t,e){return{get:function(){var n=t();if(null!=n){if(!n)return(this.get=e).apply(this,arguments);delete this.get}}}}function D(t,e){if(e in t)return e;for(var n=e.charAt(0).toUpperCase()+e.slice(1),r=e,i=pn.length;i--;){e=pn[i]+n;if(e in t)return e}return r}function L(t,e){for(var n,r,i,o=[],a=0,s=t.length;s>a;a++){r=t[a];if(r.style){o[a]=oe._data(r,"olddisplay");n=r.style.display;if(e){o[a]||"none"!==n||(r.style.display="");""===r.style.display&&Le(r)&&(o[a]=oe._data(r,"olddisplay",k(r.nodeName)))}else{i=Le(r);(n&&"none"!==n||!i)&&oe._data(r,"olddisplay",i?n:oe.css(r,"display"))}}}for(a=0;s>a;a++){r=t[a];r.style&&(e&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=e?o[a]||"":"none"))}return t}function A(t,e,n){var r=cn.exec(e);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):e}function N(t,e,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===e?1:0,a=0;4>o;o+=2){"margin"===n&&(a+=oe.css(t,n+De[o],!0,i));if(r){"content"===n&&(a-=oe.css(t,"padding"+De[o],!0,i));"margin"!==n&&(a-=oe.css(t,"border"+De[o]+"Width",!0,i))}else{a+=oe.css(t,"padding"+De[o],!0,i);"padding"!==n&&(a+=oe.css(t,"border"+De[o]+"Width",!0,i))}}return a}function E(t,e,n){var r=!0,i="width"===e?t.offsetWidth:t.offsetHeight,o=en(t),a=re.boxSizing&&"border-box"===oe.css(t,"boxSizing",!1,o);if(0>=i||null==i){i=nn(t,e,o);(0>i||null==i)&&(i=t.style[e]);if(on.test(i))return i;r=a&&(re.boxSizingReliable()||i===t.style[e]);i=parseFloat(i)||0}return i+N(t,e,n||(a?"border":"content"),r,o)+"px"}function j(t,e,n,r,i){return new j.prototype.init(t,e,n,r,i)}function I(){setTimeout(function(){gn=void 0});return gn=oe.now()}function P(t,e){var n,r={height:t},i=0;e=e?1:0;for(;4>i;i+=2-e){n=De[i];r["margin"+n]=r["padding"+n]=t}e&&(r.opacity=r.width=t);return r}function H(t,e,n){for(var r,i=(wn[e]||[]).concat(wn["*"]),o=0,a=i.length;a>o;o++)if(r=i[o].call(n,e,t))return r}function O(t,e,n){var r,i,o,a,s,l,u,c,f=this,h={},d=t.style,p=t.nodeType&&Le(t),g=oe._data(t,"fxshow");if(!n.queue){s=oe._queueHooks(t,"fx");if(null==s.unqueued){s.unqueued=0;l=s.empty.fire;s.empty.fire=function(){s.unqueued||l()}}s.unqueued++;f.always(function(){f.always(function(){s.unqueued--;oe.queue(t,"fx").length||s.empty.fire()})})}if(1===t.nodeType&&("height"in e||"width"in e)){n.overflow=[d.overflow,d.overflowX,d.overflowY];u=oe.css(t,"display");c="none"===u?oe._data(t,"olddisplay")||k(t.nodeName):u;"inline"===c&&"none"===oe.css(t,"float")&&(re.inlineBlockNeedsLayout&&"inline"!==k(t.nodeName)?d.zoom=1:d.display="inline-block")}if(n.overflow){d.overflow="hidden";re.shrinkWrapBlocks()||f.always(function(){d.overflow=n.overflow[0];d.overflowX=n.overflow[1];d.overflowY=n.overflow[2]})}for(r in e){i=e[r];if(vn.exec(i)){delete e[r];o=o||"toggle"===i;if(i===(p?"hide":"show")){if("show"!==i||!g||void 0===g[r])continue;p=!0}h[r]=g&&g[r]||oe.style(t,r)}else u=void 0}if(oe.isEmptyObject(h))"inline"===("none"===u?k(t.nodeName):u)&&(d.display=u);else{g?"hidden"in g&&(p=g.hidden):g=oe._data(t,"fxshow",{});o&&(g.hidden=!p);p?oe(t).show():f.done(function(){oe(t).hide()});f.done(function(){var e;oe._removeData(t,"fxshow");for(e in h)oe.style(t,e,h[e])});for(r in h){a=H(p?g[r]:0,r,f);if(!(r in g)){g[r]=a.start;if(p){a.end=a.start;a.start="width"===r||"height"===r?1:0}}}}}function F(t,e){var n,r,i,o,a;for(n in t){r=oe.camelCase(n);i=e[r];o=t[n];if(oe.isArray(o)){i=o[1];o=t[n]=o[0]}if(n!==r){t[r]=o;delete t[n]}a=oe.cssHooks[r];if(a&&"expand"in a){o=a.expand(o);delete t[r];for(n in o)if(!(n in t)){t[n]=o[n];e[n]=i}}else e[r]=i}}function R(t,e,n){var r,i,o=0,a=xn.length,s=oe.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;for(var e=gn||I(),n=Math.max(0,u.startTime+u.duration-e),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;l>a;a++)u.tweens[a].run(o);s.notifyWith(t,[u,o,n]);if(1>o&&l)return n;s.resolveWith(t,[u]);return!1},u=s.promise({elem:t,props:oe.extend({},e),opts:oe.extend(!0,{specialEasing:{}},n),originalProperties:e,originalOptions:n,startTime:gn||I(),duration:n.duration,tweens:[],createTween:function(e,n){var r=oe.Tween(t,u.opts,e,n,u.opts.specialEasing[e]||u.opts.easing);u.tweens.push(r);return r},stop:function(e){var n=0,r=e?u.tweens.length:0;if(i)return this;i=!0;for(;r>n;n++)u.tweens[n].run(1);e?s.resolveWith(t,[u,e]):s.rejectWith(t,[u,e]);return this}}),c=u.props;F(c,u.opts.specialEasing);for(;a>o;o++){r=xn[o].call(u,t,c,u.opts);if(r)return r}oe.map(c,H,u);oe.isFunction(u.opts.start)&&u.opts.start.call(t,u);oe.fx.timer(oe.extend(l,{elem:t,anim:u,queue:u.opts.queue}));return u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always) }function W(t){return function(e,n){if("string"!=typeof e){n=e;e="*"}var r,i=0,o=e.toLowerCase().match(xe)||[];if(oe.isFunction(n))for(;r=o[i++];)if("+"===r.charAt(0)){r=r.slice(1)||"*";(t[r]=t[r]||[]).unshift(n)}else(t[r]=t[r]||[]).push(n)}}function z(t,e,n,r){function i(s){var l;o[s]=!0;oe.each(t[s]||[],function(t,s){var u=s(e,n,r);if("string"==typeof u&&!a&&!o[u]){e.dataTypes.unshift(u);i(u);return!1}return a?!(l=u):void 0});return l}var o={},a=t===Vn;return i(e.dataTypes[0])||!o["*"]&&i("*")}function q(t,e){var n,r,i=oe.ajaxSettings.flatOptions||{};for(r in e)void 0!==e[r]&&((i[r]?t:n||(n={}))[r]=e[r]);n&&oe.extend(!0,t,n);return t}function U(t,e,n){for(var r,i,o,a,s=t.contents,l=t.dataTypes;"*"===l[0];){l.shift();void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"))}if(i)for(a in s)if(s[a]&&s[a].test(i)){l.unshift(a);break}if(l[0]in n)o=l[0];else{for(a in n){if(!l[0]||t.converters[a+" "+l[0]]){o=a;break}r||(r=a)}o=o||r}if(o){o!==l[0]&&l.unshift(o);return n[o]}}function B(t,e,n,r){var i,o,a,s,l,u={},c=t.dataTypes.slice();if(c[1])for(a in t.converters)u[a.toLowerCase()]=t.converters[a];o=c.shift();for(;o;){t.responseFields[o]&&(n[t.responseFields[o]]=e);!l&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType));l=o;o=c.shift();if(o)if("*"===o)o=l;else if("*"!==l&&l!==o){a=u[l+" "+o]||u["* "+o];if(!a)for(i in u){s=i.split(" ");if(s[1]===o){a=u[l+" "+s[0]]||u["* "+s[0]];if(a){if(a===!0)a=u[i];else if(u[i]!==!0){o=s[0];c.unshift(s[1])}break}}}if(a!==!0)if(a&&t["throws"])e=a(e);else try{e=a(e)}catch(f){return{state:"parsererror",error:a?f:"No conversion from "+l+" to "+o}}}}return{state:"success",data:e}}function V(t,e,n,r){var i;if(oe.isArray(e))oe.each(e,function(e,i){n||Yn.test(t)?r(t,i):V(t+"["+("object"==typeof i?e:"")+"]",i,n,r)});else if(n||"object"!==oe.type(e))r(t,e);else for(i in e)V(t+"["+i+"]",e[i],n,r)}function X(){try{return new e.XMLHttpRequest}catch(t){}}function G(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $(t){return oe.isWindow(t)?t:9===t.nodeType?t.defaultView||t.parentWindow:!1}var Y=[],J=Y.slice,K=Y.concat,Z=Y.push,Q=Y.indexOf,te={},ee=te.toString,ne=te.hasOwnProperty,re={},ie="1.11.1",oe=function(t,e){return new oe.fn.init(t,e)},ae=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,se=/^-ms-/,le=/-([\da-z])/gi,ue=function(t,e){return e.toUpperCase()};oe.fn=oe.prototype={jquery:ie,constructor:oe,selector:"",length:0,toArray:function(){return J.call(this)},get:function(t){return null!=t?0>t?this[t+this.length]:this[t]:J.call(this)},pushStack:function(t){var e=oe.merge(this.constructor(),t);e.prevObject=this;e.context=this.context;return e},each:function(t,e){return oe.each(this,t,e)},map:function(t){return this.pushStack(oe.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(J.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(0>t?e:0);return this.pushStack(n>=0&&e>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:Y.sort,splice:Y.splice};oe.extend=oe.fn.extend=function(){var t,e,n,r,i,o,a=arguments[0]||{},s=1,l=arguments.length,u=!1;if("boolean"==typeof a){u=a;a=arguments[s]||{};s++}"object"==typeof a||oe.isFunction(a)||(a={});if(s===l){a=this;s--}for(;l>s;s++)if(null!=(i=arguments[s]))for(r in i){t=a[r];n=i[r];if(a!==n)if(u&&n&&(oe.isPlainObject(n)||(e=oe.isArray(n)))){if(e){e=!1;o=t&&oe.isArray(t)?t:[]}else o=t&&oe.isPlainObject(t)?t:{};a[r]=oe.extend(u,o,n)}else void 0!==n&&(a[r]=n)}return a};oe.extend({expando:"jQuery"+(ie+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===oe.type(t)},isArray:Array.isArray||function(t){return"array"===oe.type(t)},isWindow:function(t){return null!=t&&t==t.window},isNumeric:function(t){return!oe.isArray(t)&&t-parseFloat(t)>=0},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},isPlainObject:function(t){var e;if(!t||"object"!==oe.type(t)||t.nodeType||oe.isWindow(t))return!1;try{if(t.constructor&&!ne.call(t,"constructor")&&!ne.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(re.ownLast)for(e in t)return ne.call(t,e);for(e in t);return void 0===e||ne.call(t,e)},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?te[ee.call(t)]||"object":typeof t},globalEval:function(t){t&&oe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(t){return t.replace(se,"ms-").replace(le,ue)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,n){var i,o=0,a=t.length,s=r(t);if(n)if(s)for(;a>o;o++){i=e.apply(t[o],n);if(i===!1)break}else for(o in t){i=e.apply(t[o],n);if(i===!1)break}else if(s)for(;a>o;o++){i=e.call(t[o],o,t[o]);if(i===!1)break}else for(o in t){i=e.call(t[o],o,t[o]);if(i===!1)break}return t},trim:function(t){return null==t?"":(t+"").replace(ae,"")},makeArray:function(t,e){var n=e||[];null!=t&&(r(Object(t))?oe.merge(n,"string"==typeof t?[t]:t):Z.call(n,t));return n},inArray:function(t,e,n){var r;if(e){if(Q)return Q.call(e,t,n);r=e.length;n=n?0>n?Math.max(0,r+n):n:0;for(;r>n;n++)if(n in e&&e[n]===t)return n}return-1},merge:function(t,e){for(var n=+e.length,r=0,i=t.length;n>r;)t[i++]=e[r++];if(n!==n)for(;void 0!==e[r];)t[i++]=e[r++];t.length=i;return t},grep:function(t,e,n){for(var r,i=[],o=0,a=t.length,s=!n;a>o;o++){r=!e(t[o],o);r!==s&&i.push(t[o])}return i},map:function(t,e,n){var i,o=0,a=t.length,s=r(t),l=[];if(s)for(;a>o;o++){i=e(t[o],o,n);null!=i&&l.push(i)}else for(o in t){i=e(t[o],o,n);null!=i&&l.push(i)}return K.apply([],l)},guid:1,proxy:function(t,e){var n,r,i;if("string"==typeof e){i=t[e];e=t;t=i}if(!oe.isFunction(t))return void 0;n=J.call(arguments,2);r=function(){return t.apply(e||this,n.concat(J.call(arguments)))};r.guid=t.guid=t.guid||oe.guid++;return r},now:function(){return+new Date},support:re});oe.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){te["[object "+e+"]"]=e.toLowerCase()});var ce=function(t){function e(t,e,n,r){var i,o,a,s,l,u,f,d,p,g;(e?e.ownerDocument||e:W)!==E&&N(e);e=e||E;n=n||[];if(!t||"string"!=typeof t)return n;if(1!==(s=e.nodeType)&&9!==s)return[];if(I&&!r){if(i=ye.exec(t))if(a=i[1]){if(9===s){o=e.getElementById(a);if(!o||!o.parentNode)return n;if(o.id===a){n.push(o);return n}}else if(e.ownerDocument&&(o=e.ownerDocument.getElementById(a))&&F(e,o)&&o.id===a){n.push(o);return n}}else{if(i[2]){Q.apply(n,e.getElementsByTagName(t));return n}if((a=i[3])&&w.getElementsByClassName&&e.getElementsByClassName){Q.apply(n,e.getElementsByClassName(a));return n}}if(w.qsa&&(!P||!P.test(t))){d=f=R;p=e;g=9===s&&t;if(1===s&&"object"!==e.nodeName.toLowerCase()){u=_(t);(f=e.getAttribute("id"))?d=f.replace(xe,"\\$&"):e.setAttribute("id",d);d="[id='"+d+"'] ";l=u.length;for(;l--;)u[l]=d+h(u[l]);p=be.test(t)&&c(e.parentNode)||e;g=u.join(",")}if(g)try{Q.apply(n,p.querySelectorAll(g));return n}catch(m){}finally{f||e.removeAttribute("id")}}}return M(t.replace(le,"$1"),e,n,r)}function n(){function t(n,r){e.push(n+" ")>S.cacheLength&&delete t[e.shift()];return t[n+" "]=r}var e=[];return t}function r(t){t[R]=!0;return t}function i(t){var e=E.createElement("div");try{return!!t(e)}catch(n){return!1}finally{e.parentNode&&e.parentNode.removeChild(e);e=null}}function o(t,e){for(var n=t.split("|"),r=t.length;r--;)S.attrHandle[n[r]]=e}function a(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||$)-(~t.sourceIndex||$);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function l(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function u(t){return r(function(e){e=+e;return r(function(n,r){for(var i,o=t([],n.length,e),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(t){return t&&typeof t.getElementsByTagName!==G&&t}function f(){}function h(t){for(var e=0,n=t.length,r="";n>e;e++)r+=t[e].value;return r}function d(t,e,n){var r=e.dir,i=n&&"parentNode"===r,o=q++;return e.first?function(e,n,o){for(;e=e[r];)if(1===e.nodeType||i)return t(e,n,o)}:function(e,n,a){var s,l,u=[z,o];if(a){for(;e=e[r];)if((1===e.nodeType||i)&&t(e,n,a))return!0}else for(;e=e[r];)if(1===e.nodeType||i){l=e[R]||(e[R]={});if((s=l[r])&&s[0]===z&&s[1]===o)return u[2]=s[2];l[r]=u;if(u[2]=t(e,n,a))return!0}}}function p(t){return t.length>1?function(e,n,r){for(var i=t.length;i--;)if(!t[i](e,n,r))return!1;return!0}:t[0]}function g(t,n,r){for(var i=0,o=n.length;o>i;i++)e(t,n[i],r);return r}function m(t,e,n,r,i){for(var o,a=[],s=0,l=t.length,u=null!=e;l>s;s++)if((o=t[s])&&(!n||n(o,r,i))){a.push(o);u&&e.push(s)}return a}function v(t,e,n,i,o,a){i&&!i[R]&&(i=v(i));o&&!o[R]&&(o=v(o,a));return r(function(r,a,s,l){var u,c,f,h=[],d=[],p=a.length,v=r||g(e||"*",s.nodeType?[s]:s,[]),y=!t||!r&&e?v:m(v,h,t,s,l),b=n?o||(r?t:p||i)?[]:a:y;n&&n(y,b,s,l);if(i){u=m(b,d);i(u,[],s,l);c=u.length;for(;c--;)(f=u[c])&&(b[d[c]]=!(y[d[c]]=f))}if(r){if(o||t){if(o){u=[];c=b.length;for(;c--;)(f=b[c])&&u.push(y[c]=f);o(null,b=[],u,l)}c=b.length;for(;c--;)(f=b[c])&&(u=o?ee.call(r,f):h[c])>-1&&(r[u]=!(a[u]=f))}}else{b=m(b===a?b.splice(p,b.length):b);o?o(null,a,b,l):Q.apply(a,b)}})}function y(t){for(var e,n,r,i=t.length,o=S.relative[t[0].type],a=o||S.relative[" "],s=o?1:0,l=d(function(t){return t===e},a,!0),u=d(function(t){return ee.call(e,t)>-1},a,!0),c=[function(t,n,r){return!o&&(r||n!==D)||((e=n).nodeType?l(t,n,r):u(t,n,r))}];i>s;s++)if(n=S.relative[t[s].type])c=[d(p(c),n)];else{n=S.filter[t[s].type].apply(null,t[s].matches);if(n[R]){r=++s;for(;i>r&&!S.relative[t[r].type];r++);return v(s>1&&p(c),s>1&&h(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(le,"$1"),n,r>s&&y(t.slice(s,r)),i>r&&y(t=t.slice(r)),i>r&&h(t))}c.push(n)}return p(c)}function b(t,n){var i=n.length>0,o=t.length>0,a=function(r,a,s,l,u){var c,f,h,d=0,p="0",g=r&&[],v=[],y=D,b=r||o&&S.find.TAG("*",u),x=z+=null==y?1:Math.random()||.1,w=b.length;u&&(D=a!==E&&a);for(;p!==w&&null!=(c=b[p]);p++){if(o&&c){f=0;for(;h=t[f++];)if(h(c,a,s)){l.push(c);break}u&&(z=x)}if(i){(c=!h&&c)&&d--;r&&g.push(c)}}d+=p;if(i&&p!==d){f=0;for(;h=n[f++];)h(g,v,a,s);if(r){if(d>0)for(;p--;)g[p]||v[p]||(v[p]=K.call(l));v=m(v)}Q.apply(l,v);u&&!r&&v.length>0&&d+n.length>1&&e.uniqueSort(l)}if(u){z=x;D=y}return g};return i?r(a):a}var x,w,S,C,T,_,k,M,D,L,A,N,E,j,I,P,H,O,F,R="sizzle"+-new Date,W=t.document,z=0,q=0,U=n(),B=n(),V=n(),X=function(t,e){t===e&&(A=!0);return 0},G="undefined",$=1<<31,Y={}.hasOwnProperty,J=[],K=J.pop,Z=J.push,Q=J.push,te=J.slice,ee=J.indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(this[e]===t)return e;return-1},ne="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",re="[\\x20\\t\\r\\n\\f]",ie="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",oe=ie.replace("w","w#"),ae="\\["+re+"*("+ie+")(?:"+re+"*([*^$|!~]?=)"+re+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+oe+"))|)"+re+"*\\]",se=":("+ie+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ae+")*)|.*)\\)|)",le=new RegExp("^"+re+"+|((?:^|[^\\\\])(?:\\\\.)*)"+re+"+$","g"),ue=new RegExp("^"+re+"*,"+re+"*"),ce=new RegExp("^"+re+"*([>+~]|"+re+")"+re+"*"),fe=new RegExp("="+re+"*([^\\]'\"]*?)"+re+"*\\]","g"),he=new RegExp(se),de=new RegExp("^"+oe+"$"),pe={ID:new RegExp("^#("+ie+")"),CLASS:new RegExp("^\\.("+ie+")"),TAG:new RegExp("^("+ie.replace("w","w*")+")"),ATTR:new RegExp("^"+ae),PSEUDO:new RegExp("^"+se),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:new RegExp("^(?:"+ne+")$","i"),needsContext:new RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=/[+~]/,xe=/'|\\/g,we=new RegExp("\\\\([\\da-f]{1,6}"+re+"?|("+re+")|.)","ig"),Se=function(t,e,n){var r="0x"+e-65536;return r!==r||n?e:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{Q.apply(J=te.call(W.childNodes),W.childNodes);J[W.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(t,e){Z.apply(t,te.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}w=e.support={};T=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1};N=e.setDocument=function(t){var e,n=t?t.ownerDocument||t:W,r=n.defaultView;if(n===E||9!==n.nodeType||!n.documentElement)return E;E=n;j=n.documentElement;I=!T(n);r&&r!==r.top&&(r.addEventListener?r.addEventListener("unload",function(){N()},!1):r.attachEvent&&r.attachEvent("onunload",function(){N()}));w.attributes=i(function(t){t.className="i";return!t.getAttribute("className")});w.getElementsByTagName=i(function(t){t.appendChild(n.createComment(""));return!t.getElementsByTagName("*").length});w.getElementsByClassName=ve.test(n.getElementsByClassName)&&i(function(t){t.innerHTML="<div class='a'></div><div class='a i'></div>";t.firstChild.className="i";return 2===t.getElementsByClassName("i").length});w.getById=i(function(t){j.appendChild(t).id=R;return!n.getElementsByName||!n.getElementsByName(R).length});if(w.getById){S.find.ID=function(t,e){if(typeof e.getElementById!==G&&I){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}};S.filter.ID=function(t){var e=t.replace(we,Se);return function(t){return t.getAttribute("id")===e}}}else{delete S.find.ID;S.filter.ID=function(t){var e=t.replace(we,Se);return function(t){var n=typeof t.getAttributeNode!==G&&t.getAttributeNode("id");return n&&n.value===e}}}S.find.TAG=w.getElementsByTagName?function(t,e){return typeof e.getElementsByTagName!==G?e.getElementsByTagName(t):void 0}:function(t,e){var n,r=[],i=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o};S.find.CLASS=w.getElementsByClassName&&function(t,e){return typeof e.getElementsByClassName!==G&&I?e.getElementsByClassName(t):void 0};H=[];P=[];if(w.qsa=ve.test(n.querySelectorAll)){i(function(t){t.innerHTML="<select msallowclip=''><option selected=''></option></select>";t.querySelectorAll("[msallowclip^='']").length&&P.push("[*^$]="+re+"*(?:''|\"\")");t.querySelectorAll("[selected]").length||P.push("\\["+re+"*(?:value|"+ne+")");t.querySelectorAll(":checked").length||P.push(":checked")});i(function(t){var e=n.createElement("input");e.setAttribute("type","hidden");t.appendChild(e).setAttribute("name","D");t.querySelectorAll("[name=d]").length&&P.push("name"+re+"*[*^$|!~]?=");t.querySelectorAll(":enabled").length||P.push(":enabled",":disabled");t.querySelectorAll("*,:x");P.push(",.*:")})}(w.matchesSelector=ve.test(O=j.matches||j.webkitMatchesSelector||j.mozMatchesSelector||j.oMatchesSelector||j.msMatchesSelector))&&i(function(t){w.disconnectedMatch=O.call(t,"div");O.call(t,"[s!='']:x");H.push("!=",se)});P=P.length&&new RegExp(P.join("|"));H=H.length&&new RegExp(H.join("|"));e=ve.test(j.compareDocumentPosition);F=e||ve.test(j.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1};X=e?function(t,e){if(t===e){A=!0;return 0}var r=!t.compareDocumentPosition-!e.compareDocumentPosition;if(r)return r;r=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1;return 1&r||!w.sortDetached&&e.compareDocumentPosition(t)===r?t===n||t.ownerDocument===W&&F(W,t)?-1:e===n||e.ownerDocument===W&&F(W,e)?1:L?ee.call(L,t)-ee.call(L,e):0:4&r?-1:1}:function(t,e){if(t===e){A=!0;return 0}var r,i=0,o=t.parentNode,s=e.parentNode,l=[t],u=[e];if(!o||!s)return t===n?-1:e===n?1:o?-1:s?1:L?ee.call(L,t)-ee.call(L,e):0;if(o===s)return a(t,e);r=t;for(;r=r.parentNode;)l.unshift(r);r=e;for(;r=r.parentNode;)u.unshift(r);for(;l[i]===u[i];)i++;return i?a(l[i],u[i]):l[i]===W?-1:u[i]===W?1:0};return n};e.matches=function(t,n){return e(t,null,null,n)};e.matchesSelector=function(t,n){(t.ownerDocument||t)!==E&&N(t);n=n.replace(fe,"='$1']");if(!(!w.matchesSelector||!I||H&&H.test(n)||P&&P.test(n)))try{var r=O.call(t,n);if(r||w.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(i){}return e(n,E,null,[t]).length>0};e.contains=function(t,e){(t.ownerDocument||t)!==E&&N(t);return F(t,e)};e.attr=function(t,e){(t.ownerDocument||t)!==E&&N(t);var n=S.attrHandle[e.toLowerCase()],r=n&&Y.call(S.attrHandle,e.toLowerCase())?n(t,e,!I):void 0;return void 0!==r?r:w.attributes||!I?t.getAttribute(e):(r=t.getAttributeNode(e))&&r.specified?r.value:null};e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)};e.uniqueSort=function(t){var e,n=[],r=0,i=0;A=!w.detectDuplicates;L=!w.sortStable&&t.slice(0);t.sort(X);if(A){for(;e=t[i++];)e===t[i]&&(r=n.push(i));for(;r--;)t.splice(n[r],1)}L=null;return t};C=e.getText=function(t){var e,n="",r=0,i=t.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=C(t)}else if(3===i||4===i)return t.nodeValue}else for(;e=t[r++];)n+=C(e);return n};S=e.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){t[1]=t[1].replace(we,Se);t[3]=(t[3]||t[4]||t[5]||"").replace(we,Se);"~="===t[2]&&(t[3]=" "+t[3]+" ");return t.slice(0,4)},CHILD:function(t){t[1]=t[1].toLowerCase();if("nth"===t[1].slice(0,3)){t[3]||e.error(t[0]);t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3]));t[5]=+(t[7]+t[8]||"odd"===t[3])}else t[3]&&e.error(t[0]);return t},PSEUDO:function(t){var e,n=!t[6]&&t[2];if(pe.CHILD.test(t[0]))return null;if(t[3])t[2]=t[4]||t[5]||"";else if(n&&he.test(n)&&(e=_(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)){t[0]=t[0].slice(0,e);t[2]=n.slice(0,e)}return t.slice(0,3)}},filter:{TAG:function(t){var e=t.replace(we,Se).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=U[t+" "];return e||(e=new RegExp("(^|"+re+")"+t+"("+re+"|$)"))&&U(t,function(t){return e.test("string"==typeof t.className&&t.className||typeof t.getAttribute!==G&&t.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(i){var o=e.attr(i,t);if(null==o)return"!="===n;if(!n)return!0;o+="";return"="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1}},CHILD:function(t,e,n,r,i){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===r&&0===i?function(t){return!!t.parentNode}:function(e,n,l){var u,c,f,h,d,p,g=o!==a?"nextSibling":"previousSibling",m=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!l&&!s;if(m){if(o){for(;g;){f=e;for(;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}p=[a?m.firstChild:m.lastChild];if(a&&y){c=m[R]||(m[R]={});u=c[t]||[];d=u[0]===z&&u[1];h=u[0]===z&&u[2];f=d&&m.childNodes[d];for(;f=++d&&f&&f[g]||(h=d=0)||p.pop();)if(1===f.nodeType&&++h&&f===e){c[t]=[z,d,h];break}}else if(y&&(u=(e[R]||(e[R]={}))[t])&&u[0]===z)h=u[1];else for(;f=++d&&f&&f[g]||(h=d=0)||p.pop();)if((s?f.nodeName.toLowerCase()===v:1===f.nodeType)&&++h){y&&((f[R]||(f[R]={}))[t]=[z,h]);if(f===e)break}h-=i;return h===r||h%r===0&&h/r>=0}}},PSEUDO:function(t,n){var i,o=S.pseudos[t]||S.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);if(o[R])return o(n);if(o.length>1){i=[t,t,"",n];return S.setFilters.hasOwnProperty(t.toLowerCase())?r(function(t,e){for(var r,i=o(t,n),a=i.length;a--;){r=ee.call(t,i[a]);t[r]=!(e[r]=i[a])}}):function(t){return o(t,0,i)}}return o}},pseudos:{not:r(function(t){var e=[],n=[],i=k(t.replace(le,"$1"));return i[R]?r(function(t,e,n,r){for(var o,a=i(t,null,r,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,r,o){e[0]=t;i(e,null,o,n);return!n.pop()}}),has:r(function(t){return function(n){return e(t,n).length>0}}),contains:r(function(t){return function(e){return(e.textContent||e.innerText||C(e)).indexOf(t)>-1}}),lang:r(function(t){de.test(t||"")||e.error("unsupported lang: "+t);t=t.replace(we,Se).toLowerCase();return function(e){var n;do if(n=I?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang")){n=n.toLowerCase();return n===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===j},focus:function(t){return t===E.activeElement&&(!E.hasFocus||E.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){t.parentNode&&t.parentNode.selectedIndex;return t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!S.pseudos.empty(t)},header:function(t){return me.test(t.nodeName)},input:function(t){return ge.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,n){return[0>n?n+e:n]}),even:u(function(t,e){for(var n=0;e>n;n+=2)t.push(n);return t}),odd:u(function(t,e){for(var n=1;e>n;n+=2)t.push(n);return t}),lt:u(function(t,e,n){for(var r=0>n?n+e:n;--r>=0;)t.push(r);return t}),gt:u(function(t,e,n){for(var r=0>n?n+e:n;++r<e;)t.push(r);return t})}};S.pseudos.nth=S.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})S.pseudos[x]=s(x);for(x in{submit:!0,reset:!0})S.pseudos[x]=l(x);f.prototype=S.filters=S.pseudos;S.setFilters=new f;_=e.tokenize=function(t,n){var r,i,o,a,s,l,u,c=B[t+" "];if(c)return n?0:c.slice(0);s=t;l=[];u=S.preFilter;for(;s;){if(!r||(i=ue.exec(s))){i&&(s=s.slice(i[0].length)||s);l.push(o=[])}r=!1;if(i=ce.exec(s)){r=i.shift();o.push({value:r,type:i[0].replace(le," ")});s=s.slice(r.length)}for(a in S.filter)if((i=pe[a].exec(s))&&(!u[a]||(i=u[a](i)))){r=i.shift();o.push({value:r,type:a,matches:i});s=s.slice(r.length)}if(!r)break}return n?s.length:s?e.error(t):B(t,l).slice(0)};k=e.compile=function(t,e){var n,r=[],i=[],o=V[t+" "];if(!o){e||(e=_(t));n=e.length;for(;n--;){o=y(e[n]);o[R]?r.push(o):i.push(o)}o=V(t,b(i,r));o.selector=t}return o};M=e.select=function(t,e,n,r){var i,o,a,s,l,u="function"==typeof t&&t,f=!r&&_(t=u.selector||t);n=n||[];if(1===f.length){o=f[0]=f[0].slice(0);if(o.length>2&&"ID"===(a=o[0]).type&&w.getById&&9===e.nodeType&&I&&S.relative[o[1].type]){e=(S.find.ID(a.matches[0].replace(we,Se),e)||[])[0];if(!e)return n;u&&(e=e.parentNode);t=t.slice(o.shift().value.length)}i=pe.needsContext.test(t)?0:o.length;for(;i--;){a=o[i];if(S.relative[s=a.type])break;if((l=S.find[s])&&(r=l(a.matches[0].replace(we,Se),be.test(o[0].type)&&c(e.parentNode)||e))){o.splice(i,1);t=r.length&&h(o);if(!t){Q.apply(n,r);return n}break}}}(u||k(t,f))(r,e,!I,n,be.test(t)&&c(e.parentNode)||e);return n};w.sortStable=R.split("").sort(X).join("")===R;w.detectDuplicates=!!A;N();w.sortDetached=i(function(t){return 1&t.compareDocumentPosition(E.createElement("div"))});i(function(t){t.innerHTML="<a href='#'></a>";return"#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){return n?void 0:t.getAttribute(e,"type"===e.toLowerCase()?1:2)});w.attributes&&i(function(t){t.innerHTML="<input/>";t.firstChild.setAttribute("value","");return""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){return n||"input"!==t.nodeName.toLowerCase()?void 0:t.defaultValue});i(function(t){return null==t.getAttribute("disabled")})||o(ne,function(t,e,n){var r;return n?void 0:t[e]===!0?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null});return e}(e);oe.find=ce;oe.expr=ce.selectors;oe.expr[":"]=oe.expr.pseudos;oe.unique=ce.uniqueSort;oe.text=ce.getText;oe.isXMLDoc=ce.isXML;oe.contains=ce.contains;var fe=oe.expr.match.needsContext,he=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,de=/^.[^:#\[\.,]*$/;oe.filter=function(t,e,n){var r=e[0];n&&(t=":not("+t+")");return 1===e.length&&1===r.nodeType?oe.find.matchesSelector(r,t)?[r]:[]:oe.find.matches(t,oe.grep(e,function(t){return 1===t.nodeType}))};oe.fn.extend({find:function(t){var e,n=[],r=this,i=r.length;if("string"!=typeof t)return this.pushStack(oe(t).filter(function(){for(e=0;i>e;e++)if(oe.contains(r[e],this))return!0}));for(e=0;i>e;e++)oe.find(t,r[e],n);n=this.pushStack(i>1?oe.unique(n):n);n.selector=this.selector?this.selector+" "+t:t;return n},filter:function(t){return this.pushStack(i(this,t||[],!1))},not:function(t){return this.pushStack(i(this,t||[],!0))},is:function(t){return!!i(this,"string"==typeof t&&fe.test(t)?oe(t):t||[],!1).length}});var pe,ge=e.document,me=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ve=oe.fn.init=function(t,e){var n,r;if(!t)return this;if("string"==typeof t){n="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:me.exec(t);if(!n||!n[1]&&e)return!e||e.jquery?(e||pe).find(t):this.constructor(e).find(t);if(n[1]){e=e instanceof oe?e[0]:e;oe.merge(this,oe.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:ge,!0));if(he.test(n[1])&&oe.isPlainObject(e))for(n in e)oe.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}r=ge.getElementById(n[2]);if(r&&r.parentNode){if(r.id!==n[2])return pe.find(t);this.length=1;this[0]=r}this.context=ge;this.selector=t;return this}if(t.nodeType){this.context=this[0]=t;this.length=1;return this}if(oe.isFunction(t))return"undefined"!=typeof pe.ready?pe.ready(t):t(oe);if(void 0!==t.selector){this.selector=t.selector;this.context=t.context}return oe.makeArray(t,this)};ve.prototype=oe.fn;pe=oe(ge);var ye=/^(?:parents|prev(?:Until|All))/,be={children:!0,contents:!0,next:!0,prev:!0};oe.extend({dir:function(t,e,n){for(var r=[],i=t[e];i&&9!==i.nodeType&&(void 0===n||1!==i.nodeType||!oe(i).is(n));){1===i.nodeType&&r.push(i);i=i[e]}return r},sibling:function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n}});oe.fn.extend({has:function(t){var e,n=oe(t,this),r=n.length;return this.filter(function(){for(e=0;r>e;e++)if(oe.contains(this,n[e]))return!0})},closest:function(t,e){for(var n,r=0,i=this.length,o=[],a=fe.test(t)||"string"!=typeof t?oe(t,e||this.context):0;i>r;r++)for(n=this[r];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&oe.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?oe.unique(o):o)},index:function(t){return t?"string"==typeof t?oe.inArray(this[0],oe(t)):oe.inArray(t.jquery?t[0]:t,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(oe.unique(oe.merge(this.get(),oe(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}});oe.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return oe.dir(t,"parentNode")},parentsUntil:function(t,e,n){return oe.dir(t,"parentNode",n)},next:function(t){return o(t,"nextSibling")},prev:function(t){return o(t,"previousSibling")},nextAll:function(t){return oe.dir(t,"nextSibling")},prevAll:function(t){return oe.dir(t,"previousSibling")},nextUntil:function(t,e,n){return oe.dir(t,"nextSibling",n)},prevUntil:function(t,e,n){return oe.dir(t,"previousSibling",n)},siblings:function(t){return oe.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return oe.sibling(t.firstChild)},contents:function(t){return oe.nodeName(t,"iframe")?t.contentDocument||t.contentWindow.document:oe.merge([],t.childNodes)}},function(t,e){oe.fn[t]=function(n,r){var i=oe.map(this,e,n);"Until"!==t.slice(-5)&&(r=n);r&&"string"==typeof r&&(i=oe.filter(r,i));if(this.length>1){be[t]||(i=oe.unique(i));ye.test(t)&&(i=i.reverse())}return this.pushStack(i)}});var xe=/\S+/g,we={};oe.Callbacks=function(t){t="string"==typeof t?we[t]||a(t):oe.extend({},t);var e,n,r,i,o,s,l=[],u=!t.once&&[],c=function(a){n=t.memory&&a;r=!0;o=s||0;s=0;i=l.length;e=!0;for(;l&&i>o;o++)if(l[o].apply(a[0],a[1])===!1&&t.stopOnFalse){n=!1;break}e=!1;l&&(u?u.length&&c(u.shift()):n?l=[]:f.disable())},f={add:function(){if(l){var r=l.length;(function o(e){oe.each(e,function(e,n){var r=oe.type(n);"function"===r?t.unique&&f.has(n)||l.push(n):n&&n.length&&"string"!==r&&o(n)})})(arguments);if(e)i=l.length;else if(n){s=r;c(n)}}return this},remove:function(){l&&oe.each(arguments,function(t,n){for(var r;(r=oe.inArray(n,l,r))>-1;){l.splice(r,1);if(e){i>=r&&i--;o>=r&&o--}}});return this},has:function(t){return t?oe.inArray(t,l)>-1:!(!l||!l.length)},empty:function(){l=[];i=0;return this},disable:function(){l=u=n=void 0;return this},disabled:function(){return!l},lock:function(){u=void 0;n||f.disable();return this},locked:function(){return!u},fireWith:function(t,n){if(l&&(!r||u)){n=n||[];n=[t,n.slice?n.slice():n];e?u.push(n):c(n)}return this},fire:function(){f.fireWith(this,arguments);return this},fired:function(){return!!r}};return f};oe.extend({Deferred:function(t){var e=[["resolve","done",oe.Callbacks("once memory"),"resolved"],["reject","fail",oe.Callbacks("once memory"),"rejected"],["notify","progress",oe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){i.done(arguments).fail(arguments);return this},then:function(){var t=arguments;return oe.Deferred(function(n){oe.each(e,function(e,o){var a=oe.isFunction(t[e])&&t[e];i[o[1]](function(){var t=a&&a.apply(this,arguments);t&&oe.isFunction(t.promise)?t.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===r?n.promise():this,a?[t]:arguments)})});t=null}).promise()},promise:function(t){return null!=t?oe.extend(t,r):r}},i={};r.pipe=r.then;oe.each(e,function(t,o){var a=o[2],s=o[3];r[o[1]]=a.add;s&&a.add(function(){n=s},e[1^t][2].disable,e[2][2].lock);i[o[0]]=function(){i[o[0]+"With"](this===i?r:this,arguments);return this};i[o[0]+"With"]=a.fireWith});r.promise(i);t&&t.call(i,i);return i},when:function(t){var e,n,r,i=0,o=J.call(arguments),a=o.length,s=1!==a||t&&oe.isFunction(t.promise)?a:0,l=1===s?t:oe.Deferred(),u=function(t,n,r){return function(i){n[t]=this;r[t]=arguments.length>1?J.call(arguments):i;r===e?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(a>1){e=new Array(a);n=new Array(a);r=new Array(a);for(;a>i;i++)o[i]&&oe.isFunction(o[i].promise)?o[i].promise().done(u(i,r,o)).fail(l.reject).progress(u(i,n,e)):--s}s||l.resolveWith(r,o);return l.promise()}});var Se;oe.fn.ready=function(t){oe.ready.promise().done(t);return this};oe.extend({isReady:!1,readyWait:1,holdReady:function(t){t?oe.readyWait++:oe.ready(!0)},ready:function(t){if(t===!0?!--oe.readyWait:!oe.isReady){if(!ge.body)return setTimeout(oe.ready);oe.isReady=!0;if(!(t!==!0&&--oe.readyWait>0)){Se.resolveWith(ge,[oe]);if(oe.fn.triggerHandler){oe(ge).triggerHandler("ready");oe(ge).off("ready")}}}}});oe.ready.promise=function(t){if(!Se){Se=oe.Deferred();if("complete"===ge.readyState)setTimeout(oe.ready);else if(ge.addEventListener){ge.addEventListener("DOMContentLoaded",l,!1);e.addEventListener("load",l,!1)}else{ge.attachEvent("onreadystatechange",l);e.attachEvent("onload",l);var n=!1;try{n=null==e.frameElement&&ge.documentElement}catch(r){}n&&n.doScroll&&function i(){if(!oe.isReady){try{n.doScroll("left")}catch(t){return setTimeout(i,50)}s();oe.ready()}}()}}return Se.promise(t) };var Ce,Te="undefined";for(Ce in oe(re))break;re.ownLast="0"!==Ce;re.inlineBlockNeedsLayout=!1;oe(function(){var t,e,n,r;n=ge.getElementsByTagName("body")[0];if(n&&n.style){e=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(e);if(typeof e.style.zoom!==Te){e.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";re.inlineBlockNeedsLayout=t=3===e.offsetWidth;t&&(n.style.zoom=1)}n.removeChild(r)}});(function(){var t=ge.createElement("div");if(null==re.deleteExpando){re.deleteExpando=!0;try{delete t.test}catch(e){re.deleteExpando=!1}}t=null})();oe.acceptData=function(t){var e=oe.noData[(t.nodeName+" ").toLowerCase()],n=+t.nodeType||1;return 1!==n&&9!==n?!1:!e||e!==!0&&t.getAttribute("classid")===e};var _e=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ke=/([A-Z])/g;oe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(t){t=t.nodeType?oe.cache[t[oe.expando]]:t[oe.expando];return!!t&&!c(t)},data:function(t,e,n){return f(t,e,n)},removeData:function(t,e){return h(t,e)},_data:function(t,e,n){return f(t,e,n,!0)},_removeData:function(t,e){return h(t,e,!0)}});oe.fn.extend({data:function(t,e){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===t){if(this.length){i=oe.data(o);if(1===o.nodeType&&!oe._data(o,"parsedAttrs")){n=a.length;for(;n--;)if(a[n]){r=a[n].name;if(0===r.indexOf("data-")){r=oe.camelCase(r.slice(5));u(o,r,i[r])}}oe._data(o,"parsedAttrs",!0)}}return i}return"object"==typeof t?this.each(function(){oe.data(this,t)}):arguments.length>1?this.each(function(){oe.data(this,t,e)}):o?u(o,t,oe.data(o,t)):void 0},removeData:function(t){return this.each(function(){oe.removeData(this,t)})}});oe.extend({queue:function(t,e,n){var r;if(t){e=(e||"fx")+"queue";r=oe._data(t,e);n&&(!r||oe.isArray(n)?r=oe._data(t,e,oe.makeArray(n)):r.push(n));return r||[]}},dequeue:function(t,e){e=e||"fx";var n=oe.queue(t,e),r=n.length,i=n.shift(),o=oe._queueHooks(t,e),a=function(){oe.dequeue(t,e)};if("inprogress"===i){i=n.shift();r--}if(i){"fx"===e&&n.unshift("inprogress");delete o.stop;i.call(t,a,o)}!r&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return oe._data(t,n)||oe._data(t,n,{empty:oe.Callbacks("once memory").add(function(){oe._removeData(t,e+"queue");oe._removeData(t,n)})})}});oe.fn.extend({queue:function(t,e){var n=2;if("string"!=typeof t){e=t;t="fx";n--}return arguments.length<n?oe.queue(this[0],t):void 0===e?this:this.each(function(){var n=oe.queue(this,t,e);oe._queueHooks(this,t);"fx"===t&&"inprogress"!==n[0]&&oe.dequeue(this,t)})},dequeue:function(t){return this.each(function(){oe.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var n,r=1,i=oe.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};if("string"!=typeof t){e=t;t=void 0}t=t||"fx";for(;a--;){n=oe._data(o[a],t+"queueHooks");if(n&&n.empty){r++;n.empty.add(s)}}s();return i.promise(e)}});var Me=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,De=["Top","Right","Bottom","Left"],Le=function(t,e){t=e||t;return"none"===oe.css(t,"display")||!oe.contains(t.ownerDocument,t)},Ae=oe.access=function(t,e,n,r,i,o,a){var s=0,l=t.length,u=null==n;if("object"===oe.type(n)){i=!0;for(s in n)oe.access(t,e,s,n[s],!0,o,a)}else if(void 0!==r){i=!0;oe.isFunction(r)||(a=!0);if(u)if(a){e.call(t,r);e=null}else{u=e;e=function(t,e,n){return u.call(oe(t),n)}}if(e)for(;l>s;s++)e(t[s],n,a?r:r.call(t[s],s,e(t[s],n)))}return i?t:u?e.call(t):l?e(t[0],n):o},Ne=/^(?:checkbox|radio)$/i;(function(){var t=ge.createElement("input"),e=ge.createElement("div"),n=ge.createDocumentFragment();e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";re.leadingWhitespace=3===e.firstChild.nodeType;re.tbody=!e.getElementsByTagName("tbody").length;re.htmlSerialize=!!e.getElementsByTagName("link").length;re.html5Clone="<:nav></:nav>"!==ge.createElement("nav").cloneNode(!0).outerHTML;t.type="checkbox";t.checked=!0;n.appendChild(t);re.appendChecked=t.checked;e.innerHTML="<textarea>x</textarea>";re.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue;n.appendChild(e);e.innerHTML="<input type='radio' checked='checked' name='t'/>";re.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked;re.noCloneEvent=!0;if(e.attachEvent){e.attachEvent("onclick",function(){re.noCloneEvent=!1});e.cloneNode(!0).click()}if(null==re.deleteExpando){re.deleteExpando=!0;try{delete e.test}catch(r){re.deleteExpando=!1}}})();(function(){var t,n,r=ge.createElement("div");for(t in{submit:!0,change:!0,focusin:!0}){n="on"+t;if(!(re[t+"Bubbles"]=n in e)){r.setAttribute(n,"t");re[t+"Bubbles"]=r.attributes[n].expando===!1}}r=null})();var Ee=/^(?:input|select|textarea)$/i,je=/^key/,Ie=/^(?:mouse|pointer|contextmenu)|click/,Pe=/^(?:focusinfocus|focusoutblur)$/,He=/^([^.]*)(?:\.(.+)|)$/;oe.event={global:{},add:function(t,e,n,r,i){var o,a,s,l,u,c,f,h,d,p,g,m=oe._data(t);if(m){if(n.handler){l=n;n=l.handler;i=l.selector}n.guid||(n.guid=oe.guid++);(a=m.events)||(a=m.events={});if(!(c=m.handle)){c=m.handle=function(t){return typeof oe===Te||t&&oe.event.triggered===t.type?void 0:oe.event.dispatch.apply(c.elem,arguments)};c.elem=t}e=(e||"").match(xe)||[""];s=e.length;for(;s--;){o=He.exec(e[s])||[];d=g=o[1];p=(o[2]||"").split(".").sort();if(d){u=oe.event.special[d]||{};d=(i?u.delegateType:u.bindType)||d;u=oe.event.special[d]||{};f=oe.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&oe.expr.match.needsContext.test(i),namespace:p.join(".")},l);if(!(h=a[d])){h=a[d]=[];h.delegateCount=0;u.setup&&u.setup.call(t,r,p,c)!==!1||(t.addEventListener?t.addEventListener(d,c,!1):t.attachEvent&&t.attachEvent("on"+d,c))}if(u.add){u.add.call(t,f);f.handler.guid||(f.handler.guid=n.guid)}i?h.splice(h.delegateCount++,0,f):h.push(f);oe.event.global[d]=!0}}t=null}},remove:function(t,e,n,r,i){var o,a,s,l,u,c,f,h,d,p,g,m=oe.hasData(t)&&oe._data(t);if(m&&(c=m.events)){e=(e||"").match(xe)||[""];u=e.length;for(;u--;){s=He.exec(e[u])||[];d=g=s[1];p=(s[2]||"").split(".").sort();if(d){f=oe.event.special[d]||{};d=(r?f.delegateType:f.bindType)||d;h=c[d]||[];s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)");l=o=h.length;for(;o--;){a=h[o];if(!(!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector))){h.splice(o,1);a.selector&&h.delegateCount--;f.remove&&f.remove.call(t,a)}}if(l&&!h.length){f.teardown&&f.teardown.call(t,p,m.handle)!==!1||oe.removeEvent(t,d,m.handle);delete c[d]}}else for(d in c)oe.event.remove(t,d+e[u],n,r,!0)}if(oe.isEmptyObject(c)){delete m.handle;oe._removeData(t,"events")}}},trigger:function(t,n,r,i){var o,a,s,l,u,c,f,h=[r||ge],d=ne.call(t,"type")?t.type:t,p=ne.call(t,"namespace")?t.namespace.split("."):[];s=c=r=r||ge;if(3!==r.nodeType&&8!==r.nodeType&&!Pe.test(d+oe.event.triggered)){if(d.indexOf(".")>=0){p=d.split(".");d=p.shift();p.sort()}a=d.indexOf(":")<0&&"on"+d;t=t[oe.expando]?t:new oe.Event(d,"object"==typeof t&&t);t.isTrigger=i?2:3;t.namespace=p.join(".");t.namespace_re=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;t.result=void 0;t.target||(t.target=r);n=null==n?[t]:oe.makeArray(n,[t]);u=oe.event.special[d]||{};if(i||!u.trigger||u.trigger.apply(r,n)!==!1){if(!i&&!u.noBubble&&!oe.isWindow(r)){l=u.delegateType||d;Pe.test(l+d)||(s=s.parentNode);for(;s;s=s.parentNode){h.push(s);c=s}c===(r.ownerDocument||ge)&&h.push(c.defaultView||c.parentWindow||e)}f=0;for(;(s=h[f++])&&!t.isPropagationStopped();){t.type=f>1?l:u.bindType||d;o=(oe._data(s,"events")||{})[t.type]&&oe._data(s,"handle");o&&o.apply(s,n);o=a&&s[a];if(o&&o.apply&&oe.acceptData(s)){t.result=o.apply(s,n);t.result===!1&&t.preventDefault()}}t.type=d;if(!i&&!t.isDefaultPrevented()&&(!u._default||u._default.apply(h.pop(),n)===!1)&&oe.acceptData(r)&&a&&r[d]&&!oe.isWindow(r)){c=r[a];c&&(r[a]=null);oe.event.triggered=d;try{r[d]()}catch(g){}oe.event.triggered=void 0;c&&(r[a]=c)}return t.result}}},dispatch:function(t){t=oe.event.fix(t);var e,n,r,i,o,a=[],s=J.call(arguments),l=(oe._data(this,"events")||{})[t.type]||[],u=oe.event.special[t.type]||{};s[0]=t;t.delegateTarget=this;if(!u.preDispatch||u.preDispatch.call(this,t)!==!1){a=oe.event.handlers.call(this,t,l);e=0;for(;(i=a[e++])&&!t.isPropagationStopped();){t.currentTarget=i.elem;o=0;for(;(r=i.handlers[o++])&&!t.isImmediatePropagationStopped();)if(!t.namespace_re||t.namespace_re.test(r.namespace)){t.handleObj=r;t.data=r.data;n=((oe.event.special[r.origType]||{}).handle||r.handler).apply(i.elem,s);if(void 0!==n&&(t.result=n)===!1){t.preventDefault();t.stopPropagation()}}}u.postDispatch&&u.postDispatch.call(this,t);return t.result}},handlers:function(t,e){var n,r,i,o,a=[],s=e.delegateCount,l=t.target;if(s&&l.nodeType&&(!t.button||"click"!==t.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==t.type)){i=[];for(o=0;s>o;o++){r=e[o];n=r.selector+" ";void 0===i[n]&&(i[n]=r.needsContext?oe(n,this).index(l)>=0:oe.find(n,this,null,[l]).length);i[n]&&i.push(r)}i.length&&a.push({elem:l,handlers:i})}s<e.length&&a.push({elem:this,handlers:e.slice(s)});return a},fix:function(t){if(t[oe.expando])return t;var e,n,r,i=t.type,o=t,a=this.fixHooks[i];a||(this.fixHooks[i]=a=Ie.test(i)?this.mouseHooks:je.test(i)?this.keyHooks:{});r=a.props?this.props.concat(a.props):this.props;t=new oe.Event(o);e=r.length;for(;e--;){n=r[e];t[n]=o[n]}t.target||(t.target=o.srcElement||ge);3===t.target.nodeType&&(t.target=t.target.parentNode);t.metaKey=!!t.metaKey;return a.filter?a.filter(t,o):t},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode);return t}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var n,r,i,o=e.button,a=e.fromElement;if(null==t.pageX&&null!=e.clientX){r=t.target.ownerDocument||ge;i=r.documentElement;n=r.body;t.pageX=e.clientX+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0);t.pageY=e.clientY+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)}!t.relatedTarget&&a&&(t.relatedTarget=a===t.target?e.toElement:a);t.which||void 0===o||(t.which=1&o?1:2&o?3:4&o?2:0);return t}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==g()&&this.focus)try{this.focus();return!1}catch(t){}},delegateType:"focusin"},blur:{trigger:function(){if(this===g()&&this.blur){this.blur();return!1}},delegateType:"focusout"},click:{trigger:function(){if(oe.nodeName(this,"input")&&"checkbox"===this.type&&this.click){this.click();return!1}},_default:function(t){return oe.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}},simulate:function(t,e,n,r){var i=oe.extend(new oe.Event,n,{type:t,isSimulated:!0,originalEvent:{}});r?oe.event.trigger(i,null,e):oe.event.dispatch.call(e,i);i.isDefaultPrevented()&&n.preventDefault()}};oe.removeEvent=ge.removeEventListener?function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n,!1)}:function(t,e,n){var r="on"+e;if(t.detachEvent){typeof t[r]===Te&&(t[r]=null);t.detachEvent(r,n)}};oe.Event=function(t,e){if(!(this instanceof oe.Event))return new oe.Event(t,e);if(t&&t.type){this.originalEvent=t;this.type=t.type;this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&t.returnValue===!1?d:p}else this.type=t;e&&oe.extend(this,e);this.timeStamp=t&&t.timeStamp||oe.now();this[oe.expando]=!0};oe.Event.prototype={isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=d;t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=d;if(t){t.stopPropagation&&t.stopPropagation();t.cancelBubble=!0}},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=d;t&&t.stopImmediatePropagation&&t.stopImmediatePropagation();this.stopPropagation()}};oe.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){oe.event.special[t]={delegateType:e,bindType:e,handle:function(t){var n,r=this,i=t.relatedTarget,o=t.handleObj;if(!i||i!==r&&!oe.contains(r,i)){t.type=o.origType;n=o.handler.apply(this,arguments);t.type=e}return n}}});re.submitBubbles||(oe.event.special.submit={setup:function(){if(oe.nodeName(this,"form"))return!1;oe.event.add(this,"click._submit keypress._submit",function(t){var e=t.target,n=oe.nodeName(e,"input")||oe.nodeName(e,"button")?e.form:void 0;if(n&&!oe._data(n,"submitBubbles")){oe.event.add(n,"submit._submit",function(t){t._submit_bubble=!0});oe._data(n,"submitBubbles",!0)}});return void 0},postDispatch:function(t){if(t._submit_bubble){delete t._submit_bubble;this.parentNode&&!t.isTrigger&&oe.event.simulate("submit",this.parentNode,t,!0)}},teardown:function(){if(oe.nodeName(this,"form"))return!1;oe.event.remove(this,"._submit");return void 0}});re.changeBubbles||(oe.event.special.change={setup:function(){if(Ee.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type){oe.event.add(this,"propertychange._change",function(t){"checked"===t.originalEvent.propertyName&&(this._just_changed=!0)});oe.event.add(this,"click._change",function(t){this._just_changed&&!t.isTrigger&&(this._just_changed=!1);oe.event.simulate("change",this,t,!0)})}return!1}oe.event.add(this,"beforeactivate._change",function(t){var e=t.target;if(Ee.test(e.nodeName)&&!oe._data(e,"changeBubbles")){oe.event.add(e,"change._change",function(t){!this.parentNode||t.isSimulated||t.isTrigger||oe.event.simulate("change",this.parentNode,t,!0)});oe._data(e,"changeBubbles",!0)}})},handle:function(t){var e=t.target;return this!==e||t.isSimulated||t.isTrigger||"radio"!==e.type&&"checkbox"!==e.type?t.handleObj.handler.apply(this,arguments):void 0},teardown:function(){oe.event.remove(this,"._change");return!Ee.test(this.nodeName)}});re.focusinBubbles||oe.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){oe.event.simulate(e,t.target,oe.event.fix(t),!0)};oe.event.special[e]={setup:function(){var r=this.ownerDocument||this,i=oe._data(r,e);i||r.addEventListener(t,n,!0);oe._data(r,e,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=oe._data(r,e)-1;if(i)oe._data(r,e,i);else{r.removeEventListener(t,n,!0);oe._removeData(r,e)}}}});oe.fn.extend({on:function(t,e,n,r,i){var o,a;if("object"==typeof t){if("string"!=typeof e){n=n||e;e=void 0}for(o in t)this.on(o,e,n,t[o],i);return this}if(null==n&&null==r){r=e;n=e=void 0}else if(null==r)if("string"==typeof e){r=n;n=void 0}else{r=n;n=e;e=void 0}if(r===!1)r=p;else if(!r)return this;if(1===i){a=r;r=function(t){oe().off(t);return a.apply(this,arguments)};r.guid=a.guid||(a.guid=oe.guid++)}return this.each(function(){oe.event.add(this,t,r,n,e)})},one:function(t,e,n,r){return this.on(t,e,n,r,1)},off:function(t,e,n){var r,i;if(t&&t.preventDefault&&t.handleObj){r=t.handleObj;oe(t.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler);return this}if("object"==typeof t){for(i in t)this.off(i,e,t[i]);return this}if(e===!1||"function"==typeof e){n=e;e=void 0}n===!1&&(n=p);return this.each(function(){oe.event.remove(this,t,n,e)})},trigger:function(t,e){return this.each(function(){oe.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];return n?oe.event.trigger(t,e,n,!0):void 0}});var Oe="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Fe=/ jQuery\d+="(?:null|\d+)"/g,Re=new RegExp("<(?:"+Oe+")[\\s/>]","i"),We=/^\s+/,ze=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,qe=/<([\w:]+)/,Ue=/<tbody/i,Be=/<|&#?\w+;/,Ve=/<(?:script|style|link)/i,Xe=/checked\s*(?:[^=]|=\s*.checked.)/i,Ge=/^$|\/(?:java|ecma)script/i,$e=/^true\/(.*)/,Ye=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Je={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:re.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ke=m(ge),Ze=Ke.appendChild(ge.createElement("div"));Je.optgroup=Je.option;Je.tbody=Je.tfoot=Je.colgroup=Je.caption=Je.thead;Je.th=Je.td;oe.extend({clone:function(t,e,n){var r,i,o,a,s,l=oe.contains(t.ownerDocument,t);if(re.html5Clone||oe.isXMLDoc(t)||!Re.test("<"+t.nodeName+">"))o=t.cloneNode(!0);else{Ze.innerHTML=t.outerHTML;Ze.removeChild(o=Ze.firstChild)}if(!(re.noCloneEvent&&re.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||oe.isXMLDoc(t))){r=v(o);s=v(t);for(a=0;null!=(i=s[a]);++a)r[a]&&T(i,r[a])}if(e)if(n){s=s||v(t);r=r||v(o);for(a=0;null!=(i=s[a]);a++)C(i,r[a])}else C(t,o);r=v(o,"script");r.length>0&&S(r,!l&&v(t,"script"));r=s=i=null;return o},buildFragment:function(t,e,n,r){for(var i,o,a,s,l,u,c,f=t.length,h=m(e),d=[],p=0;f>p;p++){o=t[p];if(o||0===o)if("object"===oe.type(o))oe.merge(d,o.nodeType?[o]:o);else if(Be.test(o)){s=s||h.appendChild(e.createElement("div"));l=(qe.exec(o)||["",""])[1].toLowerCase();c=Je[l]||Je._default;s.innerHTML=c[1]+o.replace(ze,"<$1></$2>")+c[2];i=c[0];for(;i--;)s=s.lastChild;!re.leadingWhitespace&&We.test(o)&&d.push(e.createTextNode(We.exec(o)[0]));if(!re.tbody){o="table"!==l||Ue.test(o)?"<table>"!==c[1]||Ue.test(o)?0:s:s.firstChild;i=o&&o.childNodes.length;for(;i--;)oe.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}oe.merge(d,s.childNodes);s.textContent="";for(;s.firstChild;)s.removeChild(s.firstChild);s=h.lastChild}else d.push(e.createTextNode(o))}s&&h.removeChild(s);re.appendChecked||oe.grep(v(d,"input"),y);p=0;for(;o=d[p++];)if(!r||-1===oe.inArray(o,r)){a=oe.contains(o.ownerDocument,o);s=v(h.appendChild(o),"script");a&&S(s);if(n){i=0;for(;o=s[i++];)Ge.test(o.type||"")&&n.push(o)}}s=null;return h},cleanData:function(t,e){for(var n,r,i,o,a=0,s=oe.expando,l=oe.cache,u=re.deleteExpando,c=oe.event.special;null!=(n=t[a]);a++)if(e||oe.acceptData(n)){i=n[s];o=i&&l[i];if(o){if(o.events)for(r in o.events)c[r]?oe.event.remove(n,r):oe.removeEvent(n,r,o.handle);if(l[i]){delete l[i];u?delete n[s]:typeof n.removeAttribute!==Te?n.removeAttribute(s):n[s]=null;Y.push(i)}}}}});oe.fn.extend({text:function(t){return Ae(this,function(t){return void 0===t?oe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ge).createTextNode(t))},null,t,arguments.length)},append:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=b(this,t);e.appendChild(t)}})},prepend:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=b(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},remove:function(t,e){for(var n,r=t?oe.filter(t,this):this,i=0;null!=(n=r[i]);i++){e||1!==n.nodeType||oe.cleanData(v(n));if(n.parentNode){e&&oe.contains(n.ownerDocument,n)&&S(v(n,"script"));n.parentNode.removeChild(n)}}return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++){1===t.nodeType&&oe.cleanData(v(t,!1));for(;t.firstChild;)t.removeChild(t.firstChild);t.options&&oe.nodeName(t,"select")&&(t.options.length=0)}return this},clone:function(t,e){t=null==t?!1:t;e=null==e?t:e;return this.map(function(){return oe.clone(this,t,e)})},html:function(t){return Ae(this,function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t)return 1===e.nodeType?e.innerHTML.replace(Fe,""):void 0;if(!("string"!=typeof t||Ve.test(t)||!re.htmlSerialize&&Re.test(t)||!re.leadingWhitespace&&We.test(t)||Je[(qe.exec(t)||["",""])[1].toLowerCase()])){t=t.replace(ze,"<$1></$2>");try{for(;r>n;n++){e=this[n]||{};if(1===e.nodeType){oe.cleanData(v(e,!1));e.innerHTML=t}}e=0}catch(i){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=arguments[0];this.domManip(arguments,function(e){t=this.parentNode;oe.cleanData(v(this));t&&t.replaceChild(e,this)});return t&&(t.length||t.nodeType)?this:this.remove()},detach:function(t){return this.remove(t,!0)},domManip:function(t,e){t=K.apply([],t);var n,r,i,o,a,s,l=0,u=this.length,c=this,f=u-1,h=t[0],d=oe.isFunction(h);if(d||u>1&&"string"==typeof h&&!re.checkClone&&Xe.test(h))return this.each(function(n){var r=c.eq(n);d&&(t[0]=h.call(this,n,r.html()));r.domManip(t,e)});if(u){s=oe.buildFragment(t,this[0].ownerDocument,!1,this);n=s.firstChild;1===s.childNodes.length&&(s=n);if(n){o=oe.map(v(s,"script"),x);i=o.length;for(;u>l;l++){r=s;if(l!==f){r=oe.clone(r,!0,!0);i&&oe.merge(o,v(r,"script"))}e.call(this[l],r,l)}if(i){a=o[o.length-1].ownerDocument;oe.map(o,w);for(l=0;i>l;l++){r=o[l];Ge.test(r.type||"")&&!oe._data(r,"globalEval")&&oe.contains(a,r)&&(r.src?oe._evalUrl&&oe._evalUrl(r.src):oe.globalEval((r.text||r.textContent||r.innerHTML||"").replace(Ye,"")))}}s=n=null}}return this}});oe.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){oe.fn[t]=function(t){for(var n,r=0,i=[],o=oe(t),a=o.length-1;a>=r;r++){n=r===a?this:this.clone(!0);oe(o[r])[e](n);Z.apply(i,n.get())}return this.pushStack(i)}});var Qe,tn={};(function(){var t;re.shrinkWrapBlocks=function(){if(null!=t)return t;t=!1;var e,n,r;n=ge.getElementsByTagName("body")[0];if(n&&n.style){e=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(e);if(typeof e.style.zoom!==Te){e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1";e.appendChild(ge.createElement("div")).style.width="5px";t=3!==e.offsetWidth}n.removeChild(r);return t}}})();var en,nn,rn=/^margin/,on=new RegExp("^("+Me+")(?!px)[a-z%]+$","i"),an=/^(top|right|bottom|left)$/;if(e.getComputedStyle){en=function(t){return t.ownerDocument.defaultView.getComputedStyle(t,null)};nn=function(t,e,n){var r,i,o,a,s=t.style;n=n||en(t);a=n?n.getPropertyValue(e)||n[e]:void 0;if(n){""!==a||oe.contains(t.ownerDocument,t)||(a=oe.style(t,e));if(on.test(a)&&rn.test(e)){r=s.width;i=s.minWidth;o=s.maxWidth;s.minWidth=s.maxWidth=s.width=a;a=n.width;s.width=r;s.minWidth=i;s.maxWidth=o}}return void 0===a?a:a+""}}else if(ge.documentElement.currentStyle){en=function(t){return t.currentStyle};nn=function(t,e,n){var r,i,o,a,s=t.style;n=n||en(t);a=n?n[e]:void 0;null==a&&s&&s[e]&&(a=s[e]);if(on.test(a)&&!an.test(e)){r=s.left;i=t.runtimeStyle;o=i&&i.left;o&&(i.left=t.currentStyle.left);s.left="fontSize"===e?"1em":a;a=s.pixelLeft+"px";s.left=r;o&&(i.left=o)}return void 0===a?a:a+""||"auto"}}(function(){function t(){var t,n,r,i;n=ge.getElementsByTagName("body")[0];if(n&&n.style){t=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(t);t.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute";o=a=!1;l=!0;if(e.getComputedStyle){o="1%"!==(e.getComputedStyle(t,null)||{}).top;a="4px"===(e.getComputedStyle(t,null)||{width:"4px"}).width;i=t.appendChild(ge.createElement("div"));i.style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0";i.style.marginRight=i.style.width="0";t.style.width="1px";l=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)}t.innerHTML="<table><tr><td></td><td>t</td></tr></table>";i=t.getElementsByTagName("td");i[0].style.cssText="margin:0;border:0;padding:0;display:none";s=0===i[0].offsetHeight;if(s){i[0].style.display="";i[1].style.display="none";s=0===i[0].offsetHeight}n.removeChild(r)}}var n,r,i,o,a,s,l;n=ge.createElement("div");n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";i=n.getElementsByTagName("a")[0];r=i&&i.style;if(r){r.cssText="float:left;opacity:.5";re.opacity="0.5"===r.opacity;re.cssFloat=!!r.cssFloat;n.style.backgroundClip="content-box";n.cloneNode(!0).style.backgroundClip="";re.clearCloneStyle="content-box"===n.style.backgroundClip;re.boxSizing=""===r.boxSizing||""===r.MozBoxSizing||""===r.WebkitBoxSizing;oe.extend(re,{reliableHiddenOffsets:function(){null==s&&t();return s},boxSizingReliable:function(){null==a&&t();return a},pixelPosition:function(){null==o&&t();return o},reliableMarginRight:function(){null==l&&t();return l}})}})();oe.swap=function(t,e,n,r){var i,o,a={};for(o in e){a[o]=t.style[o];t.style[o]=e[o]}i=n.apply(t,r||[]);for(o in e)t.style[o]=a[o];return i};var sn=/alpha\([^)]*\)/i,ln=/opacity\s*=\s*([^)]*)/,un=/^(none|table(?!-c[ea]).+)/,cn=new RegExp("^("+Me+")(.*)$","i"),fn=new RegExp("^([+-])=("+Me+")","i"),hn={position:"absolute",visibility:"hidden",display:"block"},dn={letterSpacing:"0",fontWeight:"400"},pn=["Webkit","O","Moz","ms"];oe.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=nn(t,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":re.cssFloat?"cssFloat":"styleFloat"},style:function(t,e,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var i,o,a,s=oe.camelCase(e),l=t.style;e=oe.cssProps[s]||(oe.cssProps[s]=D(l,s));a=oe.cssHooks[e]||oe.cssHooks[s];if(void 0===n)return a&&"get"in a&&void 0!==(i=a.get(t,!1,r))?i:l[e];o=typeof n;if("string"===o&&(i=fn.exec(n))){n=(i[1]+1)*i[2]+parseFloat(oe.css(t,e));o="number"}if(null!=n&&n===n){"number"!==o||oe.cssNumber[s]||(n+="px");re.clearCloneStyle||""!==n||0!==e.indexOf("background")||(l[e]="inherit");if(!(a&&"set"in a&&void 0===(n=a.set(t,n,r))))try{l[e]=n}catch(u){}}}},css:function(t,e,n,r){var i,o,a,s=oe.camelCase(e);e=oe.cssProps[s]||(oe.cssProps[s]=D(t.style,s));a=oe.cssHooks[e]||oe.cssHooks[s];a&&"get"in a&&(o=a.get(t,!0,n));void 0===o&&(o=nn(t,e,r));"normal"===o&&e in dn&&(o=dn[e]);if(""===n||n){i=parseFloat(o);return n===!0||oe.isNumeric(i)?i||0:o}return o}});oe.each(["height","width"],function(t,e){oe.cssHooks[e]={get:function(t,n,r){return n?un.test(oe.css(t,"display"))&&0===t.offsetWidth?oe.swap(t,hn,function(){return E(t,e,r)}):E(t,e,r):void 0},set:function(t,n,r){var i=r&&en(t);return A(t,n,r?N(t,e,r,re.boxSizing&&"border-box"===oe.css(t,"boxSizing",!1,i),i):0)}}});re.opacity||(oe.cssHooks.opacity={get:function(t,e){return ln.test((e&&t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":e?"1":""},set:function(t,e){var n=t.style,r=t.currentStyle,i=oe.isNumeric(e)?"alpha(opacity="+100*e+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if((e>=1||""===e)&&""===oe.trim(o.replace(sn,""))&&n.removeAttribute){n.removeAttribute("filter");if(""===e||r&&!r.filter)return}n.filter=sn.test(o)?o.replace(sn,i):o+" "+i}});oe.cssHooks.marginRight=M(re.reliableMarginRight,function(t,e){return e?oe.swap(t,{display:"inline-block"},nn,[t,"marginRight"]):void 0});oe.each({margin:"",padding:"",border:"Width"},function(t,e){oe.cssHooks[t+e]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++)i[t+De[r]+e]=o[r]||o[r-2]||o[0];return i}};rn.test(t)||(oe.cssHooks[t+e].set=A)});oe.fn.extend({css:function(t,e){return Ae(this,function(t,e,n){var r,i,o={},a=0;if(oe.isArray(e)){r=en(t);i=e.length;for(;i>a;a++)o[e[a]]=oe.css(t,e[a],!1,r);return o}return void 0!==n?oe.style(t,e,n):oe.css(t,e)},t,e,arguments.length>1)},show:function(){return L(this,!0)},hide:function(){return L(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Le(this)?oe(this).show():oe(this).hide()})}});oe.Tween=j;j.prototype={constructor:j,init:function(t,e,n,r,i,o){this.elem=t;this.prop=n;this.easing=i||"swing";this.options=e;this.start=this.now=this.cur();this.end=r;this.unit=o||(oe.cssNumber[n]?"":"px")},cur:function(){var t=j.propHooks[this.prop];return t&&t.get?t.get(this):j.propHooks._default.get(this)},run:function(t){var e,n=j.propHooks[this.prop];this.pos=e=this.options.duration?oe.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t;this.now=(this.end-this.start)*e+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);n&&n.set?n.set(this):j.propHooks._default.set(this);return this}};j.prototype.init.prototype=j.prototype;j.propHooks={_default:{get:function(t){var e;if(null!=t.elem[t.prop]&&(!t.elem.style||null==t.elem.style[t.prop]))return t.elem[t.prop];e=oe.css(t.elem,t.prop,"");return e&&"auto"!==e?e:0},set:function(t){oe.fx.step[t.prop]?oe.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[oe.cssProps[t.prop]]||oe.cssHooks[t.prop])?oe.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}};j.propHooks.scrollTop=j.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}};oe.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}};oe.fx=j.prototype.init;oe.fx.step={};var gn,mn,vn=/^(?:toggle|show|hide)$/,yn=new RegExp("^(?:([+-])=|)("+Me+")([a-z%]*)$","i"),bn=/queueHooks$/,xn=[O],wn={"*":[function(t,e){var n=this.createTween(t,e),r=n.cur(),i=yn.exec(e),o=i&&i[3]||(oe.cssNumber[t]?"":"px"),a=(oe.cssNumber[t]||"px"!==o&&+r)&&yn.exec(oe.css(n.elem,t)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3];i=i||[];a=+r||1;do{s=s||".5";a/=s;oe.style(n.elem,t,a+o)}while(s!==(s=n.cur()/r)&&1!==s&&--l)}if(i){a=n.start=+a||+r||0;n.unit=o;n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]}return n}]};oe.Animation=oe.extend(R,{tweener:function(t,e){if(oe.isFunction(t)){e=t;t=["*"]}else t=t.split(" ");for(var n,r=0,i=t.length;i>r;r++){n=t[r];wn[n]=wn[n]||[];wn[n].unshift(e)}},prefilter:function(t,e){e?xn.unshift(t):xn.push(t)}});oe.speed=function(t,e,n){var r=t&&"object"==typeof t?oe.extend({},t):{complete:n||!n&&e||oe.isFunction(t)&&t,duration:t,easing:n&&e||e&&!oe.isFunction(e)&&e};r.duration=oe.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in oe.fx.speeds?oe.fx.speeds[r.duration]:oe.fx.speeds._default;(null==r.queue||r.queue===!0)&&(r.queue="fx");r.old=r.complete;r.complete=function(){oe.isFunction(r.old)&&r.old.call(this);r.queue&&oe.dequeue(this,r.queue)};return r};oe.fn.extend({fadeTo:function(t,e,n,r){return this.filter(Le).css("opacity",0).show().end().animate({opacity:e},t,n,r)},animate:function(t,e,n,r){var i=oe.isEmptyObject(t),o=oe.speed(e,n,r),a=function(){var e=R(this,oe.extend({},t),o);(i||oe._data(this,"finish"))&&e.stop(!0)};a.finish=a;return i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(t,e,n){var r=function(t){var e=t.stop;delete t.stop;e(n)};if("string"!=typeof t){n=e;e=t;t=void 0}e&&t!==!1&&this.queue(t||"fx",[]);return this.each(function(){var e=!0,i=null!=t&&t+"queueHooks",o=oe.timers,a=oe._data(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&bn.test(i)&&r(a[i]);for(i=o.length;i--;)if(o[i].elem===this&&(null==t||o[i].queue===t)){o[i].anim.stop(n);e=!1;o.splice(i,1)}(e||!n)&&oe.dequeue(this,t)})},finish:function(t){t!==!1&&(t=t||"fx");return this.each(function(){var e,n=oe._data(this),r=n[t+"queue"],i=n[t+"queueHooks"],o=oe.timers,a=r?r.length:0;n.finish=!0;oe.queue(this,t,[]);i&&i.stop&&i.stop.call(this,!0); for(e=o.length;e--;)if(o[e].elem===this&&o[e].queue===t){o[e].anim.stop(!0);o.splice(e,1)}for(e=0;a>e;e++)r[e]&&r[e].finish&&r[e].finish.call(this);delete n.finish})}});oe.each(["toggle","show","hide"],function(t,e){var n=oe.fn[e];oe.fn[e]=function(t,r,i){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(P(e,!0),t,r,i)}});oe.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){oe.fn[t]=function(t,n,r){return this.animate(e,t,n,r)}});oe.timers=[];oe.fx.tick=function(){var t,e=oe.timers,n=0;gn=oe.now();for(;n<e.length;n++){t=e[n];t()||e[n]!==t||e.splice(n--,1)}e.length||oe.fx.stop();gn=void 0};oe.fx.timer=function(t){oe.timers.push(t);t()?oe.fx.start():oe.timers.pop()};oe.fx.interval=13;oe.fx.start=function(){mn||(mn=setInterval(oe.fx.tick,oe.fx.interval))};oe.fx.stop=function(){clearInterval(mn);mn=null};oe.fx.speeds={slow:600,fast:200,_default:400};oe.fn.delay=function(t,e){t=oe.fx?oe.fx.speeds[t]||t:t;e=e||"fx";return this.queue(e,function(e,n){var r=setTimeout(e,t);n.stop=function(){clearTimeout(r)}})};(function(){var t,e,n,r,i;e=ge.createElement("div");e.setAttribute("className","t");e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";r=e.getElementsByTagName("a")[0];n=ge.createElement("select");i=n.appendChild(ge.createElement("option"));t=e.getElementsByTagName("input")[0];r.style.cssText="top:1px";re.getSetAttribute="t"!==e.className;re.style=/top/.test(r.getAttribute("style"));re.hrefNormalized="/a"===r.getAttribute("href");re.checkOn=!!t.value;re.optSelected=i.selected;re.enctype=!!ge.createElement("form").enctype;n.disabled=!0;re.optDisabled=!i.disabled;t=ge.createElement("input");t.setAttribute("value","");re.input=""===t.getAttribute("value");t.value="t";t.setAttribute("type","radio");re.radioValue="t"===t.value})();var Sn=/\r/g;oe.fn.extend({val:function(t){var e,n,r,i=this[0];if(arguments.length){r=oe.isFunction(t);return this.each(function(n){var i;if(1===this.nodeType){i=r?t.call(this,n,oe(this).val()):t;null==i?i="":"number"==typeof i?i+="":oe.isArray(i)&&(i=oe.map(i,function(t){return null==t?"":t+""}));e=oe.valHooks[this.type]||oe.valHooks[this.nodeName.toLowerCase()];e&&"set"in e&&void 0!==e.set(this,i,"value")||(this.value=i)}})}if(i){e=oe.valHooks[i.type]||oe.valHooks[i.nodeName.toLowerCase()];if(e&&"get"in e&&void 0!==(n=e.get(i,"value")))return n;n=i.value;return"string"==typeof n?n.replace(Sn,""):null==n?"":n}}});oe.extend({valHooks:{option:{get:function(t){var e=oe.find.attr(t,"value");return null!=e?e:oe.trim(oe.text(t))}},select:{get:function(t){for(var e,n,r=t.options,i=t.selectedIndex,o="select-one"===t.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;s>l;l++){n=r[l];if(!(!n.selected&&l!==i||(re.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&oe.nodeName(n.parentNode,"optgroup"))){e=oe(n).val();if(o)return e;a.push(e)}}return a},set:function(t,e){for(var n,r,i=t.options,o=oe.makeArray(e),a=i.length;a--;){r=i[a];if(oe.inArray(oe.valHooks.option.get(r),o)>=0)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1}n||(t.selectedIndex=-1);return i}}}});oe.each(["radio","checkbox"],function(){oe.valHooks[this]={set:function(t,e){return oe.isArray(e)?t.checked=oe.inArray(oe(t).val(),e)>=0:void 0}};re.checkOn||(oe.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var Cn,Tn,_n=oe.expr.attrHandle,kn=/^(?:checked|selected)$/i,Mn=re.getSetAttribute,Dn=re.input;oe.fn.extend({attr:function(t,e){return Ae(this,oe.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){oe.removeAttr(this,t)})}});oe.extend({attr:function(t,e,n){var r,i,o=t.nodeType;if(t&&3!==o&&8!==o&&2!==o){if(typeof t.getAttribute===Te)return oe.prop(t,e,n);if(1!==o||!oe.isXMLDoc(t)){e=e.toLowerCase();r=oe.attrHooks[e]||(oe.expr.match.bool.test(e)?Tn:Cn)}if(void 0===n){if(r&&"get"in r&&null!==(i=r.get(t,e)))return i;i=oe.find.attr(t,e);return null==i?void 0:i}if(null!==n){if(r&&"set"in r&&void 0!==(i=r.set(t,n,e)))return i;t.setAttribute(e,n+"");return n}oe.removeAttr(t,e)}},removeAttr:function(t,e){var n,r,i=0,o=e&&e.match(xe);if(o&&1===t.nodeType)for(;n=o[i++];){r=oe.propFix[n]||n;oe.expr.match.bool.test(n)?Dn&&Mn||!kn.test(n)?t[r]=!1:t[oe.camelCase("default-"+n)]=t[r]=!1:oe.attr(t,n,"");t.removeAttribute(Mn?n:r)}},attrHooks:{type:{set:function(t,e){if(!re.radioValue&&"radio"===e&&oe.nodeName(t,"input")){var n=t.value;t.setAttribute("type",e);n&&(t.value=n);return e}}}}});Tn={set:function(t,e,n){e===!1?oe.removeAttr(t,n):Dn&&Mn||!kn.test(n)?t.setAttribute(!Mn&&oe.propFix[n]||n,n):t[oe.camelCase("default-"+n)]=t[n]=!0;return n}};oe.each(oe.expr.match.bool.source.match(/\w+/g),function(t,e){var n=_n[e]||oe.find.attr;_n[e]=Dn&&Mn||!kn.test(e)?function(t,e,r){var i,o;if(!r){o=_n[e];_n[e]=i;i=null!=n(t,e,r)?e.toLowerCase():null;_n[e]=o}return i}:function(t,e,n){return n?void 0:t[oe.camelCase("default-"+e)]?e.toLowerCase():null}});Dn&&Mn||(oe.attrHooks.value={set:function(t,e,n){if(!oe.nodeName(t,"input"))return Cn&&Cn.set(t,e,n);t.defaultValue=e;return void 0}});if(!Mn){Cn={set:function(t,e,n){var r=t.getAttributeNode(n);r||t.setAttributeNode(r=t.ownerDocument.createAttribute(n));r.value=e+="";return"value"===n||e===t.getAttribute(n)?e:void 0}};_n.id=_n.name=_n.coords=function(t,e,n){var r;return n?void 0:(r=t.getAttributeNode(e))&&""!==r.value?r.value:null};oe.valHooks.button={get:function(t,e){var n=t.getAttributeNode(e);return n&&n.specified?n.value:void 0},set:Cn.set};oe.attrHooks.contenteditable={set:function(t,e,n){Cn.set(t,""===e?!1:e,n)}};oe.each(["width","height"],function(t,e){oe.attrHooks[e]={set:function(t,n){if(""===n){t.setAttribute(e,"auto");return n}}}})}re.style||(oe.attrHooks.style={get:function(t){return t.style.cssText||void 0},set:function(t,e){return t.style.cssText=e+""}});var Ln=/^(?:input|select|textarea|button|object)$/i,An=/^(?:a|area)$/i;oe.fn.extend({prop:function(t,e){return Ae(this,oe.prop,t,e,arguments.length>1)},removeProp:function(t){t=oe.propFix[t]||t;return this.each(function(){try{this[t]=void 0;delete this[t]}catch(e){}})}});oe.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(t,e,n){var r,i,o,a=t.nodeType;if(t&&3!==a&&8!==a&&2!==a){o=1!==a||!oe.isXMLDoc(t);if(o){e=oe.propFix[e]||e;i=oe.propHooks[e]}return void 0!==n?i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:t[e]=n:i&&"get"in i&&null!==(r=i.get(t,e))?r:t[e]}},propHooks:{tabIndex:{get:function(t){var e=oe.find.attr(t,"tabindex");return e?parseInt(e,10):Ln.test(t.nodeName)||An.test(t.nodeName)&&t.href?0:-1}}}});re.hrefNormalized||oe.each(["href","src"],function(t,e){oe.propHooks[e]={get:function(t){return t.getAttribute(e,4)}}});re.optSelected||(oe.propHooks.selected={get:function(t){var e=t.parentNode;if(e){e.selectedIndex;e.parentNode&&e.parentNode.selectedIndex}return null}});oe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){oe.propFix[this.toLowerCase()]=this});re.enctype||(oe.propFix.enctype="encoding");var Nn=/[\t\r\n\f]/g;oe.fn.extend({addClass:function(t){var e,n,r,i,o,a,s=0,l=this.length,u="string"==typeof t&&t;if(oe.isFunction(t))return this.each(function(e){oe(this).addClass(t.call(this,e,this.className))});if(u){e=(t||"").match(xe)||[];for(;l>s;s++){n=this[s];r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Nn," "):" ");if(r){o=0;for(;i=e[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");a=oe.trim(r);n.className!==a&&(n.className=a)}}}return this},removeClass:function(t){var e,n,r,i,o,a,s=0,l=this.length,u=0===arguments.length||"string"==typeof t&&t;if(oe.isFunction(t))return this.each(function(e){oe(this).removeClass(t.call(this,e,this.className))});if(u){e=(t||"").match(xe)||[];for(;l>s;s++){n=this[s];r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Nn," "):"");if(r){o=0;for(;i=e[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");a=t?oe.trim(r):"";n.className!==a&&(n.className=a)}}}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):this.each(oe.isFunction(t)?function(n){oe(this).toggleClass(t.call(this,n,this.className,e),e)}:function(){if("string"===n)for(var e,r=0,i=oe(this),o=t.match(xe)||[];e=o[r++];)i.hasClass(e)?i.removeClass(e):i.addClass(e);else if(n===Te||"boolean"===n){this.className&&oe._data(this,"__className__",this.className);this.className=this.className||t===!1?"":oe._data(this,"__className__")||""}})},hasClass:function(t){for(var e=" "+t+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(Nn," ").indexOf(e)>=0)return!0;return!1}});oe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){oe.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}});oe.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,r){return this.on(e,t,n,r)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}});var En=oe.now(),jn=/\?/,In=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;oe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=oe.trim(t+"");return i&&!oe.trim(i.replace(In,function(t,e,i,o){n&&e&&(r=0);if(0===r)return t;n=i||e;r+=!o-!i;return""}))?Function("return "+i)():oe.error("Invalid JSON: "+t)};oe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{if(e.DOMParser){r=new DOMParser;n=r.parseFromString(t,"text/xml")}else{n=new ActiveXObject("Microsoft.XMLDOM");n.async="false";n.loadXML(t)}}catch(i){n=void 0}n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||oe.error("Invalid XML: "+t);return n};var Pn,Hn,On=/#.*$/,Fn=/([?&])_=[^&]*/,Rn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Wn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,zn=/^(?:GET|HEAD)$/,qn=/^\/\//,Un=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Bn={},Vn={},Xn="*/".concat("*");try{Hn=location.href}catch(Gn){Hn=ge.createElement("a");Hn.href="";Hn=Hn.href}Pn=Un.exec(Hn.toLowerCase())||[];oe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Hn,type:"GET",isLocal:Wn.test(Pn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":oe.parseJSON,"text xml":oe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?q(q(t,oe.ajaxSettings),e):q(oe.ajaxSettings,t)},ajaxPrefilter:W(Bn),ajaxTransport:W(Vn),ajax:function(t,e){function n(t,e,n,r){var i,c,v,y,x,S=e;if(2!==b){b=2;s&&clearTimeout(s);u=void 0;a=r||"";w.readyState=t>0?4:0;i=t>=200&&300>t||304===t;n&&(y=U(f,w,n));y=B(f,y,w,i);if(i){if(f.ifModified){x=w.getResponseHeader("Last-Modified");x&&(oe.lastModified[o]=x);x=w.getResponseHeader("etag");x&&(oe.etag[o]=x)}if(204===t||"HEAD"===f.type)S="nocontent";else if(304===t)S="notmodified";else{S=y.state;c=y.data;v=y.error;i=!v}}else{v=S;if(t||!S){S="error";0>t&&(t=0)}}w.status=t;w.statusText=(e||S)+"";i?p.resolveWith(h,[c,S,w]):p.rejectWith(h,[w,S,v]);w.statusCode(m);m=void 0;l&&d.trigger(i?"ajaxSuccess":"ajaxError",[w,f,i?c:v]);g.fireWith(h,[w,S]);if(l){d.trigger("ajaxComplete",[w,f]);--oe.active||oe.event.trigger("ajaxStop")}}}if("object"==typeof t){e=t;t=void 0}e=e||{};var r,i,o,a,s,l,u,c,f=oe.ajaxSetup({},e),h=f.context||f,d=f.context&&(h.nodeType||h.jquery)?oe(h):oe.event,p=oe.Deferred(),g=oe.Callbacks("once memory"),m=f.statusCode||{},v={},y={},b=0,x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!c){c={};for(;e=Rn.exec(a);)c[e[1].toLowerCase()]=e[2]}e=c[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(t,e){var n=t.toLowerCase();if(!b){t=y[n]=y[n]||t;v[t]=e}return this},overrideMimeType:function(t){b||(f.mimeType=t);return this},statusCode:function(t){var e;if(t)if(2>b)for(e in t)m[e]=[m[e],t[e]];else w.always(t[w.status]);return this},abort:function(t){var e=t||x;u&&u.abort(e);n(0,e);return this}};p.promise(w).complete=g.add;w.success=w.done;w.error=w.fail;f.url=((t||f.url||Hn)+"").replace(On,"").replace(qn,Pn[1]+"//");f.type=e.method||e.type||f.method||f.type;f.dataTypes=oe.trim(f.dataType||"*").toLowerCase().match(xe)||[""];if(null==f.crossDomain){r=Un.exec(f.url.toLowerCase());f.crossDomain=!(!r||r[1]===Pn[1]&&r[2]===Pn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Pn[3]||("http:"===Pn[1]?"80":"443")))}f.data&&f.processData&&"string"!=typeof f.data&&(f.data=oe.param(f.data,f.traditional));z(Bn,f,e,w);if(2===b)return w;l=f.global;l&&0===oe.active++&&oe.event.trigger("ajaxStart");f.type=f.type.toUpperCase();f.hasContent=!zn.test(f.type);o=f.url;if(!f.hasContent){if(f.data){o=f.url+=(jn.test(o)?"&":"?")+f.data;delete f.data}f.cache===!1&&(f.url=Fn.test(o)?o.replace(Fn,"$1_="+En++):o+(jn.test(o)?"&":"?")+"_="+En++)}if(f.ifModified){oe.lastModified[o]&&w.setRequestHeader("If-Modified-Since",oe.lastModified[o]);oe.etag[o]&&w.setRequestHeader("If-None-Match",oe.etag[o])}(f.data&&f.hasContent&&f.contentType!==!1||e.contentType)&&w.setRequestHeader("Content-Type",f.contentType);w.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Xn+"; q=0.01":""):f.accepts["*"]);for(i in f.headers)w.setRequestHeader(i,f.headers[i]);if(f.beforeSend&&(f.beforeSend.call(h,w,f)===!1||2===b))return w.abort();x="abort";for(i in{success:1,error:1,complete:1})w[i](f[i]);u=z(Vn,f,e,w);if(u){w.readyState=1;l&&d.trigger("ajaxSend",[w,f]);f.async&&f.timeout>0&&(s=setTimeout(function(){w.abort("timeout")},f.timeout));try{b=1;u.send(v,n)}catch(S){if(!(2>b))throw S;n(-1,S)}}else n(-1,"No Transport");return w},getJSON:function(t,e,n){return oe.get(t,e,n,"json")},getScript:function(t,e){return oe.get(t,void 0,e,"script")}});oe.each(["get","post"],function(t,e){oe[e]=function(t,n,r,i){if(oe.isFunction(n)){i=i||r;r=n;n=void 0}return oe.ajax({url:t,type:e,dataType:i,data:n,success:r})}});oe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){oe.fn[e]=function(t){return this.on(e,t)}});oe._evalUrl=function(t){return oe.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})};oe.fn.extend({wrapAll:function(t){if(oe.isFunction(t))return this.each(function(e){oe(this).wrapAll(t.call(this,e))});if(this[0]){var e=oe(t,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&e.insertBefore(this[0]);e.map(function(){for(var t=this;t.firstChild&&1===t.firstChild.nodeType;)t=t.firstChild;return t}).append(this)}return this},wrapInner:function(t){return this.each(oe.isFunction(t)?function(e){oe(this).wrapInner(t.call(this,e))}:function(){var e=oe(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=oe.isFunction(t);return this.each(function(n){oe(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(){return this.parent().each(function(){oe.nodeName(this,"body")||oe(this).replaceWith(this.childNodes)}).end()}});oe.expr.filters.hidden=function(t){return t.offsetWidth<=0&&t.offsetHeight<=0||!re.reliableHiddenOffsets()&&"none"===(t.style&&t.style.display||oe.css(t,"display"))};oe.expr.filters.visible=function(t){return!oe.expr.filters.hidden(t)};var $n=/%20/g,Yn=/\[\]$/,Jn=/\r?\n/g,Kn=/^(?:submit|button|image|reset|file)$/i,Zn=/^(?:input|select|textarea|keygen)/i;oe.param=function(t,e){var n,r=[],i=function(t,e){e=oe.isFunction(e)?e():null==e?"":e;r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};void 0===e&&(e=oe.ajaxSettings&&oe.ajaxSettings.traditional);if(oe.isArray(t)||t.jquery&&!oe.isPlainObject(t))oe.each(t,function(){i(this.name,this.value)});else for(n in t)V(n,t[n],e,i);return r.join("&").replace($n,"+")};oe.fn.extend({serialize:function(){return oe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=oe.prop(this,"elements");return t?oe.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!oe(this).is(":disabled")&&Zn.test(this.nodeName)&&!Kn.test(t)&&(this.checked||!Ne.test(t))}).map(function(t,e){var n=oe(this).val();return null==n?null:oe.isArray(n)?oe.map(n,function(t){return{name:e.name,value:t.replace(Jn,"\r\n")}}):{name:e.name,value:n.replace(Jn,"\r\n")}}).get()}});oe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&X()||G()}:X;var Qn=0,tr={},er=oe.ajaxSettings.xhr();e.ActiveXObject&&oe(e).on("unload",function(){for(var t in tr)tr[t](void 0,!0)});re.cors=!!er&&"withCredentials"in er;er=re.ajax=!!er;er&&oe.ajaxTransport(function(t){if(!t.crossDomain||re.cors){var e;return{send:function(n,r){var i,o=t.xhr(),a=++Qn;o.open(t.type,t.url,t.async,t.username,t.password);if(t.xhrFields)for(i in t.xhrFields)o[i]=t.xhrFields[i];t.mimeType&&o.overrideMimeType&&o.overrideMimeType(t.mimeType);t.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)void 0!==n[i]&&o.setRequestHeader(i,n[i]+"");o.send(t.hasContent&&t.data||null);e=function(n,i){var s,l,u;if(e&&(i||4===o.readyState)){delete tr[a];e=void 0;o.onreadystatechange=oe.noop;if(i)4!==o.readyState&&o.abort();else{u={};s=o.status;"string"==typeof o.responseText&&(u.text=o.responseText);try{l=o.statusText}catch(c){l=""}s||!t.isLocal||t.crossDomain?1223===s&&(s=204):s=u.text?200:404}}u&&r(s,l,u,o.getAllResponseHeaders())};t.async?4===o.readyState?setTimeout(e):o.onreadystatechange=tr[a]=e:e()},abort:function(){e&&e(void 0,!0)}}}});oe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(t){oe.globalEval(t);return t}}});oe.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1);if(t.crossDomain){t.type="GET";t.global=!1}});oe.ajaxTransport("script",function(t){if(t.crossDomain){var e,n=ge.head||oe("head")[0]||ge.documentElement;return{send:function(r,i){e=ge.createElement("script");e.async=!0;t.scriptCharset&&(e.charset=t.scriptCharset);e.src=t.url;e.onload=e.onreadystatechange=function(t,n){if(n||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;e.parentNode&&e.parentNode.removeChild(e);e=null;n||i(200,"success")}};n.insertBefore(e,n.firstChild)},abort:function(){e&&e.onload(void 0,!0)}}}});var nr=[],rr=/(=)\?(?=&|$)|\?\?/;oe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=nr.pop()||oe.expando+"_"+En++;this[t]=!0;return t}});oe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(rr.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&rr.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0]){i=t.jsonpCallback=oe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback;s?t[s]=t[s].replace(rr,"$1"+i):t.jsonp!==!1&&(t.url+=(jn.test(t.url)?"&":"?")+t.jsonp+"="+i);t.converters["script json"]=function(){a||oe.error(i+" was not called");return a[0]};t.dataTypes[0]="json";o=e[i];e[i]=function(){a=arguments};r.always(function(){e[i]=o;if(t[i]){t.jsonpCallback=n.jsonpCallback;nr.push(i)}a&&oe.isFunction(o)&&o(a[0]);a=o=void 0});return"script"}});oe.parseHTML=function(t,e,n){if(!t||"string"!=typeof t)return null;if("boolean"==typeof e){n=e;e=!1}e=e||ge;var r=he.exec(t),i=!n&&[];if(r)return[e.createElement(r[1])];r=oe.buildFragment([t],e,i);i&&i.length&&oe(i).remove();return oe.merge([],r.childNodes)};var ir=oe.fn.load;oe.fn.load=function(t,e,n){if("string"!=typeof t&&ir)return ir.apply(this,arguments);var r,i,o,a=this,s=t.indexOf(" ");if(s>=0){r=oe.trim(t.slice(s,t.length));t=t.slice(0,s)}if(oe.isFunction(e)){n=e;e=void 0}else e&&"object"==typeof e&&(o="POST");a.length>0&&oe.ajax({url:t,type:o,dataType:"html",data:e}).done(function(t){i=arguments;a.html(r?oe("<div>").append(oe.parseHTML(t)).find(r):t)}).complete(n&&function(t,e){a.each(n,i||[t.responseText,e,t])});return this};oe.expr.filters.animated=function(t){return oe.grep(oe.timers,function(e){return t===e.elem}).length};var or=e.document.documentElement;oe.offset={setOffset:function(t,e,n){var r,i,o,a,s,l,u,c=oe.css(t,"position"),f=oe(t),h={};"static"===c&&(t.style.position="relative");s=f.offset();o=oe.css(t,"top");l=oe.css(t,"left");u=("absolute"===c||"fixed"===c)&&oe.inArray("auto",[o,l])>-1;if(u){r=f.position();a=r.top;i=r.left}else{a=parseFloat(o)||0;i=parseFloat(l)||0}oe.isFunction(e)&&(e=e.call(t,n,s));null!=e.top&&(h.top=e.top-s.top+a);null!=e.left&&(h.left=e.left-s.left+i);"using"in e?e.using.call(t,h):f.css(h)}};oe.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){oe.offset.setOffset(this,t,e)});var e,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o){e=o.documentElement;if(!oe.contains(e,i))return r;typeof i.getBoundingClientRect!==Te&&(r=i.getBoundingClientRect());n=$(o);return{top:r.top+(n.pageYOffset||e.scrollTop)-(e.clientTop||0),left:r.left+(n.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}}},position:function(){if(this[0]){var t,e,n={top:0,left:0},r=this[0];if("fixed"===oe.css(r,"position"))e=r.getBoundingClientRect();else{t=this.offsetParent();e=this.offset();oe.nodeName(t[0],"html")||(n=t.offset());n.top+=oe.css(t[0],"borderTopWidth",!0);n.left+=oe.css(t[0],"borderLeftWidth",!0)}return{top:e.top-n.top-oe.css(r,"marginTop",!0),left:e.left-n.left-oe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||or;t&&!oe.nodeName(t,"html")&&"static"===oe.css(t,"position");)t=t.offsetParent;return t||or})}});oe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n=/Y/.test(e);oe.fn[t]=function(r){return Ae(this,function(t,r,i){var o=$(t);if(void 0===i)return o?e in o?o[e]:o.document.documentElement[r]:t[r];o?o.scrollTo(n?oe(o).scrollLeft():i,n?i:oe(o).scrollTop()):t[r]=i;return void 0},t,r,arguments.length,null)}});oe.each(["top","left"],function(t,e){oe.cssHooks[e]=M(re.pixelPosition,function(t,n){if(n){n=nn(t,e);return on.test(n)?oe(t).position()[e]+"px":n}})});oe.each({Height:"height",Width:"width"},function(t,e){oe.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,r){oe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Ae(this,function(e,n,r){var i;if(oe.isWindow(e))return e.document.documentElement["client"+t];if(9===e.nodeType){i=e.documentElement;return Math.max(e.body["scroll"+t],i["scroll"+t],e.body["offset"+t],i["offset"+t],i["client"+t])}return void 0===r?oe.css(e,n,a):oe.style(e,n,r,a)},e,o?r:void 0,o,null)}})});oe.fn.size=function(){return this.length};oe.fn.andSelf=oe.fn.addBack;"function"==typeof t&&t.amd&&t("jquery",[],function(){return oe});var ar=e.jQuery,sr=e.$;oe.noConflict=function(t){e.$===oe&&(e.$=sr);t&&e.jQuery===oe&&(e.jQuery=ar);return oe};typeof n===Te&&(e.jQuery=e.$=oe);return oe})},{}],18:[function(e,n,r){(function(){(function(i){if("object"==typeof r&&"object"==typeof n)return i(e("jquery"));if("function"==typeof t&&t.amd)return t(["jquery"],i);i(jQuery);return void 0})(function(t){var e;e=t;return e.pivotUtilities.d3_renderers={Treemap:function(t,n){var r,i,o,a,s,l,u,c,f,h,d,p,g,m;o={localeStrings:{}};n=e.extend(o,n);l=e("<div style='width: 100%; height: 100%;'>");c={name:"All",children:[]};r=function(t,e,n){var i,o,a,s,l,u,c;if(0!==e.length){null==(u=t.children)&&(t.children=[]);a=e.shift();c=t.children;for(s=0,l=c.length;l>s;s++){i=c[s];if(i.name===a){r(i,e,n);return}}o={name:a};r(o,e,n);return t.children.push(o)}t.value=n};m=t.getRowKeys();for(p=0,g=m.length;g>p;p++){u=m[p];h=t.getAggregator(u,[]).value();null!=h&&r(c,u,h)}i=d3.scale.category10();d=e(window).width()/1.4;a=e(window).height()/1.4;s=10;f=d3.layout.treemap().size([d,a]).sticky(!0).value(function(t){return t.size});d3.select(l[0]).append("div").style("position","relative").style("width",d+2*s+"px").style("height",a+2*s+"px").style("left",s+"px").style("top",s+"px").datum(c).selectAll(".node").data(f.padding([15,0,0,0]).value(function(t){return t.value}).nodes).enter().append("div").attr("class","node").style("background",function(t){return null!=t.children?"lightgrey":i(t.name)}).text(function(t){return t.name}).call(function(){this.style("left",function(t){return t.x+"px"}).style("top",function(t){return t.y+"px"}).style("width",function(t){return Math.max(0,t.dx-1)+"px"}).style("height",function(t){return Math.max(0,t.dy-1)+"px"})});return l}}})}).call(this)},{jquery:17}],19:[function(e,n,r){(function(){(function(i){if("object"==typeof r&&"object"==typeof n)return i(e("jquery"));if("function"==typeof t&&t.amd)return t(["jquery"],i);i(jQuery);return void 0})(function(t){var e,n;e=t;n=function(t,n){return function(r,i){var o,a,s,l,u,c,f,h,d,p,g,m,v,y,b,x,w,S,C,T,_,k,M,D,L;c={localeStrings:{vs:"vs",by:"by"}};i=e.extend(c,i);w=r.getRowKeys();0===w.length&&w.push([]);s=r.getColKeys();0===s.length&&s.push([]);p=function(){var t,e,n;n=[];for(t=0,e=w.length;e>t;t++){h=w[t];n.push(h.join("-"))}return n}();p.unshift("");m=0;l=[p];for(k=0,D=s.length;D>k;k++){a=s[k];b=[a.join("-")];m+=b[0].length;for(M=0,L=w.length;L>M;M++){x=w[M];o=r.getAggregator(x,a);b.push(null!=o.value()?o.value():null)}l.push(b)}S=T=r.aggregatorName+(r.valAttrs.length?"("+r.valAttrs.join(", ")+")":"");d=r.colAttrs.join("-");""!==d&&(S+=" "+i.localeStrings.vs+" "+d);f=r.rowAttrs.join("-");""!==f&&(S+=" "+i.localeStrings.by+" "+f);v={width:e(window).width()/1.4,height:e(window).height()/1.4,title:S,hAxis:{title:d,slantedText:m>50},vAxis:{title:T}};2===l[0].length&&""===l[0][1]&&(v.legend={position:"none"});for(g in n){C=n[g];v[g]=C}u=google.visualization.arrayToDataTable(l);y=e("<div style='width: 100%; height: 100%;'>");_=new google.visualization.ChartWrapper({dataTable:u,chartType:t,options:v});_.draw(y[0]);y.bind("dblclick",function(){var t;t=new google.visualization.ChartEditor;google.visualization.events.addListener(t,"ok",function(){return t.getChartWrapper().draw(y[0])});return t.openDialog(_)});return y}};return e.pivotUtilities.gchart_renderers={"Line Chart":n("LineChart"),"Bar Chart":n("ColumnChart"),"Stacked Bar Chart":n("ColumnChart",{isStacked:!0}),"Area Chart":n("AreaChart",{isStacked:!0})}})}).call(this)},{jquery:17}],20:[function(e,n,r){(function(){var i=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},o=[].slice,a=function(t,e){return function(){return t.apply(e,arguments)}},s={}.hasOwnProperty;(function(i){if("object"==typeof r&&"object"==typeof n)return i(e("jquery"));if("function"==typeof t&&t.amd)return t(["jquery"],i);i(jQuery);return void 0})(function(t){var e,n,r,l,u,c,f,h,d,p,g,m,v,y,b,x,w;e=t;r=function(t,e,n){var r,i,o,a;t+="";i=t.split(".");o=i[0];a=i.length>1?n+i[1]:"";r=/(\d+)(\d{3})/;for(;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+a};g=function(t){var n;n={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:"",showZero:!1};t=e.extend(n,t);return function(e){var n;if(isNaN(e)||!isFinite(e))return"";if(0===e&&!t.showZero)return"";n=r((t.scaler*e).toFixed(t.digitsAfterDecimal),t.thousandsSep,t.decimalSep);return""+t.prefix+n+t.suffix}};y=g();b=g({digitsAfterDecimal:0});x=g({digitsAfterDecimal:1,scaler:100,suffix:"%"});l={count:function(t){null==t&&(t=b);return function(){return function(){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},countUnique:function(t){null==t&&(t=b);return function(e){var n;n=e[0];return function(){return{uniq:[],push:function(t){var e;return e=t[n],i.call(this.uniq,e)<0?this.uniq.push(t[n]):void 0},value:function(){return this.uniq.length},format:t,numInputs:null!=n?0:1}}}},listUnique:function(t){return function(e){var n;n=e[0];return function(){return{uniq:[],push:function(t){var e;return e=t[n],i.call(this.uniq,e)<0?this.uniq.push(t[n]):void 0},value:function(){return this.uniq.join(t)},format:function(t){return t},numInputs:null!=n?0:1}}}},sum:function(t){null==t&&(t=y);return function(e){var n;n=e[0];return function(){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},average:function(t){null==t&&(t=y);return function(e){var n;n=e[0];return function(){return{sum:0,len:0,push:function(t){if(!isNaN(parseFloat(t[n]))){this.sum+=parseFloat(t[n]);return this.len++}},value:function(){return this.sum/this.len},format:t,numInputs:null!=n?0:1}}}},sumOverSum:function(t){null==t&&(t=y);return function(e){var n,r;r=e[0],n=e[1];return function(){return{sumNum:0,sumDenom:0,push:function(t){isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r]));return isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){null==t&&(t=!0);null==e&&(e=y);return function(n){var r,i;i=n[0],r=n[1];return function(){return{sumNum:0,sumDenom:0,push:function(t){isNaN(parseFloat(t[i]))||(this.sumNum+=parseFloat(t[i]));return isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;e=t?1:-1;return(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=i&&null!=r?0:2}}}},fractionOf:function(t,e,n){null==e&&(e="total");null==n&&(n=x);return function(){var r;r=1<=arguments.length?o.call(arguments,0):[];return function(i,o,a){return{selector:{total:[[],[]],row:[o,[]],col:[[],a]}[e],inner:t.apply(null,r)(i,o,a),push:function(t){return this.inner.push(t)},format:n,value:function(){return this.inner.value()/i.getAggregator.apply(i,this.selector).inner.value()},numInputs:t.apply(null,r)().numInputs}}}}};u=function(t){return{Count:t.count(b),"Count Unique Values":t.countUnique(b),"List Unique Values":t.listUnique(", "),Sum:t.sum(y),"Integer Sum":t.sum(b),Average:t.average(y),"Sum over Sum":t.sumOverSum(y),"80% Upper Bound":t.sumOverSumBound80(!0,y),"80% Lower Bound":t.sumOverSumBound80(!1,y),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",x),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",x),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",x),"Count as Fraction of Total":t.fractionOf(t.count(),"total",x),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",x),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",x)}}(l);v={Table:function(t,e){return m(t,e)},"Table Barchart":function(t,n){return e(m(t,n)).barchart()},Heatmap:function(t,n){return e(m(t,n)).heatmap()},"Row Heatmap":function(t,n){return e(m(t,n)).heatmap("rowheatmap")},"Col Heatmap":function(t,n){return e(m(t,n)).heatmap("colheatmap")}};h={en:{aggregators:u,renderers:v,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter results",totals:"Totals",vs:"vs",by:"by"}}}; d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];w=function(t){return("0"+t).substr(-2,2)};f={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r){null==n&&(n=d);null==r&&(r=c);return function(i){var o;o=new Date(Date.parse(i[t]));return isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o.getFullYear();case"m":return w(o.getMonth()+1);case"n":return n[o.getMonth()];case"d":return w(o.getDate());case"w":return r[o.getDay()];case"x":return o.getDay();case"H":return w(o.getHours());case"M":return w(o.getMinutes());case"S":return w(o.getSeconds());default:return"%"+e}})}}};p=function(t,e){var n,r,i,o,a,s,l;s=/(\d+)|(\D+)/g;a=/\d/;l=/^0/;if("number"==typeof t||"number"==typeof e)return isNaN(t)?1:isNaN(e)?-1:t-e;n=String(t).toLowerCase();i=String(e).toLowerCase();if(n===i)return 0;if(!a.test(n)||!a.test(i))return n>i?1:-1;n=n.match(s);i=i.match(s);for(;n.length&&i.length;){r=n.shift();o=i.shift();if(r!==o)return a.test(r)&&a.test(o)?r.replace(l,".0")-o.replace(l,".0"):r>o?1:-1}return n.length-i.length};e.pivotUtilities={aggregatorTemplates:l,aggregators:u,renderers:v,derivers:f,locales:h,naturalSort:p,numberFormat:g};n=function(){function n(t,e){this.getAggregator=a(this.getAggregator,this);this.getRowKeys=a(this.getRowKeys,this);this.getColKeys=a(this.getColKeys,this);this.sortKeys=a(this.sortKeys,this);this.arrSort=a(this.arrSort,this);this.natSort=a(this.natSort,this);var r=this;this.aggregator=e.aggregator;this.aggregatorName=e.aggregatorName;this.colAttrs=e.cols;this.rowAttrs=e.rows;this.valAttrs=e.vals;this.tree={};this.rowKeys=[];this.colKeys=[];this.rowTotals={};this.colTotals={};this.allTotal=this.aggregator(this,[],[]);this.sorted=!1;n.forEachRecord(t,e.derivedAttributes,function(t){return e.filter(t)?r.processRecord(t):void 0})}n.forEachRecord=function(n,r,i){var o,a,l,u,c,f,h,d,p,g,m,v;o=e.isEmptyObject(r)?i:function(t){var e,n,o;for(e in r){n=r[e];t[e]=null!=(o=n(t))?o:t[e]}return i(t)};if(e.isFunction(n))return n(o);if(e.isArray(n)){if(e.isArray(n[0])){m=[];for(l in n)if(s.call(n,l)){a=n[l];if(l>0){f={};g=n[0];for(u in g)if(s.call(g,u)){c=g[u];f[c]=a[u]}m.push(o(f))}}return m}v=[];for(d=0,p=n.length;p>d;d++){f=n[d];v.push(o(f))}return v}if(n instanceof t){h=[];e("thead > tr > th",n).each(function(){return h.push(e(this).text())});return e("tbody > tr",n).each(function(){f={};e("td",this).each(function(t){return f[h[t]]=e(this).text()});return o(f)})}throw new Error("unknown input format")};n.convertToArray=function(t){var e;e=[];n.forEachRecord(t,{},function(t){return e.push(t)});return e};n.prototype.natSort=function(t,e){return p(t,e)};n.prototype.arrSort=function(t,e){return this.natSort(t.join(),e.join())};n.prototype.sortKeys=function(){if(!this.sorted){this.rowKeys.sort(this.arrSort);this.colKeys.sort(this.arrSort)}return this.sorted=!0};n.prototype.getColKeys=function(){this.sortKeys();return this.colKeys};n.prototype.getRowKeys=function(){this.sortKeys();return this.rowKeys};n.prototype.processRecord=function(t){var e,n,r,i,o,a,s,l,u,c,f,h,d;e=[];i=[];c=this.colAttrs;for(a=0,l=c.length;l>a;a++){o=c[a];e.push(null!=(f=t[o])?f:"null")}h=this.rowAttrs;for(s=0,u=h.length;u>s;s++){o=h[s];i.push(null!=(d=t[o])?d:"null")}r=i.join(String.fromCharCode(0));n=e.join(String.fromCharCode(0));this.allTotal.push(t);if(0!==i.length){if(!this.rowTotals[r]){this.rowKeys.push(i);this.rowTotals[r]=this.aggregator(this,i,[])}this.rowTotals[r].push(t)}if(0!==e.length){if(!this.colTotals[n]){this.colKeys.push(e);this.colTotals[n]=this.aggregator(this,[],e)}this.colTotals[n].push(t)}if(0!==e.length&&0!==i.length){this.tree[r]||(this.tree[r]={});this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,i,e));return this.tree[r][n].push(t)}};n.prototype.getAggregator=function(t,e){var n,r,i;i=t.join(String.fromCharCode(0));r=e.join(String.fromCharCode(0));n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[i]:this.tree[i][r];return null!=n?n:{value:function(){return null},format:function(){return""}}};return n}();m=function(t,n){var r,i,o,a,l,u,c,f,h,d,p,g,m,v,y,b,x,w,S,C,T;u={localeStrings:{totals:"Totals"}};n=e.extend(u,n);o=t.colAttrs;p=t.rowAttrs;m=t.getRowKeys();l=t.getColKeys();d=document.createElement("table");d.className="pvtTable";v=function(t,e,n){var r,i,o,a,s,l;if(0!==e){i=!0;for(a=s=0;n>=0?n>=s:s>=n;a=n>=0?++s:--s)t[e-1][a]!==t[e][a]&&(i=!1);if(i)return-1}r=0;for(;e+r<t.length;){o=!1;for(a=l=0;n>=0?n>=l:l>=n;a=n>=0?++l:--l)t[e][a]!==t[e+r][a]&&(o=!0);if(o)break;r++}return r};for(f in o)if(s.call(o,f)){i=o[f];w=document.createElement("tr");if(0===parseInt(f)&&0!==p.length){b=document.createElement("th");b.setAttribute("colspan",p.length);b.setAttribute("rowspan",o.length);w.appendChild(b)}b=document.createElement("th");b.className="pvtAxisLabel";b.textContent=i;w.appendChild(b);for(c in l)if(s.call(l,c)){a=l[c];T=v(l,parseInt(c),parseInt(f));if(-1!==T){b=document.createElement("th");b.className="pvtColLabel";b.textContent=a[f];b.setAttribute("colspan",T);parseInt(f)===o.length-1&&0!==p.length&&b.setAttribute("rowspan",2);w.appendChild(b)}}if(0===parseInt(f)){b=document.createElement("th");b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals;b.setAttribute("rowspan",o.length+(0===p.length?0:1));w.appendChild(b)}d.appendChild(w)}if(0!==p.length){w=document.createElement("tr");for(c in p)if(s.call(p,c)){h=p[c];b=document.createElement("th");b.className="pvtAxisLabel";b.textContent=h;w.appendChild(b)}b=document.createElement("th");if(0===o.length){b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals}w.appendChild(b);d.appendChild(w)}for(c in m)if(s.call(m,c)){g=m[c];w=document.createElement("tr");for(f in g)if(s.call(g,f)){S=g[f];T=v(m,parseInt(c),parseInt(f));if(-1!==T){b=document.createElement("th");b.className="pvtRowLabel";b.textContent=S;b.setAttribute("rowspan",T);parseInt(f)===p.length-1&&0!==o.length&&b.setAttribute("colspan",2);w.appendChild(b)}}for(f in l)if(s.call(l,f)){a=l[f];r=t.getAggregator(g,a);C=r.value();y=document.createElement("td");y.className="pvtVal row"+c+" col"+f;y.innerHTML=r.format(C);y.setAttribute("data-value",C);w.appendChild(y)}x=t.getAggregator(g,[]);C=x.value();y=document.createElement("td");y.className="pvtTotal rowTotal";y.innerHTML=x.format(C);y.setAttribute("data-value",C);y.setAttribute("data-for","row"+c);w.appendChild(y);d.appendChild(w)}w=document.createElement("tr");b=document.createElement("th");b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals;b.setAttribute("colspan",p.length+(0===o.length?0:1));w.appendChild(b);for(f in l)if(s.call(l,f)){a=l[f];x=t.getAggregator([],a);C=x.value();y=document.createElement("td");y.className="pvtTotal colTotal";y.innerHTML=x.format(C);y.setAttribute("data-value",C);y.setAttribute("data-for","col"+f);w.appendChild(y)}x=t.getAggregator([],[]);C=x.value();y=document.createElement("td");y.className="pvtGrandTotal";y.innerHTML=x.format(C);y.setAttribute("data-value",C);w.appendChild(y);d.appendChild(w);d.setAttribute("data-numrows",m.length);d.setAttribute("data-numcols",l.length);return d};e.fn.pivot=function(t,r){var i,o,a,s;i={cols:[],rows:[],filter:function(){return!0},aggregator:l.count()(),aggregatorName:"Count",derivedAttributes:{},renderer:m,rendererOptions:null,localeStrings:h.en.localeStrings};r=e.extend(i,r);a=null;try{o=new n(t,r);try{a=r.renderer(o,r.rendererOptions)}catch(u){"undefined"!=typeof console&&null!==console&&console.error(u.stack);a=e("<span>").html(r.localeStrings.renderError)}}catch(u){"undefined"!=typeof console&&null!==console&&console.error(u.stack);a=e("<span>").html(r.localeStrings.computeError)}s=this[0];for(;s.hasChildNodes();)s.removeChild(s.lastChild);return this.append(a)};e.fn.pivotUI=function(t,r,o,a){var l,u,c,f,d,g,m,v,y,b,x,w,S,C,T,_,k,M,D,L,A,N,E,j,I,P,H,O,F,R,W,z,q,U,B,V,X,G,$=this;null==o&&(o=!1);null==a&&(a="en");m={derivedAttributes:{},aggregators:h[a].aggregators,renderers:h[a].renderers,hiddenAttributes:[],menuLimit:200,cols:[],rows:[],vals:[],exclusions:{},unusedAttrsVertical:"auto",autoSortUnusedAttrs:!1,rendererOptions:{localeStrings:h[a].localeStrings},onRefresh:null,filter:function(){return!0},localeStrings:h[a].localeStrings};v=this.data("pivotUIOptions");w=null==v||o?e.extend(m,r):v;try{t=n.convertToArray(t);D=function(){var e,n;e=t[0];n=[];for(x in e)s.call(e,x)&&n.push(x);return n}();U=w.derivedAttributes;for(d in U)s.call(U,d)&&i.call(D,d)<0&&D.push(d);f={};for(P=0,R=D.length;R>P;P++){j=D[P];f[j]={}}n.forEachRecord(t,w.derivedAttributes,function(t){var e,n,r,i;i=[];for(x in t)if(s.call(t,x)){e=t[x];if(w.filter(t)){null==e&&(e="null");null==(r=(n=f[x])[e])&&(n[e]=0);i.push(f[x][e]++)}}return i});N=e("<table cellpadding='5'>");k=e("<td>");_=e("<select class='pvtRenderer'>").appendTo(k).bind("change",function(){return C()});B=w.renderers;for(j in B)s.call(B,j)&&e("<option>").val(j).html(j).appendTo(_);g=e("<td class='pvtAxisContainer pvtUnused'>");M=function(){var t,e,n;n=[];for(t=0,e=D.length;e>t;t++){d=D[t];i.call(w.hiddenAttributes,d)<0&&n.push(d)}return n}();E=!1;if("auto"===w.unusedAttrsVertical){c=0;for(H=0,W=M.length;W>H;H++){l=M[H];c+=l.length}E=c>120}g.addClass(w.unusedAttrsVertical===!0||E?"pvtVertList":"pvtHorizList");I=function(t){var n,r,o,a,s,l,u,c,h,d,m,v,b,S,T;u=function(){var e;e=[];for(x in f[t])e.push(x);return e}();l=!1;v=e("<div>").addClass("pvtFilterBox").hide();v.append(e("<h4>").text(""+t+" ("+u.length+")"));if(u.length>w.menuLimit)v.append(e("<p>").html(w.localeStrings.tooMany));else{r=e("<p>").appendTo(v);r.append(e("<button>").html(w.localeStrings.selectAll).bind("click",function(){return v.find("input:visible").prop("checked",!0)}));r.append(e("<button>").html(w.localeStrings.selectNone).bind("click",function(){return v.find("input:visible").prop("checked",!1)}));r.append(e("<input>").addClass("pvtSearch").attr("placeholder",w.localeStrings.filterResults).bind("keyup",function(){var t;t=e(this).val().toLowerCase();return e(this).parents(".pvtFilterBox").find("label span").each(function(){var n;n=e(this).text().toLowerCase().indexOf(t);return-1!==n?e(this).parent().show():e(this).parent().hide()})}));o=e("<div>").addClass("pvtCheckContainer").appendTo(v);T=u.sort(p);for(b=0,S=T.length;S>b;b++){x=T[b];m=f[t][x];a=e("<label>");s=w.exclusions[t]?i.call(w.exclusions[t],x)>=0:!1;l||(l=s);e("<input type='checkbox' class='pvtFilter'>").attr("checked",!s).data("filter",[t,x]).appendTo(a);a.append(e("<span>").text(""+x+" ("+m+")"));o.append(e("<p>").append(a))}}d=function(){var t;t=e(v).find("[type='checkbox']").length-e(v).find("[type='checkbox']:checked").length;t>0?n.addClass("pvtFilteredAttribute"):n.removeClass("pvtFilteredAttribute");return u.length>w.menuLimit?v.toggle():v.toggle(0,C)};e("<p>").appendTo(v).append(e("<button>").text("OK").bind("click",d));c=function(t){v.css({left:t.pageX,top:t.pageY}).toggle();e(".pvtSearch").val("");return e("label").show()};h=e("<span class='pvtTriangle'>").html(" &#x25BE;").bind("click",c);n=e("<li class='axis_"+y+"'>").append(e("<span class='pvtAttr'>").text(t).data("attrName",t).append(h));l&&n.addClass("pvtFilteredAttribute");g.append(n).append(v);return n.bind("dblclick",c)};for(y in M){d=M[y];I(d)}L=e("<tr>").appendTo(N);u=e("<select class='pvtAggregator'>").bind("change",function(){return C()});V=w.aggregators;for(j in V)s.call(V,j)&&u.append(e("<option>").val(j).html(j));e("<td class='pvtVals'>").appendTo(L).append(u).append(e("<br>"));e("<td class='pvtAxisContainer pvtHorizList pvtCols'>").appendTo(L);A=e("<tr>").appendTo(N);A.append(e("<td valign='top' class='pvtAxisContainer pvtRows'>"));S=e("<td valign='top' class='pvtRendererArea'>").appendTo(A);if(w.unusedAttrsVertical===!0||E){N.find("tr:nth-child(1)").prepend(k);N.find("tr:nth-child(2)").prepend(g)}else N.prepend(e("<tr>").append(k).append(g));this.html(N);X=w.cols;for(O=0,z=X.length;z>O;O++){j=X[O];this.find(".pvtCols").append(this.find(".axis_"+M.indexOf(j)))}G=w.rows;for(F=0,q=G.length;q>F;F++){j=G[F];this.find(".pvtRows").append(this.find(".axis_"+M.indexOf(j)))}null!=w.aggregatorName&&this.find(".pvtAggregator").val(w.aggregatorName);null!=w.rendererName&&this.find(".pvtRenderer").val(w.rendererName);b=!0;T=function(){var n,r,o,a,s,l,c,f,h,d,p,g,m,v;f={derivedAttributes:w.derivedAttributes,localeStrings:w.localeStrings,rendererOptions:w.rendererOptions,cols:[],rows:[]};s=null!=(v=w.aggregators[u.val()]([])().numInputs)?v:0;d=[];$.find(".pvtRows li span.pvtAttr").each(function(){return f.rows.push(e(this).data("attrName"))});$.find(".pvtCols li span.pvtAttr").each(function(){return f.cols.push(e(this).data("attrName"))});$.find(".pvtVals select.pvtAttrDropdown").each(function(){if(0===s)return e(this).remove();s--;return""!==e(this).val()?d.push(e(this).val()):void 0});if(0!==s){c=$.find(".pvtVals");for(j=g=0;s>=0?s>g:g>s;j=s>=0?++g:--g){a=e("<select class='pvtAttrDropdown'>").append(e("<option>")).bind("change",function(){return C()});for(m=0,p=M.length;p>m;m++){n=M[m];a.append(e("<option>").val(n).text(n))}c.append(a)}}if(b){d=w.vals;y=0;$.find(".pvtVals select.pvtAttrDropdown").each(function(){e(this).val(d[y]);return y++});b=!1}f.aggregatorName=u.val();f.vals=d;f.aggregator=w.aggregators[u.val()](d);f.renderer=w.renderers[_.val()];r={};$.find("input.pvtFilter").not(":checked").each(function(){var t;t=e(this).data("filter");return null!=r[t[0]]?r[t[0]].push(t[1]):r[t[0]]=[t[1]]});f.filter=function(t){var e,n;if(!w.filter(t))return!1;for(x in r){e=r[x];if(n=""+t[x],i.call(e,n)>=0)return!1}return!0};S.pivot(t,f);l=e.extend(w,{cols:f.cols,rows:f.rows,vals:d,exclusions:r,aggregatorName:u.val(),rendererName:_.val()});$.data("pivotUIOptions",l);if(w.autoSortUnusedAttrs){o=e.pivotUtilities.naturalSort;h=$.find("td.pvtUnused.pvtAxisContainer");e(h).children("li").sort(function(t,n){return o(e(t).text(),e(n).text())}).appendTo(h)}S.css("opacity",1);return null!=w.onRefresh?w.onRefresh(l):void 0};C=function(){S.css("opacity",.5);return setTimeout(T,10)};C();this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?C():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Y){"undefined"!=typeof console&&null!==console&&console.error(Y.stack);this.html(w.localeStrings.uiRenderError)}return this};e.fn.heatmap=function(t){var n,r,i,o,a,s,l,u,c=this;null==t&&(t="heatmap");s=this.data("numrows");a=this.data("numcols");n=function(t,e,n){var r;r=function(){switch(t){case"red":return function(t){return"ff"+t+t};case"green":return function(t){return""+t+"ff"+t};case"blue":return function(t){return""+t+t+"ff"}}}();return function(t){var i,o;o=255-Math.round(255*(t-e)/(n-e));i=o.toString(16).split(".")[0];1===i.length&&(i=0+i);return r(i)}};r=function(t,r){var i,o,a;o=function(n){return c.find(t).each(function(){var t;t=e(this).data("value");return null!=t&&isFinite(t)?n(t,e(this)):void 0})};a=[];o(function(t){return a.push(t)});i=n(r,Math.min.apply(Math,a),Math.max.apply(Math,a));return o(function(t,e){return e.css("background-color","#"+i(t))})};switch(t){case"heatmap":r(".pvtVal","red");break;case"rowheatmap":for(i=l=0;s>=0?s>l:l>s;i=s>=0?++l:--l)r(".pvtVal.row"+i,"red");break;case"colheatmap":for(o=u=0;a>=0?a>u:u>a;o=a>=0?++u:--u)r(".pvtVal.col"+o,"red")}r(".pvtTotal.rowTotal","red");r(".pvtTotal.colTotal","red");return this};return e.fn.barchart=function(){var t,n,r,i,o,a=this;i=this.data("numrows");r=this.data("numcols");t=function(t){var n,r,i,o;n=function(n){return a.find(t).each(function(){var t;t=e(this).data("value");return null!=t&&isFinite(t)?n(t,e(this)):void 0})};o=[];n(function(t){return o.push(t)});r=Math.max.apply(Math,o);i=function(t){return 100*t/(1.4*r)};return n(function(t,n){var r,o;r=n.text();o=e("<div>").css({position:"relative",height:"55px"});o.append(e("<div>").css({position:"absolute",bottom:0,left:0,right:0,height:i(t)+"%","background-color":"gray"}));o.append(e("<div>").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"}));return n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(o)})};for(n=o=0;i>=0?i>o:o>i;n=i>=0?++o:--o)t(".pvtVal.row"+n);t(".pvtTotal.colTotal");return this}})}).call(this)},{jquery:17}],21:[function(e,n){(function(e){function r(){try{return l in e&&e[l]}catch(t){return!1}}function i(t){return t.replace(/^d/,"___$&").replace(p,"___")}var o,a={},s=e.document,l="localStorage",u="script";a.disabled=!1;a.version="1.3.17";a.set=function(){};a.get=function(){};a.has=function(t){return void 0!==a.get(t)};a.remove=function(){};a.clear=function(){};a.transact=function(t,e,n){if(null==n){n=e;e=null}null==e&&(e={});var r=a.get(t,e);n(r);a.set(t,r)};a.getAll=function(){};a.forEach=function(){};a.serialize=function(t){return JSON.stringify(t)};a.deserialize=function(t){if("string"!=typeof t)return void 0;try{return JSON.parse(t)}catch(e){return t||void 0}};if(r()){o=e[l];a.set=function(t,e){if(void 0===e)return a.remove(t);o.setItem(t,a.serialize(e));return e};a.get=function(t,e){var n=a.deserialize(o.getItem(t));return void 0===n?e:n};a.remove=function(t){o.removeItem(t)};a.clear=function(){o.clear()};a.getAll=function(){var t={};a.forEach(function(e,n){t[e]=n});return t};a.forEach=function(t){for(var e=0;e<o.length;e++){var n=o.key(e);t(n,a.get(n))}}}else if(s.documentElement.addBehavior){var c,f;try{f=new ActiveXObject("htmlfile");f.open();f.write("<"+u+">document.w=window</"+u+'><iframe src="/favicon.ico"></iframe>');f.close();c=f.w.frames[0].document;o=c.createElement("div")}catch(h){o=s.createElement("div");c=s.body}var d=function(t){return function(){var e=Array.prototype.slice.call(arguments,0);e.unshift(o);c.appendChild(o);o.addBehavior("#default#userData");o.load(l);var n=t.apply(a,e);c.removeChild(o);return n}},p=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");a.set=d(function(t,e,n){e=i(e);if(void 0===n)return a.remove(e);t.setAttribute(e,a.serialize(n));t.save(l);return n});a.get=d(function(t,e,n){e=i(e);var r=a.deserialize(t.getAttribute(e));return void 0===r?n:r});a.remove=d(function(t,e){e=i(e);t.removeAttribute(e);t.save(l)});a.clear=d(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(l);for(var n,r=0;n=e[r];r++)t.removeAttribute(n.name);t.save(l)});a.getAll=function(){var t={};a.forEach(function(e,n){t[e]=n});return t};a.forEach=d(function(t,e){for(var n,r=t.XMLDocument.documentElement.attributes,i=0;n=r[i];++i)e(n.name,a.deserialize(t.getAttribute(n.name)))})}try{var g="__storejs__";a.set(g,g);a.get(g)!=g&&(a.disabled=!0);a.remove(g)}catch(h){a.disabled=!0}a.enabled=!a.disabled;"undefined"!=typeof n&&n.exports&&this.module!==n?n.exports=a:"function"==typeof t&&t.amd?t(a):e.store=a})(Function("return this")())},{}],22:[function(t,e){e.exports={name:"yasgui-utils",version:"1.5.0",description:"Utils for YASGUI libs",main:"src/main.js",repository:{type:"git",url:"git://github.com/YASGUI/Utils.git"},licenses:[{type:"MIT",url:"http://yasgui.github.io/license.txt"}],author:"Laurens Rietveld",maintainers:[{name:"Laurens Rietveld",email:"laurens.rietveld@gmail.com",web:"http://laurensrietveld.nl"}],bugs:{url:"https://github.com/YASGUI/Utils/issues"},homepage:"https://github.com/YASGUI/Utils",dependencies:{store:"^1.3.14"}}},{}],23:[function(t,e){window.console=window.console||{log:function(){}};e.exports={storage:t("./storage.js"),svg:t("./svg.js"),version:{"yasgui-utils":t("../package.json").version}}},{"../package.json":22,"./storage.js":24,"./svg.js":25}],24:[function(t,e){{var n=t("store"),r={day:function(){return 864e5},month:function(){30*r.day()},year:function(){12*r.month()}};e.exports={set:function(t,e,i){if(e){"string"==typeof i&&(i=r[i]());e.documentElement&&(e=(new XMLSerializer).serializeToString(e.documentElement));n.set(t,{val:e,exp:i,time:(new Date).getTime()})}},remove:function(t){n.remove(t)},get:function(t){var e=n.get(t);return e?e.exp&&(new Date).getTime()-e.time>e.exp?null:e.val:null}}}},{store:21}],25:[function(t,e){e.exports={draw:function(t,n){if(t){var r=e.exports.getElement(n);r&&(t.append?t.append(r):t.appendChild(r))}},getElement:function(t){if(t&&0==t.indexOf("<svg")){var e=new DOMParser,n=e.parseFromString(t,"text/xml"),r=n.documentElement,i=document.createElement("div");i.className="svgImg";i.appendChild(r);return i}return!1}}},{}],26:[function(t,e){e.exports={name:"yasgui-yasr",description:"Yet Another SPARQL Resultset GUI",version:"2.3.2",main:"src/main.js",licenses:[{type:"MIT",url:"http://yasr.yasgui.org/license.txt"}],author:"Laurens Rietveld",homepage:"http://yasr.yasgui.org",devDependencies:{browserify:"^6.1.0",gulp:"~3.6.0","gulp-bump":"^0.1.11","gulp-concat":"^2.4.1","gulp-connect":"^2.0.5","gulp-embedlr":"^0.5.2","gulp-filter":"^1.0.2","gulp-git":"^0.5.2","gulp-jsvalidate":"^0.2.0","gulp-livereload":"^1.3.1","gulp-minify-css":"^0.3.11","gulp-notify":"^2.0.1","gulp-rename":"^1.2.0","gulp-streamify":"0.0.5","gulp-tag-version":"^1.1.0","gulp-uglify":"^1.0.1","require-dir":"^0.1.0","run-sequence":"^1.0.1","vinyl-buffer":"^1.0.0","vinyl-source-stream":"~0.1.1",watchify:"^0.6.4","gulp-sourcemaps":"^1.2.8",exorcist:"^0.1.6","vinyl-transform":"0.0.1","gulp-sass":"^1.2.2","bootstrap-sass":"^3.3.1","browserify-transform-tools":"^1.2.1","gulp-cssimport":"^1.3.1","gulp-html-replace":"^1.4.1","browserify-shim":"^3.8.1"},bugs:"https://github.com/YASGUI/YASR/issues/",keywords:["JavaScript","SPARQL","Editor","Semantic Web","Linked Data"],maintainers:[{name:"Laurens Rietveld",email:"laurens.rietveld@gmail.com",web:"http://laurensrietveld.nl"}],repository:{type:"git",url:"https://github.com/YASGUI/YASR.git"},dependencies:{jquery:"~ 1.11.0",codemirror:"^4.7.0","yasgui-utils":"^1.4.1",pivottable:"^1.2.2","jquery-ui":"^1.10.5",d3:"^3.4.13"},"browserify-shim":{google:"global:google"},browserify:{transform:["browserify-shim"]},optionalShim:{codemirror:{require:"codemirror",global:"CodeMirror"},jquery:{require:"jquery",global:"jQuery"},"../../lib/codemirror":{require:"codemirror",global:"CodeMirror"},"../lib/DataTables/media/js/jquery.dataTables.js":{require:"datatables",global:"jQuery"},datatables:{require:"datatables",global:"jQuery"},d3:{require:"d3",global:"d3"},"jquery-ui/sortable":{require:"jquery-ui/sortable",global:"jQuery"},pivottable:{require:"pivottable",global:"jQuery"}}}},{}],27:[function(t,e){"use strict";e.exports=function(t){var e='"',n=",",r="\n",i=t.head.vars,o=t.results.bindings,a=function(){for(var t=0;t<i.length;t++)u(i[t]);f+=r},s=function(){for(var t=0;t<o.length;t++){l(o[t]);f+=r}},l=function(t){for(var e=0;e<i.length;e++){var n=i[e];u(t.hasOwnProperty(n)?t[n].value:"")}},u=function(t){t.replace(e,e+e);c(t)&&(t=e+t+e);f+=" "+t+" "+n},c=function(t){var r=!1;t.match("[\\w|"+n+"|"+e+"]")&&(r=!0);return r},f="";a();s();return f}},{}],28:[function(t,e){"use strict";var n=t("jquery"),r=e.exports=function(e){var r=n("<div class='booleanResult'></div>"),i=function(){r.empty().appendTo(e.resultsContainer);var i=e.results.getBoolean(),o=null,a=null;if(i===!0){o="check";a="True"}else if(i===!1){o="cross";a="False"}else{r.width("140");a="Could not find boolean value in response"}o&&t("yasgui-utils").svg.draw(r,t("./imgs.js")[o]);n("<span></span>").text(a).appendTo(r)},o=function(){return e.results.getBoolean&&(e.results.getBoolean()===!0||0==e.results.getBoolean())};return{name:null,draw:i,hideFromSelection:!0,getPriority:10,canHandleResults:o}};r.version={"YASR-boolean":t("../package.json").version,jquery:n.fn.jquery}},{"../package.json":26,"./imgs.js":31,jquery:17,"yasgui-utils":23}],29:[function(t,e){"use strict";var n=t("jquery");e.exports={output:"table",outputPlugins:["table","error","boolean","rawResponse"],drawOutputSelector:!0,drawDownloadIcon:!0,getUsedPrefixes:null,persistency:{outputSelector:function(t){return"selector_"+n(t.container).closest("[id]").attr("id")},results:{id:function(t){return"results_"+n(t.container).closest("[id]").attr("id")},maxSize:1e5}}}},{jquery:17}],30:[function(t,e){"use strict";var n=t("jquery"),r=e.exports=function(t){var e=n("<div class='errorResult'></div>"),i=(n.extend(!0,{},r.defaults),function(){var r=t.results.getException();e.empty().appendTo(t.resultsContainer);var i="Error";r.statusText&&r.statusText.length<100&&(i=r.statusText);void 0!=r.status&&(i+=" (#"+r.status+")");e.append(n("<span>",{"class":"exception"}).text(i));var o=null;r.responseText?o=r.responseText:"string"==typeof r&&(o=r);o&&e.append(n("<pre>").text(o))}),o=function(t){return t.results.getException()||!1};return{name:null,draw:i,getPriority:20,hideFromSelection:!0,canHandleResults:o}};r.defaults={}},{jquery:17}],31:[function(t,e){"use strict";e.exports={cross:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><g> <path d="M83.288,88.13c-2.114,2.112-5.575,2.112-7.689,0L53.659,66.188c-2.114-2.112-5.573-2.112-7.687,0L24.251,87.907 c-2.113,2.114-5.571,2.114-7.686,0l-4.693-4.691c-2.114-2.114-2.114-5.573,0-7.688l21.719-21.721c2.113-2.114,2.113-5.573,0-7.686 L11.872,24.4c-2.114-2.113-2.114-5.571,0-7.686l4.842-4.842c2.113-2.114,5.571-2.114,7.686,0L46.12,33.591 c2.114,2.114,5.572,2.114,7.688,0l21.721-21.719c2.114-2.114,5.573-2.114,7.687,0l4.695,4.695c2.111,2.113,2.111,5.571-0.003,7.686 L66.188,45.973c-2.112,2.114-2.112,5.573,0,7.686L88.13,75.602c2.112,2.111,2.112,5.572,0,7.687L83.288,88.13z"/></g></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path fill="#000000" d="M14.301,49.982l22.606,17.047L84.361,4.903c2.614-3.733,7.76-4.64,11.493-2.026l0.627,0.462 c3.732,2.614,4.64,7.758,2.025,11.492l-51.783,79.77c-1.955,2.791-3.896,3.762-7.301,3.988c-3.405,0.225-5.464-1.039-7.508-3.084 L2.447,61.814c-3.263-3.262-3.263-8.553,0-11.814l0.041-0.019C5.75,46.718,11.039,46.718,14.301,49.982z"/></svg>',unsorted:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path7-9" d="m 8.8748339,52.571766 16.9382111,-0.222584 4.050851,-0.06665 15.719154,-0.222166 0.27778,-0.04246 0.43276,0.0017 0.41632,-0.06121 0.37532,-0.0611 0.47132,-0.119342 0.27767,-0.08206 0.55244,-0.198047 0.19707,-0.08043 0.61095,-0.259721 0.0988,-0.05825 0.019,-0.01914 0.59303,-0.356548 0.11787,-0.0788 0.49125,-0.337892 0.17994,-0.139779 0.37317,-0.336871 0.21862,-0.219786 0.31311,-0.31479 0.21993,-0.259387 c 0.92402,-1.126057 1.55249,-2.512251 1.78961,-4.016904 l 0.0573,-0.25754 0.0195,-0.374113 0.0179,-0.454719 0.0175,-0.05874 -0.0169,-0.258049 -0.0225,-0.493503 -0.0398,-0.355569 -0.0619,-0.414201 -0.098,-0.414812 -0.083,-0.353334 L 53.23955,41.1484 53.14185,40.850967 52.93977,40.377742 52.84157,40.161628 34.38021,4.2507375 C 33.211567,1.9401875 31.035446,0.48226552 28.639484,0.11316952 l -0.01843,-0.01834 -0.671963,-0.07882 -0.236871,0.0042 L 27.335984,-4.7826577e-7 27.220736,0.00379952 l -0.398804,0.0025 -0.313848,0.04043 -0.594474,0.07724 -0.09611,0.02147 C 23.424549,0.60716252 21.216017,2.1142355 20.013025,4.4296865 L 0.93967491,40.894479 c -2.08310801,3.997178 -0.588125,8.835482 3.35080799,10.819749 1.165535,0.613495 2.43199,0.88731 3.675026,0.864202 l 0.49845,-0.02325 0.410875,0.01658 z M 9.1502369,43.934401 9.0136999,43.910011 27.164145,9.2564625 44.70942,43.42818 l -14.765289,0.214677 -4.031106,0.0468 -16.7627881,0.244744 z" /></svg>',sortDesc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,0.12823506 0.09753,0.02006 c 2.39093,0.458209 4.599455,1.96811104 5.80244,4.28639004 L 52.785897,40.894525 c 2.088044,4.002139 0.590949,8.836902 -3.348692,10.821875 -1.329078,0.688721 -2.766603,0.943695 -4.133174,0.841768 l -0.454018,0.02 L 27.910392,52.354171 23.855313,52.281851 8.14393,52.061827 7.862608,52.021477 7.429856,52.021738 7.014241,51.959818 6.638216,51.900838 6.164776,51.779369 5.889216,51.699439 5.338907,51.500691 5.139719,51.419551 4.545064,51.145023 4.430618,51.105123 4.410168,51.084563 3.817138,50.730843 3.693615,50.647783 3.207314,50.310611 3.028071,50.174369 2.652795,49.833957 2.433471,49.613462 2.140099,49.318523 1.901127,49.041407 C 0.97781,47.916059 0.347935,46.528448 0.11153,45.021676 L 0.05352,44.766255 0.05172,44.371683 0.01894,43.936017 0,43.877277 0.01836,43.62206 0.03666,43.122889 0.0765,42.765905 0.13912,42.352413 0.23568,41.940425 0.32288,41.588517 0.481021,41.151945 0.579391,40.853806 0.77369,40.381268 0.876097,40.162336 19.338869,4.2542801 c 1.172169,-2.308419 3.34759,-3.76846504 5.740829,-4.17716604 l 0.01975,0.01985 0.69605,-0.09573 0.218437,0.0225 0.490791,-0.02132 0.39809,0.0046 0.315972,0.03973 0.594462,0.08149 z" /></svg>',sortAsc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,0.70898699,-0.70898699,-0.70522156,97.988199,58.704807)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,113.65778 0.09753,-0.0201 c 2.39093,-0.45821 4.599455,-1.96811 5.80244,-4.28639 L 52.785897,72.891487 c 2.088044,-4.002139 0.590949,-8.836902 -3.348692,-10.821875 -1.329078,-0.688721 -2.766603,-0.943695 -4.133174,-0.841768 l -0.454018,-0.02 -16.939621,0.223997 -4.055079,0.07232 -15.711383,0.220024 -0.281322,0.04035 -0.432752,-2.61e-4 -0.415615,0.06192 -0.376025,0.05898 -0.47344,0.121469 -0.27556,0.07993 -0.550309,0.198748 -0.199188,0.08114 -0.594655,0.274528 -0.114446,0.0399 -0.02045,0.02056 -0.59303,0.35372 -0.123523,0.08306 -0.486301,0.337172 -0.179243,0.136242 -0.375276,0.340412 -0.219324,0.220495 -0.293372,0.294939 -0.238972,0.277116 C 0.97781,65.869953 0.347935,67.257564 0.11153,68.764336 L 0.05352,69.019757 0.05172,69.414329 0.01894,69.849995 0,69.908735 l 0.01836,0.255217 0.0183,0.499171 0.03984,0.356984 0.06262,0.413492 0.09656,0.411988 0.0872,0.351908 0.158141,0.436572 0.09837,0.298139 0.194299,0.472538 0.102407,0.218932 18.462772,35.908054 c 1.172169,2.30842 3.34759,3.76847 5.740829,4.17717 l 0.01975,-0.0199 0.69605,0.0957 0.218437,-0.0225 0.490791,0.0213 0.39809,-0.005 0.315972,-0.0397 0.594462,-0.0815 z" /></svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 100 100" xml:space="preserve"><g id="Captions"></g><g id="Your_Icon"> <path fill-rule="evenodd" fill="#000000" d="M88,84v-2c0-2.961-0.859-4-4-4H16c-2.961,0-4,0.98-4,4v2c0,3.102,1.039,4,4,4h68 C87.02,88,88,87.039,88,84z M58,12H42c-5,0-6,0.941-6,6v22H16l34,34l34-34H64V18C64,12.941,62.939,12,58,12z"/></g></svg>',move:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_11656_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="753" inkscape:window-height="480" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="287" inkscape:window-y="249" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><polygon points="33,83 50,100 67,83 54,83 54,17 67,17 50,0 33,17 46,17 46,83 " transform="translate(-7.962963,-10)" /><polygon points="83,67 100,50 83,33 83,46 17,46 17,33 0,50 17,67 17,54 83,54 " transform="translate(-7.962963,-10)" /></svg>',fullscreen:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_2186_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="65" inkscape:window-y="24" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><path d="m -7.962963,-10 v 38.889 l 16.667,-16.667 16.667,16.667 5.555,-5.555 -16.667,-16.667 16.667,-16.667 h -38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 92.037037,-10 v 38.889 l -16.667,-16.667 -16.666,16.667 -5.556,-5.555 16.666,-16.667 -16.666,-16.667 h 38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="M -7.962963,90 V 51.111 l 16.667,16.666 16.667,-16.666 5.555,5.556 -16.667,16.666 16.667,16.667 h -38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="M 92.037037,90 V 51.111 l -16.667,16.666 -16.666,-16.666 -5.556,5.556 16.666,16.666 -16.666,16.667 h 38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /></svg>',smallscreen:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_2186_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1855" inkscape:window-height="1056" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="65" inkscape:window-y="24" inkscape:window-maximized="1" inkscape:current-layer="Layer_1" /><path d="m 30.926037,28.889 0,-38.889 -16.667,16.667 -16.667,-16.667 -5.555,5.555 16.667,16.667 -16.667,16.667 38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 53.148037,28.889 0,-38.889 16.667,16.667 16.666,-16.667 5.556,5.555 -16.666,16.667 16.666,16.667 -38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 30.926037,51.111 0,38.889 -16.667,-16.666 -16.667,16.666 -5.555,-5.556 16.667,-16.666 -16.667,-16.667 38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 53.148037,51.111 0,38.889 16.667,-16.666 16.666,16.666 5.556,-5.556 -16.666,-16.666 16.666,-16.667 -38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /></svg>'} },{}],32:[function(t,e){"use strict";var n=t("jquery"),r=t("yasgui-utils");console=console||{log:function(){}};var i=e.exports=function(e,s,l){var u={};u.options=n.extend(!0,{},i.defaults,s);u.container=n("<div class='yasr'></div>").appendTo(e);u.header=n("<div class='yasr_header'></div>").appendTo(u.container);u.resultsContainer=n("<div class='yasr_results'></div>").appendTo(u.container);u.plugins={};for(var c in i.plugins)u.plugins[c]=new i.plugins[c](u);u.draw=function(t){if(!u.results)return!1;t||(t=u.options.output);var e=null,r=-1,i=[];for(var o in u.plugins)if(u.plugins[o].canHandleResults(u)){var a=u.plugins[o].getPriority;"function"==typeof a&&(a=a(u));if(null!=a&&void 0!=a&&a>r){r=a;e=o}}else i.push(o);f(i);if(t in u.plugins&&u.plugins[t].canHandleResults(u)){n(u.resultsContainer).empty();u.plugins[t].draw();return!0}if(e){n(u.resultsContainer).empty();u.plugins[e].draw();return!0}return!1};var f=function(t){u.header.find(".yasr_btnGroup .yasr_btn").removeClass("disabled");t.forEach(function(t){u.header.find(".yasr_btnGroup .select_"+t).addClass("disabled")})};u.somethingDrawn=function(){return!u.resultsContainer.is(":empty")};u.setResponse=function(e,n,i){try{u.results=t("./parsers/wrapper.js")(e,n,i)}catch(o){u.results={getException:function(){return o}}}u.draw();if(u.options.persistency&&u.options.persistency.results){var a="string"==typeof u.options.persistency.results.id?u.options.persistency.results.id:u.options.persistency.results.id(u);u.results.getOriginalResponseAsString&&u.results.getOriginalResponseAsString().length<u.options.persistency.results.maxSize?r.storage.set(a,u.results.getAsStoreObject(),"month"):r.storage.remove(a)}};if(u.options.persistency&&u.options.persistency.outputSelector){var h="string"==typeof u.options.persistency.outputSelector?u.options.persistency.outputSelector:u.options.persistency.outputSelector(u);if(h){var d=r.storage.get(h);d&&(u.options.output=d)}}a(u);if(!l&&u.options.persistency&&u.options.persistency.results){var h="string"==typeof u.options.persistency.results.id?u.options.persistency.results.id:u.options.persistency.results.id(u),p=r.storage.get(h);p&&(n.isArray(p)?u.setResponse.apply(this,p):u.setResponse(p))}l&&u.setResponse(l);o(u);return u},o=function(t){var e=t.header.find(".yasr_downloadIcon");e.removeAttr("title");var n=t.plugins[t.options.output];if(n){var r=n.getDownloadInfo?n.getDownloadInfo():null;if(r){r.buttonTitle&&e.attr(r.buttonTitle);e.prop("disabled",!1);e.find("path").each(function(){this.style.fill="black"})}else{e.prop("disabled",!0).prop("title","Download not supported for this result representation");e.find("path").each(function(){this.style.fill="gray"})}}},a=function(e){var i=function(){var t=n('<div class="yasr_btnGroup"></div>');n.each(e.plugins,function(i,a){if(!a.hideFromSelection){var s=a.name||i,l=n("<button class='yasr_btn'></button>").text(s).addClass("select_"+i).click(function(){t.find("button.selected").removeClass("selected");n(this).addClass("selected");e.options.output=i;if(e.options.persistency&&e.options.persistency.outputSelector){var a="string"==typeof e.options.persistency.outputSelector?e.options.persistency.outputSelector:e.options.persistency.outputSelector(e);r.storage.set(a,e.options.output,"month")}e.draw();o(e)}).appendTo(t);e.options.output==i&&l.addClass("selected")}});t.children().length>1&&e.header.append(t)},a=function(){var r=function(t,e){var n=null,r=window.URL||window.webkitURL||window.mozURL||window.msURL;if(r&&Blob){var i=new Blob([t],{type:e});n=r.createObjectURL(i)}return n},i=n("<button class='yasr_btn yasr_downloadIcon btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").download)).click(function(){var t=e.plugins[e.options.output];if(t&&t.getDownloadInfo){var i=t.getDownloadInfo(),o=r(i.getContent(),i.contentType?i.contentType:"text/plain"),a=n("<a></a>");a.attr("href",o);a.attr("download",i.filename);a.get(0).click()}});e.header.append(i)},s=function(){var r=n("<button class='yasr_btn btn_fullscreen btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").fullscreen)).click(function(){e.container.addClass("yasr_fullscreen")});e.header.append(r)},l=function(){var r=n("<button class='yasr_btn btn_smallscreen btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").smallscreen)).click(function(){e.container.removeClass("yasr_fullscreen")});e.header.append(r)};s();l();e.options.drawOutputSelector&&i();e.options.drawDownloadIcon&&a()};i.plugins={};i.registerOutput=function(t,e){i.plugins[t]=e};try{i.registerOutput("boolean",t("./boolean.js"))}catch(s){}try{i.registerOutput("rawResponse",t("./rawResponse.js"))}catch(s){}try{i.registerOutput("table",t("./table.js"))}catch(s){}try{i.registerOutput("error",t("./error.js"))}catch(s){}try{i.registerOutput("pivot",t("./pivot.js"))}catch(s){}i.defaults=t("./defaults.js");i.version={YASR:t("../package.json").version,jquery:n.fn.jquery,"yasgui-utils":t("yasgui-utils").version};i.$=n},{"../package.json":26,"./boolean.js":28,"./defaults.js":29,"./error.js":30,"./imgs.js":31,"./parsers/wrapper.js":37,"./pivot.js":39,"./rawResponse.js":40,"./table.js":41,jquery:17,"yasgui-utils":23}],33:[function(t,e){"use strict";t("jquery"),e.exports=function(e){return t("./dlv.js")(e,",")}},{"./dlv.js":34,jquery:17}],34:[function(t,e){"use strict";var n=jQuery=t("jquery");t("../../lib/jquery.csv-0.71.js");e.exports=function(t,e){var r={},i=n.csv.toArrays(t,{separator:e}),o=function(t){return 0==t.indexOf("http")?"uri":null},a=function(){if(2==i.length&&1==i[0].length&&1==i[1].length&&"boolean"==i[0][0]&&("1"==i[1][0]||"0"==i[1][0])){r.boolean="1"==i[1][0]?!0:!1;return!0}return!1},s=function(){if(i.length>0&&i[0].length>0){r.head={vars:i[0]};return!0}return!1},l=function(){if(i.length>1){r.results={bindings:[]};for(var t=1;t<i.length;t++){for(var e={},n=0;n<i[t].length;n++){var a=r.head.vars[n];if(a){var s=i[t][n],l=o(s);e[a]={value:s};l&&(e[a].type=l)}}r.results.bindings.push(e)}r.head={vars:i[0]};return!0}return!1},u=a();if(!u){var c=s();c&&l()}return r}},{"../../lib/jquery.csv-0.71.js":3,jquery:17}],35:[function(t,e){"use strict";t("jquery"),e.exports=function(t){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return!1}return"object"==typeof t&&t.constructor==={}.constructor?t:!1}},{jquery:17}],36:[function(t,e){"use strict";t("jquery"),e.exports=function(e){return t("./dlv.js")(e," ")}},{"./dlv.js":34,jquery:17}],37:[function(t,e){"use strict";t("jquery"),e.exports=function(e,n,r){var i={xml:t("./xml.js"),json:t("./json.js"),tsv:t("./tsv.js"),csv:t("./csv.js")},o=null,a=null,s=null,l=null,u=null,c=function(){if("object"==typeof e){if(e.exception)u=e.exception;else if(void 0!=e.status&&(e.status>=300||0===e.status)){u={status:e.status};"string"==typeof r&&(u.errorString=r);e.responseText&&(u.responseText=e.responseText);e.statusText&&(u.statusText=e.statusText)}if(e.contentType)o=e.contentType.toLowerCase();else if(e.getResponseHeader&&e.getResponseHeader("content-type")){var t=e.getResponseHeader("content-type").trim().toLowerCase();t.length>0&&(o=t)}e.response?a=e.response:n||r||(a=e)}u||a||(a=e.responseText?e.responseText:e)},f=function(){if(s)return s;if(s===!1||u)return!1;var t=function(){if(o)if(o.indexOf("json")>-1){try{s=i.json(a)}catch(t){u=t}l="json"}else if(o.indexOf("xml")>-1){try{s=i.xml(a)}catch(t){u=t}l="xml"}else if(o.indexOf("csv")>-1){try{s=i.csv(a)}catch(t){u=t}l="csv"}else if(o.indexOf("tab-separated")>-1){try{s=i.tsv(a)}catch(t){u=t}l="tsv"}},e=function(){s=i.json(a);if(s)l="json";else try{s=i.xml(a);s&&(l="xml")}catch(t){}};t();s||e();s||(s=!1);return s},h=function(){var t=f();return t&&"head"in t?t.head.vars:null},d=function(){var t=f();return t&&"results"in t?t.results.bindings:null},p=function(){var t=f();return t&&"boolean"in t?t.boolean:null},g=function(){return a},m=function(){var t="";"string"==typeof a?t=a:"json"==l?t=JSON.stringify(a,void 0,2):"xml"==l&&(t=(new XMLSerializer).serializeToString(a));return t},v=function(){return u},y=function(){null==l&&f();return l},b=function(){var t={};if(e.status){t.status=e.status;t.responseText=e.responseText;t.statusText=e.statusText;t.contentType=o}else t=e;var i=n,a=void 0;"string"==typeof r&&(a=r);return[t,i,a]};c();s=f();return{getAsStoreObject:b,getAsJson:f,getOriginalResponse:g,getOriginalResponseAsString:m,getOriginalContentType:function(){return o},getVariables:h,getBindings:d,getBoolean:p,getType:y,getException:v}}},{"./csv.js":33,"./json.js":35,"./tsv.js":36,"./xml.js":38,jquery:17}],38:[function(t,e){"use strict";{var n=t("jquery");e.exports=function(t){var e=function(t){a.head={};for(var e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if("variable"==n.nodeName){a.head.vars||(a.head.vars=[]);var r=n.getAttribute("name");r&&a.head.vars.push(r)}}},r=function(t){a.results={};a.results.bindings=[];for(var e=0;e<t.childNodes.length;e++){for(var n=t.childNodes[e],r=null,i=0;i<n.childNodes.length;i++){var o=n.childNodes[i];if("binding"==o.nodeName){var s=o.getAttribute("name");if(s){r=r||{};r[s]={};for(var l=0;l<o.childNodes.length;l++){var u=o.childNodes[l],c=u.nodeName;if("#text"!=c){r[s].type=c;r[s].value=u.innerHTML;var f=u.getAttribute("datatype");f&&(r[s].datatype=f)}}}}}r&&a.results.bindings.push(r)}},i=function(t){a.boolean="true"==t.innerHTML?!0:!1},o=null;"string"==typeof t?o=n.parseXML(t):n.isXMLDoc(t)&&(o=t);var t=null;if(!(o.childNodes.length>0))return null;t=o.childNodes[0];for(var a={},s=0;s<t.childNodes.length;s++){var l=t.childNodes[s];"head"==l.nodeName&&e(l);"results"==l.nodeName&&r(l);"boolean"==l.nodeName&&i(l)}return a}}},{jquery:17}],39:[function(t,e){(function(n){"use strict";var r=t("jquery"),i=t("./utils.js"),o=t("yasgui-utils"),a=t("./imgs.js");t("jquery-ui/sortable");t("pivottable");if(!r.fn.pivotUI)throw new Error("Pivot lib not loaded");var s=e.exports=function(e){var l=!1,u=!1,c=r.pivotUtilities.renderers,f=r.extend(!0,{},s.defaults);if(f.useD3Chart){try{var h=t("d3");h&&t("../node_modules/pivottable/dist/d3_renderers.js")}catch(d){}r.pivotUtilities.d3_renderers&&r.extend(!0,c,r.pivotUtilities.d3_renderers)}var p=function(){var e=function(){try{t("../node_modules/pivottable/dist/gchart_renderers.js");r.extend(!0,c,r.pivotUtilities.gchart_renderers)}catch(e){}u=!1;l&&C();l=!1};r.ajax({cache:!0,dataType:"script",url:"//google.com/jsapi"}).done(function(){var t="undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null;t.load("visualization","1",{packages:["corechart","charteditor"],callback:e})}).fail(e)};if(f.useGChart&&!r.pivotUtilities.gchart_renderers){u=!0;p()}var g,m=null,v=function(){var t=e.results.getVariables();if(!f.mergeLabelsWithUris)return t;var n=[];m="string"==typeof f.mergeLabelsWithUris?f.mergeLabelsWithUris:"Label";t.forEach(function(e){-1!==e.indexOf(m,e.length-m.length)&&t.indexOf(e.substring(0,e.length-m.length))>=0||n.push(e)});return n},y=function(t){var n=v(),r=null;e.options.getUsedPrefixes&&(r="function"==typeof e.options.getUsedPrefixes?e.options.getUsedPrefixes(e):e.options.getUsedPrefixes);e.results.getBindings().forEach(function(e){var o={};n.forEach(function(t){if(t in e){var n=e[t].value;m&&e[t+m]?n=e[t+m].value:"uri"==e.type&&(n=i.uriToPrefixed(r,n));o[t]=n}else o[t]=null});t(o)})},b=null,x=function(){null===b&&(b="string"==typeof f.persistency?f.persistency:"function"==typeof f.persistency?f.persistency(e):!1);return b},w=function(t){if(x()){var e={cols:t.cols,rows:t.rows,rendererName:t.rendererName};o.storage.set(x(),e,"month")}},S=function(){var t=o.storage.get(x());if(t){var n=e.results.getVariables(),r=!0;t.cols.forEach(function(t){n.indexOf(t)<0&&(r=!1)});r&&t.rows.forEach(function(t){n.indexOf(t)<0&&(r=!1)});if(!r){t.cols=[];t.rows=[]}c[t.rendererName]||delete t.rendererName}else t={};return t},C=function(){if(u)l=!0;else{g=r("<div>",{"class":"pivotTable"}).appendTo(r(e.resultsContainer));var t=(r.pivotUtilities.renderers,r.extend(!0,{},S(),s.defaults.pivotTable));t.onRefresh=function(){var e=t.onRefresh;return function(t){w(t);e&&e(t)}}();window.pivot=g.pivotUI(y,t);var n=r(o.svg.getElement(a.move));g.find(".pvtTriangle").replaceWith(n);r(".pvtCols").prepend(r("<div>",{"class":"containerHeader"}).text("Columns"));r(".pvtRows").prepend(r("<div>",{"class":"containerHeader"}).text("Rows"));r(".pvtUnused").prepend(r("<div>",{"class":"containerHeader"}).text("Available Variables"));r(".pvtVals").prepend(r("<div>",{"class":"containerHeader"}).text("Cells"))}},T=function(){return e.results&&e.results.getVariables&&e.results.getVariables()&&e.results.getVariables().length>0};return{draw:C,name:"Pivot Table",canHandleResults:T,getPriority:4}};s.defaults={mergeLabelsWithUris:!1,useGChart:!0,useD3Chart:!0,persistency:function(t){return"yasr_pivot_"+r(t.container).closest("[id]").attr("id")},pivotTable:{}};s.version={"YASR-rawResponse":t("../package.json").version,jquery:r.fn.jquery}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../node_modules/pivottable/dist/d3_renderers.js":18,"../node_modules/pivottable/dist/gchart_renderers.js":19,"../package.json":26,"./imgs.js":31,"./utils.js":42,d3:12,jquery:17,"jquery-ui/sortable":15,pivottable:20,"yasgui-utils":23}],40:[function(t,e){"use strict";var n=t("jquery"),r=t("codemirror");t("codemirror/addon/fold/foldcode.js");t("codemirror/addon/fold/foldgutter.js");t("codemirror/addon/fold/xml-fold.js");t("codemirror/addon/fold/brace-fold.js");t("codemirror/addon/edit/matchbrackets.js");t("codemirror/mode/xml/xml.js");t("codemirror/mode/javascript/javascript.js");var i=e.exports=function(t){var e=n.extend(!0,{},i.defaults),o=null,a=function(){var n=e.CodeMirror;n.value=t.results.getOriginalResponseAsString();var i=t.results.getType();if(i){"json"==i&&(i={name:"javascript",json:!0});n.mode=i}o=r(t.resultsContainer.get()[0],n);o.on("fold",function(){o.refresh()});o.on("unfold",function(){o.refresh()})},s=function(){if(!t.results)return!1;if(!t.results.getOriginalResponseAsString)return!1;var e=t.results.getOriginalResponseAsString();return e&&0!=e.length||!t.results.getException()?!0:!1},l=function(){if(!t.results)return null;var e=t.results.getOriginalContentType(),n=t.results.getType();return{getContent:function(){return t.results.getOriginalResponse()},filename:"queryResults"+(n?"."+n:""),contentType:e?e:"text/plain",buttonTitle:"Download raw response"}};return{draw:a,name:"Raw Response",canHandleResults:s,getPriority:2,getDownloadInfo:l}};i.defaults={CodeMirror:{readOnly:!0,lineNumbers:!0,lineWrapping:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"]}};i.version={"YASR-rawResponse":t("../package.json").version,jquery:n.fn.jquery,CodeMirror:r.version}},{"../package.json":26,codemirror:9,"codemirror/addon/edit/matchbrackets.js":4,"codemirror/addon/fold/brace-fold.js":5,"codemirror/addon/fold/foldcode.js":6,"codemirror/addon/fold/foldgutter.js":7,"codemirror/addon/fold/xml-fold.js":8,"codemirror/mode/javascript/javascript.js":10,"codemirror/mode/xml/xml.js":11,jquery:17}],41:[function(t,e){"use strict";var n=t("jquery"),r=t("yasgui-utils"),i=t("./imgs.js");t("../lib/DataTables/media/js/jquery.dataTables.js");var o=e.exports=function(e){var a=null,s={name:"Table",getPriority:10},u=s.options=n.extend(!0,{},o.defaults),c=function(){var t=[],n=e.results.getBindings(),r=e.results.getVariables(),i=null;e.options.getUsedPrefixes&&(i="function"==typeof e.options.getUsedPrefixes?e.options.getUsedPrefixes(e):e.options.getUsedPrefixes);for(var o=0;o<n.length;o++){var a=[];a.push("");for(var l=n[o],c=0;c<r.length;c++){var f=r[c];a.push(f in l?u.getCellContent?u.getCellContent(e,s,l,f,{rowId:o,colId:c,usedPrefixes:i}):"":"")}t.push(a)}return t},f=function(){a.on("order.dt",function(){h()});u.persistency&&u.persistency.tableLength&&a.on("length.dt",function(t,n,i){var o="string"==typeof u.persistency.tableLength?u.persistency.tableLength:u.persistency.tableLength(e);r.storage.set(o,i,"month")});n.extend(!0,u.callbacks,u.handlers);a.delegate("td","click",function(t){if(u.callbacks&&u.callbacks.onCellClick){var e=u.callbacks.onCellClick(this,t);if(e===!1)return!1}}).delegate("td","mouseenter",function(t){u.callbacks&&u.callbacks.onCellMouseEnter&&u.callbacks.onCellMouseEnter(this,t);var e=n(this);u.fetchTitlesFromPreflabel&&void 0===e.attr("title")&&0==e.text().trim().indexOf("http")&&l(e)}).delegate("td","mouseleave",function(t){u.callbacks&&u.callbacks.onCellMouseLeave&&u.callbacks.onCellMouseLeave(this,t)})};s.draw=function(){a=n('<table cellpadding="0" cellspacing="0" border="0" class="resultsTable"></table>');n(e.resultsContainer).html(a);var t=u.datatable;t.data=c();t.columns=u.getColumns(e,s);if(u.persistency&&u.persistency.tableLength){var i="string"==typeof u.persistency.tableLength?u.persistency.tableLength:u.persistency.tableLength(e),o=r.storage.get(i);o&&(t.pageLength=o)}a.DataTable(n.extend(!0,{},t));h();f();var l=e.header.outerHeight()-5;l>0&&e.resultsContainer.find(".dataTables_wrapper").css("position","relative").css("top","-"+l+"px").css("margin-bottom","-"+l+"px")};var h=function(){var t={sorting:"unsorted",sorting_asc:"sortAsc",sorting_desc:"sortDesc"};a.find(".sortIcons").remove();var e=8,o=13;for(var s in t){var l=n("<div class='sortIcons'></div>").css("float","right").css("margin-right","-12px").width(e).height(o);r.svg.draw(l,i[t[s]]);a.find("th."+s).append(l)}};s.canHandleResults=function(){return e.results&&e.results.getVariables&&e.results.getVariables()&&e.results.getVariables().length>0};s.getDownloadInfo=function(){return e.results?{getContent:function(){return t("./bindingsToCsv.js")(e.results.getAsJson())},filename:"queryResults.csv",contentType:"text/csv",buttonTitle:"Download as CSV"}:null};return s},a=function(t,e,n){var r=n.value;if(n["xml:lang"])r='"'+n.value+'"@'+n["xml:lang"];else if(n.datatype){var i="http://www.w3.org/2001/XMLSchema#",o=n.datatype;o=0==o.indexOf(i)?"xsd:"+o.substring(i.length):"<"+o+">";r='"'+r+'"^^'+o}return r},s=function(t,e,n,r,i){var o=n[r],s=null;if("uri"==o.type){var l=null,u=o.value,c=u;if(i.usedPrefixes)for(var f in i.usedPrefixes)if(0==c.indexOf(i.usedPrefixes[f])){c=f+":"+u.substring(i.usedPrefixes[f].length);break}if(e.options.mergeLabelsWithUris){var h="string"==typeof e.options.mergeLabelsWithUris?e.options.mergeLabelsWithUris:"Label";if(n[r+h]){c=a(t,e,n[r+h]);l=u}}s="<a "+(l?"title='"+u+"' ":"")+"class='uri' target='_blank' href='"+u+"'>"+c+"</a>"}else s="<span class='nonUri'>"+a(t,e,o)+"</span>";return s},l=function(t){var e=function(){t.attr("title","")};n.get("http://preflabel.org/api/v1/label/"+encodeURIComponent(t.text())+"?silent=true").success(function(n){"object"==typeof n&&n.label?t.attr("title",n.label):"string"==typeof n&&n.length>0?t.attr("title",n):e()}).fail(e)};o.defaults={getCellContent:s,persistency:{tableLength:function(t){return"tableLength_"+n(t.container).closest("[id]").attr("id")}},getColumns:function(t,e){var n=function(n){if(!e.options.mergeLabelsWithUris)return!0;var r="string"==typeof e.options.mergeLabelsWithUris?e.options.mergeLabelsWithUris:"Label";return-1!==n.indexOf(r,n.length-r.length)&&t.results.getVariables().indexOf(n.substring(0,n.length-r.length))>=0?!1:!0},r=[];r.push({title:""});t.results.getVariables().forEach(function(t){r.push({title:t,visible:n(t)})});return r},fetchTitlesFromPreflabel:!0,mergeLabelsWithUris:!1,callbacks:{onCellMouseEnter:null,onCellMouseLeave:null,onCellClick:null},datatable:{order:[],pageLength:50,lengthMenu:[[10,50,100,1e3,-1],[10,50,100,1e3,"All"]],lengthChange:!0,pagingType:"full_numbers",drawCallback:function(t){for(var e=0;e<t.aiDisplay.length;e++)n("td:eq(0)",t.aoData[t.aiDisplay[e]].nTr).html(e+1);var r=!1;n(t.nTableWrapper).find(".paginate_button").each(function(){-1==n(this).attr("class").indexOf("current")&&-1==n(this).attr("class").indexOf("disabled")&&(r=!0)});r?n(t.nTableWrapper).find(".dataTables_paginate").show():n(t.nTableWrapper).find(".dataTables_paginate").hide()},columnDefs:[{width:"12px",orderable:!1,targets:0}]}};o.version={"YASR-table":t("../package.json").version,jquery:n.fn.jquery,"jquery-datatables":n.fn.DataTable.version}},{"../lib/DataTables/media/js/jquery.dataTables.js":2,"../package.json":26,"./bindingsToCsv.js":27,"./imgs.js":31,jquery:17,"yasgui-utils":23}],42:[function(t,e){"use strict";t("jquery");e.exports={uriToPrefixed:function(t,e){if(t)for(var n in t)if(0==e.indexOf(t[n])){e=n+":"+e.substring(t[n].length);break}}}},{jquery:17}]},{},[1])(1)}); //# sourceMappingURL=yasr.bundled.min.js.map
packages/material-ui-icons/src/FiberDvrSharp.js
allanalexandre/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M17.5 10.5h2v1h-2v-1zm-13 0h2v3h-2v-3zM23 3H1v18h22V3zM8 13.5c0 .85-.65 1.5-1.5 1.5H3V9h3.5c.85 0 1.5.65 1.5 1.5v3zm4.62 1.5h-1.5L9.37 9h1.5l1 3.43 1-3.43h1.5l-1.75 6zM21 12.9h-.9L21 15h-1.5l-.85-2H17.5v2H16V9h5v3.9z" /></React.Fragment> , 'FiberDvrSharp');
js/jquery-1.11.0.js
kls2177/kls2177.github.io
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f }}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?"<table>"!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b) },a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
clients/libs/slate-editor-strikethrough-plugin/src/StrikethroughMark.js
nossas/bonde-client
import React from 'react' // eslint-disable-next-line react/prop-types const StrikethroughMark = ({ children }) => ( <del> {children} </del> ) export default StrikethroughMark
docs/app/Examples/modules/Accordion/Variations/index.js
Rohanhacker/Semantic-UI-React
import React from 'react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' const AccordionTypesExamples = () => ( <ExampleSection title='Variations'> <ComponentExample title='Fluid' description='An accordion can take up the width of its container.' examplePath='modules/Accordion/Variations/AccordionExampleFluid' /> <ComponentExample title='Inverted' description='An accordion can be formatted to appear on dark backgrounds.' examplePath='modules/Accordion/Variations/AccordionExampleInverted' /> <ComponentExample title='Exclusive' description='An accordion can have multiple panels open at the same time.' examplePath='modules/Accordion/Variations/AccordionExampleExclusive' /> </ExampleSection> ) export default AccordionTypesExamples
ajax/libs/flocks.js/0.15.2/flocks.js
aashish24/cdnjs
/** @jsx React.DOM */ /* jshint node: true, browser: true, newcap: false */ /** * The Flocks library module. * * @module Flocks * @main Flocks * @class Flocks */ // if it's in a <script> it's defined already // otherwise assume commonjs if (typeof React === 'undefined') { var React = require('react'); } // wrap the remainder (function() { 'use strict'; var initialized = false, updateBlocks = 0, dirty = false, tagtype, handler = function(Ignored) { return true; }, finalizer = function() { return true; }, prevFCtx = {}, nextFCtx = {}, flocks2_ctxs = { flocks2context: React.PropTypes.object }; function flocksLog(Level, Message) { if (typeof Level === 'string') { if (array_member(Level, ['warn','debug','error','log','info','exception','assert'])) { console[Level]('Flocks2 [' + Level + '] ' + Message.toString()); } else { console.log('Flocks2 [Unknown level] ' + Message.toString()); } } else if (isUndefined(nextFCtx.flocks_config)) { console.log('Flocks2 pre-config [' + Level.toString() + '] ' + Message.toString()); } else if (nextFCtx.flocks_config.log_level >= Level) { console.log('Flocks2 [' + Level.toString() + '] ' + Message.toString()); } } function enforceString(On, Label) { if (typeof On !== 'string') { throw Label || 'Argument must be a string'; } } function enforceArray(On, Label) { if (!isArray(On)) { throw Label || 'Argument must be an array'; } } function enforceNonArrayObject(On, Label) { if (!isNonArrayObject(On)) { throw Label || 'Argument must be a non-array object'; } } function isArray(maybeArray) { return (Object.prototype.toString.call(maybeArray) === '[object Array]'); } function isUndefined(maybeUndefined) { return (typeof maybeUndefined === 'undefined'); } function isNonArrayObject(maybeArray) { if (typeof maybeArray !== 'object') { return false; } if (Object.prototype.toString.call(maybeArray) === '[object Array]') { return false; } return true; } function setByKey(Key, MaybeValue) { enforceString(Key, "Flocks2 set/2 must take a string for its key"); nextFCtx[Key] = MaybeValue; flocksLog(1, " - Flocks2 setByKey \"" + Key + "\""); attemptUpdate(); } // function setByPath(Key, MaybeValue) { flocksLog(0, ' - Flocks2 setByPath stub' ); attemptUpdate(); } // whargarbl todo // function setByObject(Key, MaybeValue) { flocksLog(0, ' - Flocks2 setByObject stub'); attemptUpdate(); } // whargarbl todo function set(Key, MaybeValue) { flocksLog(3, ' - Flocks2 multi-set'); if (typeof Key === 'string') { setByKey(Key, MaybeValue); } // else if (isArray(Key)) { setByPath(Key, MaybeValue); } // whargarbl todo // else if (isNonArrayObject(Key)) { setByObject(Key); } // whargarbl todo else { throw 'Flocks2 set/1,2 key must be a string or an array'; } } function update(SparseObject) { console.log('update - whargarbl stub'); enforceNonArrayObject(SparseObject, 'Flocks2 update/1 must take a plain object'); } function lock() { ++updateBlocks; } function unlock() { if (updateBlocks <= 0) { throw 'unlock()ed with no lock!'; } --updateBlocks; attemptUpdate(); } function clone(obj) { if ((null === obj) || ('object' != typeof obj)) { return obj; } var copy = obj.constructor(); for (var attr in obj) { if (obj.hasOwnProperty(attr)) { copy[attr] = obj[attr]; } } return copy; } // ... lol function array_member(Item, Array) { return (!!(~( Array.indexOf(Item, 0) ))); } function attemptUpdate() { flocksLog(3, ' - Flocks2 attempting update'); dirty = true; if (!(initialized)) { flocksLog(1, ' x Flocks2 skipped update: root is not initialized'); return null; } if (updateBlocks) { flocksLog(1, ' x Flocks2 skipped update: lock count updateBlocks is non-zero'); return null; } /* whargarbl see issue #9 https://github.com/StoneCypher/flocks.js/issues/9 if (deepCompare(nextFCtx, prevFCtx)) { flocksLog(2, ' x Flocks2 skipped update: no update to state'); return true; } */ if (!(handler(nextFCtx))) { flocksLog(0, ' ! Flocks2 rolling back update: handler rejected propset'); nextFCtx = prevFCtx; dirty = false; return null; } prevFCtx = nextFCtx; flocksLog(3, ' - Flocks2 update passed'); React.render( React.createFactory(tagtype)( { flocks2context: nextFCtx } ), document.body ); dirty = false; flocksLog(3, ' - Flocks2 update complete; finalizing'); finalizer(); return true; } function create(iFlocksConfig, iFlocksData) { var FlocksConfig = iFlocksConfig || {}, FlocksData = iFlocksData || {}, target = FlocksConfig.target || document.body, stub = function() { window.alert('whargarbl stub'); attemptUpdate(); }, updater = { get : stub, set : set, override : stub, clear : stub, update : update, lock : lock, unlock : unlock }; FlocksConfig.log_level = FlocksConfig.log_level || -1; tagtype = FlocksConfig.control; FlocksData.flocks_config = FlocksConfig; nextFCtx = FlocksData; flocksLog(1, 'Flocks2 root creation begins'); if (!(tagtype)) { throw 'Flocks2 fatal error: must provide a control in create/2 FlocksConfig'; } if (FlocksConfig.handler) { handler = FlocksConfig.handler; flocksLog(3, ' - Flocks2 handler assigned' ); } if (FlocksConfig.finalizer) { finalizer = FlocksConfig.finalizer; flocksLog(3, ' - Flocks2 finalizer assigned'); } if (FlocksConfig.preventAutoContext) { flocksLog(2, ' - Flocks2 skipping auto-context'); } else { flocksLog(2, ' - Flocks2 engaging auto-context'); this.fctx = clone(nextFCtx); } flocksLog(3, 'Flocks2 creation finished; initializing'); initialized = true; attemptUpdate(); flocksLog(3, 'Flocks2 expose updater'); this.fupd = updater; this.fset = updater.set; this.flock = updater.lock; this.funlock = updater.unlock; this.fupdate = updater.update; flocksLog(3, 'Flocks2 initialization finished'); return updater; } var Mixin = { contextTypes : flocks2_ctxs, childContextTypes : flocks2_ctxs, componentWillMount: function() { flocksLog(1, ' - Flocks2 component will mount: ' + this.constructor.displayName); flocksLog(3, isUndefined(this.props.flocks2context) ? ' - No F2 Context Prop' : ' - F2 Context Prop found'); flocksLog(3, isUndefined(this.context.flocks2context) ? ' - No F2 Context' : ' - F2 Context found'); if (this.props.flocks2context) { this.context.flocks2context = this.props.flocks2context; } this.fupdate = function(Obj) { update(Obj); }; this.fset = function(K,V) { set(K,V); }; this.flock = function() { lock(); }; this.funlock = function() { unlock(); }; this.fctx = this.context.flocks2context; }, getChildContext: function() { return this.context; } }; function atLeastFlocks(OriginalList) { if (isUndefined(OriginalList)) { return [ Mixin ]; } if (isArray(OriginalList)) { if (array_member(Mixin, OriginalList)) { return OriginalList; } else { var NewList = clone(OriginalList); NewList.push(Mixin); return NewList; } } throw 'Original mixin list must be an array or undefined!'; } function createClass(spec) { spec.mixins = atLeastFlocks(spec.mixins); return React.createClass(spec); } var exports = { plumbing : Mixin, createClass : createClass, mount : create, clone : clone, isArray : isArray, isUndefined : isUndefined, isNonArrayObject : isNonArrayObject, enforceString : enforceString, enforceArray : enforceArray, enforceNonArrayObject : enforceNonArrayObject, atLeastFlocks : atLeastFlocks }; if (typeof module !== 'undefined') { module.exports = exports; } else { window.flocks = exports; } }());
Libraries/ReactIOS/ReactIOSMount.js
gregRV/rn-property-finder
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactIOSMount * @flow */ 'use strict'; var RCTUIManager = require('NativeModules').UIManager; var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactPerf = require('ReactPerf'); var ReactReconciler = require('ReactReconciler'); var ReactUpdates = require('ReactUpdates'); var emptyObject = require('emptyObject'); var instantiateReactComponent = require('instantiateReactComponent'); var invariant = require('invariant'); var TOP_ROOT_NODE_IDS = {}; function instanceNumberToChildRootID(rootNodeID, instanceNumber) { return rootNodeID + '[' + instanceNumber + ']'; } /** * Mounts this component and inserts it into the DOM. * * @param {ReactComponent} componentInstance The instance to mount. * @param {number} rootID ID of the root node. * @param {number} container container element to mount into. * @param {ReactReconcileTransaction} transaction */ function mountComponentIntoNode( componentInstance, rootID, container, transaction) { var markup = ReactReconciler.mountComponent( componentInstance, rootID, transaction, emptyObject ); componentInstance._isTopLevel = true; ReactIOSMount._mountImageIntoNode(markup, container); } /** * Batched mount. * * @param {ReactComponent} componentInstance The instance to mount. * @param {number} rootID ID of the root node. * @param {number} container container element to mount into. */ function batchedMountComponentIntoNode( componentInstance, rootID, container) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); transaction.perform( mountComponentIntoNode, null, componentInstance, rootID, container, transaction ); ReactUpdates.ReactReconcileTransaction.release(transaction); } /** * As soon as `ReactMount` is refactored to not rely on the DOM, we can share * code between the two. For now, we'll hard code the ID logic. */ var ReactIOSMount = { instanceCount: 0, _instancesByContainerID: {}, /** * @param {ReactComponent} instance Instance to render. * @param {containerTag} containerView Handle to native view tag */ renderComponent: function( descriptor: ReactComponent, containerTag: number ) { var instance = instantiateReactComponent(descriptor); if (!ReactIOSTagHandles.reactTagIsNativeTopRootID(containerTag)) { console.error('You cannot render into anything but a top root'); return; } var topRootNodeID = ReactIOSTagHandles.allocateRootNodeIDForTag(containerTag); ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle( topRootNodeID, containerTag ); TOP_ROOT_NODE_IDS[topRootNodeID] = true; var childRootNodeID = instanceNumberToChildRootID( topRootNodeID, ReactIOSMount.instanceCount++ ); ReactIOSMount._instancesByContainerID[topRootNodeID] = instance; // The initial render is synchronous but any updates that happen during // rendering, in componentWillMount or componentDidMount, will be batched // according to the current batching strategy. ReactUpdates.batchedUpdates( batchedMountComponentIntoNode, instance, childRootNodeID, topRootNodeID ); }, /** * @param {View} view View tree image. * @param {number} containerViewID View to insert sub-view into. */ _mountImageIntoNode: ReactPerf.measure( // FIXME(frantic): #4441289 Hack to avoid modifying react-tools 'ReactComponentBrowserEnvironment', 'mountImageIntoNode', function(mountImage, containerID) { // Since we now know that the `mountImage` has been mounted, we can // mark it as such. ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle( mountImage.rootNodeID, mountImage.tag ); var addChildTags = [mountImage.tag]; var addAtIndices = [0]; RCTUIManager.manageChildren( ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID), null, // moveFromIndices null, // moveToIndices addChildTags, addAtIndices, null // removeAtIndices ); } ), /** * Standard unmounting of the component that is rendered into `containerID`, * but will also execute a command to remove the actual container view * itself. This is useful when a client is cleaning up a React tree, and also * knows that the container will no longer be needed. When executing * asynchronously, it's easier to just have this method be the one that calls * for removal of the view. */ unmountComponentAtNodeAndRemoveContainer: function( containerTag: number ) { ReactIOSMount.unmountComponentAtNode(containerTag); // call back into native to remove all of the subviews from this container RCTUIManager.removeRootView(containerTag); }, /** * Unmount component at container ID by iterating through each child component * that has been rendered and unmounting it. There should just be one child * component at this time. */ unmountComponentAtNode: function(containerTag: number): bool { var containerID = ReactIOSTagHandles.tagToRootNodeID[containerTag]; invariant( TOP_ROOT_NODE_IDS[containerID], 'We only currently support removing components from the root node' ); var instance = ReactIOSMount._instancesByContainerID[containerID]; if (!instance) { console.error('Tried to unmount a component that does not exist'); return false; } ReactIOSMount.unmountComponentFromNode(instance, containerID); delete ReactIOSMount._instancesByContainerID[containerID]; delete TOP_ROOT_NODE_IDS[containerID]; return true; }, /** * Unmounts a component and sends messages back to iOS to remove its subviews. * * @param {ReactComponent} instance React component instance. * @param {string} containerID ID of container we're removing from. * @final * @internal * @see {ReactIOSMount.unmountComponentAtNode} */ unmountComponentFromNode: function( instance: ReactComponent, containerID: string ) { // call back into native to remove all of the subviews from this container // TODO: ReactComponent.prototype.unmountComponent is missing from Flow's // react lib. (instance: any).unmountComponent(); var containerTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID); RCTUIManager.removeSubviewsFromContainerWithID(containerTag); }, getNode: function<T>(id: T): T { return id; } }; ReactIOSMount.renderComponent = ReactPerf.measure( 'ReactMount', '_renderNewRootComponent', ReactIOSMount.renderComponent ); module.exports = ReactIOSMount;
app/javascript/flavours/glitch/features/composer/options/index.js
vahnj/mastodon
// Package imports. import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage, defineMessages, } from 'react-intl'; import spring from 'react-motion/lib/spring'; // Components. import IconButton from 'flavours/glitch/components/icon_button'; import TextIconButton from 'flavours/glitch/components/text_icon_button'; import Dropdown from './dropdown'; // Utils. import Motion from 'flavours/glitch/util/optional_motion'; import { assignHandlers, hiddenComponent, } from 'flavours/glitch/util/react_helpers'; // Messages. const messages = defineMessages({ advanced_options_icon_title: { defaultMessage: 'Advanced options', id: 'advanced_options.icon_title', }, attach: { defaultMessage: 'Attach...', id: 'compose.attach', }, change_privacy: { defaultMessage: 'Adjust status privacy', id: 'privacy.change', }, direct_long: { defaultMessage: 'Post to mentioned users only', id: 'privacy.direct.long', }, direct_short: { defaultMessage: 'Direct', id: 'privacy.direct.short', }, doodle: { defaultMessage: 'Draw something', id: 'compose.attach.doodle', }, local_only_long: { defaultMessage: 'Do not post to other instances', id: 'advanced_options.local-only.long', }, local_only_short: { defaultMessage: 'Local-only', id: 'advanced_options.local-only.short', }, private_long: { defaultMessage: 'Post to followers only', id: 'privacy.private.long', }, private_short: { defaultMessage: 'Followers-only', id: 'privacy.private.short', }, public_long: { defaultMessage: 'Post to public timelines', id: 'privacy.public.long', }, public_short: { defaultMessage: 'Public', id: 'privacy.public.short', }, sensitive: { defaultMessage: 'Mark media as sensitive', id: 'compose_form.sensitive', }, spoiler: { defaultMessage: 'Hide text behind warning', id: 'compose_form.spoiler', }, threaded_mode_long: { defaultMessage: 'Automatically opens a reply on posting', id: 'advanced_options.threaded_mode.long', }, threaded_mode_short: { defaultMessage: 'Threaded mode', id: 'advanced_options.threaded_mode.short', }, unlisted_long: { defaultMessage: 'Do not show in public timelines', id: 'privacy.unlisted.long', }, unlisted_short: { defaultMessage: 'Unlisted', id: 'privacy.unlisted.short', }, upload: { defaultMessage: 'Upload a file', id: 'compose.attach.upload', }, }); // Handlers. const handlers = { // Handles file selection. handleChangeFiles ({ target: { files } }) { const { onUpload } = this.props; if (files.length && onUpload) { onUpload(files); } }, // Handles attachment clicks. handleClickAttach (name) { const { fileElement } = this; const { onDoodleOpen } = this.props; // We switch over the name of the option. switch (name) { case 'upload': if (fileElement) { fileElement.click(); } return; case 'doodle': if (onDoodleOpen) { onDoodleOpen(); } return; } }, // Handles a ref to the file input. handleRefFileElement (fileElement) { this.fileElement = fileElement; }, }; // The component. export default class ComposerOptions extends React.PureComponent { // Constructor. constructor (props) { super(props); assignHandlers(this, handlers); // Instance variables. this.fileElement = null; } // Rendering. render () { const { handleChangeFiles, handleClickAttach, handleRefFileElement, } = this.handlers; const { acceptContentTypes, advancedOptions, disabled, full, hasMedia, intl, onChangeAdvancedOption, onChangeSensitivity, onChangeVisibility, onModalClose, onModalOpen, onToggleSpoiler, privacy, resetFileKey, sensitive, spoiler, } = this.props; // We predefine our privacy items so that we can easily pick the // dropdown icon later. const privacyItems = { direct: { icon: 'envelope', meta: <FormattedMessage {...messages.direct_long} />, name: 'direct', text: <FormattedMessage {...messages.direct_short} />, }, private: { icon: 'lock', meta: <FormattedMessage {...messages.private_long} />, name: 'private', text: <FormattedMessage {...messages.private_short} />, }, public: { icon: 'globe', meta: <FormattedMessage {...messages.public_long} />, name: 'public', text: <FormattedMessage {...messages.public_short} />, }, unlisted: { icon: 'unlock-alt', meta: <FormattedMessage {...messages.unlisted_long} />, name: 'unlisted', text: <FormattedMessage {...messages.unlisted_short} />, }, }; // The result. return ( <div className='composer--options'> <input accept={acceptContentTypes} disabled={disabled || full} key={resetFileKey} onChange={handleChangeFiles} ref={handleRefFileElement} type='file' {...hiddenComponent} /> <Dropdown disabled={disabled || full} icon='paperclip' items={[ { icon: 'cloud-upload', name: 'upload', text: <FormattedMessage {...messages.upload} />, }, { icon: 'paint-brush', name: 'doodle', text: <FormattedMessage {...messages.doodle} />, }, ]} onChange={handleClickAttach} onModalClose={onModalClose} onModalOpen={onModalOpen} title={intl.formatMessage(messages.attach)} /> <Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(hasMedia ? 1 : 0.87, { stiffness: 200, damping: 3, }), }} > {({ scale }) => ( <div style={{ display: hasMedia ? null : 'none', transform: `scale(${scale})`, }} > <IconButton active={sensitive} className='sensitive' disabled={spoiler} icon={sensitive ? 'eye-slash' : 'eye'} inverted onClick={onChangeSensitivity} size={18} style={{ height: null, lineHeight: null, }} title={intl.formatMessage(messages.sensitive)} /> </div> )} </Motion> <hr /> <Dropdown disabled={disabled} icon={(privacyItems[privacy] || {}).icon} items={[ privacyItems.public, privacyItems.unlisted, privacyItems.private, privacyItems.direct, ]} onChange={onChangeVisibility} onModalClose={onModalClose} onModalOpen={onModalOpen} title={intl.formatMessage(messages.change_privacy)} value={privacy} /> <TextIconButton active={spoiler} ariaControls='glitch.composer.spoiler.input' label='CW' onClick={onToggleSpoiler} title={intl.formatMessage(messages.spoiler)} /> <Dropdown active={advancedOptions && advancedOptions.some(value => !!value)} disabled={disabled} icon='ellipsis-h' items={advancedOptions ? [ { meta: <FormattedMessage {...messages.local_only_long} />, name: 'do_not_federate', on: advancedOptions.get('do_not_federate'), text: <FormattedMessage {...messages.local_only_short} />, }, { meta: <FormattedMessage {...messages.threaded_mode_long} />, name: 'threaded_mode', on: advancedOptions.get('threaded_mode'), text: <FormattedMessage {...messages.threaded_mode_short} />, }, ] : null} onChange={onChangeAdvancedOption} onModalClose={onModalClose} onModalOpen={onModalOpen} title={intl.formatMessage(messages.advanced_options_icon_title)} /> </div> ); } } // Props. ComposerOptions.propTypes = { acceptContentTypes: PropTypes.string, advancedOptions: ImmutablePropTypes.map, disabled: PropTypes.bool, full: PropTypes.bool, hasMedia: PropTypes.bool, intl: PropTypes.object.isRequired, onChangeAdvancedOption: PropTypes.func, onChangeSensitivity: PropTypes.func, onChangeVisibility: PropTypes.func, onDoodleOpen: PropTypes.func, onModalClose: PropTypes.func, onModalOpen: PropTypes.func, onToggleSpoiler: PropTypes.func, onUpload: PropTypes.func, privacy: PropTypes.string, resetFileKey: PropTypes.number, sensitive: PropTypes.bool, spoiler: PropTypes.bool, };
addons/themes/ethereal/layouts/Home.js
rendact/rendact
import React from 'react'; import {Link} from 'react-router'; import PanelBanner from '../includes/PanelBanner'; import PanelFooter from '../includes/PanelFooter'; class Home extends React.Component { componentDidMount(){ require("../css/main.css") document.body.className = "" document.body.addEventListener("wheel", (e) => {window.scrollBy(e.deltaY, 0)}) } render(){ return ( <div id="page-wrapper"> <div id="wrapper"> <PanelBanner title={this.props.theConfig && this.props.theConfig.name} content={this.props.theConfig && this.props.theConfig.tagline} image={require('images/logo-130.png')} /> {this.props.thePagination} <section className="panel color2" id="first" > {this.props.data && this.props.data.map((post, index) => ( <div className="panel"> <div key={post.id} className="intro joined span-3"> <h2 className="major"><Link to={"/post" + post.id}>{post.title}</Link></h2> <p dangerouslySetInnerHTML={{__html: post.content && post.content.replace(" ", "").replace("\n", "").slice(0, 100) + "..."}}/> <ul className="actions"> <li> <Link className="button special icon circle color1 fa-external-link" to={"/post/" + post.id}>Read more</Link> </li> </ul> </div> <div className="image span-2-5" style={{flexWrap: "wrap", overflow: "hidden"}}><img src={post.imageFeatured?post.imageFeatured.blobUrl:require('images/logo-130.png')} style={{margin: "30% 0"}} alt=""/></div> </div> )) } <PanelFooter {...this.props}/> </section> <div className="copyright">Converted from ethereal theme; Rendact Team</div> </div> </div> ) } } export default Home
jspm_packages/npm/babel-core@5.8.33/browser.min.js
JHKennedy4/nqr-client
/* */ "format amd";  !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.babel=e()}}(function(){var e,t,r;return function n(e,t,r){function i(s,o){if(!t[s]){if(!e[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var l=t[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return i(r?r:t)},l,l.exports,n,e,t,r)}return t[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){function n(e,t){return d.isUndefined(t)?""+t:d.isNumber(t)&&!isFinite(t)?t.toString():d.isFunction(t)||d.isRegExp(t)?t.toString():t}function i(e,t){return d.isString(e)?e.length<t?e:e.slice(0,t):e}function a(e){return i(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+i(JSON.stringify(e.expected,n),128)}function s(e,t,r,n,i){throw new y.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function o(e,t){e||s(e,!0,t,"==",y.ok)}function u(e,t){if(e===t)return!0;if(d.isBuffer(e)&&d.isBuffer(t)){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return d.isDate(e)&&d.isDate(t)?e.getTime()===t.getTime():d.isRegExp(e)&&d.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:d.isObject(e)||d.isObject(t)?l(e,t):e==t}function p(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function l(e,t){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(t))return e===t;var r=p(e),n=p(t);if(r&&!n||!r&&n)return!1;if(r)return e=h.call(e),t=h.call(t),u(e,t);var i,a,s=g(e),o=g(t);if(s.length!=o.length)return!1;for(s.sort(),o.sort(),a=s.length-1;a>=0;a--)if(s[a]!=o[a])return!1;for(a=s.length-1;a>=0;a--)if(i=s[a],!u(e[i],t[i]))return!1;return!0}function c(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function f(e,t,r,n){var i;d.isString(r)&&(n=r,r=null);try{t()}catch(a){i=a}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&s(i,r,"Missing expected exception"+n),!e&&c(i,r)&&s(i,r,"Got unwanted exception"+n),e&&i&&r&&!c(i,r)||!e&&i)throw i}var d=e(13),h=Array.prototype.slice,m=Object.prototype.hasOwnProperty,y=t.exports=o;y.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=a(this),this.generatedMessage=!0);var t=e.stackStartFunction||s;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=t.name,o=n.indexOf("\n"+i);if(o>=0){var u=n.indexOf("\n",o+1);n=n.substring(u+1)}this.stack=n}}},d.inherits(y.AssertionError,Error),y.fail=s,y.ok=o,y.equal=function(e,t,r){e!=t&&s(e,t,r,"==",y.equal)},y.notEqual=function(e,t,r){e==t&&s(e,t,r,"!=",y.notEqual)},y.deepEqual=function(e,t,r){u(e,t)||s(e,t,r,"deepEqual",y.deepEqual)},y.notDeepEqual=function(e,t,r){u(e,t)&&s(e,t,r,"notDeepEqual",y.notDeepEqual)},y.strictEqual=function(e,t,r){e!==t&&s(e,t,r,"===",y.strictEqual)},y.notStrictEqual=function(e,t,r){e===t&&s(e,t,r,"!==",y.notStrictEqual)},y["throws"]=function(e,t,r){f.apply(this,[!0].concat(h.call(arguments)))},y.doesNotThrow=function(e,t){f.apply(this,[!1].concat(h.call(arguments)))},y.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var r in e)m.call(e,r)&&t.push(r);return t}},{13:13}],3:[function(e,t,r){(function(t){function n(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e){return this instanceof a?(this.length=0,this.parent=void 0,"number"==typeof e?s(this,e):"string"==typeof e?o(this,e,arguments.length>1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new a(e,arguments[1]):new a(e)}function s(e,t){if(e=m(e,0>t?0:0|y(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function o(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|v(t,r);return e=m(e,n),e.write(t,r),e}function u(e,t){if(a.isBuffer(t))return p(e,t);if(K(t))return l(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return c(e,t);if(t instanceof ArrayBuffer)return f(e,t)}return t.length?d(e,t):h(e,t)}function p(e,t){var r=0|y(t.length);return e=m(e,r),t.copy(e,0,0,r),e}function l(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function c(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function f(e,t){return a.TYPED_ARRAY_SUPPORT?(t.byteLength,e=a._augment(new Uint8Array(t))):e=c(e,new Uint8Array(t)),e}function d(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function h(e,t){var r,n=0;"Buffer"===t.type&&K(t.data)&&(r=t.data,n=0|y(r.length)),e=m(e,n);for(var i=0;n>i;i+=1)e[i]=255&r[i];return e}function m(e,t){a.TYPED_ARRAY_SUPPORT?(e=a._augment(new Uint8Array(t)),e.__proto__=a.prototype):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=a.poolSize>>>1;return r&&(e.parent=$),e}function y(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e,t){if(!(this instanceof g))return new g(e,t);var r=new a(e,t);return delete r.parent,r}function v(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return G(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){var n=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return F(this,t,r);case"binary":return k(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function E(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");n>a/2&&(n=a/2);for(var s=0;n>s;s++){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[r+s]=o}return s}function x(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function S(e,t,r,n){return Y(H(t),e,r,n)}function A(e,t,r,n){return S(e,t,r,n)}function D(e,t,r,n){return Y(X(t),e,r,n)}function C(e,t,r,n){return Y(W(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?J.fromByteArray(e):J.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var a=e[i],s=null,o=a>239?4:a>223?3:a>191?2:1;if(r>=i+o){var u,p,l,c;switch(o){case 1:128>a&&(s=a);break;case 2:u=e[i+1],128===(192&u)&&(c=(31&a)<<6|63&u,c>127&&(s=c));break;case 3:u=e[i+1],p=e[i+2],128===(192&u)&&128===(192&p)&&(c=(15&a)<<12|(63&u)<<6|63&p,c>2047&&(55296>c||c>57343)&&(s=c));break;case 4:u=e[i+1],p=e[i+2],l=e[i+3],128===(192&u)&&128===(192&p)&&128===(192&l)&&(c=(15&a)<<18|(63&u)<<12|(63&p)<<6|63&l,c>65535&&1114112>c&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return _(n)}function _(e){var t=e.length;if(Q>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Q));return r}function F(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function k(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function P(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",a=t;r>a;a++)i+=q(e[a]);return i}function B(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function T(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!a.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||s>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range")}function O(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);a>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);a>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,a){if(t>i||a>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function N(e,t,r,n,i){return i||L(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return i||L(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function V(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function G(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],s=0;n>s;s++){if(r=e.charCodeAt(s),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=i-55296<<10|r-56320|65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function W(e,t){for(var r,n,i,a=[],s=0;s<e.length&&!((t-=2)<0);s++)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function X(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}var J=e(4),z=e(5),K=e(6);r.Buffer=a,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,a.poolSize=8192;var $={};a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array),a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);s>i&&e[i]===t[i];)++i;return i!==s&&(r=e[i],n=t[i]),n>r?-1:r>n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!K(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new a(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new a(t),i=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(n,i),i+=s.length}return n},a.byteLength=v,a.prototype.length=void 0,a.prototype.parent=void 0,a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):b.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},a.prototype.compare=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:a.compare(this,e)},a.prototype.indexOf=function(e,t){function r(e,t,r){for(var n=-1,i=0;r+i<e.length;i++)if(e[r+i]===t[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===t.length)return r+n}else n=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(a.isBuffer(e))return r(this,e,t);if("number"==typeof e)return a.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},a.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},a.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=t,t=0|r,r=i}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return S(this,e,t,r);case"binary":return A(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(a.TYPED_ARRAY_SUPPORT)n=a._augment(this.subarray(e,t));else{var i=t-e;n=new a(i,void 0);for(var s=0;i>s;s++)n[s]=this[s+e]}return n.length&&(n.parent=this.parent||this),n},a.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},a.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},a.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=0,s=1,o=0>e?1:0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0>e?1:0;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&t>r&&n>t)for(i=s-1;i>=0;i--)e[i+t]=this[i+r];else if(1e3>s||!a.TYPED_ARRAY_SUPPORT)for(i=0;s>i;i++)e[i+t]=this[i+r];else e._set(this.subarray(r,r+s),t);return s},a.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var i=G(e.toString()),a=i.length;for(n=t;r>n;n++)this[n]=i[n%a]}return this}},a.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(a.TYPED_ARRAY_SUPPORT)return new a(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Z=a.prototype;a._augment=function(e){return e.constructor=a,e._isBuffer=!0,e._set=e.set,e.get=Z.get,e.set=Z.set,e.write=Z.write,e.toString=Z.toString,e.toLocaleString=Z.toString,e.toJSON=Z.toJSON,e.equals=Z.equals,e.compare=Z.compare,e.indexOf=Z.indexOf,e.copy=Z.copy,e.slice=Z.slice,e.readUIntLE=Z.readUIntLE,e.readUIntBE=Z.readUIntBE,e.readUInt8=Z.readUInt8,e.readUInt16LE=Z.readUInt16LE,e.readUInt16BE=Z.readUInt16BE,e.readUInt32LE=Z.readUInt32LE,e.readUInt32BE=Z.readUInt32BE,e.readIntLE=Z.readIntLE,e.readIntBE=Z.readIntBE,e.readInt8=Z.readInt8,e.readInt16LE=Z.readInt16LE,e.readInt16BE=Z.readInt16BE,e.readInt32LE=Z.readInt32LE,e.readInt32BE=Z.readInt32BE,e.readFloatLE=Z.readFloatLE,e.readFloatBE=Z.readFloatBE,e.readDoubleLE=Z.readDoubleLE,e.readDoubleBE=Z.readDoubleBE,e.writeUInt8=Z.writeUInt8,e.writeUIntLE=Z.writeUIntLE,e.writeUIntBE=Z.writeUIntBE,e.writeUInt16LE=Z.writeUInt16LE,e.writeUInt16BE=Z.writeUInt16BE,e.writeUInt32LE=Z.writeUInt32LE,e.writeUInt32BE=Z.writeUInt32BE,e.writeIntLE=Z.writeIntLE,e.writeIntBE=Z.writeIntBE,e.writeInt8=Z.writeInt8,e.writeInt16LE=Z.writeInt16LE,e.writeInt16BE=Z.writeInt16BE,e.writeInt32LE=Z.writeInt32LE,e.writeInt32BE=Z.writeInt32BE,e.writeFloatLE=Z.writeFloatLE,e.writeFloatBE=Z.writeFloatBE,e.writeDoubleLE=Z.writeDoubleLE,e.writeDoubleBE=Z.writeDoubleBE,e.fill=Z.fill,e.inspect=Z.inspect,e.toArrayBuffer=Z.toArrayBuffer,e};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{4:4,5:5,6:6}],4:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s||t===c?62:t===o||t===f?63:u>t?-1:u+10>t?t-u+26+26:l+26>t?t-l:p+26>t?t-p+26:void 0}function r(e){function r(e){p[c++]=e}var n,i,s,o,u,p;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;u="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,p=new a(3*e.length/4-u),s=u>0?e.length-4:e.length;var c=0;for(n=0,i=0;s>n;n+=4,i+=3)o=t(e.charAt(n))<<18|t(e.charAt(n+1))<<12|t(e.charAt(n+2))<<6|t(e.charAt(n+3)),r((16711680&o)>>16),r((65280&o)>>8),r(255&o);return 2===u?(o=t(e.charAt(n))<<2|t(e.charAt(n+1))>>4,r(255&o)):1===u&&(o=t(e.charAt(n))<<10|t(e.charAt(n+1))<<4|t(e.charAt(n+2))>>2,r(o>>8&255),r(255&o)),p}function i(e){function t(e){return n.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,a,s,o=e.length%3,u="";for(i=0,s=e.length-o;s>i;i+=3)a=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u+=r(a);switch(o){case 1:a=e[e.length-1],u+=t(a>>2),u+=t(a<<4&63),u+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],u+=t(a>>10),u+=t(a>>4&63),u+=t(a<<2&63),u+="="}return u}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),o="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),l="A".charCodeAt(0),c="-".charCodeAt(0),f="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],5:[function(e,t,r){r.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,p=u>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=e[t+c];for(c+=f,a=d&(1<<-l)-1,d>>=-l,l+=o;l>0;a=256*a+e[t+c],c+=f,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+c],c+=f,l-=8);if(0===a)a=1-p;else{if(a===u)return s?NaN:(d?-1:1)*(1/0);s+=Math.pow(2,n),a-=p}return(d?-1:1)*s*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var s,o,u,p=8*a-i-1,l=(1<<p)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,h=n?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+c>=1?f/u:f*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=l?(o=0,s=l):s+c>=1?(o=(t*u-1)*Math.pow(2,i),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&o,d+=h,o/=256,i-=8);for(s=s<<i|o,p+=i;p>0;e[r+d]=255&s,d+=h,s/=256,p-=8);e[r+d-h]|=128*m}},{}],6:[function(e,t,r){var n=Array.isArray,i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],7:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],8:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},{}],9:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return i.exec(e).slice(1)};r.resolve=function(){for(var r="",i=!1,a=arguments.length-1;a>=-1&&!i;a--){var s=a>=0?arguments[a]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,i="/"===s.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),a="/"===s(e,-1);return e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),a=n(t.split("/")),s=Math.min(i.length,a.length),o=s,u=0;s>u;u++)if(i[u]!==a[u]){o=u;break}for(var p=[],u=o;u<i.length;u++)p.push("..");return p=p.concat(a.slice(o)),p.join("/")},r.sep="/",r.delimiter=":",r.dirname=function(e){var t=a(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(e,t){var r=a(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){return a(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return 0>t&&(t=e.length+t),e.substr(t,r)}}).call(this,e(10))},{10:10}],10:[function(e,t,r){function n(){l=!1,o.length?p=o.concat(p):c=-1,p.length&&i()}function i(){if(!l){var e=setTimeout(n);l=!0;for(var t=p.length;t;){for(o=p,p=[];++c<t;)o&&o[c].run();c=-1,t=p.length}o=null,l=!1,clearTimeout(e)}}function a(e,t){this.fun=e,this.array=t}function s(){}var o,u=t.exports={},p=[],l=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];p.push(new a(e,t)),1!==p.length||l||setTimeout(i,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=s,u.addListener=s,u.once=s,u.off=s,u.removeListener=s,u.removeAllListeners=s,u.emit=s,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],11:[function(e,t,r){function n(){throw new Error("tty.ReadStream is not implemented")}function i(){throw new Error("tty.ReadStream is not implemented")}r.isatty=function(){return!1},r.ReadStream=n,r.WriteStream=i},{}],12:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],13:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),u(n,e,n.depth)}function a(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function o(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&w(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=u(e,i,n)),i}var a=p(e,t);if(a)return a;var s=Object.keys(t),m=o(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),C(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(w(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(S(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(D(t))return e.stylize(Date.prototype.toString.call(t),"date");if(C(t))return l(t)}var g="",v=!1,E=["{","}"];if(h(t)&&(v=!0,E=["[","]"]),w(t)){var x=t.name?": "+t.name:"";g=" [Function"+x+"]"}if(S(t)&&(g=" "+RegExp.prototype.toString.call(t)),D(t)&&(g=" "+Date.prototype.toUTCString.call(t)),C(t)&&(g=" "+l(t)),0===s.length&&(!v||0==t.length))return E[0]+g+E[1];if(0>n)return S(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return A=v?c(e,t,n,m,s):s.map(function(r){return f(e,t,n,m,r,v)}),e.seen.pop(),d(A,g,E)}function p(e,t){if(x(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,n,i){for(var a=[],s=0,o=t.length;o>s;++s)P(t,String(s))?a.push(f(e,t,r,n,String(s),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(f(e,t,r,n,i,!0))}),a}function f(e,t,r,n,i,a){var s,o,p;if(p=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},p.get?o=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(o=e.stylize("[Setter]","special")),P(n,i)||(s="["+i+"]"),o||(e.seen.indexOf(p.value)<0?(o=y(r)?u(e,p.value,null):u(e,p.value,r-1),o.indexOf("\n")>-1&&(o=a?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),x(s)){if(a&&i.match(/^\d+$/))return o; s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function d(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function y(e){return null===e}function g(e){return null==e}function v(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function x(e){return void 0===e}function S(e){return A(e)&&"[object RegExp]"===_(e)}function A(e){return"object"==typeof e&&null!==e}function D(e){return A(e)&&"[object Date]"===_(e)}function C(e){return A(e)&&("[object Error]"===_(e)||e instanceof Error)}function w(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(e){return Object.prototype.toString.call(e)}function F(e){return 10>e?"0"+e.toString(10):e.toString(10)}function k(){var e=new Date,t=[F(e.getHours()),F(e.getMinutes()),F(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,a=n.length,s=String(e).replace(B,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}}),o=n[r];a>r;o=n[++r])s+=y(o)||!A(o)?" "+o:" "+i(o);return s},r.deprecate=function(e,i){function a(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(x(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return a};var T,M={};r.debuglog=function(e){if(x(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var n=t.pid;M[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else M[e]=function(){};return M[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=h,r.isBoolean=m,r.isNull=y,r.isNullOrUndefined=g,r.isNumber=v,r.isString=b,r.isSymbol=E,r.isUndefined=x,r.isRegExp=S,r.isObject=A,r.isDate=D,r.isError=C,r.isFunction=w,r.isPrimitive=I,r.isBuffer=e(12);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",k(),r.format.apply(r,arguments))},r.inherits=e(7),r._extend=function(e,t){if(!t||!A(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,12:12,7:7}],14:[function(e,t,r){(function(r){"use strict";e(15);var n=t.exports=e(66);n.options=e(49),n.version=e(603).version,n.transform=n,n.run=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.sourceMaps="inline",new Function(n(e,t).code)()},n.load=function(e,t,i,a){void 0===i&&(i={}),i.filename=i.filename||e;var s=r.ActiveXObject?new r.ActiveXObject("Microsoft.XMLHTTP"):new r.XMLHttpRequest;s.open("GET",e,!0),"overrideMimeType"in s&&s.overrideMimeType("text/plain"),s.onreadystatechange=function(){if(4===s.readyState){var r=s.status;if(0!==r&&200!==r)throw new Error("Could not load "+e);var o=[s.responseText,i];a||n.run.apply(n,o),t&&t(o)}},s.send(null)};var i=function(){for(var e=[],t=["text/ecmascript-6","text/6to5","text/babel","module"],i=0,a=function l(){var t=e[i];t instanceof Array&&(n.run.apply(n,t),i++,l())},s=function(t,r){var i={};t.src?n.load(t.src,function(t){e[r]=t,a()},i,!0):(i.filename="embedded",e[r]=[t.innerHTML,i])},o=r.document.getElementsByTagName("script"),u=0;u<o.length;++u){var p=o[u];t.indexOf(p.type)>=0&&e.push(p)}for(u in e)s(e[u],u);a()};r.addEventListener?r.addEventListener("DOMContentLoaded",i,!1):r.attachEvent&&r.attachEvent("onload",i)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{15:15,49:49,603:603,66:66}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(t){var r=e(17);return null!=t&&r(t),r}function o(){e(44)}function u(e,t,r){f["default"](t)&&(r=t,t={}),t.filename=e,E["default"].readFile(e,function(e,n){if(e)return r(e);var i;try{i=h["default"](n,t)}catch(e){return r(e)}r(null,i)})}function p(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.filename=e,h["default"](E["default"].readFileSync(e,"utf8"),t)}function l(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.allowHashBang=!0,t.sourceType="module",t.ecmaVersion=1/0,t.plugins={jsx:!0,flow:!0},t.features={};for(var r in h["default"].pipeline.transformers)t.features[r]=!0;var n=y.parse(e,t);if(t.onToken){var i;(i=t.onToken).push.apply(i,n.tokens)}if(t.onComment){var a;(a=t.onComment).push.apply(a,n.comments)}return n.program}r.__esModule=!0,r.register=s,r.polyfill=o,r.transformFile=u,r.transformFileSync=p,r.parse=l;var c=e(500),f=a(c),d=e(66),h=a(d),m=e(605),y=i(m),g=e(182),v=i(g),b=e(1),E=a(b),x=e(179),S=i(x);r.util=v,r.acorn=y,r.transform=h["default"],r.pipeline=d.pipeline,r.canCompile=g.canCompile;var A=e(46);r.File=n(A);var D=e(48);r.options=n(D);var C=e(82);r.Plugin=n(C);var w=e(83);r.Transformer=n(w);var I=e(80);r.Pipeline=n(I);var _=e(148);r.traverse=n(_);var F=e(45);r.buildExternalHelpers=n(F);var k=e(603);r.version=k.version,r.types=S},{1:1,148:148,17:17,179:179,182:182,44:44,45:45,46:46,48:48,500:500,603:603,605:605,66:66,80:80,82:82,83:83}],16:[function(e,t,r){"use strict";r.__esModule=!0,e(44),r["default"]=function(){},t.exports=r["default"]},{44:44}],17:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}r.__esModule=!0,e(44);var i=e(16);r["default"]=n(i),t.exports=r["default"]},{16:16,44:44}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(584),s=n(a),o=e(601),u=n(o),p=e(498),l=n(p),c=e(413),f=n(c),d=e(502),h=n(d),m=function(){function e(t,r){i(this,e),this.parenPushNewlineState=null,this.position=t,this._indent=r.indent.base,this.format=r,this.buf=""}return e.prototype.get=function(){return u["default"](this.buf)},e.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":s["default"](this.format.indent.style,this._indent)},e.prototype.indentSize=function(){return this.getIndent().length},e.prototype.indent=function(){this._indent++},e.prototype.dedent=function(){this._indent--},e.prototype.semicolon=function(){this.push(";")},e.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},e.prototype.rightBrace=function(){this.newline(!0),this.push("}")},e.prototype.keyword=function(e){this.push(e),this.space()},e.prototype.space=function(e){(e||!this.format.compact)&&(e||this.buf&&!this.isLast(" ")&&!this.isLast("\n"))&&this.push(" ")},e.prototype.removeLast=function(e){return this.format.compact?void 0:this._removeLast(e)},e.prototype._removeLast=function(e){this._isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},e.prototype.startTerminatorless=function(){return this.parenPushNewlineState={printed:!1}},e.prototype.endTerminatorless=function(e){e.printed&&(this.dedent(),this.newline(),this.push(")"))},e.prototype.newline=function(e,t){if(!this.format.compact&&!this.format.retainLines){if(this.format.concise)return void this.space();if(t=t||!1,h["default"](e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(t),e--}else l["default"](e)&&(t=e),this._newline(t)}},e.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},e.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var t=this.buf.length-1;t>e&&" "===this.buf[t];)t--;t===e&&(this.buf=this.buf.substring(0,t+1))}},e.prototype.push=function(e,t){if(!this.format.compact&&this._indent&&!t&&"\n"!==e){var r=this.getIndent();e=e.replace(/\n/g,"\n"+r),this.isLast("\n")&&this._push(r)}this._push(e)},e.prototype._push=function(e){var t=this.parenPushNewlineState;if(t)for(var r=0;r<e.length;r++){var n=e[r];if(" "!==n){this.parenPushNewlineState=null,("\n"===n||"/"===n)&&(this._push("("),this.indent(),t.printed=!0);break}}this.position.push(e),this.buf+=e},e.prototype.endsWith=function(e){var t=arguments.length<=1||void 0===arguments[1]?this.buf:arguments[1];return 1===e.length?t[t.length-1]===e:t.slice(-e.length)===e},e.prototype.isLast=function(e){return this.format.compact?!1:this._isLast(e)},e.prototype._isLast=function(e){var t=this.buf,r=t[t.length-1];return Array.isArray(e)?f["default"](e,r):e===r},e}();r["default"]=m,t.exports=r["default"]},{413:413,498:498,502:502,584:584,601:601}],19:[function(e,t,r){"use strict";function n(e,t){t.plain(e.program)}function i(e,t){t.sequence(e.body)}function a(e,t){this.push("{"),e.body.length?(this.newline(),t.sequence(e.body,{indent:!0}),this.format.retainLines||this.removeLast("\n"),this.rightBrace()):(t.printInnerComments(),this.push("}"))}function s(){}r.__esModule=!0,r.File=n,r.Program=i,r.BlockStatement=a,r.Noop=s},{}],20:[function(e,t,r){"use strict";function n(e,t){t.list(e.decorators,{separator:""}),this.push("class"),e.id&&(this.push(" "),t.plain(e.id)),t.plain(e.typeParameters),e.superClass&&(this.push(" extends "),t.plain(e.superClass),t.plain(e.superTypeParameters)),e["implements"]&&(this.push(" implements "),t.join(e["implements"],{separator:", "})),this.space(),t.plain(e.body)}function i(e,t){this.push("{"),0===e.body.length?(t.printInnerComments(),this.push("}")):(this.newline(),this.indent(),t.sequence(e.body),this.dedent(),this.rightBrace())}function a(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),t.plain(e.key),t.plain(e.typeAnnotation),e.value&&(this.space(),this.push("="),this.space(),t.plain(e.value)),this.semicolon()}function s(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),this._method(e,t)}r.__esModule=!0,r.ClassDeclaration=n,r.ClassBody=i,r.ClassProperty=a,r.MethodDefinition=s,r.ClassExpression=n},{}],21:[function(e,t,r){"use strict";function n(e,t){this.keyword("for"),this.push("("),t.plain(e.left),this.push(" of "),t.plain(e.right),this.push(")")}function i(e,t){this.push(e.generator?"(":"["),t.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),t.plain(e.filter),this.push(")"),this.space()),t.plain(e.body),this.push(e.generator?")":"]")}r.__esModule=!0,r.ComprehensionBlock=n,r.ComprehensionExpression=i},{}],22:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=/[a-z]$/.test(e.operator),n=e.argument;(k.isUpdateExpression(n)||k.isUnaryExpression(n))&&(r=!0),k.isUnaryExpression(n)&&"!"===n.operator&&(r=!1),this.push(e.operator),r&&this.push(" "),t.plain(e.argument)}function s(e,t){this.push("do"),this.space(),t.plain(e.body)}function o(e,t){this.push("("),t.plain(e.expression),this.push(")")}function u(e,t){e.prefix?(this.push(e.operator),t.plain(e.argument)):(t.plain(e.argument),this.push(e.operator))}function p(e,t){t.plain(e.test),this.space(),this.push("?"),this.space(),t.plain(e.consequent),this.space(),this.push(":"),this.space(),t.plain(e.alternate)}function l(e,t){this.push("new "),t.plain(e.callee),this.push("("),t.list(e.arguments),this.push(")")}function c(e,t){t.list(e.expressions)}function f(){this.push("this")}function d(){this.push("super")}function h(e,t){this.push("@"),t.plain(e.expression),this.newline()}function m(e,t){t.plain(e.callee),this.push("(");var r,n=e._prettyCall&&!this.format.retainLines&&!this.format.compact;n&&(r=",\n",this.newline(),this.indent()),t.list(e.arguments,{separator:r}),n&&(this.newline(),this.dedent()),this.push(")")}function y(){this.semicolon()}function g(e,t){t.plain(e.expression),this.semicolon()}function v(e,t){t.plain(e.left),this.push(" = "),t.plain(e.right)}function b(e,t,r){var n=this._inForStatementInit&&"in"===e.operator&&!_["default"].needsParens(e,r);n&&this.push("("),t.plain(e.left);var i="in"===e.operator||"instanceof"===e.operator;i=!0,this.space(i),this.push(e.operator),i||(i="<"===e.operator&&k.isUnaryExpression(e.right,{prefix:!0,operator:"!"})&&k.isUnaryExpression(e.right.argument,{prefix:!0,operator:"--"})),this.space(i),t.plain(e.right),n&&this.push(")")}function E(e,t){t.plain(e.object),this.push("::"),t.plain(e.callee)}function x(e,t){var r=e.object;if(t.plain(r),!e.computed&&k.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var n=e.computed;if(k.isLiteral(e.property)&&w["default"](e.property.value)&&(n=!0),n)this.push("["),t.plain(e.property),this.push("]");else{if(k.isLiteral(e.object)){var i=this._Literal(e.object);!D["default"](+i)||P.test(i)||this.endsWith(".")||B.test(i)||this.push(".")}this.push("."),t.plain(e.property)}}function S(e,t){t.plain(e.meta),this.push("."),t.plain(e.property)}r.__esModule=!0,r.UnaryExpression=a,r.DoExpression=s,r.ParenthesizedExpression=o,r.UpdateExpression=u,r.ConditionalExpression=p,r.NewExpression=l,r.SequenceExpression=c,r.ThisExpression=f,r.Super=d,r.Decorator=h,r.CallExpression=m,r.EmptyStatement=y,r.ExpressionStatement=g,r.AssignmentPattern=v,r.AssignmentExpression=b,r.BindExpression=E,r.MemberExpression=x,r.MetaProperty=S;var A=e(398),D=i(A),C=e(502),w=i(C),I=e(31),_=i(I),F=e(179),k=n(F),P=/e/i,B=/^0(b|o|x)/i,T=function(e){return function(t,r){if(this.push(e),(t.delegate||t.all)&&this.push("*"),t.argument){this.push(" ");var n=this.startTerminatorless();r.plain(t.argument),this.endTerminatorless(n)}}},M=T("yield");r.YieldExpression=M;var O=T("await");r.AwaitExpression=O,r.BinaryExpression=b,r.LogicalExpression=b},{179:179,31:31,398:398,502:502}],23:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){this.push("any")}function a(e,t){t.plain(e.elementType),this.push("["),this.push("]")}function s(){this.push("bool")}function o(e){this.push(e.value?"true":"false")}function u(e,t){this.push("declare class "),this._interfaceish(e,t)}function p(e,t){this.push("declare function "),t.plain(e.id),t.plain(e.id.typeAnnotation.typeAnnotation),this.semicolon()}function l(e,t){this.push("declare module "),t.plain(e.id),this.space(),t.plain(e.body)}function c(e,t){this.push("declare var "),t.plain(e.id),t.plain(e.id.typeAnnotation),this.semicolon()}function f(e,t,r){t.plain(e.typeParameters),this.push("("),t.list(e.params),e.rest&&(e.params.length&&(this.push(","),this.space()),this.push("..."),t.plain(e.rest)),this.push(")"),"ObjectTypeProperty"===r.type||"ObjectTypeCallProperty"===r.type||"DeclareFunction"===r.type?this.push(":"):(this.space(),this.push("=>")),this.space(),t.plain(e.returnType)}function d(e,t){t.plain(e.name),e.optional&&this.push("?"),this.push(":"),this.space(),t.plain(e.typeAnnotation)}function h(e,t){t.plain(e.id),t.plain(e.typeParameters)}function m(e,t){t.plain(e.id),t.plain(e.typeParameters),e["extends"].length&&(this.push(" extends "),t.join(e["extends"],{separator:", "})),this.space(),t.plain(e.body)}function y(e,t){this.push("interface "),this._interfaceish(e,t)}function g(e,t){t.join(e.types,{separator:" & "})}function v(){this.push("mixed")}function b(e,t){this.push("?"),t.plain(e.typeAnnotation)}function E(){this.push("number")}function x(e){this.push(this._stringLiteral(e.value))}function S(){this.push("string")}function A(e,t){this.push("["),t.join(e.types,{separator:", "}),this.push("]")}function D(e,t){this.push("typeof "),t.plain(e.argument)}function C(e,t){this.push("type "),t.plain(e.id),t.plain(e.typeParameters),this.space(),this.push("="),this.space(),t.plain(e.right),this.semicolon()}function w(e,t){this.push(":"),this.space(),e.optional&&this.push("?"),t.plain(e.typeAnnotation)}function I(e,t){this.push("<"),t.join(e.params,{separator:", ",iterator:function(e){t.plain(e.typeAnnotation)}}),this.push(">")}function _(e,t){var r=this;this.push("{");var n=e.properties.concat(e.callProperties,e.indexers);n.length&&(this.space(),t.list(n,{separator:!1,indent:!0,iterator:function(){1!==n.length&&(r.semicolon(),r.space())}}),this.space()),this.push("}")}function F(e,t){e["static"]&&this.push("static "),t.plain(e.value)}function k(e,t){e["static"]&&this.push("static "),this.push("["),t.plain(e.id),this.push(":"),this.space(),t.plain(e.key),this.push("]"),this.push(":"),this.space(),t.plain(e.value)}function P(e,t){e["static"]&&this.push("static "),t.plain(e.key),e.optional&&this.push("?"),L.isFunctionTypeAnnotation(e.value)||(this.push(":"),this.space()),t.plain(e.value)}function B(e,t){t.plain(e.qualification),this.push("."),t.plain(e.id)}function T(e,t){t.join(e.types,{separator:" | "})}function M(e,t){this.push("("),t.plain(e.expression),t.plain(e.typeAnnotation),this.push(")")}function O(){this.push("void")}r.__esModule=!0,r.AnyTypeAnnotation=i,r.ArrayTypeAnnotation=a,r.BooleanTypeAnnotation=s,r.BooleanLiteralTypeAnnotation=o,r.DeclareClass=u,r.DeclareFunction=p,r.DeclareModule=l,r.DeclareVariable=c,r.FunctionTypeAnnotation=f,r.FunctionTypeParam=d,r.InterfaceExtends=h,r._interfaceish=m,r.InterfaceDeclaration=y,r.IntersectionTypeAnnotation=g,r.MixedTypeAnnotation=v,r.NullableTypeAnnotation=b,r.NumberTypeAnnotation=E,r.StringLiteralTypeAnnotation=x,r.StringTypeAnnotation=S,r.TupleTypeAnnotation=A,r.TypeofTypeAnnotation=D,r.TypeAlias=C,r.TypeAnnotation=w,r.TypeParameterInstantiation=I,r.ObjectTypeAnnotation=_,r.ObjectTypeCallProperty=F,r.ObjectTypeIndexer=k,r.ObjectTypeProperty=P,r.QualifiedTypeIdentifier=B,r.UnionTypeAnnotation=T,r.TypeCastExpression=M,r.VoidTypeAnnotation=O;var j=e(179),L=n(j);r.ClassImplements=h,r.GenericTypeAnnotation=h;var N=e(29);r.NumberLiteralTypeAnnotation=N.Literal,r.TypeParameterDeclaration=I},{179:179,29:29}],24:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.name),e.value&&(this.push("="),t.plain(e.value))}function a(e){this.push(e.name)}function s(e,t){t.plain(e.namespace),this.push(":"),t.plain(e.name)}function o(e,t){t.plain(e.object),this.push("."),t.plain(e.property)}function u(e,t){this.push("{..."),t.plain(e.argument),this.push("}")}function p(e,t){this.push("{"),t.plain(e.expression),this.push("}")}function l(e,t){var r=e.openingElement;if(t.plain(r),!r.selfClosing){this.indent();for(var n=e.children,i=0;i<n.length;i++){var a=n[i];m.isLiteral(a)?this.push(a.value,!0):t.plain(a)}this.dedent(),t.plain(e.closingElement)}}function c(e,t){this.push("<"),t.plain(e.name),e.attributes.length>0&&(this.push(" "),t.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")}function f(e,t){this.push("</"),t.plain(e.name),this.push(">")}function d(){}r.__esModule=!0,r.JSXAttribute=i,r.JSXIdentifier=a,r.JSXNamespacedName=s,r.JSXMemberExpression=o,r.JSXSpreadAttribute=u,r.JSXExpressionContainer=p,r.JSXElement=l,r.JSXOpeningElement=c,r.JSXClosingElement=f,r.JSXEmptyExpression=d;var h=e(179),m=n(h)},{179:179}],25:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=this;t.plain(e.typeParameters),this.push("("),t.list(e.params,{iterator:function(e){e.optional&&r.push("?"),t.plain(e.typeAnnotation)}}),this.push(")"),e.returnType&&t.plain(e.returnType)}function a(e,t){var r=e.value,n=e.kind,i=e.key;("method"===n||"init"===n)&&r.generator&&this.push("*"),("get"===n||"set"===n)&&this.push(n+" "),r.async&&this.push("async "),e.computed?(this.push("["),t.plain(i),this.push("]")):t.plain(i),this._params(r,t),this.space(),t.plain(r.body)}function s(e,t){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),t.plain(e.id)):this.space(),this._params(e,t),this.space(),t.plain(e.body)}function o(e,t){e.async&&this.push("async "),1===e.params.length&&p.isIdentifier(e.params[0])?t.plain(e.params[0]):this._params(e,t),this.push(" => ");var r=p.isObjectExpression(e.body);r&&this.push("("),t.plain(e.body),r&&this.push(")")}r.__esModule=!0,r._params=i,r._method=a,r.FunctionExpression=s,r.ArrowFunctionExpression=o;var u=e(179),p=n(u);r.FunctionDeclaration=s},{179:179}],26:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.imported),e.local&&e.local.name!==e.imported.name&&(this.push(" as "),t.plain(e.local))}function a(e,t){t.plain(e.local)}function s(e,t){t.plain(e.exported)}function o(e,t){t.plain(e.local),e.exported&&e.local.name!==e.exported.name&&(this.push(" as "),t.plain(e.exported))}function u(e,t){this.push("* as "),t.plain(e.exported)}function p(e,t){this.push("export *"),e.exported&&(this.push(" as "),t.plain(e.exported)),this.push(" from "),t.plain(e.source),this.semicolon()}function l(e,t){this.push("export "),f.call(this,e,t)}function c(e,t){this.push("export default "),f.call(this,e,t)}function f(e,t){var r=e.specifiers;if(e.declaration){var n=e.declaration;if(t.plain(n),y.isStatement(n)||y.isFunction(n)||y.isClass(n))return}else{"type"===e.exportKind&&this.push("type ");var i=r[0],a=!1;(y.isExportDefaultSpecifier(i)||y.isExportNamespaceSpecifier(i))&&(a=!0,t.plain(r.shift()),r.length&&this.push(", ")),(r.length||!r.length&&!a)&&(this.push("{"),r.length&&(this.space(),t.join(r,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),t.plain(e.source))}this.ensureSemicolon()}function d(e,t){this.push("import "),("type"===e.importKind||"typeof"===e.importKind)&&this.push(e.importKind+" ");var r=e.specifiers;if(r&&r.length){var n=e.specifiers[0];(y.isImportDefaultSpecifier(n)||y.isImportNamespaceSpecifier(n))&&(t.plain(e.specifiers.shift()),e.specifiers.length&&this.push(", ")),e.specifiers.length&&(this.push("{"),this.space(),t.join(e.specifiers,{separator:", "}),this.space(),this.push("}")),this.push(" from ")}t.plain(e.source),this.semicolon()}function h(e,t){this.push("* as "),t.plain(e.local)}r.__esModule=!0,r.ImportSpecifier=i,r.ImportDefaultSpecifier=a,r.ExportDefaultSpecifier=s,r.ExportSpecifier=o,r.ExportNamespaceSpecifier=u,r.ExportAllDeclaration=p,r.ExportNamedDeclaration=l,r.ExportDefaultDeclaration=c,r.ImportDeclaration=d,r.ImportNamespaceSpecifier=h;var m=e(179),y=n(m)},{179:179}],27:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){this.keyword("with"),this.push("("),t.plain(e.object),this.push(")"),t.block(e.body)}function s(e,t){this.keyword("if"),this.push("("),t.plain(e.test),this.push(")"),this.space(),t.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),t.indentOnComments(e.alternate))}function o(e,t){this.keyword("for"),this.push("("),this._inForStatementInit=!0,t.plain(e.init),this._inForStatementInit=!1,this.push(";"),e.test&&(this.space(),t.plain(e.test)),this.push(";"),e.update&&(this.space(),t.plain(e.update)),this.push(")"),t.block(e.body)}function u(e,t){this.keyword("while"),this.push("("),t.plain(e.test),this.push(")"),t.block(e.body)}function p(e,t){this.push("do "),t.plain(e.body),this.space(),this.keyword("while"),this.push("("),t.plain(e.test),this.push(");")}function l(e,t){t.plain(e.label),this.push(": "),t.plain(e.body)}function c(e,t){this.keyword("try"),t.plain(e.block),this.space(),e.handlers?t.plain(e.handlers[0]):t.plain(e.handler),e.finalizer&&(this.space(),this.push("finally "),t.plain(e.finalizer))}function f(e,t){this.keyword("catch"),this.push("("),t.plain(e.param),this.push(") "),t.plain(e.body)}function d(e,t){this.keyword("switch"),this.push("("),t.plain(e.discriminant),this.push(")"),this.space(),this.push("{"),t.sequence(e.cases,{indent:!0,addNewlines:function(t,r){return t||e.cases[e.cases.length-1]!==r?void 0:-1}}),this.push("}")}function h(e,t){e.test?(this.push("case "),t.plain(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),t.sequence(e.consequent,{indent:!0}))}function m(){this.push("debugger;")}function y(e,t,r){this.push(e.kind+" ");var n=!1;if(!x.isFor(r))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];s.init&&(n=!0)}var o;this.format.compact||this.format.concise||!n||this.format.retainLines||(o=",\n"+b["default"](" ",e.kind.length+1)),t.list(e.declarations,{separator:o}),(!x.isFor(r)||r.left!==e&&r.init!==e)&&this.semicolon()}function g(e,t){t.plain(e.id),t.plain(e.id.typeAnnotation),e.init&&(this.space(),this.push("="),this.space(),t.plain(e.init))}r.__esModule=!0,r.WithStatement=a,r.IfStatement=s,r.ForStatement=o,r.WhileStatement=u,r.DoWhileStatement=p,r.LabeledStatement=l,r.TryStatement=c,r.CatchClause=f,r.SwitchStatement=d,r.SwitchCase=h,r.DebuggerStatement=m,r.VariableDeclaration=y,r.VariableDeclarator=g;var v=e(584),b=i(v),E=e(179),x=n(E),S=function(e){return function(t,r){this.keyword("for"),this.push("("),r.plain(t.left),this.push(" "+e+" "),r.plain(t.right),this.push(")"),r.block(t.body)}},A=S("in");r.ForInStatement=A;var D=S("of");r.ForOfStatement=D;var C=function(e){var t=arguments.length<=1||void 0===arguments[1]?"label":arguments[1];return function(r,n){this.push(e);var i=r[t];if(i){this.push(" ");var a=this.startTerminatorless();n.plain(i),this.endTerminatorless(a)}this.semicolon()}},w=C("continue");r.ContinueStatement=w;var I=C("return","argument");r.ReturnStatement=I;var _=C("break");r.BreakStatement=_;var F=C("throw","argument");r.ThrowStatement=F},{179:179,584:584}],28:[function(e,t,r){"use strict";function n(e,t){t.plain(e.tag),t.plain(e.quasi)}function i(e){this._push(e.value.raw)}function a(e,t){this.push("`");for(var r=e.quasis,n=r.length,i=0;n>i;i++)t.plain(r[i]),n>i+1&&(this.push("${ "),t.plain(e.expressions[i]),this.push(" }"));this._push("`")}r.__esModule=!0,r.TaggedTemplateExpression=n,r.TemplateElement=i,r.TemplateLiteral=a},{}],29:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){this.push(e.name)}function a(e,t){this.push("..."),t.plain(e.argument)}function s(e,t){var r=e.properties;this.push("{"),t.printInnerComments(),r.length&&(this.space(),t.list(r,{indent:!0}),this.space()),this.push("}")}function o(e,t){if(t.list(e.decorators,{separator:""}),e.method||"get"===e.kind||"set"===e.kind)this._method(e,t);else{if(e.computed)this.push("["),t.plain(e.key),this.push("]");else{if(d.isAssignmentPattern(e.value)&&d.isIdentifier(e.key)&&e.key.name===e.value.left.name)return void t.plain(e.value);if(t.plain(e.key),e.shorthand&&d.isIdentifier(e.key)&&d.isIdentifier(e.value)&&e.key.name===e.value.name)return}this.push(":"),this.space(),t.plain(e.value)}}function u(e,t){var r=e.elements,n=r.length;this.push("["),t.printInnerComments();for(var i=0;i<r.length;i++){var a=r[i];a?(i>0&&this.space(),t.plain(a),n-1>i&&this.push(",")):this.push(",")}this.push("]")}function p(e){this.push(""),this._push(this._Literal(e))}function l(e){var t=e.value;if(e.regex)return"/"+e.regex.pattern+"/"+e.regex.flags;if(null!=e.raw&&null!=e.rawValue&&t===e.rawValue)return e.raw;switch(typeof t){case"string":return this._stringLiteral(t);case"number":return t+"";case"boolean":return t?"true":"false";default:if(null===t)return"null";throw new Error("Invalid Literal type")}}function c(e){return e=JSON.stringify(e),e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),"single"===this.format.quotes&&(e=e.slice(1,-1),e=e.replace(/\\"/g,'"'),e=e.replace(/'/g,"\\'"),e="'"+e+"'"),e}r.__esModule=!0,r.Identifier=i,r.RestElement=a,r.ObjectExpression=s,r.Property=o,r.ArrayExpression=u,r.Literal=p,r._Literal=l,r._stringLiteral=c;var f=e(179),d=n(f);r.SpreadElement=a,r.SpreadProperty=a,r.ObjectPattern=s,r.ArrayPattern=u},{179:179}],30:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(391),u=i(o),p=e(37),l=i(p),c=e(33),f=i(c),d=e(584),h=i(d),m=e(36),y=i(m),g=e(35),v=i(g),b=e(43),E=n(b),x=e(18),S=i(x),A=e(511),D=i(A),C=e(411),w=i(C),I=e(31),_=i(I),F=e(179),k=n(F),P=function(){function t(e,r,n){a(this,t),r=r||{},this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=t.normalizeOptions(n,r,this.tokens),this.opts=r,this.ast=e,this.whitespace=new l["default"](this.tokens),this.position=new v["default"],this.map=new y["default"](this.position,r,n),this.buffer=new S["default"](this.position,this.format)}return t.normalizeOptions=function(e,r,n){var i=" ";if(e){var a=u["default"](e).indent;a&&" "!==a&&(i=a)}var s={shouldPrintComment:r.shouldPrintComment,retainLines:r.retainLines,comments:null==r.comments||r.comments,compact:r.compact,quotes:t.findCommonStringDelimiter(e,n),indent:{adjustMultilineComment:!0,style:i,base:0}};return"auto"===s.compact&&(s.compact=e.length>1e5,s.compact&&console.error("[BABEL] "+E.get("codeGeneratorDeopt",r.filename,"100KB"))),s.compact&&(s.indent.adjustMultilineComment=!1),s},t.findCommonStringDelimiter=function(e,t){for(var r={single:0,"double":0},n=0,i=0;i<t.length;i++){var a=t[i];if("string"===a.type.label){var s=e.slice(a.start,a.end);if("'"===s[0]?r.single++:r["double"]++,n++,n>=3)break}}return r.single>r["double"]?"single":"double"},t.prototype.generate=function(){var e=this.ast;if(this.print(e),e.comments){for(var t=[],r=e.comments,n=0;n<r.length;n++){var i=r[n];i._displayed||t.push(i)}this._printComments(t)}return{map:this.map.get(),code:this.buffer.get()}},t.prototype.buildPrint=function(e){return new f["default"](this,e)},t.prototype.catchUp=function(e){if(e.loc&&this.format.retainLines&&this.buffer.buf)for(;this.position.line<e.loc.start.line;)this._push("\n"); },t.prototype._printNewline=function(e,t,r,n){if(n.statement||_["default"].isUserWhitespacable(t,r)){var i=0;if(null==t.start||t._ignoreUserWhitespace){e||i++,n.addNewlines&&(i+=n.addNewlines(e,t)||0);var a=_["default"].needsWhitespaceAfter;e&&(a=_["default"].needsWhitespaceBefore),a(t,r)&&i++,this.buffer.buf||(i=0)}else i=e?this.whitespace.getNewlinesBefore(t):this.whitespace.getNewlinesAfter(t);this.newline(i)}},t.prototype.print=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e){t&&t._compact&&(e._compact=!0);var n=this.format.concise;if(e._compact&&(this.format.concise=!0),!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var i=_["default"].needsParens(e,t);i&&this.push("("),this.printLeadingComments(e,t),this.catchUp(e),this._printNewline(!0,e,t,r),r.before&&r.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),t),i&&this.push(")"),this.map.mark(e,"end"),r.after&&r.after(),this.format.concise=n,this._printNewline(!1,e,t,r),this.printTrailingComments(e,t)}},t.prototype.printJoin=function(e,t){var r=this,n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t&&t.length){var i=t.length;n.indent&&this.indent();for(var a={statement:n.statement,addNewlines:n.addNewlines,after:function(){n.iterator&&n.iterator(o,s),n.separator&&i-1>s&&r.push(n.separator)}},s=0;s<t.length;s++){var o=t[s];e.plain(o,a)}n.indent&&this.dedent()}},t.prototype.printAndIndentOnComments=function(e,t){var r=!!t.leadingComments;r&&this.indent(),e.plain(t),r&&this.dedent()},t.prototype.printBlock=function(e,t){k.isEmptyStatement(t)?this.semicolon():(this.push(" "),e.plain(t))},t.prototype.generateComment=function(e){var t=e.value;return t="CommentLine"===e.type?"//"+t:"/*"+t+"*/"},t.prototype.printTrailingComments=function(e,t){this._printComments(this.getComments("trailingComments",e,t))},t.prototype.printLeadingComments=function(e,t){this._printComments(this.getComments("leadingComments",e,t))},t.prototype.getComments=function(e,t,r){if(k.isExpressionStatement(r))return[];var n=[],i=[t];k.isExpressionStatement(t)&&i.push(t.argument);for(var a=i,s=0;s<a.length;s++){var o=a[s];n=n.concat(this._getComments(e,o))}return n},t.prototype._getComments=function(e,t){return t&&t[e]||[]},t.prototype.shouldPrintComment=function(e){return this.format.shouldPrintComment?this.format.shouldPrintComment(e.value):e.value.indexOf("@license")>=0||e.value.indexOf("@preserve")>=0?!0:this.format.comments},t.prototype._printComments=function(e){if(e&&e.length)for(var t=e,r=0;r<t.length;r++){var n=t[r];if(this.shouldPrintComment(n)&&!n._displayed){n._displayed=!0,this.catchUp(n),this.newline(this.whitespace.getNewlinesBefore(n));var i=this.position.column,a=this.generateComment(n);if(i&&!this.isLast(["\n"," ","[","{"])&&(this._push(" "),i++),"CommentBlock"===n.type&&this.format.indent.adjustMultilineComment){var s=n.loc&&n.loc.start.column;if(s){var o=new RegExp("\\n\\s{1,"+s+"}","g");a=a.replace(o,"\n")}var u=Math.max(this.indentSize(),i);a=a.replace(/\n/g,"\n"+h["default"](" ",u))}0===i&&(a=this.getIndent()+a),(this.format.compact||this.format.retainLines)&&"CommentLine"===n.type&&(a+="\n"),this._push(a),this.newline(this.whitespace.getNewlinesAfter(n))}}},s(t,null,[{key:"generators",value:{templateLiterals:e(28),comprehensions:e(21),expressions:e(22),statements:e(27),classes:e(20),methods:e(25),modules:e(26),types:e(29),flow:e(23),base:e(19),jsx:e(24)},enumerable:!0}]),t}();w["default"](S["default"].prototype,function(e,t){P.prototype[t]=function(){return e.apply(this.buffer,arguments)}}),w["default"](P.generators,function(e){D["default"](P.prototype,e)}),t.exports=function(e,t,r){var n=new P(e,t,r);return n.generate()},t.exports.CodeGenerator=P},{179:179,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,31:31,33:33,35:35,36:36,37:37,391:391,411:411,43:43,511:511,584:584}],31:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(34),o=i(s),u=e(32),p=n(u),l=e(411),c=i(l),f=e(416),d=i(f),h=e(179),m=n(h),y=function(e,t,r){if(e){for(var n,i=Object.keys(e),a=0;a<i.length;a++){var s=i[a];if(m.is(s,t)){var o=e[s];if(n=o(t,r),null!=n)break}}return n}},g=function(){function e(t,r){a(this,e),this.parent=r,this.node=t}return e.isUserWhitespacable=function(e){return m.isUserWhitespacable(e)},e.needsWhitespace=function(t,r,n){if(!t)return 0;m.isExpressionStatement(t)&&(t=t.expression);var i=y(o["default"].nodes,t,r);if(!i){var a=y(o["default"].list,t,r);if(a)for(var s=0;s<a.length&&!(i=e.needsWhitespace(a[s],t,n));s++);}return i&&i[n]||0},e.needsWhitespaceBefore=function(t,r){return e.needsWhitespace(t,r,"before")},e.needsWhitespaceAfter=function(t,r){return e.needsWhitespace(t,r,"after")},e.needsParens=function(e,t){if(!t)return!1;if(m.isNewExpression(t)&&t.callee===e){if(m.isCallExpression(e))return!0;var r=d["default"](e,function(e){return m.isCallExpression(e)});if(r)return!0}return y(p,e,t)},e}();r["default"]=g,c["default"](g,function(e,t){g.prototype[t]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var r=0;r<e.length;r++)e[r+2]=arguments[r];return g[t].apply(null,e)}}),t.exports=r["default"]},{179:179,32:32,34:34,411:411,416:416}],32:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return E.isArrayTypeAnnotation(t)}function s(e,t){return E.isMemberExpression(t)&&t.object===e?!0:void 0}function o(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function u(e,t){if((E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e)return!0;if(E.isUnaryLike(t))return!0;if(E.isMemberExpression(t)&&t.object===e)return!0;if(E.isBinary(t)){var r=t.operator,n=x[r],i=e.operator,a=x[i];if(n>a)return!0;if(n===a&&t.right===e&&!E.isLogicalExpression(t))return!0}}function p(e,t){if("in"===e.operator){if(E.isVariableDeclarator(t))return!0;if(E.isFor(t))return!0}}function l(e,t){return E.isForStatement(t)?!1:E.isExpressionStatement(t)&&t.expression===e?!1:E.isReturnStatement(t)?!1:!0}function c(e,t){return E.isBinary(t)||E.isUnaryLike(t)||E.isCallExpression(t)||E.isMemberExpression(t)||E.isNewExpression(t)||E.isConditionalExpression(t)||E.isYieldExpression(t)}function f(e,t){return E.isExpressionStatement(t)}function d(e,t){return E.isMemberExpression(t)&&t.object===e}function h(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:E.isCallExpression(t)&&t.callee===e?!0:void 0}function m(e,t){return E.isUnaryLike(t)?!0:E.isBinary(t)?!0:(E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e?!0:E.isConditionalExpression(t)&&t.test===e?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function y(e){return E.isObjectPattern(e.left)?!0:m.apply(void 0,arguments)}r.__esModule=!0,r.NullableTypeAnnotation=a,r.UpdateExpression=s,r.ObjectExpression=o,r.Binary=u,r.BinaryExpression=p,r.SequenceExpression=l,r.YieldExpression=c,r.ClassExpression=f,r.UnaryLike=d,r.FunctionExpression=h,r.ConditionalExpression=m,r.AssignmentExpression=y;var g=e(411),v=i(g),b=e(179),E=n(b),x={};v["default"]([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,t){v["default"](e,function(e){x[e]=t})}),r.FunctionTypeAnnotation=a},{179:179,411:411}],33:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t,r){n(this,e),this.generator=t,this.parent=r}return e.prototype.printInnerComments=function(){if(this.parent.innerComments){var e=this.generator;e.indent(),e._printComments(this.parent.innerComments),e.dedent()}},e.prototype.plain=function(e,t){return this.generator.print(e,this.parent,t)},e.prototype.sequence=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.statement=!0,this.generator.printJoin(this,e,t)},e.prototype.join=function(e,t){return this.generator.printJoin(this,e,t)},e.prototype.list=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return null==t.separator&&(t.separator=",",this.generator.format.compact||(t.separator+=" ")),this.join(e,t)},e.prototype.block=function(e){return this.generator.printBlock(this,e)},e.prototype.indentOnComments=function(e){return this.generator.printAndIndentOnComments(this,e)},e}();r["default"]=i,t.exports=r["default"]},{}],34:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return m.isMemberExpression(e)?(a(e.object,t),e.computed&&a(e.property,t)):m.isBinary(e)||m.isAssignmentExpression(e)?(a(e.left,t),a(e.right,t)):m.isCallExpression(e)?(t.hasCall=!0,a(e.callee,t)):m.isFunction(e)?t.hasFunction=!0:m.isIdentifier(e)&&(t.hasHelper=t.hasHelper||s(e.callee)),t}function s(e){return m.isMemberExpression(e)?s(e.object)||s(e.property):m.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:m.isCallExpression(e)?s(e.callee):m.isBinary(e)||m.isAssignmentExpression(e)?m.isIdentifier(e.left)&&s(e.left)||s(e.right):!1}function o(e){return m.isLiteral(e)||m.isObjectExpression(e)||m.isArrayExpression(e)||m.isIdentifier(e)||m.isMemberExpression(e)}var u=e(498),p=i(u),l=e(411),c=i(l),f=e(414),d=i(f),h=e(179),m=n(h);r.nodes={AssignmentExpression:function(e){var t=a(e.right);return t.hasCall&&t.hasHelper||t.hasFunction?{before:t.hasFunction,after:!0}:void 0},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){return m.isFunction(e.left)||m.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return m.isFunction(e.callee)||s(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var t=0;t<e.declarations.length;t++){var r=e.declarations[t],n=s(r.id)&&!o(r.init);if(!n){var i=a(r.init);n=s(r.init)&&i.hasCall||i.hasFunction}if(n)return{before:!0,after:!0}}},IfStatement:function(e){return m.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0}},r.nodes.Property=r.nodes.SpreadProperty=function(e,t){return t.properties[0]===e?{before:!0}:void 0},r.list={VariableDeclaration:function(e){return d["default"](e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},c["default"]({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,t){p["default"](e)&&(e={after:e,before:e}),c["default"]([t].concat(m.FLIPPED_ALIAS_KEYS[t]||[]),function(t){r.nodes[t]=function(){return e}})})},{179:179,411:411,414:414,498:498}],35:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(){n(this,e),this.line=1,this.column=0}return e.prototype.push=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?(this.line++,this.column=0):this.column++},e.prototype.unshift=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?this.line--:this.column--},e}();r["default"]=i,t.exports=r["default"]},{}],36:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(599),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n){a(this,e),this.position=t,this.opts=r,r.sourceMaps?(this.map=new o["default"].SourceMapGenerator({file:r.sourceMapTarget,sourceRoot:r.sourceRoot}),this.map.setSourceContent(r.sourceFileName,n)):this.map=null}return e.prototype.get=function(){var e=this.map;return e?e.toJSON():e},e.prototype.mark=function(e,t){var r=e.loc;if(r){var n=this.map;if(n&&!p.isProgram(e)&&!p.isFile(e)){var i=this.position,a={line:i.line,column:i.column},s=r[t];n.addMapping({source:this.opts.sourceFileName,generated:a,original:s})}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,599:599}],37:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return e+=t,e>=r&&(e-=r),e}r.__esModule=!0;var a=function(){function e(t){n(this,e),this.tokens=t,this.used={},this._lastFoundIndex=0}return e.prototype.getNewlinesBefore=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.start===o.start){t=n[s-1],r=o,this._lastFoundIndex=s;break}}return this.getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.end===o.end){t=o,r=n[s+1],","===r.type.label&&(r=n[s+2]),this._lastFoundIndex=s;break}}if(r&&"eof"===r.type.label)return 1;var u=this.getNewlinesBetween(t,r);return"CommentLine"!==e.type||u?u:1},e.prototype.getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,a=r;n>a;a++)"undefined"==typeof this.used[a]&&(this.used[a]=!0,i++);return i},e}();r["default"]=a,t.exports=r["default"]},{}],38:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=c["default"].matchToToken(e);if("name"===t.type&&d["default"].keyword.isReservedWordES6(t.value))return"keyword";if("punctuator"===t.type)switch(t.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return t.type}function a(e){return e.replace(c["default"],function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=i(t),a=y[n];return a?t[0].split(g).map(function(e){return a(e)}).join("\n"):t[0]})}r.__esModule=!0;var s=e(403),o=n(s),u=e(584),p=n(u),l=e(401),c=n(l),f=e(395),d=n(f),h=e(200),m=n(h),y={string:m["default"].red,punctuator:m["default"].bold,curly:m["default"].green,parens:m["default"].blue.bold,square:m["default"].yellow,keyword:m["default"].cyan,number:m["default"].magenta,regex:m["default"].magenta,comment:m["default"].grey,invalid:m["default"].inverse},g=/\r\n|[\n\r\u2028\u2029]/;r["default"]=function(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];r=Math.max(r,0);var i=n.highlightCode&&m["default"].supportsColor;i&&(e=a(e)),e=e.split(g);var s=Math.max(t-3,0),u=Math.min(e.length,t+3);t||r||(s=0,u=e.length);var l=o["default"](e.slice(s,u),{start:s+1,before:" ",after:" | ",transform:function(e){e.number===t&&(r&&(e.line+="\n"+e.before+p["default"](" ",e.width)+e.after+p["default"](" ",r-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n");return i?m["default"].reset(l):l},t.exports=r["default"]},{200:200,395:395,401:401,403:403,584:584}],39:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(515),a=n(i);r["default"]=function(e,t){return e&&t?a["default"](e,t,function(e,t){if(t&&Array.isArray(e)){for(var r=e.slice(0),n=t,i=Array.isArray(n),a=0,n=i?n:n[Symbol.iterator]();;){var s;if(i){if(a>=n.length)break;s=n[a++]}else{if(a=n.next(),a.done)break;s=a.value}var o=s;e.indexOf(o)<0&&r.push(o)}return r}}):void 0},t.exports=r["default"]},{515:515}],40:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t,r){if(e&&"Program"===e.type)return a.file(e,t||[],r||[]);throw new Error("Not a valid ast?")},t.exports=r["default"]},{179:179}],41:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]=function(){return Object.create(null)},t.exports=r["default"]},{}],42:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(605),a=n(i);r["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r={allowImportExportEverywhere:t.looseModules,allowReturnOutsideFunction:t.looseModules,allowHashBang:!0,ecmaVersion:6,strictMode:t.strictMode,sourceType:t.sourceType,locations:!0,features:t.features||{},plugins:t.plugins||{}};return t.nonStandard&&(r.plugins.jsx=!0,r.plugins.flow=!0),a.parse(e,r)},t.exports=r["default"]},{605:605}],43:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=u[e];if(!i)throw new ReferenceError("Unknown message "+JSON.stringify(e));return r=a(r),i.replace(/\$(\d+)/g,function(e,t){return r[--t]})}function a(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(t){return o.inspect(e)}})}r.__esModule=!0,r.get=i,r.parseArgs=a;var s=e(13),o=n(s),u={tailCallReassignmentDeopt:"Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",JSXNamespacedTags:"Namespace tags are not supported. ReactJSX is not XML.",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",scopeDuplicateDeclaration:"Duplicate declaration $1",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1",lostTrackNodePath:"We lost track of this node's position, likely because the AST was directly manipulated",modulesIllegalExportName:"Illegal export $1",modulesDuplicateDeclarations:"Duplicate module declarations with the same source but in different scopes",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableType:"Referencing a type alias outside of a type annotation",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",traverseNeedsParent:"You must pass a scope and parentPath unless traversing a Program/File got a $1 node",traverseVerifyRootFunction:"You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",traverseVerifyVisitorProperty:"You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",traverseVerifyNodeType:"You gave us a visitor for the node type $1 but it's not a valid type",pluginIllegalKind:"Illegal kind $1 for plugin $2",pluginIllegalPosition:"Illegal position $1 for plugin $2",pluginKeyCollision:"The plugin $1 collides with another of the same name",pluginNotTransformer:"The plugin $1 didn't export a Plugin instance",pluginUnknown:"Unknown plugin $1",pluginNotFile:"Plugin $1 is resolving to a different Babel version than what is performing the transformation.",pluginInvalidProperty:"Plugin $1 provided an invalid property of $2.",pluginInvalidPropertyVisitor:'Define your visitor methods inside a `visitor` property like so:\n\n new Plugin("foobar", {\n visitor: {\n // define your visitor methods here!\n }\n });\n'};r.MESSAGES=u},{13:13}],44:[function(e,t,r){(function(t){"use strict";if(e(387),e(577),t._babelPolyfill)throw new Error("only one instance of babel/polyfill is allowed");t._babelPolyfill=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{387:387,577:577}],45:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=[],n=E.functionExpression(null,[E.identifier("global")],E.blockStatement(r)),i=E.program([E.expressionStatement(E.callExpression(n,[h.template("helper-self-global")]))]);return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.assignmentExpression("=",E.memberExpression(E.identifier("global"),e),E.objectExpression([])))])),t(r),i}function s(e,t){var r=[];r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.identifier("global"))])),t(r);var n=h.template("umd-commonjs-strict",{FACTORY_PARAMETERS:E.identifier("global"),BROWSER_ARGUMENTS:E.assignmentExpression("=",E.memberExpression(E.identifier("root"),e),E.objectExpression({})),COMMON_ARGUMENTS:E.identifier("exports"),AMD_ARGUMENTS:E.arrayExpression([E.literal("exports")]),FACTORY_BODY:r,UMD_ROOT:E.identifier("this")});return E.program([n])}function o(e,t){var r=[];return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.objectExpression({}))])),t(r),E.program(r)}function u(e,t,r){v["default"](y["default"].helpers,function(n){if(!r||-1!==r.indexOf(n)){var i=E.identifier(E.toIdentifier(n));e.push(E.expressionStatement(E.assignmentExpression("=",E.memberExpression(t,i),h.template("helper-"+n))))}})}r.__esModule=!0;var p=e(30),l=i(p),c=e(43),f=n(c),d=e(182),h=n(d),m=e(46),y=i(m),g=e(411),v=i(g),b=e(179),E=n(b);r["default"]=function(e){var t,r=arguments.length<=1||void 0===arguments[1]?"global":arguments[1],n=E.identifier("babelHelpers"),i=function(t){return u(t,n,e)},p={global:a,umd:s,"var":o}[r];if(!p)throw new Error(f.get("unsupportedOutputType",r));return t=p(n,i),l["default"](t).code},t.exports=r["default"]},{179:179,182:182,30:30,411:411,43:43,46:46}],46:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e(208),p=a(u),l=e(74),c=a(l),f=e(50),d=a(f),h=e(52),m=a(h),y=e(587),g=a(y),v=e(155),b=a(v),E=e(500),x=a(E),S=e(599),A=a(S),D=e(30),C=a(D),w=e(38),I=a(w),_=e(510),F=a(_),k=e(413),P=a(k),B=e(148),T=a(B),M=e(602),O=a(M),j=e(47),L=a(j),N=e(82),R=a(N),V=e(42),U=a(V),q=e(147),G=a(q),H=e(182),W=i(H),X=e(9),Y=a(X),J=e(179),z=i(J),K=function(){function t(e,r){void 0===e&&(e={}),s(this,t),this.transformerDependencies={},this.dynamicImportTypes={},this.dynamicImportIds={},this.dynamicImports=[],this.declarations={},this.usedHelpers={},this.dynamicData={},this.data={},this.ast={},this.metadata={modules:{imports:[],exports:{exported:[],specifiers:[]}}},this.hub=new G["default"](this),this.pipeline=r,this.log=new L["default"](this,e.filename||"unknown"),this.opts=this.initOptions(e),this.buildTransformers()}return t.prototype.initOptions=function(e){return e=new d["default"](this.log,this.pipeline).init(e),e.inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=Y["default"].basename(e.filename,Y["default"].extname(e.filename)),e.ignore=W.arrayify(e.ignore,W.regexify),e.only&&(e.only=W.arrayify(e.only,W.regexify)),F["default"](e,{moduleRoot:e.sourceRoot}),F["default"](e,{sourceRoot:e.moduleRoot}),F["default"](e,{filenameRelative:e.filename}),F["default"](e,{sourceFileName:e.filenameRelative,sourceMapTarget:e.filenameRelative}),e.externalHelpers&&this.set("helpersNamespace",z.identifier("babelHelpers")),e},t.prototype.isLoose=function(e){return P["default"](this.opts.loose,e)},t.prototype.buildTransformers=function(){var e=this,t=this.transformers={},r=[],n=[];for(var i in this.pipeline.transformers){var a=this.pipeline.transformers[i],s=t[i]=a.buildPass(e);s.canTransform()&&(n.push(s),a.metadata.secondPass&&r.push(s),a.manipulateOptions&&a.manipulateOptions(e.opts,e))}for(var o=[],u=[],p=new m["default"]({file:this,transformers:this.transformers,before:o,after:u}),l=0;l<e.opts.plugins.length;l++)p.add(e.opts.plugins[l]);n=o.concat(n,u),this.uncollapsedTransformerStack=n=n.concat(r);for(var c=n,f=0;f<c.length;f++)for(var s=c[f],d=s.plugin.dependencies,h=0;h<d.length;h++){var y=d[h];this.transformerDependencies[y]=s.key}this.transformerStack=this.collapseStack(n)},t.prototype.collapseStack=function(e){for(var t=[],r=[],n=e,i=0;i<n.length;i++){var a=n[i];if(!(r.indexOf(a)>=0)){var s=a.plugin.metadata.group;if(a.canTransform()&&s){for(var o=[],u=e,p=0;p<u.length;p++){var l=u[p];l.plugin.metadata.group===s&&(o.push(l),r.push(l))}for(var c=[],f=o,d=0;d<f.length;d++){var h=f[d];c.push(h.plugin.visitor)}var m=T["default"].visitors.merge(c),y=new R["default"](s,{visitor:m});t.push(y.buildPass(this))}else t.push(a)}}return t},t.prototype.set=function(e,t){return this.data[e]=t},t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(e){var t=this.data[e];if(t)return t;var r=this.dynamicData[e];return r?this.set(e,r()):void 0},t.prototype.resolveModuleSource=function r(e){var r=this.opts.resolveModuleSource;return r&&(e=r(e,this.opts.filename)),e},t.prototype.addImport=function(e,t,r){t=t||e;var n=this.dynamicImportIds[t];if(!n){e=this.resolveModuleSource(e),n=this.dynamicImportIds[t]=this.scope.generateUidIdentifier(t);var i=[z.importDefaultSpecifier(n)],a=z.importDeclaration(i,z.literal(e));if(a._blockHoist=3,r){var s=this.dynamicImportTypes[r]=this.dynamicImportTypes[r]||[];s.push(a)}this.transformers["es6.modules"].canTransform()?(this.moduleFormatter.importSpecifier(i[0],a,this.dynamicImports,this.scope),this.moduleFormatter.hasLocalImports=!0):this.dynamicImports.push(a)}return n},t.prototype.attachAuxiliaryComment=function(e){var t=this.opts.auxiliaryCommentBefore;t&&(e.leadingComments=e.leadingComments||[],e.leadingComments.push({type:"CommentLine",value:" "+t}));var r=this.opts.auxiliaryCommentAfter;return r&&(e.trailingComments=e.trailingComments||[],e.trailingComments.push({type:"CommentLine",value:" "+r})),e},t.prototype.addHelper=function(e){var r=P["default"](t.soloHelpers,e);if(!r&&!P["default"](t.helpers,e))throw new ReferenceError("Unknown helper "+e);var n=this.declarations[e];if(n)return n;if(this.usedHelpers[e]=!0,!r){var i=this.get("helperGenerator"),a=this.get("helpersNamespace");if(i)return i(e);if(a){var s=z.identifier(z.toIdentifier(e));return z.memberExpression(a,s)}}var o=W.template("helper-"+e),u=this.declarations[e]=this.scope.generateUidIdentifier(e);return z.isFunctionExpression(o)&&!o.id?(o.body._compact=!0,o._generated=!0,o.id=u,o.type="FunctionDeclaration",this.attachAuxiliaryComment(o),this.path.unshiftContainer("body",o)):(o._compact=!0,this.scope.push({id:u,init:o,unique:!0})),u},t.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),a=this.declarations[i];if(a)return a;var s=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=z.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:s,init:u,_blockHoist:1.9}),s},t.prototype.errorWithNode=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?SyntaxError:arguments[2],i=e&&(e.loc||e._loc);return i?(r=new n("Line "+i.start.line+": "+t),r.loc=i.start):r=new n("There's been an error on a dynamic node. This is almost certainly an internal error. Please report it."),r},t.prototype.mergeSourceMap=function(e){var t=this.opts,r=t.inputSourceMap;if(r){e.sources[0]=r.file;var n=new A["default"].SourceMapConsumer(r),i=new A["default"].SourceMapConsumer(e),a=A["default"].SourceMapGenerator.fromSourceMap(i);a.applySourceMap(n);var s=a.toJSON();return s.sources=r.sources,s.file=r.file,s}return e},t.prototype.getModuleFormatter=function(t){(x["default"](t)||!c["default"][t])&&this.log.deprecate("Custom module formatters are deprecated and will be removed in the next major. Please use Babel plugins instead.");var r=x["default"](t)?t:c["default"][t];if(!r){var n=O["default"].relative(t);n&&(r=e(n))}if(!r)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(t));return new r(this)},t.prototype.parse=function(e){var t=this.opts,r={highlightCode:t.highlightCode,nonStandard:t.nonStandard,sourceType:t.sourceType,filename:t.filename,plugins:{}},n=r.features={};for(var i in this.transformers){var a=this.transformers[i];n[i]=a.canTransform()}r.looseModules=this.isLoose("es6.modules"),r.strictMode=n.strict,this.log.debug("Parse start");var s=U["default"](e,r);return this.log.debug("Parse stop"),s},t.prototype._addAst=function(e){this.path=b["default"].get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e},t.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST"),this.log.debug("Start module formatter init");var t=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);t.init&&this.transformers["es6.modules"].canTransform()&&t.init(),this.log.debug("End module formatter init")},t.prototype.transform=function(){this.call("pre");for(var e=this.transformerStack,t=0;t<e.length;t++){var r=e[t];r.transform()}return this.call("post"),this.generate()},t.prototype.wrap=function(e,t){e+="";try{return this.shouldIgnore()?this.makeResult({code:e,ignored:!0}):t()}catch(r){if(r._babel)throw r;r._babel=!0;var i=r.message=this.opts.filename+": "+r.message,a=r.loc;if(a&&(r.codeFrame=I["default"](e,a.line,a.column+1,this.opts),i+="\n"+r.codeFrame),n.browser&&(r.message=i),r.stack){var s=r.stack.replace(r.message,i);try{r.stack=s}catch(o){}}throw r}},t.prototype.addCode=function(e){e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e},t.prototype.parseCode=function(){this.parseShebang();var e=this.parse(this.code);this.addAst(e)},t.prototype.shouldIgnore=function(){var e=this.opts;return W.shouldIgnore(e.filename,e.ignore,e.only)},t.prototype.call=function(e){for(var t=this.uncollapsedTransformerStack,r=0;r<t.length;r++){var n=t[r],i=n.plugin[e];i&&i(this)}},t.prototype.parseInputSourceMap=function(e){var t=this.opts;if(t.inputSourceMap!==!1){var r=p["default"].fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=p["default"].removeComments(e))}return e},t.prototype.parseShebang=function(){var e=g["default"].exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(g["default"],""))},t.prototype.makeResult=function(e){var t=e.code,r=e.map,n=void 0===r?null:r,i=e.ast,a=e.ignored,s={metadata:null,ignored:!!a,code:null,ast:null,map:n};return this.opts.code&&(s.code=t), this.opts.ast&&(s.ast=i),this.opts.metadata&&(s.metadata=this.metadata,s.metadata.usedHelpers=Object.keys(this.usedHelpers)),s},t.prototype.generate=function(){var e=this.opts,t=this.ast,r={ast:t};if(!e.code)return this.makeResult(r);this.log.debug("Generation start");var n=C["default"](t,e,this.code);return r.code=n.code,r.map=n.map,this.log.debug("Generation end"),this.shebang&&(r.code=this.shebang+"\n"+r.code),r.map&&(r.map=this.mergeSourceMap(r.map)),("inline"===e.sourceMaps||"both"===e.sourceMaps)&&(r.code+="\n"+p["default"].fromObject(r.map).toComment()),"inline"===e.sourceMaps&&(r.map=null),this.makeResult(r)},o(t,null,[{key:"helpers",value:["inherits","defaults","create-class","create-decorated-class","create-decorated-object","define-decorated-property-descriptor","tagged-template-literal","tagged-template-literal-loose","to-array","to-consumable-array","sliced-to-array","sliced-to-array-loose","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-export-wildcard","interop-require-wildcard","interop-require-default","typeof","extends","get","set","new-arrow-check","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global","typeof-react-element","default-props","instanceof","interop-require"],enumerable:!0},{key:"soloHelpers",value:[],enumerable:!0}]),t}();r["default"]=K,t.exports=r["default"]}).call(this,e(10))},{10:10,147:147,148:148,155:155,179:179,182:182,208:208,30:30,38:38,413:413,42:42,47:47,50:50,500:500,510:510,52:52,587:587,599:599,602:602,74:74,82:82,9:9}],47:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(389),s=n(a),o=s["default"]("babel:verbose"),u=s["default"]("babel"),p=[],l=function(){function e(t,r){i(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){var t=arguments.length<=1||void 0===arguments[1]?Error:arguments[1];throw new t(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),p.indexOf(e)>=0||(p.push(e),console.error(e)))},e.prototype.verbose=function(e){o.enabled&&o(this._buildMessage(e))},e.prototype.debug=function(e){u.enabled&&u(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r["default"]=l,t.exports=r["default"]},{389:389}],48:[function(e,t,r){t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc","default":"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},extra:{hidden:!0,"default":{}},env:{hidden:!0,"default":{}},moduleId:{description:"specify a custom name for module ids",type:"string"},getModuleId:{hidden:!0},retainLines:{type:"boolean","default":!1,description:"retain line numbers - will result in really ugly code"},nonStandard:{type:"boolean","default":!0,description:"enable/disable support for JSX and Flow (on by default)"},experimental:{type:"boolean",description:"allow use of experimental transformers","default":!1},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean","default":!0},suppressDeprecationMessages:{type:"boolean","default":!1,hidden:!0},resolveModuleSource:{hidden:!0},stage:{description:"ECMAScript proposal stage version to allow [0-4]",shorthand:"e",type:"number","default":2},blacklist:{type:"transformerList",description:"blacklist of transformers to NOT use",shorthand:"b","default":[]},whitelist:{type:"transformerList",optional:!0,description:"whitelist of transformers to ONLY use",shorthand:"l"},optional:{type:"transformerList",description:"list of optional transformers to enable","default":[]},modules:{type:"string",description:"module formatter type to use [common]","default":"common",shorthand:"m"},moduleIds:{type:"boolean","default":!1,shorthand:"M",description:"insert an explicit id for modules"},loose:{type:"transformerList",description:"list of transformers to enable loose mode ON",shorthand:"L"},jsxPragma:{type:"string",description:"custom pragma to use with JSX (same functionality as @jsx comments)","default":"React.createElement",shorthand:"P"},plugins:{type:"list",description:"","default":[]},ignore:{type:"list",description:"list of glob paths to **not** compile","default":[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,"default":!0,type:"boolean"},metadata:{hidden:!0,"default":!0,type:"boolean"},ast:{hidden:!0,"default":!0,type:"boolean"},comments:{type:"boolean","default":!0,description:"strip/output comments in generated output (on by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},compact:{type:"booleanString","default":"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},keepModuleIdExtensions:{type:"boolean",description:"keep extensions when generating module ids","default":!1,shorthand:"k"},auxiliaryComment:{deprecated:"renamed to auxiliaryCommentBefore",shorthand:"a",alias:"auxiliaryCommentBefore"},auxiliaryCommentBefore:{type:"string","default":"",description:"attach a comment before all helper declarations and auxiliary code"},auxiliaryCommentAfter:{type:"string","default":"",description:"attach a comment after all helper declarations and auxiliary code"},externalHelpers:{type:"boolean","default":!1,shorthand:"r",description:"uses a reference to `babelHelpers` instead of placing helpers at the top of your code."},metadataUsedHelpers:{deprecated:"Not required anymore as this is enabled by default",type:"boolean","default":!1,hidden:!0},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]","default":!1,shorthand:"s"},sourceMapName:{alias:"sourceMapTarget",description:"DEPRECATED - Please use sourceMapTarget"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},breakConfig:{type:"boolean","default":!1,hidden:!0,description:"stop trying to load .babelrc files"},babelrc:{description:"Specify a custom list of babelrc files to use",type:"list"},sourceType:{description:"","default":"module"}}},{}],49:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t,r){var n=l["default"][e],i=n&&u[n.type];return i&&i.validate?i.validate(e,t,r):t}function s(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];for(var t in e){var r=e[t];if(null!=r){var n=l["default"][t];if(n){var i=u[n.type];i&&(r=i(r)),e[t]=r}}}return e}r.__esModule=!0,r.validateOption=a,r.normaliseOptions=s;var o=e(51),u=i(o),p=e(48),l=n(p);r.config=l["default"]},{48:48,51:51}],50:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){var t=D[e];return null!=t?t:D[e]=d["default"].sync(e)}r.__esModule=!0;var o=e(49),u=e(402),p=i(u),l=e(527),c=i(l),f=e(526),d=i(f),h=e(494),m=i(h),y=e(39),g=i(y),v=e(48),b=i(v),E=e(9),x=i(E),S=e(1),A=i(S),D={},C={},w=".babelignore",I=".babelrc",_="package.json",F=function(){function e(t,r){a(this,e),this.resolvedConfigs=[],this.options=e.createBareOptions(),this.pipeline=r,this.log=t}return e.createBareOptions=function(){var e={};for(var t in b["default"]){var r=b["default"][t];e[t]=m["default"](r["default"])}return e},e.prototype.addConfig=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?p["default"]:arguments[2];if(!(this.resolvedConfigs.indexOf(e)>=0)){var n,i=A["default"].readFileSync(e,"utf8");try{n=C[i]=C[i]||r.parse(i),t&&(n=n[t])}catch(a){throw a.message=e+": Error while parsing JSON - "+a.message,a}this.mergeOptions(n,e),this.resolvedConfigs.push(e)}},e.prototype.mergeOptions=function(e){var t=arguments.length<=1||void 0===arguments[1]?"foreign":arguments[1];if(e){for(var r in e)if("_"!==r[0]){var n=b["default"][r];n||this.log.error("Unknown option: "+t+"."+r,ReferenceError)}o.normaliseOptions(e),g["default"](this.options,e)}},e.prototype.addIgnoreConfig=function(e){var t=A["default"].readFileSync(e,"utf8"),r=t.split("\n");r=r.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e}),this.mergeOptions({ignore:r},e)},e.prototype.findConfigs=function(e){if(e)for(c["default"](e)||(e=x["default"].join(n.cwd(),e));e!==(e=x["default"].dirname(e));){if(this.options.breakConfig)return;var t=x["default"].join(e,I);s(t)&&this.addConfig(t);var r=x["default"].join(e,_);s(r)&&this.addConfig(r,"babel",JSON);var i=x["default"].join(e,w);s(i)&&this.addIgnoreConfig(i)}},e.prototype.normaliseOptions=function(){var e=this.options;for(var t in b["default"]){var r=b["default"][t],n=e[t];(n||!r.optional)&&(this.log&&n&&r.deprecated&&this.log.deprecate("Deprecated option "+t+": "+r.deprecated),this.pipeline&&n&&(n=o.validateOption(t,n,this.pipeline)),r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},e.prototype.init=function(e){if(this.mergeOptions(e,"direct"),e.babelrc)for(var t=e.babelrc,r=0;r<t.length;r++){var i=t[r];this.addConfig(i)}e.babelrc!==!1&&this.findConfigs(e.filename);var a=n.env.BABEL_ENV||n.env.NODE_ENV||"development";return this.options.env&&this.mergeOptions(this.options.env[a],"direct.env."+a),this.normaliseOptions(e),this.options},e}();r["default"]=F,t.exports=r["default"]}).call(this,e(10))},{1:1,10:10,39:39,402:402,48:48,49:49,494:494,526:526,527:527,9:9}],51:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){return d.arrayify(e)}function s(e){return+e}function o(e){return!!e}function u(e){return d.booleanify(e)}function p(e){return d.list(e)}r.__esModule=!0,r.transformerList=a,r.number=s,r["boolean"]=o,r.booleanString=u,r.list=p;var l=e(588),c=i(l),f=e(182),d=n(f);a.validate=function(e,t,r){return(t.indexOf("all")>=0||t.indexOf(!0)>=0)&&(t=Object.keys(r.transformers)),r._ensureTransformerNames(e,t)};var h=c["default"];r.filename=h},{182:182,588:588}],52:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(83),u=i(o),p=e(82),l=i(p),c=e(179),f=n(c),d=e(43),h=n(d),m=e(602),y=i(m),g=e(148),v=i(g),b=e(42),E=i(b),x={messages:h,Transformer:u["default"],Plugin:l["default"],types:f,parse:E["default"],traverse:v["default"]},S=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{transformers:{},before:[],after:[]}:arguments[0],r=e.file,n=e.transformers,i=e.before,s=e.after;a(this,t),this.transformers=n,this.file=r,this.before=i,this.after=s}return t.memoisePluginContainer=function(e){for(var r=0;r<t.memoisedPlugins.length;r++){var n=t.memoisedPlugins[r];if(n.container===e)return n.transformer}var i=e(x);return t.memoisedPlugins.push({container:e,transformer:i}),i},s(t,null,[{key:"memoisedPlugins",value:[],enumerable:!0},{key:"positions",value:["before","after"],enumerable:!0}]),t.prototype.subnormaliseString=function(t,r){var n=t.match(/^(.*?):(after|before)$/);n&&(t=n[1],r=n[2]);var i=y["default"].relative("babel-plugin-"+t)||y["default"].relative(t);if(i){var a=e(i);return{position:r,plugin:a["default"]||a}}throw new ReferenceError(h.get("pluginUnknown",t))},t.prototype.validate=function(e,t){var r=t.key;if(this.transformers[r])throw new ReferenceError(h.get("pluginKeyCollision",r));if(!t.buildPass||"Plugin"!==t.constructor.name)throw new TypeError(h.get("pluginNotTransformer",e));t.metadata.plugin=!0},t.prototype.add=function(e){var r,n;if(!e)throw new TypeError(h.get("pluginIllegalKind",typeof e,e));if("object"==typeof e&&e.transformer?(n=e.transformer,r=e.position):"string"!=typeof e&&(n=e),"string"==typeof e){var i=this.subnormaliseString(e,r);n=i.plugin,r=i.position}if(r=r||"before",t.positions.indexOf(r)<0)throw new TypeError(h.get("pluginIllegalPosition",r,e));"function"==typeof n&&(n=t.memoisePluginContainer(n)),this.validate(e,n);var a=this.transformers[n.key]=n.buildPass(this.file);if(a.canTransform()){var s="before"===r?this.before:this.after;s.push(a)}},t}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,42:42,43:43,602:602,82:82,83:83}],53:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(58),s=i(a),o=e(179),u=n(o);r["default"]=function(e){var t={},r=function(t){return t.operator===e.operator+"="},n=function(e,t){return u.assignmentExpression("=",e,t)};return t.ExpressionStatement=function(t,i,a,o){if(!this.isCompletionRecord()){var p=t.expression;if(r(p)){var l=[],c=s["default"](p.left,l,o,a,!0);return l.push(u.expressionStatement(n(c.ref,e.build(c.uid,p.right)))),l}}},t.AssignmentExpression=function(t,i,a,o){if(r(t)){var u=[],p=s["default"](t.left,u,o,a);return u.push(n(p.ref,e.build(p.uid,t.right))),u}},t.BinaryExpression=function(t){return t.operator===e.operator?e.build(t.left,t.right):void 0},t},t.exports=r["default"]},{179:179,58:58}],54:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=e.blocks.shift();if(r){var n=i(e,t);return n||(n=t(),e.filter&&(n=s.ifStatement(e.filter,s.blockStatement([n])))),s.forOfStatement(s.variableDeclaration("let",[s.variableDeclarator(r.left)]),r.right,s.blockStatement([n]))}}r.__esModule=!0,r["default"]=i;var a=e(179),s=n(a);t.exports=r["default"]},{179:179}],55:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(506),s=i(a),o=e(43),u=n(o),p=e(395),l=i(p),c=e(62),f=n(c),d=e(179),h=n(d);r["default"]=function(e){var t={};t.JSXIdentifier=function(e){return"this"===e.name&&this.isReferenced()?h.thisExpression():l["default"].keyword.isIdentifierNameES6(e.name)?void(e.type="Identifier"):h.literal(e.name)},t.JSXNamespacedName=function(){throw this.errorWithNode(u.get("JSXNamespacedTags"))},t.JSXMemberExpression={exit:function(e){e.computed=h.isLiteral(e.property),e.type="MemberExpression"}},t.JSXExpressionContainer=function(e){return e.expression},t.JSXAttribute={enter:function(e){var t=e.value;h.isLiteral(t)&&s["default"](t.value)&&(t.value=t.value.replace(/\n\s+/g," "))},exit:function(e){var t=e.value||h.literal(!0);return h.inherits(h.property("init",e.name,t),e)}},t.JSXOpeningElement={exit:function(t,n,i,a){n.children=f.buildChildren(n);var s,o=t.name,u=[];h.isIdentifier(o)?s=o.name:h.isLiteral(o)&&(s=o.value);var p={tagExpr:o,tagName:s,args:u};e.pre&&e.pre(p,a);var l=t.attributes;return l=l.length?r(l,a):h.literal(null),u.push(l),e.post&&e.post(p,a),p.call||h.callExpression(p.callee,u)}};var r=function(e,t){for(var r=[],n=[],i=function(){r.length&&(n.push(h.objectExpression(r)),r=[])};e.length;){var a=e.shift();h.isJSXSpreadAttribute(a)?(i(),n.push(a.argument)):r.push(a)}return i(),1===n.length?e=n[0]:(h.isObjectExpression(n[0])||n.unshift(h.objectExpression([])),e=h.callExpression(t.addHelper("extends"),n)),e};return t.JSXElement={exit:function(e){var t=e.openingElement;return t.arguments=t.arguments.concat(e.children),t.arguments.length>=3&&(t._prettyCall=!0),h.inherits(t,e)}},t},t.exports=r["default"]},{179:179,395:395,43:43,506:506,62:62}],56:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={enter:function(e,t,r,n){(this.isThisExpression()||this.isReferencedIdentifier({name:"arguments"}))&&(n.found=!0,this.stop())},Function:function(){this.skip()}};r["default"]=function(e,t){var r=a.functionExpression(null,[],e.body,e.generator,e.async),n=r,i=[],o={found:!1};t.traverse(e,s,o),o.found&&(n=a.memberExpression(r,a.identifier("apply")),i=[a.thisExpression(),a.identifier("arguments")]);var u=a.callExpression(n,i);return e.generator&&(u=a.yieldExpression(u,!0)),a.returnStatement(u)},t.exports=r["default"]},{179:179}],57:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){var i=m.toKeyAlias(t),a={};if(d["default"](e,i)&&(a=e[i]),e[i]=a,a._inherits=a._inherits||[],a._inherits.push(t),a._key=t.key,t.computed&&(a._computed=!0),t.decorators){var s=a.decorators=a.decorators||m.arrayExpression([]);s.elements=s.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(a.value||a.initializer)throw n.errorWithNode(t,"Key conflict with sibling node");return t.value&&("init"===t.kind&&(r="value"),"get"===t.kind&&(r="get"),"set"===t.kind&&(r="set"),m.inheritsComments(t.value,t),a[r]=t.value),a}function s(e){for(var t in e)if(e[t]._computed)return!0;return!1}function o(e){for(var t=m.arrayExpression([]),r=0;r<e.properties.length;r++){var n=e.properties[r],i=n.value;i.properties.unshift(m.property("init",m.identifier("key"),m.toComputedKey(n))),t.elements.push(i)}return t}function u(e){var t=m.objectExpression([]);return c["default"](e,function(e){var r=m.objectExpression([]),n=m.property("init",e._key,r,e._computed);c["default"](e,function(e,t){if("_"!==t[0]){var n=e;(m.isMethodDefinition(e)||m.isClassProperty(e))&&(e=e.value);var i=m.property("init",m.identifier(t),e);m.inheritsComments(i,n),m.removeComments(n),r.properties.push(i)}}),t.properties.push(n)}),t}function p(e){return c["default"](e,function(e){e.value&&(e.writable=m.literal(!0)),e.configurable=m.literal(!0),e.enumerable=m.literal(!0)}),u(e)}r.__esModule=!0,r.push=a,r.hasComputed=s,r.toComputedObjectFromClass=o,r.toClassObject=u,r.toDefineObject=p;var l=e(411),c=i(l),f=e(512),d=i(f),h=e(179),m=n(h)},{179:179,411:411,512:512}],58:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=function(e,t,r,n){var i;if(a.isIdentifier(e)){if(n.hasBinding(e.name))return e;i=e}else{if(!a.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(i=e.object,a.isIdentifier(i)&&n.hasGlobal(i.name))return i}var s=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),s},o=function(e,t,r,n){var i=e.property,s=a.toComputedKey(e,i);if(a.isLiteral(s))return s;var o=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(o,i)])),o};r["default"]=function(e,t,r,n,i){var u;u=a.isIdentifier(e)&&i?e:s(e,t,r,n);var p,l;if(a.isIdentifier(e))p=e,l=u;else{var c=o(e,t,r,n),f=e.computed||a.isLiteral(c);l=p=a.memberExpression(u,c,f)}return{uid:l,ref:p}},t.exports=r["default"]},{179:179}],59:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e){for(var t=0,r=0;r<e.params.length;r++){var n=e.params[r];a.isAssignmentPattern(n)||a.isRestElement(n)||(t=r+1)}return t},t.exports=r["default"]},{179:179}],60:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t){for(var r=0;r<e.length;r++){var n=e[r],i=n.expression;if(a.isMemberExpression(i)){var s,o=t.maybeGenerateMemoised(i.object),u=[];o?(s=o,u.push(a.assignmentExpression("=",o,i.object))):s=i.object,u.push(a.callExpression(a.memberExpression(a.memberExpression(s,i.property,i.computed),a.identifier("bind")),[s])),1===u.length?n.expression=u[0]:n.expression=a.sequenceExpression(u)}}return e},t.exports=r["default"]},{179:179}],61:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){if(t.name===n.name){var i=r.getBindingIdentifier(n.name);i===n.outerDeclar&&(n.selfReference=!0,e.stop())}}function s(e,t,r){var n=g(e,t.name,r);return y(n,e,t,r)}function o(e,t,r){var n=h.toComputedKey(e,e.key);if(h.isLiteral(n)){var i=h.toBindingIdentifierName(n.value),a=h.identifier(i),s=e.value,o=g(s,i,r);e.value=y(o,s,a,r)||s}}function u(e,t,r){if(!e.id){var n;if(!h.isProperty(t)||"init"!==t.kind||t.computed&&!h.isLiteral(t.key)){if(!h.isVariableDeclarator(t))return;if(n=t.id,h.isIdentifier(n)){var i=r.parent.getBinding(n.name);if(i&&i.constant&&r.getBinding(n.name)===i)return void(e.id=n)}}else n=t.key;var a;if(h.isLiteral(n))a=n.value;else{if(!h.isIdentifier(n))return;a=n.name}a=h.toBindingIdentifierName(a),n=h.identifier(a);var s=g(e,a,r);return y(s,e,n,r)}}r.__esModule=!0,r.custom=s,r.property=o,r.bare=u;var p=e(59),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={ReferencedIdentifier:function(e,t,r,n){a(this,e,r,n)},BindingIdentifier:function(e,t,r,n){a(this,e,r,n)}},y=function(e,t,r,n){if(e.selfReference){if(!n.hasBinding(r.name)||n.hasGlobal(r.name)){var i="property-method-assignment-wrapper";t.generator&&(i+="-generator");var a=f.template(i,{FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:n.generateUidIdentifier(r.name)});a.callee._skipModulesRemap=!0;for(var s=a.callee.body.body[0].params,o=0,u=l["default"](t);u>o;o++)s.push(n.generateUidIdentifier("x"));return a}n.rename(r.name)}t.id=r,n.getProgramParent().references[r.name]=!0},g=function(e,t,r){var n={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),references:[],name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(n.selfReference=!0):(n.outerDeclar||r.hasGlobal(t))&&r.traverse(e,m,n),n}},{179:179,182:182,59:59}],62:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&/^[a-z]|\-/.test(e)}function a(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,i=0;i<r.length;i++)r[i].match(/[^ \t]/)&&(n=i);for(var a="",i=0;i<r.length;i++){var s=r[i],o=0===i,p=i===r.length-1,l=i===n,c=s.replace(/\t/g," ");o||(c=c.replace(/^[ ]+/,"")),p||(c=c.replace(/[ ]+$/,"")),c&&(l||(c+=" "),a+=c)}a&&t.push(u.literal(a))}function s(e){for(var t=[],r=0;r<e.children.length;r++){var n=e.children[r];u.isLiteral(n)&&"string"==typeof n.value?a(n,t):(u.isJSXExpressionContainer(n)&&(n=n.expression),u.isJSXEmptyExpression(n)||t.push(n))}return t}r.__esModule=!0,r.isCompatTag=i,r.buildChildren=s;var o=e(179),u=n(o),p=u.buildMatchMemberExpression("React.Component");r.isReactComponent=p},{179:179}],63:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return l.isLiteral(e)&&e.regex&&e.regex.flags.indexOf(t)>=0}function s(e,t){var r=e.regex.flags.split("");e.regex.flags.indexOf(t)<0||(u["default"](r,t),e.regex.flags=r.join(""))}r.__esModule=!0,r.is=a,r.pullFlag=s;var o=e(408),u=i(o),p=e(179),l=n(p)},{179:179,408:408}],64:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={Function:function(){this.skip()},AwaitExpression:function(e){e.type="YieldExpression",e.all&&(e.all=!1,e.argument=a.callExpression(a.memberExpression(a.identifier("Promise"),a.identifier("all")),[e.argument]))}},o={ReferencedIdentifier:function(e,t,r,n){var i=n.id.name;return e.name===i&&r.bindingIdentifierEquals(i,n.id)?n.ref=n.ref||r.generateUidIdentifier(i):void 0}};r["default"]=function(e,t){var r=e.node;r.async=!1,r.generator=!0,e.traverse(s,p);var n=a.callExpression(t,[r]),i=r.id;if(r.id=null,a.isFunctionDeclaration(r)){var u=a.variableDeclaration("let",[a.variableDeclarator(i,n)]);return u._blockHoist=!0,u}if(i){var p={id:i};if(e.traverse(o,p),p.ref)return e.scope.parent.push({id:p.ref}),a.assignmentExpression("=",p.ref,n)}return n},t.exports=r["default"]},{179:179}],65:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){return l.isSuper(e)?l.isMemberExpression(t,{computed:!1})?!1:l.isCallExpression(t,{callee:e})?!1:!0:!1}function s(e){return l.isMemberExpression(e)&&l.isSuper(e.object)}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){var i=n.topLevel,a=n.self;if(l.isFunction(e)&&!l.isArrowFunctionExpression(e))return a.traverseLevel(this,!1),this.skip();if(l.isProperty(e,{method:!0})||l.isMethodDefinition(e))return this.skip();var s=i?l.thisExpression:a.getThisReference.bind(a),o=a.specHandle;a.isLoose&&(o=a.looseHandle);var u=o.call(a,this,s);return u&&(this.hasSuper=!0),u!==!0?u:void 0}},f=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];i(this,e),this.topLevelThisReference=t.topLevelThisReference,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=t.scope,this.file=t.file,this.opts=t}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r,n){return l.callExpression(this.file.addHelper("set"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),r?e:l.literal(e.name),t,n])},e.prototype.getSuperProperty=function(e,t,r){return l.callExpression(this.file.addHelper("get"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),t?e:l.literal(e.name),r])},e.prototype.replace=function(){this.traverseLevel(this.methodPath.get("value"),!0)},e.prototype.traverseLevel=function(e,t){var r={self:this,topLevel:t};e.traverse(c,r)},e.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(this.topLevelThisReference,l.thisExpression())])),e},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=r.key,i=this.superRef||l.identifier("Function");return t.property===e?void 0:l.isCallExpression(t,{callee:e})?(t.arguments.unshift(l.thisExpression()),"constructor"===n.name?2===t.arguments.length&&l.isSpreadElement(t.arguments[1])&&l.isIdentifier(t.arguments[1].argument,{name:"arguments"})?(t.arguments[1]=t.arguments[1].argument,l.memberExpression(i,l.identifier("apply"))):l.memberExpression(i,l.identifier("call")):(e=i,r["static"]||(e=l.memberExpression(e,l.identifier("prototype"))),e=l.memberExpression(e,n,r.computed),l.memberExpression(e,l.identifier("call")))):l.isMemberExpression(t)&&!r["static"]?l.memberExpression(i,l.identifier("prototype")):i},e.prototype.looseHandle=function(e,t){var r=e.node;if(e.isSuper())return this.getLooseSuperProperty(r,e.parent);if(e.isCallExpression()){var n=r.callee;if(!l.isMemberExpression(n))return;if(!l.isSuper(n.object))return;return l.appendToMemberExpression(n,l.identifier("call")),r.arguments.unshift(t()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r,n){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed,n()):(e=e||t.scope.generateUidIdentifier("ref"),[l.variableDeclaration("var",[l.variableDeclarator(e,r.left)]),l.expressionStatement(l.assignmentExpression("=",r.left,l.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e,t){var r,n,i,o,p=this.methodNode,c=e.parent,f=e.node;if(a(f,c))throw e.errorWithNode(u.get("classesIllegalBareSuper"));if(l.isCallExpression(f)){var d=f.callee;if(l.isSuper(d)){if(r=p.key,n=p.computed,i=f.arguments,"constructor"!==p.key.name||!this.inClass){var h=p.key.name||"METHOD_NAME";throw this.file.errorWithNode(f,u.get("classesIllegalSuperCall",h))}}else s(d)&&(r=d.property,n=d.computed,i=f.arguments)}else if(l.isMemberExpression(f)&&l.isSuper(f.object))r=f.property,n=f.computed;else{if(l.isUpdateExpression(f)&&s(f.argument)){var m=l.binaryExpression(f.operator[0],f.argument,l.literal(1));if(f.prefix)return this.specHandleAssignmentExpression(null,e,m,t);var y=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(y,e,m,t).concat(l.expressionStatement(y))}if(l.isAssignmentExpression(f)&&s(f.left))return this.specHandleAssignmentExpression(null,e,f,t)}if(r){o=t();var g=this.getSuperProperty(r,n,o);return i?1===i.length&&l.isSpreadElement(i[0])?l.callExpression(l.memberExpression(g,l.identifier("apply")),[o,i[0].argument]):l.callExpression(l.memberExpression(g,l.identifier("call")),[o].concat(i)):g}},e}();r["default"]=f,t.exports=r["default"]},{179:179,43:43}],66:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(80),s=i(a),o=e(126),u=i(o),p=e(85),l=i(p),c=e(84),f=i(c),d=e(125),h=n(d),m=new s["default"];for(var y in u["default"]){var g=u["default"][y];if("object"==typeof g){var v=g.metadata=g.metadata||{};v.group=v.group||"builtin-basic"}}m.addTransformers(u["default"]),m.addDeprecated(l["default"]),m.addAliases(f["default"]),m.addFilter(h.internal),m.addFilter(h.blacklist),m.addFilter(h.whitelist),m.addFilter(h.stage), m.addFilter(h.optional);var b=m.transform.bind(m);b.fromAst=m.transformFromAst.bind(m),b.pipeline=m,r["default"]=b,t.exports=r["default"]},{125:125,126:126,80:80,84:84,85:85}],67:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(75),o=i(s),u=e(43),p=i(u),l=e(76),c=n(l),f=e(41),d=n(f),h=e(182),m=i(h),y=e(179),g=i(y),v=function(){function e(t){a(this,e),this.sourceScopes=d["default"](),this.defaultIds=d["default"](),this.ids=d["default"](),this.remaps=new c["default"](t,this),this.scope=t.scope,this.file=t,this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localExports=d["default"](),this.localImports=d["default"](),this.metadata=t.metadata.modules,this.getMetadata()}return e.prototype.addScope=function(e){var t=e.node.source&&e.node.source.value;if(t){var r=this.sourceScopes[t];if(r&&r!==e.scope)throw e.errorWithNode(p.get("modulesDuplicateDeclarations"));this.sourceScopes[t]=e.scope}},e.prototype.isModuleType=function(e,t){var r=this.file.dynamicImportTypes[t];return r&&r.indexOf(e)>=0},e.prototype.transform=function(){this.remapAssignments()},e.prototype.doDefaultExportInterop=function(e){return(g.isExportDefaultDeclaration(e)||g.isSpecifierDefault(e))&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},e.prototype.getMetadata=function(){for(var e=!1,t=this.file.ast.program.body,r=0;r<t.length;r++){var n=t[r];if(g.isModuleDeclaration(n)){e=!0;break}}(e||this.isLoose())&&this.file.path.traverse(o,this)},e.prototype.remapAssignments=function(){(this.hasLocalExports||this.hasLocalImports)&&this.remaps.run()},e.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=g.assignmentExpression("=",g.memberExpression(g.identifier("exports"),t[n]),r);return r},e.prototype._addExport=function(e,t){var r=this.localExports[e]=this.localExports[e]||{binding:this.scope.getBindingIdentifier(e),exported:[]};r.exported.push(t)},e.prototype.getExport=function(e,t){if(g.isIdentifier(e)){var r=this.localExports[e.name];return r&&r.binding===t.getBindingIdentifier(e.name)?r.exported:void 0}},e.prototype.getModuleName=function(){var e=this.file.opts;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return e.keepModuleIdExtensions||(t=t.replace(/\.(\w*?)$/,"")),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},e.prototype._pushStatement=function(e,t){return(g.isClass(e)||g.isFunction(e))&&e.id&&(t.push(g.toStatement(e)),e=e.id),e},e.prototype._hoistExport=function(e,t,r){return g.isFunctionDeclaration(e)&&(t._blockHoist=r||2),t},e.prototype.getExternalReference=function(e,t){var r=this.ids,n=e.source.value;return r[n]?r[n]:this.ids[n]=this._getExternalReference(e,t)},e.prototype.checkExportIdentifier=function(e){if(g.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,p.get("modulesIllegalExportName",e.name))},e.prototype.exportAllDeclaration=function(e,t){var r=this.getExternalReference(e,t);t.push(this.buildExportsWildcard(r,e))},e.prototype.isLoose=function(){return this.file.isLoose("es6.modules")},e.prototype.exportSpecifier=function(e,t,r){if(t.source){var n=this.getExternalReference(t,r);if("default"!==e.local.name||this.noInteropRequireExport){if(n=g.memberExpression(n,e.local),!this.isLoose())return void r.push(this.buildExportsFromAssignment(e.exported,n,t))}else n=g.callExpression(this.file.addHelper("interop-require"),[n]);r.push(this.buildExportsAssignment(e.exported,n,t))}else r.push(this.buildExportsAssignment(e.exported,e.local,t))},e.prototype.buildExportsWildcard=function(e){return g.expressionStatement(g.callExpression(this.file.addHelper("defaults"),[g.identifier("exports"),g.callExpression(this.file.addHelper("interop-export-wildcard"),[e,this.file.addHelper("defaults")])]))},e.prototype.buildExportsFromAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-from-assign",{INIT:t,ID:g.literal(e.name)},!0)},e.prototype.buildExportsAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-assign",{VALUE:t,KEY:e},!0)},e.prototype.exportDeclaration=function(e,t){var r=e.declaration,n=r.id;g.isExportDefaultDeclaration(e)&&(n=g.identifier("default"));var i;if(g.isVariableDeclaration(r))for(var a=0;a<r.declarations.length;a++){var s=r.declarations[a];s.init=this.buildExportsAssignment(s.id,s.init,e).expression;var o=g.variableDeclaration(r.kind,[s]);0===a&&g.inherits(o,r),t.push(o)}else{var u=r;(g.isFunctionDeclaration(r)||g.isClassDeclaration(r))&&(u=r.id,t.push(r)),i=this.buildExportsAssignment(n,u,e),t.push(i),this._hoistExport(r,i)}},e}();r["default"]=v,t.exports=r["default"]},{179:179,182:182,41:41,43:43,75:75,76:76}],68:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(182),a=n(i);r["default"]=function(e){var t=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return a.inherits(t,e),t},t.exports=r["default"]},{182:182}],69:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(70),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,70:70}],70:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(72),l=i(p),c=e(413),f=i(c),d=e(517),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){l["default"].prototype._setup.call(this,this.hasNonDefaultExports)},t.prototype.buildDependencyLiterals=function(){var e=[];for(var t in this.ids)e.push(v.literal(t));return e},t.prototype.transform=function(e){l["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[v.literal("exports")];this.passModuleArg&&r.push(v.literal("module")),r=r.concat(this.buildDependencyLiterals()),r=v.arrayExpression(r);var n=h["default"](this.ids);this.passModuleArg&&n.unshift(v.identifier("module")),n.unshift(v.identifier("exports"));var i=v.functionExpression(null,n,v.blockStatement(t)),a=[r,i],s=this.getModuleName();s&&a.unshift(v.literal(s));var o=v.callExpression(v.identifier("define"),a);e.body=[v.expressionStatement(o)]},t.prototype.getModuleName=function(){return this.file.opts.moduleIds?u["default"].prototype.getModuleName.apply(this,arguments):null},t.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},t.prototype.importDeclaration=function(e){this.getExternalReference(e)},t.prototype.importSpecifier=function(e,t,r,n){var i=t.source.value,a=this.getExternalReference(t);if((v.isImportNamespaceSpecifier(e)||v.isImportDefaultSpecifier(e))&&(this.defaultIds[i]=e.local),this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.ids[t.source.value]=a,a=v.memberExpression(a,v.identifier("default"));else if(v.isImportNamespaceSpecifier(e));else if(f["default"](this.file.dynamicImported,t)||!v.isSpecifierDefault(e)||this.noInteropRequireImport){var s=e.imported;v.isSpecifierDefault(e)&&(s=v.identifier("default")),a=v.memberExpression(a,s)}else{var o=n.generateUidIdentifier(e.local.name);r.push(v.variableDeclaration("var",[v.variableDeclarator(o,v.callExpression(this.file.addHelper("interop-require-default"),[a]))])),a=v.memberExpression(o,v.identifier("default"))}this.remaps.add(n,e.local.name,a)},t.prototype.exportSpecifier=function(e,t,r){return this.doDefaultExportInterop(e)&&(this.passModuleArg=!0,e.exported!==e.local&&!t.source)?void r.push(y.template("exports-default-assign",{VALUE:e.local},!0)):void l["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e,t){if(this.doDefaultExportInterop(e)){this.passModuleArg=!0;var r=e.declaration,n=y.template("exports-default-assign",{VALUE:this._pushStatement(r,t)},!0);return v.isFunctionDeclaration(r)&&(n._blockHoist=3),void t.push(n)}u["default"].prototype.exportDeclaration.apply(this,arguments)},t}(u["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,413:413,517:517,67:67,72:72}],71:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(72),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,72:72}],72:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){this._setup(this.hasLocalExports)},t.prototype._setup=function(e){var t=this.file,r=t.scope;if(r.rename("module"),r.rename("exports"),!this.noInteropRequireImport&&e){var n="exports-module-declaration";this.file.isLoose("es6.modules")&&(n+="-loose");var i=l.template(n,!0);i._blockHoist=3,t.path.unshiftContainer("body",[i])}},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments),this.hasDefaultOnlyExport&&e.body.push(f.expressionStatement(f.assignmentExpression("=",f.memberExpression(f.identifier("module"),f.identifier("exports")),f.memberExpression(f.identifier("exports"),f.identifier("default")))))},t.prototype.importSpecifier=function(e,t,r,n){var i=e.local,a=this.getExternalReference(t,r);if(f.isSpecifierDefault(e))if(this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.remaps.add(n,i.name,a);else if(this.noInteropRequireImport)this.remaps.add(n,i.name,f.memberExpression(a,f.identifier("default")));else{var s=this.scope.generateUidIdentifierBasedOnNode(t,"import");r.push(f.variableDeclaration("var",[f.variableDeclarator(s,f.callExpression(this.file.addHelper("interop-require-default"),[a]))])),this.remaps.add(n,i.name,f.memberExpression(s,f.identifier("default")))}else f.isImportNamespaceSpecifier(e)?(this.noInteropRequireImport||(a=f.callExpression(this.file.addHelper("interop-require-wildcard"),[a])),r.push(f.variableDeclaration("var",[f.variableDeclarator(i,a)]))):this.remaps.add(n,i.name,f.memberExpression(a,f.identifier(e.imported.name)))},t.prototype.importDeclaration=function(e,t){t.push(l.template("require",{MODULE_NAME:e.source},!0))},t.prototype.exportSpecifier=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportDeclaration.apply(this,arguments)},t.prototype._getExternalReference=function(e,t){var r,n=f.callExpression(f.identifier("require"),[e.source]);this.isModuleType(e,"absolute")||(this.isModuleType(e,"absoluteDefault")?n=f.memberExpression(n,f.identifier("default")):r=this.scope.generateUidIdentifierBasedOnNode(e,"import")),r=r||e.specifiers[0].local;var i=f.variableDeclaration("var",[f.variableDeclarator(r,n)]);return t.push(i),r},t}(u["default"]);r["default"]=d,t.exports=r["default"]},{179:179,182:182,67:67}],73:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.exportDeclaration=function(e,t){var r=l.toStatement(e.declaration,!0);r&&t.push(l.inherits(r,e))},t.prototype.exportAllDeclaration=function(){},t.prototype.importDeclaration=function(){},t.prototype.importSpecifier=function(){},t.prototype.exportSpecifier=function(){},t.prototype.transform=function(){},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,67:67}],74:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={commonStrict:e(71),amdStrict:e(69),umdStrict:e(78),common:e(72),system:e(77),ignore:e(73),amd:e(70),umd:e(79)},t.exports=r["default"]},{69:69,70:70,71:71,72:72,73:73,77:77,78:78,79:79}],75:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){n.hasLocalExports=!0;var i=e.source?e.source.value:null,a=n.metadata.exports,s=this.get("declaration");if(s.isStatement()){var o=s.getBindingIdentifiers();for(var u in o){var p=o[u];n._addExport(u,p),a.exported.push(u),a.specifiers.push({kind:"local",local:u,exported:this.isExportDefaultDeclaration()?"default":u})}}if(this.isExportNamedDeclaration()&&e.specifiers)for(var c=e.specifiers,f=0;f<c.length;f++){var d=c[f],h=d.exported.name;a.exported.push(h),l.isExportDefaultSpecifier(d)&&a.specifiers.push({kind:"external",local:h,exported:h,source:i}),l.isExportNamespaceSpecifier(d)&&a.specifiers.push({kind:"external-namespace",exported:h,source:i});var m=d.local;m&&(n._addExport(m.name,d.exported),i&&a.specifiers.push({kind:"external",local:m.name,exported:h,source:i}),i||a.specifiers.push({kind:"local",local:m.name,exported:h}))}if(this.isExportAllDeclaration()&&a.specifiers.push({kind:"external-all",source:i}),!l.isExportDefaultDeclaration(e)&&!s.isTypeAlias()){var y=e.specifiers&&1===e.specifiers.length&&l.isSpecifierDefault(e.specifiers[0]);y||(n.hasNonDefaultExports=!0)}}function s(e,t,r,n){n.isLoose()||this.skip()}r.__esModule=!0,r.ExportDeclaration=a,r.Scope=s;var o=e(511),u=i(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){e.source&&(e.source.value=n.file.resolveModuleSource(e.source.value),n.addScope(this))}};r.ModuleDeclaration=c;var f={exit:function(e,t,r,n){n.hasLocalImports=!0;var i=[],a=[];n.metadata.imports.push({source:e.source.value,imported:a,specifiers:i});for(var s=this.get("specifiers"),o=0;o<s.length;o++){var p=s[o],l=p.getBindingIdentifiers();u["default"](n.localImports,l);var c=p.node.local.name;if(p.isImportDefaultSpecifier()&&(a.push("default"),i.push({kind:"named",imported:"default",local:c})),p.isImportSpecifier()){var f=p.node.imported.name;a.push(f),i.push({kind:"named",imported:f,local:c})}p.isImportNamespaceSpecifier()&&(a.push("*"),i.push({kind:"namespace",local:c}))}}};r.ImportDeclaration=f},{179:179,511:511}],76:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(179),s=n(a),o={enter:function(e){return e._skipModulesRemap?this.skip():void 0},ReferencedIdentifier:function(e,t,r,n){var i=n.formatter,a=n.get(r,e.name);return a&&e!==a&&(!r.hasBinding(e.name)||r.bindingIdentifierEquals(e.name,i.localImports[e.name]))?!i.isLoose()&&"callee"===this.key&&this.parentPath.isCallExpression()?s.sequenceExpression([s.literal(0),a]):a:void 0},AssignmentExpression:{exit:function(e,t,r,n){var i=n.formatter;if(!e._ignoreModulesRemap){var a=i.getExport(e.left,r);if(a)return i.remapExportAssignment(e,a)}}},UpdateExpression:function(e,t,r,n){var i=n.formatter,a=i.getExport(e.argument,r);if(a){this.skip();var o=s.assignmentExpression(e.operator[0]+"=",e.argument,s.literal(1)),u=i.remapExportAssignment(o,a);if(s.isExpressionStatement(t)||e.prefix)return u;var p=[];p.push(u);var l;return l="--"===e.operator?"+":"-",p.push(s.binaryExpression(l,e.argument,s.literal(1))),s.sequenceExpression(p)}}},u=function(){function e(t,r){i(this,e),this.formatter=r,this.file=t}return e.prototype.run=function(){this.file.path.traverse(o,this)},e.prototype._getKey=function(e){return e+":moduleRemap"},e.prototype.get=function(e,t){return e.getData(this._getKey(t))},e.prototype.add=function(e,t,r){return this.all&&this.all.push({name:t,scope:e,node:r}),e.setData(this._getKey(t),r)},e.prototype.remove=function(e,t){return e.removeData(this._getKey(t))},e.prototype.getAll=function(){return this.all},e.prototype.clearAll=function(){if(this.all)for(var e=this.all,t=0;t<e.length;t++){var r=e[t];r.scope.removeData(this._getKey(r.name))}this.all=[]},e}();r["default"]=u,t.exports=r["default"]},{179:179}],77:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(182),f=n(c),d=e(407),h=i(d),m=e(414),y=i(m),g=e(179),v=n(g),b={Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){if(("var"===e.kind||v.isProgram(t))&&!n.formatter._canHoist(e)){for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(n.hoistDeclarators.push(v.variableDeclarator(s.id)),s.init){var o=v.expressionStatement(v.assignmentExpression("=",s.id,s.init));i.push(o)}}return v.isFor(t)&&t.left===e?e.declarations[0].id:i}}},E={Function:function(){this.skip()},enter:function(e,t,r,n){(v.isFunctionDeclaration(e)||n.formatter._canHoist(e))&&(n.handlerBody.push(e),this.dangerouslyRemove())}},x={enter:function(e,t,r,n){if(e._importSource===n.source){if(v.isVariableDeclaration(e))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];n.hoistDeclarators.push(v.variableDeclarator(s.id)),n.nodes.push(v.expressionStatement(v.assignmentExpression("=",s.id,s.init)))}else n.nodes.push(e);this.dangerouslyRemove()}}},S=function(e){function t(r){a(this,t),e.call(this,r),this._setters=null,this.exportIdentifier=r.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,this.remaps.clearAll()}return s(t,e),t.prototype._addImportSource=function(e,t){return e&&(e._importSource=t.source&&t.source.value),e},t.prototype.buildExportsWildcard=function(e,t){var r=this.scope.generateUidIdentifier("key"),n=v.memberExpression(e,r,!0),i=v.variableDeclaration("var",[v.variableDeclarator(r)]),a=e,s=v.blockStatement([v.ifStatement(v.binaryExpression("!==",r,v.literal("default")),v.expressionStatement(this._buildExportCall(r,n)))]);return this._addImportSource(v.forInStatement(i,a,s),t)},t.prototype.buildExportsAssignment=function(e,t,r){var n=this._buildExportCall(v.literal(e.name),t,!0);return this._addImportSource(n,r)},t.prototype.buildExportsFromAssignment=function(){return this.buildExportsAssignment.apply(this,arguments)},t.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=this._buildExportCall(v.literal(t[n].name),r);return r},t.prototype._buildExportCall=function(e,t,r){var n=v.callExpression(this.exportIdentifier,[e,t]);return r?v.expressionStatement(n):n},t.prototype.importSpecifier=function(e,t,r){l["default"].prototype.importSpecifier.apply(this,arguments);for(var n=this.remaps.getAll(),i=0;i<n.length;i++){var a=n[i];r.push(v.variableDeclaration("var",[v.variableDeclarator(v.identifier(a.name),a.node)]))}this.remaps.clearAll(),this._addImportSource(h["default"](r),t)},t.prototype._buildRunnerSetters=function(e,t){var r=this.file.scope;return v.arrayExpression(y["default"](this.ids,function(n,i){var a={hoistDeclarators:t,source:i,nodes:[]};return r.traverse(e,x,a),v.functionExpression(null,[n],v.blockStatement(a.nodes))}))},t.prototype._canHoist=function(e){return e._blockHoist&&!this.file.dynamicImports.length},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=[],r=this.getModuleName(),n=v.literal(r),i=v.blockStatement(e.body),a=this._buildRunnerSetters(i,t);this._setters=a;var s=f.template("system",{MODULE_DEPENDENCIES:v.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,MODULE_NAME:n,SETTERS:a,EXECUTE:v.functionExpression(null,[],i)},!0),o=s.expression.arguments[2].body.body;r||s.expression.arguments.shift();var p=o.pop();if(this.file.scope.traverse(i,b,{formatter:this,hoistDeclarators:t}),t.length){var l=v.variableDeclaration("var",t);l._blockHoist=!0,o.unshift(l)}this.file.scope.traverse(i,E,{formatter:this,handlerBody:o}),o.push(p),e.body=[s]},t}(l["default"]);r["default"]=S,t.exports=r["default"]},{179:179,182:182,407:407,414:414,67:67,70:70}],78:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(79),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,79:79}],79:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(517),f=i(c),d=e(9),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[];for(var n in this.ids)r.push(v.literal(n));var i=f["default"](this.ids),a=[v.identifier("exports")];this.passModuleArg&&a.push(v.identifier("module")),a=a.concat(i);var s=v.functionExpression(null,a,v.blockStatement(t)),o=[v.literal("exports")];this.passModuleArg&&o.push(v.literal("module")),o=o.concat(r),o=[v.arrayExpression(o)];var p=y.template("test-exports"),l=y.template("test-module"),c=this.passModuleArg?v.logicalExpression("&&",p,l):p,d=[v.identifier("exports")];this.passModuleArg&&d.push(v.identifier("module")),d=d.concat(r.map(function(e){return v.callExpression(v.identifier("require"),[e])}));var m=[];this.passModuleArg&&m.push(v.identifier("mod"));for(var g in this.ids){var b=this.defaultIds[g]||v.identifier(v.toIdentifier(h["default"].basename(g,h["default"].extname(g))));m.push(v.memberExpression(v.identifier("global"),b))}var E=this.getModuleName();E&&o.unshift(v.literal(E));var x=this.file.opts.basename;E&&(x=E),x=v.identifier(v.toIdentifier(x));var S=y.template("umd-runner-body",{AMD_ARGUMENTS:o,COMMON_TEST:c,COMMON_ARGUMENTS:d,BROWSER_ARGUMENTS:m,GLOBAL_ARG:x});e.body=[v.expressionStatement(v.callExpression(S,[v.thisExpression(),s]))]},t}(l["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,517:517,67:67,70:70,9:9}],80:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(52),s=n(a),o=e(40),u=n(o),p=e(82),l=n(p),c=e(509),f=n(c),d=e(41),h=n(d),m=e(46),y=n(m),g=function(){function e(){i(this,e),this.transformers=h["default"](),this.namespaces=h["default"](),this.deprecated=h["default"](),this.aliases=h["default"](),this.filters=[]}return e.prototype.addTransformers=function(e){for(var t in e)this.addTransformer(t,e[t]);return this},e.prototype.addTransformer=function(e,t){if(this.transformers[e])throw new Error;var r=e.split(".")[0];this.namespaces[r]=this.namespaces[r]||[],this.namespaces[r].push(e),this.namespaces[e]=r,"function"==typeof t?(t=s["default"].memoisePluginContainer(t),t.key=e,t.metadata.optional=!0,"react.displayName"===e&&(t.metadata.optional=!1)):t=new l["default"](e,t),this.transformers[e]=t},e.prototype.addAliases=function(e){return f["default"](this.aliases,e),this},e.prototype.addDeprecated=function(e){return f["default"](this.deprecated,e),this},e.prototype.addFilter=function(e){return this.filters.push(e),this},e.prototype.canTransform=function(e,t){if(e.metadata.plugin)return!0;for(var r=this.filters,n=0;n<r.length;n++){var i=r[n],a=i(e,t);if(null!=a)return a}return!0},e.prototype.analyze=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.code=!1,this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.transformFromAst=function(e,t,r){e=u["default"](e);var n=new y["default"](r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e.prototype._ensureTransformerNames=function(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=this.deprecated[i],s=this.aliases[i];if(s)r.push(s);else if(a)console.error("[BABEL] The transformer "+i+" has been renamed to "+a),t.push(a);else if(this.transformers[i])r.push(i);else{if(!this.namespaces[i])throw new ReferenceError("Unknown transformer "+i+" specified in "+e);r=r.concat(this.namespaces[i])}}return r},e}();r["default"]=g,t.exports=r["default"]},{40:40,41:41,46:46,509:509,52:52,82:82}],81:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(148),s=n(a),o=function(){function e(t,r){i(this,e),this.plugin=r,this.file=t,this.key=r.key,this.canTransform()&&r.metadata.experimental&&!t.opts.experimental&&t.log.warn("THE TRANSFORMER "+this.key+" HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE `experimental` OPTION TO IGNORE THIS WARNING.")}return e.prototype.canTransform=function(){return this.file.transformerDependencies[this.key]||this.file.pipeline.canTransform(this.plugin,this.file.opts)},e.prototype.transform=function(){var e=this.file;e.log.debug("Start transformer "+this.key),s["default"](e.ast,this.plugin.visitor,e.scope,e),e.log.debug("Finish transformer "+this.key)},e}();r["default"]=o,t.exports=r["default"]},{148:148}],82:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(81),o=i(s),u=e(43),p=n(u),l=e(148),c=i(l),f=e(509),d=i(f),h=e(494),m=i(h),y=e(46),g=i(y),v=e(179),b=n(v),E=["visitor","metadata","manipulateOptions","post","pre"],x=["dependencies","optional","stage","group","experimental","secondPass"],S=function(){function e(t,r){a(this,e),e.validate(t,r),r=d["default"]({},r);var n=function(e){var t=r[e];return delete r[e],t};this.manipulateOptions=n("manipulateOptions"),this.metadata=n("metadata")||{},this.dependencies=this.metadata.dependencies||[],this.post=n("post"),this.pre=n("pre"),null!=this.metadata.stage&&(this.metadata.optional=!0),this.visitor=this.normalize(m["default"](n("visitor"))||{}),this.key=t}return e.validate=function(e,t){for(var r in t)if("_"!==r[0]&&!(E.indexOf(r)>=0)){var n="pluginInvalidProperty";throw b.TYPES.indexOf(r)>=0&&(n="pluginInvalidPropertyVisitor"),new Error(p.get(n,e,r))}for(var r in t.metadata)if(!(x.indexOf(r)>=0))throw new Error(p.get("pluginInvalidProperty",e,"metadata."+r))},e.prototype.normalize=function(e){return c["default"].explode(e),e},e.prototype.buildPass=function(e){if(!(e instanceof g["default"]))throw new TypeError(p.get("pluginNotFile",this.key));return new o["default"](e,this)},e}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,43:43,46:46,494:494,509:509,81:81}],83:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(82),s=n(a),o=function u(e,t){i(this,u);var r={};return r.metadata=t.metadata,delete t.metadata,r.visitor=t,new s["default"](e,r)};r["default"]=o,t.exports=r["default"]},{82:82}],84:[function(e,t,r){t.exports={useStrict:"strict","es5.runtime":"runtime","es6.runtime":"runtime","minification.inlineExpressions":"minification.constantFolding"}},{}],85:[function(e,t,r){t.exports={selfContained:"runtime","unicode-regex":"regex.unicode","spec.typeofSymbol":"es6.spec.symbols","es6.symbols":"es6.spec.symbols","es6.blockScopingTDZ":"es6.spec.blockScoping","utility.inlineExpressions":"minification.constantFolding","utility.deadCodeElimination":"minification.deadCodeElimination","utility.removeConsoleCalls":"minification.removeConsole","utility.removeDebugger":"minification.removeDebugger","es6.parameters.rest":"es6.parameters","es6.parameters.default":"es6.parameters"}},{}],86:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={MemberExpression:{exit:function(e){var t=e.property;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.property=a.literal(t.name),e.computed=!0)}}};r.visitor=o},{179:179}],87:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={ group:"builtin-trailing"};r.metadata=s;var o={Property:{exit:function(e){var t=e.key;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.key=a.literal(t.name))}}};r.visitor=o},{179:179}],88:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(57),a=n(i),s=e(179),o=n(s),u={ObjectExpression:function(e,t,r,n){for(var i=!1,s=e.properties,u=0;u<s.length;u++){var p=s[u];if("get"===p.kind||"set"===p.kind){i=!0;break}}if(i){var l={};return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(a.push(l,e,e.kind,n),!1):!0}),o.callExpression(o.memberExpression(o.identifier("Object"),o.identifier("defineProperties")),[e,a.toDefineObject(l)])}}};r.visitor=u},{179:179,57:57}],89:[function(e,t,r){"use strict";r.__esModule=!0;var n={ArrowFunctionExpression:function(e){this.ensureBlock(),e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}};r.visitor=n},{}],90:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!b.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(o(e,t))for(var r=0;r<e.declarations.length;r++){var n=e.declarations[r];n.init=n.init||b.identifier("undefined")}return e._let=!0,e.kind="var",!0}function o(e,t){return!b.isFor(t)||!b.isFor(t,{left:e})}function u(e,t){return b.isVariableDeclaration(e,{kind:"var"})&&!s(e,t)}function p(e){for(var t=e,r=0;r<t.length;r++){var n=t[r];delete n._let}}function l(e,t,r,n){var i=n[e.name];if(i){var a=r.getBindingIdentifier(e.name);a===i.binding?e.name=i.uid:this&&this.skip()}}function c(e,t,r,n){if(b.isIdentifier(e)&&l(e,t,r,n),b.isAssignmentExpression(e)){var i=b.getBindingIdentifiers(e);for(var a in i)l(i[a],t,r,n)}r.traverse(e,w,n)}r.__esModule=!0;var f=e(148),d=i(f),h=e(41),m=i(h),y=e(182),g=n(y),v=e(179),b=n(v),E=e(517),x=i(E),S=e(511),A=i(S),D={group:"builtin-advanced"};r.metadata=D;var C={VariableDeclaration:function(e,t,r,n){if(s(e,t)&&o(e)&&n.transformers["es6.spec.blockScoping"].canTransform()){for(var i=[e],a=0;a<e.declarations.length;a++){var u=e.declarations[a];if(u.init){var p=b.assignmentExpression("=",u.id,u.init);p._ignoreBlockScopingTDZ=!0,i.push(b.expressionStatement(p))}u.init=n.addHelper("temporal-undefined")}return e._blockHoist=2,i}},Loop:function(e,t,r,n){var i=e.left||e.init;s(i,e)&&(b.ensureBlock(e),e.body._letDeclarators=[i]);var a=new M(this,this.get("body"),t,r,n);return a.run()},"BlockStatement|Program":function(e,t,r,n){if(!b.isLoop(t)){var i=new M(null,this,t,r,n);i.run()}}};r.visitor=C;var w={ReferencedIdentifier:l,AssignmentExpression:function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)l(i[a],e,r,n)}},I={Function:function(e,t,r,n){return this.traverse(_,n),this.skip()}},_={ReferencedIdentifier:function(e,t,r,n){var i=n.letReferences[e.name];if(i){var a=r.getBindingIdentifier(e.name);a&&a!==i||(n.closurify=!0)}}},F={enter:function(e,t,r,n){if(this.isForStatement()){if(u(e.init,e)){var i=n.pushDeclar(e.init);1===i.length?e.init=i[0]:e.init=b.sequenceExpression(i)}}else if(this.isFor())u(e.left,e)&&(n.pushDeclar(e.left),e.left=e.left.declarations[0].id);else{if(u(e,t))return n.pushDeclar(e).map(b.expressionStatement);if(this.isFunction())return this.skip()}}},k={LabeledStatement:function(e,t,r,n){n.innerLabels.push(e.label.name)}},P={enter:function(e,t,r,n){if(this.isAssignmentExpression()||this.isUpdateExpression()){var i=this.getBindingIdentifiers();for(var a in i)n.outsideReferences[a]===r.getBindingIdentifier(a)&&(n.reassignments[a]=!0)}}},B=function(e){return b.isBreakStatement(e)?"break":b.isContinueStatement(e)?"continue":void 0},T={Loop:function(e,t,r,n){var i=n.ignoreLabeless;n.ignoreLabeless=!0,this.traverse(T,n),n.ignoreLabeless=i,this.skip()},Function:function(){this.skip()},SwitchCase:function(e,t,r,n){var i=n.inSwitchCase;n.inSwitchCase=!0,this.traverse(T,n),n.inSwitchCase=i,this.skip()},enter:function(e,t,r,n){var i,a=B(e);if(a){if(e.label){if(n.innerLabels.indexOf(e.label.name)>=0)return;a=a+"|"+e.label.name}else{if(n.ignoreLabeless)return;if(n.inSwitchCase)return;if(b.isBreakStatement(e)&&b.isSwitchCase(t))return}n.hasBreakContinue=!0,n.map[a]=e,i=b.literal(a)}return this.isReturnStatement()&&(n.hasReturn=!0,i=b.objectExpression([b.property("init",b.identifier("v"),e.argument||b.identifier("undefined"))])),i?(i=b.returnStatement(i),this.skip(),b.inherits(i,e)):void 0}},M=function(){function e(t,r,n,i,s){a(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=m["default"](),this.hasLetReferences=!1,this.letReferences=this.block._letReferences=m["default"](),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=b.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(!b.isFunction(this.parent)&&!b.isProgram(this.block)&&this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.loopLabel&&!b.isLabeledStatement(this.loopParent)?b.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.remap=function(){var e=!1,t=this.letReferences,r=this.scope,n=m["default"]();for(var i in t){var a=t[i];if(r.parentHasBinding(i)||r.hasGlobal(i)){var s=r.generateUidIdentifier(a.name).name;a.name=s,e=!0,n[i]=n[s]={binding:a,uid:s}}}if(e){var o=this.loop;o&&(c(o.right,o,r,n),c(o.test,o,r,n),c(o.update,o,r,n)),this.blockPath.traverse(w,n)}},e.prototype.wrapClosure=function(){var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=x["default"](t),a=x["default"](t),s=b.functionExpression(null,i,b.blockStatement(e.body));s.shadow=!0,this.addContinuations(s),e.body=this.body;var o=s;this.loop&&(o=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(b.variableDeclaration("var",[b.variableDeclarator(o,s)])));var u=b.callExpression(o,a),p=this.scope.generateUidIdentifier("ret"),l=d["default"].hasType(s.body,this.scope,"YieldExpression",b.FUNCTION_TYPES);l&&(s.generator=!0,u=b.yieldExpression(u,!0));var c=d["default"].hasType(s.body,this.scope,"AwaitExpression",b.FUNCTION_TYPES);c&&(s.async=!0,u=b.awaitExpression(u)),this.buildClosure(p,u)},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(b.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,P,t);for(var r=0;r<e.params.length;r++){var n=e.params[r];if(t.reassignments[n.name]){var i=this.scope.generateUidIdentifier(n.name);e.params[r]=i,this.scope.rename(n.name,i.name,e),e.body.body.push(b.expressionStatement(b.assignmentExpression("=",n,i)))}}},e.prototype.getLetReferences=function(){for(var e=this.block,t=e._letDeclarators||[],r=0;r<t.length;r++){var n=t[r];A["default"](this.outsideLetReferences,b.getBindingIdentifiers(n))}if(e.body)for(var r=0;r<e.body.length;r++){var n=e.body[r];s(n,e)&&(t=t.concat(n.declarations))}for(var r=0;r<t.length;r++){var n=t[r],i=b.getBindingIdentifiers(n);A["default"](this.letReferences,i),this.hasLetReferences=!0}if(this.hasLetReferences){p(t);var a={letReferences:this.letReferences,closurify:!1};return this.blockPath.traverse(I,a),a.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,inSwitchCase:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loop,map:{}};return this.blockPath.traverse(k,e),this.blockPath.traverse(T,e),e},e.prototype.hoistVarDeclarations=function(){this.blockPath.traverse(F,this)},e.prototype.pushDeclar=function(e){var t=[],r=b.getBindingIdentifiers(e);for(var n in r)t.push(b.variableDeclarator(r[n]));this.body.push(b.variableDeclaration(e.kind,t));for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(s.init){var o=b.assignmentExpression("=",s.id,s.init);i.push(b.inherits(o,s))}}return i},e.prototype.buildHas=function(e,t){var r=this.body;r.push(b.variableDeclaration("var",[b.variableDeclarator(e,t)]));var n,i=this.has,a=[];if(i.hasReturn&&(n=g.template("let-scoping-return",{RETURN:e})),i.hasBreakContinue){for(var s in i.map)a.push(b.switchCase(b.literal(s),[i.map[s]]));if(i.hasReturn&&a.push(b.switchCase(null,[n])),1===a.length){var o=a[0];r.push(this.file.attachAuxiliaryComment(b.ifStatement(b.binaryExpression("===",e,o.test),o.consequent[0])))}else{for(var u=0;u<a.length;u++){var p=a[u].consequent[0];b.isBreakStatement(p)&&!p.label&&(p.label=this.loopLabel=this.loopLabel||this.file.scope.generateUidIdentifier("loop"))}r.push(this.file.attachAuxiliaryComment(b.switchStatement(e,a)))}}else i.hasReturn&&r.push(this.file.attachAuxiliaryComment(n))},e}()},{148:148,179:179,182:182,41:41,511:511,517:517}],91:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(92),s=i(a),o=e(93),u=i(o),p=e(179),l=n(p),c=e(61),f={ClassDeclaration:function(e){return l.variableDeclaration("let",[l.variableDeclarator(e.id,l.toExpression(e))])},ClassExpression:function(e,t,r,n){var i=c.bare(e,t,r);return i?i:n.isLoose("es6.classes")?new s["default"](this,n).run():new u["default"](this,n).run()}};r.visitor=f},{179:179,61:61,92:92,93:93}],92:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(93),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments),this.isLoose=!0}return s(t,e),t.prototype._processMethod=function(e){if(!e.decorators){var t=this.classRef;e["static"]||(t=l.memberExpression(t,l.identifier("prototype")));var r=l.memberExpression(t,e.key,e.computed||l.isLiteral(e.key)),n=l.expressionStatement(l.assignmentExpression("=",r,e.value));return l.inheritsComments(n,e),this.body.push(n),!0}},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,93:93}],93:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(60),o=i(s),u=e(65),p=i(u),l=e(61),c=n(l),f=e(57),d=n(f),h=e(43),m=n(h),y=e(182),g=n(y),v=e(179),b=n(v),E="__initializeProperties",x={Identifier:{enter:function(e,t,r,n){this.parentPath.isClassProperty({key:e})||this.isReferenced()&&r.getBinding(e.name)===n.scope.getBinding(e.name)&&(n.references[e.name]=!0)}}},S={MethodDefinition:function(){this.skip()},Property:function(e){e.method&&this.skip()},CallExpression:{exit:function(e,t,r,n){if(this.get("callee").isSuper()&&(n.hasBareSuper=!0,n.bareSuper=this,!n.isDerived))throw this.errorWithNode("super call is only allowed in derived constructor")}},"FunctionDeclaration|FunctionExpression":function(){this.skip()},ThisExpression:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper){if(this.inShadow()){var i=n.constructorPath.getData("this");return i||(i=n.constructorPath.setData("this",n.constructorPath.scope.generateUidIdentifier("this"))),i}throw this.errorWithNode("'this' is not allowed before super()")}},Super:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper&&!this.parentPath.isCallExpression({callee:e}))throw this.errorWithNode("'super.*' is not allowed before super()")}},A=function(){function e(t,r){a(this,e),this.parent=t.parent,this.scope=t.scope,this.node=t.node,this.path=t,this.file=r,this.clearDescriptors(),this.instancePropBody=[],this.instancePropRefs={},this.staticPropBody=[],this.body=[],this.pushedConstructor=!1,this.pushedInherits=!1,this.hasDecorators=!1,this.isLoose=!1,this.classId=this.node.id,this.classRef=this.node.id||this.scope.generateUidIdentifier("class"),this.directRef=null,this.superName=this.node.superClass||b.identifier("Function"),this.isDerived=!!this.node.superClass}return e.prototype.run=function(){var e=this.superName,t=this.file,r=this.body,n=this.constructorBody=b.blockStatement([]);this.constructor=this.buildConstructor();var i=[],a=[];this.isDerived&&(a.push(e),e=this.scope.generateUidIdentifierBasedOnNode(e),i.push(e),this.superName=e);var s=this.node.decorators;if(s?this.directRef=this.scope.generateUidIdentifier(this.classRef):this.directRef=this.classRef,this.buildBody(),n.body.unshift(b.expressionStatement(b.callExpression(t.addHelper("class-call-check"),[b.thisExpression(),this.directRef]))),this.pushDecorators(),r=r.concat(this.staticPropBody),this.classId&&1===r.length)return b.toExpression(r[0]);r.push(b.returnStatement(this.classRef));var o=b.functionExpression(null,i,b.blockStatement(r));return o.shadow=!0,b.callExpression(o,a)},e.prototype.buildConstructor=function(){var e=b.functionDeclaration(this.classRef,[],this.constructorBody);return b.inherits(e,this.node),e},e.prototype.pushToMap=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?"value":arguments[2];e["static"]?(this.hasStaticDescriptors=!0,r=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,r=this.instanceMutatorMap);var i=d.push(r,e,n,this.file);t&&(i.enumerable=b.literal(!0)),i.decorators&&(this.hasDecorators=!0)},e.prototype.constructorMeMaybe=function(){for(var e=!1,t=this.path.get("body.body"),r=t,n=0;n<r.length;n++){var i=r[n];if(e=i.equals("kind","constructor"))break}if(!e){var a;a=this.isDerived?g.template("class-derived-default-constructor"):b.functionExpression(null,[],b.blockStatement([])),this.path.get("body").unshiftContainer("body",b.methodDefinition(b.identifier("constructor"),a,"constructor"))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.placePropertyInitializers(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),b.inherits(this.constructor,this.userConstructor),b.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){for(var e=this.path.get("body.body"),t=e,r=0;r<t.length;r++){var n=t[r],i=n.node;if(i.decorators&&o["default"](i.decorators,this.scope),b.isMethodDefinition(i)){var a="constructor"===i.kind;a&&this.verifyConstructor(n);var s=new p["default"]({methodPath:n,methodNode:i,objectRef:this.directRef,superRef:this.superName,isStatic:i["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);s.replace(),a?this.pushConstructor(i,n):this.pushMethod(i,n)}else b.isClassProperty(i)&&this.pushProperty(i,n)}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e,t,r=this.body,n="create-class";if(this.hasDecorators&&(n="create-decorated-class"),this.hasInstanceDescriptors&&(e=d.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(t=d.toClassObject(this.staticMutatorMap)),e||t){e&&(e=d.toComputedObjectFromClass(e)),t&&(t=d.toComputedObjectFromClass(t));var i=b.literal(null),a=[this.classRef,i,i,i,i];e&&(a[1]=e),t&&(a[2]=t),this.instanceInitializersId&&(a[3]=this.instanceInitializersId,r.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(a[4]=this.staticInitializersId,r.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,o=0;o<a.length;o++)a[o]!==i&&(s=o);a=a.slice(0,s+1),r.push(b.expressionStatement(b.callExpression(this.file.addHelper(n),a)))}this.clearDescriptors()},e.prototype.buildObjectAssignment=function(e){return b.variableDeclaration("var",[b.variableDeclarator(e,b.objectExpression([]))])},e.prototype.placePropertyInitializers=function(){var e=this.instancePropBody;if(e.length)if(this.hasPropertyCollision()){var t=b.expressionStatement(b.callExpression(b.memberExpression(b.thisExpression(),b.identifier(E)),[]));this.pushMethod(b.methodDefinition(b.identifier(E),b.functionExpression(null,[],b.blockStatement(e))),null,!0),this.isDerived?this.bareSuper.insertAfter(t):this.constructorBody.body.unshift(t)}else this.isDerived?this.bareSuper.insertAfter(e):this.constructorBody.body=e.concat(this.constructorBody.body)},e.prototype.hasPropertyCollision=function(){if(this.userConstructorPath)for(var e in this.instancePropRefs)if(this.userConstructorPath.scope.hasOwnBinding(e))return!0;return!1},e.prototype.verifyConstructor=function(e){var t={constructorPath:e.get("value"),hasBareSuper:!1,bareSuper:null,isDerived:this.isDerived,file:this.file};t.constructorPath.traverse(S,t);var r=t.constructorPath.getData("this");if(r&&t.bareSuper&&t.bareSuper.insertAfter(b.variableDeclaration("var",[b.variableDeclarator(r,b.thisExpression())])),this.bareSuper=t.bareSuper,!t.hasBareSuper&&this.isDerived)throw e.errorWithNode("Derived constructor must call super()")},e.prototype.pushMethod=function(e,t,r){if(!r&&b.isLiteral(b.toComputedKey(e),{value:E}))throw this.file.errorWithNode(e,m.get("illegalMethodName",E));"method"===e.kind&&(c.property(e,this.file,t?t.get("value").scope:this.scope),this._processMethod(e))||this.pushToMap(e)},e.prototype._processMethod=function(){return!1},e.prototype.pushProperty=function(e,t){if(t.traverse(x,{references:this.instancePropRefs,scope:this.scope}),e.decorators){var r=[];e.value?(r.push(b.returnStatement(e.value)),e.value=b.functionExpression(null,[],b.blockStatement(r))):e.value=b.literal(null),this.pushToMap(e,!0,"initializer");var n,i;e["static"]?(n=this.staticInitializersId=this.staticInitializersId||this.scope.generateUidIdentifier("staticInitializers"),r=this.staticPropBody,i=this.classRef):(n=this.instanceInitializersId=this.instanceInitializersId||this.scope.generateUidIdentifier("instanceInitializers"),r=this.instancePropBody,i=b.thisExpression()),r.push(b.expressionStatement(b.callExpression(this.file.addHelper("define-decorated-property-descriptor"),[i,b.literal(e.key.name),n])))}else{if(!e.value&&!e.decorators)return;e["static"]?this.pushToMap(e,!0):e.value&&this.instancePropBody.push(b.expressionStatement(b.assignmentExpression("=",b.memberExpression(b.thisExpression(),e.key),e.value)))}},e.prototype.pushConstructor=function(e,t){var r=t.get("value");r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor,i=e.value;this.userConstructorPath=r,this.userConstructor=i,this.hasConstructor=!0,b.inheritsComments(n,e),n._ignoreUserWhitespace=!0,n.params=i.params,b.inherits(n.body,i.body),this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(b.expressionStatement(b.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e.prototype.pushDecorators=function(){var e=this.node.decorators;if(e){this.body.push(b.variableDeclaration("var",[b.variableDeclarator(this.directRef,this.classRef)])),e=e.reverse();for(var t=e,r=0;r<t.length;r++){var n=t[r],i=g.template("class-decorator",{DECORATOR:n.expression,CLASS_REF:this.classRef},!0);i.expression._ignoreModulesRemap=!0,this.body.push(i)}}},e}();r["default"]=A,t.exports=r["default"]},{179:179,182:182,43:43,57:57,60:60,61:61,65:65}],94:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s={Scope:function(e,t,r){for(var n in r.bindings){var i=r.bindings[n];if("const"===i.kind||"module"===i.kind)for(var s=i.constantViolations,o=0;o<s.length;o++){var u=s[o];throw u.errorWithNode(a.get("readOnly",n))}}},VariableDeclaration:function(e){"const"===e.kind&&(e.kind="let")}};r.visitor=s},{43:43}],95:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){for(var t=0;t<e.declarations.length;t++)if(l.isPattern(e.declarations[t].id))return!0;return!1}function s(e){for(var t=0;t<e.elements.length;t++)if(l.isRestElement(e.elements[t]))return!0;return!1}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={group:"builtin-advanced"};r.metadata=c;var f={ForXStatement:function(e,t,r,n){var i=e.left;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");return e.left=l.variableDeclaration("var",[l.variableDeclarator(a)]),this.ensureBlock(),void e.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(i,a)]))}if(l.isVariableDeclaration(i)){var s=i.declarations[0].id;if(l.isPattern(s)){var o=r.generateUidIdentifier("ref");e.left=l.variableDeclaration(i.kind,[l.variableDeclarator(o,null)]);var u=[],p=new h({kind:i.kind,file:n,scope:r,nodes:u});p.init(s,o),this.ensureBlock();var c=e.body;c.body=u.concat(c.body)}}},Function:function(e,t,r,n){for(var i=!1,a=e.params,s=0;s<a.length;s++){var o=a[s];if(l.isPattern(o)){i=!0;break}}if(i){for(var u=[],p=0;p<e.params.length;p++){var o=e.params[p];if(l.isPattern(o)){var c=r.generateUidIdentifier("ref");if(l.isAssignmentPattern(o)){var f=o;o=o.left,f.left=c}else e.params[p]=c;l.inherits(c,o);var d=new h({blockHoist:e.params.length-p,nodes:u,scope:r,file:n,kind:"let"});d.init(o,c)}}this.ensureBlock();var m=e.body;m.body=u.concat(m.body)}},CatchClause:function(e,t,r,n){var i=e.param;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");e.param=a;var s=[],o=new h({kind:"let",file:n,scope:r,nodes:s});o.init(i,a),e.body.body=s.concat(e.body.body)}},AssignmentExpression:function(e,t,r,n){if(l.isPattern(e.left)){var i,a=[],s=new h({operator:e.operator,file:n,scope:r,nodes:a});return(this.isCompletionRecord()||!this.parentPath.isExpressionStatement())&&(i=r.generateUidIdentifierBasedOnNode(e.right,"ref"),a.push(l.variableDeclaration("var",[l.variableDeclarator(i,e.right)])),l.isArrayExpression(e.right)&&(s.arrays[i.name]=!0)),s.init(e.left,i||e.right),i&&a.push(l.expressionStatement(i)),a}},VariableDeclaration:function(e,t,r,n){if(!l.isForXStatement(t)&&a(e)){for(var i,s=[],o=0;o<e.declarations.length;o++){i=e.declarations[o];var p=i.init,c=i.id,f=new h({nodes:s,scope:r,kind:e.kind,file:n});l.isPattern(c)?(f.init(c,p),+o!==e.declarations.length-1&&l.inherits(s[s.length-1],i)):s.push(l.inherits(f.buildVariableAssignment(i.id,i.init),i))}if(!l.isProgram(t)&&!l.isBlockStatement(t)){for(i=null,o=0;o<s.length;o++){if(e=s[o],i=i||l.variableDeclaration(e.kind,[]),!l.isVariableDeclaration(e)&&i.kind!==e.kind)throw n.errorWithNode(e,u.get("invalidParentForThisNode"));i.declarations=i.declarations.concat(e.declarations)}return i}return s}}};r.visitor=f;var d={ReferencedIdentifier:function(e,t,r,n){n.bindings[e.name]&&(n.deopt=!0,this.stop())}},h=function(){function e(t){i(this,e),this.blockHoist=t.blockHoist,this.operator=t.operator,this.arrays={},this.nodes=t.nodes||[],this.scope=t.scope,this.file=t.file,this.kind=t.kind}return e.prototype.buildVariableAssignment=function(e,t){var r=this.operator;l.isMemberExpression(e)&&(r="=");var n;return n=r?l.expressionStatement(l.assignmentExpression(r,e,t)):l.variableDeclaration(this.kind,[l.variableDeclarator(e,t)]),n._blockHoist=this.blockHoist,n},e.prototype.buildVariableDeclaration=function(e,t){var r=l.variableDeclaration("var",[l.variableDeclarator(e,t)]);return r._blockHoist=this.blockHoist,r},e.prototype.push=function(e,t){l.isObjectPattern(e)?this.pushObjectPattern(e,t):l.isArrayPattern(e)?this.pushArrayPattern(e,t):l.isAssignmentPattern(e)?this.pushAssignmentPattern(e,t):this.nodes.push(this.buildVariableAssignment(e,t))},e.prototype.toArray=function(e,t){return this.file.isLoose("es6.destructuring")||l.isIdentifier(e)&&this.arrays[e.name]?e:this.scope.toArray(e,t)},e.prototype.pushAssignmentPattern=function(e,t){var r=this.scope.generateUidIdentifierBasedOnNode(t),n=l.variableDeclaration("var",[l.variableDeclarator(r,t)]);n._blockHoist=this.blockHoist,this.nodes.push(n);var i=l.conditionalExpression(l.binaryExpression("===",r,l.identifier("undefined")),e.right,r),a=e.left;if(l.isPattern(a)){var s=l.expressionStatement(l.assignmentExpression("=",r,i));s._blockHoist=this.blockHoist,this.nodes.push(s),this.push(a,r)}else this.nodes.push(this.buildVariableAssignment(a,i))},e.prototype.pushObjectSpread=function(e,t,r,n){for(var i=[],a=0;a<e.properties.length;a++){var s=e.properties[a];if(a>=n)break;if(!l.isSpreadProperty(s)){var o=s.key;l.isIdentifier(o)&&!s.computed&&(o=l.literal(s.key.name)),i.push(o)}}i=l.arrayExpression(i);var u=l.callExpression(this.file.addHelper("object-without-properties"),[t,i]);this.nodes.push(this.buildVariableAssignment(r.argument,u))},e.prototype.pushObjectProperty=function(e,t){l.isLiteral(e.key)&&(e.computed=!0);var r=e.value,n=l.memberExpression(t,e.key,e.computed);l.isPattern(r)?this.push(r,n):this.nodes.push(this.buildVariableAssignment(r,n))},e.prototype.pushObjectPattern=function(e,t){if(e.properties.length||this.nodes.push(l.expressionStatement(l.callExpression(this.file.addHelper("object-destructuring-empty"),[t]))),e.properties.length>1&&!this.scope.isStatic(t)){var r=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(r,t)),t=r}for(var n=0;n<e.properties.length;n++){var i=e.properties[n];l.isSpreadProperty(i)?this.pushObjectSpread(e,t,i,n):this.pushObjectProperty(i,t)}},e.prototype.canUnpackArrayPattern=function(e,t){if(!l.isArrayExpression(t))return!1;if(!(e.elements.length>t.elements.length)){if(e.elements.length<t.elements.length&&!s(e))return!1;for(var r=e.elements,n=0;n<r.length;n++){var i=r[n];if(!i)return!1;if(l.isMemberExpression(i))return!1}for(var a=t.elements,o=0;o<a.length;o++){var i=a[o];if(l.isSpreadElement(i))return!1}var u=l.getBindingIdentifiers(e),p={deopt:!1,bindings:u};return this.scope.traverse(t,d,p),!p.deopt}},e.prototype.pushUnpackedArrayPattern=function(e,t){for(var r=0;r<e.elements.length;r++){var n=e.elements[r];l.isRestElement(n)?this.push(n.argument,l.arrayExpression(t.elements.slice(r))):this.push(n,t.elements[r])}},e.prototype.pushArrayPattern=function(e,t){if(e.elements){if(this.canUnpackArrayPattern(e,t))return this.pushUnpackedArrayPattern(e,t);var r=!s(e)&&e.elements.length,n=this.toArray(t,r);l.isIdentifier(n)?t=n:(t=this.scope.generateUidIdentifierBasedOnNode(t),this.arrays[t.name]=!0,this.nodes.push(this.buildVariableDeclaration(t,n)));for(var i=0;i<e.elements.length;i++){var a=e.elements[i];if(a){var o;l.isRestElement(a)?(o=this.toArray(t),i>0&&(o=l.callExpression(l.memberExpression(o,l.identifier("slice")),[l.literal(i)])),a=a.argument):o=l.memberExpression(t,l.literal(i),!0),this.push(a,o)}}}},e.prototype.init=function(e,t){if(!l.isArrayExpression(t)&&!l.isMemberExpression(t)){var r=this.scope.maybeGenerateMemoised(t,!0);r&&(this.nodes.push(this.buildVariableDeclaration(r,t)),t=r)}return this.push(e,t),this.nodes},e}()},{179:179,43:43}],96:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=[],n=e.right;if(!l.isIdentifier(n)||!t.hasBinding(n.name)){var i=t.generateUidIdentifier("arr");r.push(l.variableDeclaration("var",[l.variableDeclarator(i,n)])),n=i}var a=t.generateUidIdentifier("i"),s=u.template("for-of-array",{BODY:e.body,KEY:a,ARR:n});l.inherits(s,e),l.ensureBlock(s);var o=l.memberExpression(n,a,!0),p=e.left;return l.isVariableDeclaration(p)?(p.declarations[0].init=o,s.body.body.unshift(p)):s.body.body.unshift(l.expressionStatement(l.assignmentExpression("=",p,o))),this.parentPath.isLabeledStatement()&&(s=l.labeledStatement(this.parentPath.node.label,s)),r.push(s),r}r.__esModule=!0,r._ForOfStatementArray=i;var a=e(43),s=n(a),o=e(182),u=n(o),p=e(179),l=n(p),c={ForOfStatement:function(e,t,r,n){if(this.get("right").isArrayExpression())return i.call(this,e,r,n);var a=d;n.isLoose("es6.forOf")&&(a=f);var s=a(e,t,r,n),o=s.declar,u=s.loop,p=u.body;return this.ensureBlock(),o&&p.body.push(o),p.body=p.body.concat(e.body.body),l.inherits(u,e),l.inherits(u.body,e.body),s.replaceParent?(this.parentPath.replaceWithMultiple(s.node),void this.dangerouslyRemove()):s.node}};r.visitor=c;var f=function(e,t,r,n){var i,a,o=e.left;if(l.isIdentifier(o)||l.isPattern(o)||l.isMemberExpression(o))a=o;else{if(!l.isVariableDeclaration(o))throw n.errorWithNode(o,s.get("unknownForHead",o.type));a=r.generateUidIdentifier("ref"),i=l.variableDeclaration(o.kind,[l.variableDeclarator(o.declarations[0].id,a)])}var p=r.generateUidIdentifier("iterator"),c=r.generateUidIdentifier("isArray"),f=u.template("for-of-loose",{LOOP_OBJECT:p,IS_ARRAY:c,OBJECT:e.right,INDEX:r.generateUidIdentifier("i"),ID:a});return i||f.body.body.shift(),{declar:i,node:f,loop:f}},d=function(e,t,r,n){var i,a=e.left,o=r.generateUidIdentifier("step"),p=l.memberExpression(o,l.identifier("value"));if(l.isIdentifier(a)||l.isPattern(a)||l.isMemberExpression(a))i=l.expressionStatement(l.assignmentExpression("=",a,p));else{if(!l.isVariableDeclaration(a))throw n.errorWithNode(a,s.get("unknownForHead",a.type));i=l.variableDeclaration(a.kind,[l.variableDeclarator(a.declarations[0].id,p)])}var c=r.generateUidIdentifier("iterator"),f=u.template("for-of",{ITERATOR_HAD_ERROR_KEY:r.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:r.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:r.generateUidIdentifier("iteratorError"),ITERATOR_KEY:c,STEP_KEY:o,OBJECT:e.right,BODY:null}),d=l.isLabeledStatement(t),h=f[3].block.body,m=h[0];return d&&(h[0]=l.labeledStatement(t.label,m)),{replaceParent:d,declar:i,loop:m,node:f}}},{179:179,182:182,43:43}],97:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-pre"};r.metadata=n;var i={Literal:function(e){"number"==typeof e.value&&/^0[ob]/i.test(e.raw)&&(e.raw=void 0),"string"==typeof e.value&&/\\[u]/gi.test(e.raw)&&(e.raw=void 0)}};r.visitor=i},{}],98:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(e._blockHoist)for(var r=0;r<t.length;r++)t[r]._blockHoist=e._blockHoist}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-modules"};r.metadata=o;var u={ImportDeclaration:function(e,t,r,n){if("type"!==e.importKind&&"typeof"!==e.importKind){var i=[];if(e.specifiers.length)for(var a=e.specifiers,s=0;s<a.length;s++){var o=a[s];n.moduleFormatter.importSpecifier(o,e,i,r); }else n.moduleFormatter.importDeclaration(e,i,r);return 1===i.length&&(i[0]._blockHoist=e._blockHoist),i}},ExportAllDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportAllDeclaration(e,a,r),i(e,a),a},ExportDefaultDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportDeclaration(e,a,r),i(e,a),a},ExportNamedDeclaration:function(e,t,r,n){if(!this.get("declaration").isTypeAlias()){var a=[];if(e.declaration){if(s.isVariableDeclaration(e.declaration)){var o=e.declaration.declarations[0];o.init=o.init||s.identifier("undefined")}n.moduleFormatter.exportDeclaration(e,a,r)}else if(e.specifiers)for(var u=0;u<e.specifiers.length;u++)n.moduleFormatter.exportSpecifier(e.specifiers[u],e,a,r);return i(e,a),a}}};r.visitor=u},{179:179}],99:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if((t.method||"init"!==t.kind)&&p.isFunction(t.value)){var a=new o["default"]({getObjectRef:n,methodNode:t,methodPath:e,isStatic:!0,scope:r,file:i});a.replace()}}r.__esModule=!0;var s=e(65),o=i(s),u=e(179),p=n(u),l={ObjectExpression:function(e,t,r,n){for(var i,s=function(){return i=i||r.generateUidIdentifier("obj")},o=this.get("properties"),u=0;u<e.properties.length;u++)a(o[u],e.properties[u],r,s,n);return i?(r.push({id:i}),p.assignmentExpression("=",i,e)):void 0}};r.visitor=l},{179:179,65:65}],100:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(56),s=i(a),o=e(59),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){for(var t=0;t<e.params.length;t++)if(!f.isIdentifier(e.params[t]))return!0;return!1},h={ReferencedIdentifier:function(e,t,r,n){if("eval"!==e.name){if(!n.scope.hasOwnBinding(e.name))return;if(n.scope.bindingIdentifierEquals(e.name,e))return}n.iife=!0,this.stop()}},m={Function:function(e,t,r,n){function i(t,r,i){var s;s=a(i)||f.isPattern(t)||n.transformers["es6.spec.blockScoping"].canTransform()?l.template("default-parameter",{VARIABLE_NAME:t,DEFAULT_VALUE:r,ARGUMENT_KEY:f.literal(i),ARGUMENTS:c},!0):l.template("default-parameter-assign",{VARIABLE_NAME:t,DEFAULT_VALUE:r},!0),s._blockHoist=e.params.length-i,p.push(s)}function a(e){return e+1>m}if(d(e)){this.ensureBlock();var o={iife:!1,scope:r},p=[],c=f.identifier("arguments");c._shadowedFunctionLiteral=this;for(var m=u["default"](e),y=this.get("params"),g=0;g<y.length;g++){var v=y[g];if(v.isAssignmentPattern()){var b=v.get("left"),E=v.get("right");if(a(g)||b.isPattern()){var x=r.generateUidIdentifier("x");x._isDefaultPlaceholder=!0,e.params[g]=x}else e.params[g]=b.node;o.iife||(E.isIdentifier()&&r.hasOwnBinding(E.node.name)?o.iife=!0:E.traverse(h,o)),i(b.node,E.node,g)}else v.isIdentifier()||v.traverse(h,o),n.transformers["es6.spec.blockScoping"].canTransform()&&v.isIdentifier()&&i(v.node,f.identifier("undefined"),g)}e.params=e.params.slice(0,m),o.iife?(p.push(s["default"](e,r)),e.body=f.blockStatement(p)):e.body.body=p.concat(e.body.body)}}};r.visitor=m},{179:179,182:182,56:56,59:59}],101:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(168),a=n(i),s=e(100),o=n(s),u=e(102),p=n(u),l={group:"builtin-advanced"};r.metadata=l;var c=a.merge([p.visitor,o.visitor]);r.visitor=c},{100:100,102:102,168:168}],102:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(0!==t){var r,n=e.property;p.isLiteral(n)?(n.value+=t,n.raw=String(n.value)):(r=p.binaryExpression("+",n,p.literal(t)),e.property=r)}}function a(e){return p.isRestElement(e.params[e.params.length-1])}r.__esModule=!0;var s=e(182),o=n(s),u=e(179),p=n(u),l={Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.name,n.outerBinding)||this.skip()},Flow:function(){this.skip()},Function:function(e,t,r,n){var i=n.noOptimise;n.noOptimise=!0,this.traverse(l,n),n.noOptimise=i,this.skip()},ReferencedIdentifier:function(e,t,r,n){if("arguments"===e.name&&(n.deopted=!0),e.name===n.name)if(n.noOptimise)n.deopted=!0;else{if(this.parentPath.isMemberExpression({computed:!0,object:e})){var i=this.parentPath.get("property");if(i.isBaseType("number"))return void n.candidates.push(this)}if(this.parentPath.isSpreadElement()&&0===n.offset){var a=this.parentPath.parentPath;if(a.isCallExpression()&&1===a.node.arguments.length)return void n.candidates.push(this)}n.references.push(this)}},BindingIdentifier:function(e,t,r,n){e.name===n.name&&(n.deopted=!0)}},c={Function:function(e,t,r){if(a(e)){var n=e.params.pop(),s=n.argument,u=p.identifier("arguments");if(u._shadowedFunctionLiteral=this,p.isPattern(s)){var c=s;s=r.generateUidIdentifier("ref");var f=p.variableDeclaration("let",c.elements.map(function(e,t){var r=p.memberExpression(s,p.literal(t),!0);return p.variableDeclarator(e,r)}));e.body.body.unshift(f)}var d={references:[],offset:e.params.length,argumentsNode:u,outerBinding:r.getBindingIdentifier(s.name),candidates:[],name:s.name,deopted:!1};if(this.traverse(l,d),d.deopted||d.references.length){d.references=d.references.concat(d.candidates),d.deopted=d.deopted||!!e.shadow;var h=p.literal(e.params.length),m=r.generateUidIdentifier("key"),y=r.generateUidIdentifier("len"),g=m,v=y;e.params.length&&(g=p.binaryExpression("-",m,h),v=p.conditionalExpression(p.binaryExpression(">",y,h),p.binaryExpression("-",y,h),p.literal(0)));var b=o.template("rest",{ARRAY_TYPE:n.typeAnnotation,ARGUMENTS:u,ARRAY_KEY:g,ARRAY_LEN:v,START:h,ARRAY:s,KEY:m,LEN:y});if(d.deopted)b._blockHoist=e.params.length+1,e.body.body.unshift(b);else{b._blockHoist=1;var E,x=this.getEarliestCommonAncestorFrom(d.references).getStatementParent();x.findParent(function(e){if(e.isLoop())E=e;else if(e.isFunction())return!0}),E&&(x=E),x.insertBefore(b)}}else if(d.candidates.length)for(var S=d.candidates,A=0;A<S.length;A++){var D=S[A];D.replaceWith(u),D.parentPath.isMemberExpression()&&i(D.parent,d.offset)}}}};r.visitor=c},{179:179,182:182}],103:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];t.push(o.expressionStatement(o.assignmentExpression("=",o.memberExpression(r,a.key,a.computed||o.isLiteral(a.key)),a.value)))}}function a(e,t,r,n,i){for(var a=e.properties,s=0;s<a.length;s++){var u=a[s];if(o.isLiteral(o.toComputedKey(u),{value:"__proto__"}))n.push(u);else{var p=u.key;o.isIdentifier(p)&&!u.computed&&(p=o.literal(p.name));var l=o.callExpression(i.addHelper("define-property"),[r,p,u.value]);t.push(o.expressionStatement(l))}}if(1===t.length){var c=t[0].expression;if(o.isCallExpression(c))return c.arguments[0]=o.objectExpression(n),c}}r.__esModule=!0;var s=e(179),o=n(s),u={ObjectExpression:{exit:function(e,t,r,n){for(var s=!1,u=e.properties,p=0;p<u.length;p++){var l=u[p];if(s=o.isProperty(l,{computed:!0,kind:"init"}))break}if(s){var c=[],f=!1;e.properties=e.properties.filter(function(e){return e.computed&&(f=!0),"init"===e.kind&&f?!0:(c.push(e),!1)});var d=r.generateUidIdentifierBasedOnNode(t),h=[],m=a;n.isLoose("es6.properties.computed")&&(m=i);var y=m(e,h,d,c,n);return y?y:(h.unshift(o.variableDeclaration("var",[o.variableDeclarator(d,o.objectExpression(c))])),h.push(o.expressionStatement(d)),h)}}}};r.visitor=u},{179:179}],104:[function(e,t,r){"use strict";r.__esModule=!0;var n={Property:function(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1)}};r.visitor=n},{}],105:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(63),a=n(i),s=e(179),o=n(s),u={Literal:function(e){return a.is(e,"y")?o.newExpression(o.identifier("RegExp"),[o.literal(e.regex.pattern),o.literal(e.regex.flags)]):void 0}};r.visitor=u},{179:179,63:63}],106:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(583),s=i(a),o=e(63),u=n(o),p={Literal:function(e){u.is(e,"u")&&(e.regex.pattern=s["default"](e.regex.pattern,e.regex.flags),u.pullFlag(e,"u"))}};r.visitor=p},{583:583,63:63}],107:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={ArrowFunctionExpression:function(e,t,r,n){if(!e.shadow){e.shadow={"this":!1};var i=a.thisExpression();return i._forceShadow=this,a.ensureBlock(e),this.get("body").unshiftContainer("body",a.expressionStatement(a.callExpression(n.addHelper("new-arrow-check"),[a.thisExpression(),i]))),a.callExpression(a.memberExpression(e,a.identifier("bind")),[a.thisExpression()])}}};r.visitor=o},{179:179}],108:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return o.callExpression(t.addHelper("temporal-assert-defined"),[e,o.literal(e.name),t.addHelper("temporal-undefined")])}function a(e,t,r){var n=r.letRefs[e.name];return n?t.getBindingIdentifier(e.name)===n:!1}r.__esModule=!0;var s=e(179),o=n(s),u={ReferencedIdentifier:function(e,t,r,n){if((!o.isFor(t)||t.left!==e)&&a(e,r,n)){var s=i(e,n.file);return this.skip(),o.isUpdateExpression(t)?void(t._ignoreBlockScopingTDZ||this.parentPath.replaceWith(o.sequenceExpression([s,t]))):o.logicalExpression("&&",s,e)}},AssignmentExpression:{exit:function(e,t,r,n){if(!e._ignoreBlockScopingTDZ){var s=[],u=this.getBindingIdentifiers();for(var p in u){var l=u[p];a(l,r,n)&&s.push(i(l,n.file))}return s.length?(e._ignoreBlockScopingTDZ=!0,s.push(e),s.map(o.expressionStatement)):void 0}}}},p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l={"Program|Loop|BlockStatement":{exit:function(e,t,r,n){var i=e._letReferences;i&&this.traverse(u,{letRefs:i,file:n})}}};r.visitor=l},{179:179}],109:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={Program:function(){var e=this.scope.generateUidIdentifier("null");this.unshiftContainer("body",[a.variableDeclaration("var",[a.variableDeclarator(e,a.literal(null))]),a.exportNamedDeclaration(null,[a.exportSpecifier(e,a.identifier("__proto__"))])])}};r.visitor=o},{179:179}],110:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0};r.metadata=s;var o={UnaryExpression:function(e,t,r,n){if(!e._ignoreSpecSymbols){if(this.parentPath.isBinaryExpression()&&a.EQUALITY_BINARY_OPERATORS.indexOf(t.operator)>=0){var i=this.getOpposite();if(i.isLiteral()&&"symbol"!==i.node.value&&"object"!==i.node.value)return}if("typeof"===e.operator){var s=a.callExpression(n.addHelper("typeof"),[e.argument]);if(this.get("argument").isIdentifier()){var o=a.literal("undefined"),u=a.unaryExpression("typeof",e.argument);return u._ignoreSpecSymbols=!0,a.conditionalExpression(a.binaryExpression("===",u,o),o,s)}return s}}},BinaryExpression:function(e,t,r,n){return"instanceof"===e.operator?a.callExpression(n.addHelper("instanceof"),[e.left,e.right]):void 0},"VariableDeclaration|FunctionDeclaration":function(e){e._generated&&this.skip()}};r.visitor=o},{179:179}],111:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-pre"};r.metadata=s;var o={TemplateLiteral:function(e,t){if(!a.isTaggedTemplateExpression(t))for(var r=0;r<e.expressions.length;r++)e.expressions[r]=a.callExpression(a.identifier("String"),[e.expressions[r]])}};r.visitor=o},{179:179}],112:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return t.hub.file.isLoose("es6.spread")&&!u.isIdentifier(e.argument,{name:"arguments"})?e.argument:t.toArray(e.argument,!0)}function a(e){for(var t=0;t<e.length;t++)if(u.isSpreadElement(e[t]))return!0;return!1}function s(e,t){for(var r=[],n=[],a=function(){n.length&&(r.push(u.arrayExpression(n)),n=[])},s=0;s<e.length;s++){var o=e[s];u.isSpreadElement(o)?(a(),r.push(i(o,t))):n.push(o)}return a(),r}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-advanced"};r.metadata=p;var l={ArrayExpression:function(e,t,r){var n=e.elements;if(a(n)){var i=s(n,r),o=i.shift();return u.isArrayExpression(o)||(i.unshift(o),o=u.arrayExpression([])),u.callExpression(u.memberExpression(o,u.identifier("concat")),i)}},CallExpression:function(e,t,r){var n=e.arguments;if(a(n)){var i=u.identifier("undefined");e.arguments=[];var o;o=1===n.length&&"arguments"===n[0].argument.name?[n[0].argument]:s(n,r);var p=o.shift();o.length?e.arguments.push(u.callExpression(u.memberExpression(p,u.identifier("concat")),o)):e.arguments.push(p);var l=e.callee;if(this.get("callee").isMemberExpression()){var c=r.maybeGenerateMemoised(l.object);c?(l.object=u.assignmentExpression("=",c,l.object),i=c):i=l.object,u.appendToMemberExpression(l,u.identifier("apply"))}else e.callee=u.memberExpression(e.callee,u.identifier("apply"));e.arguments.unshift(i)}},NewExpression:function(e,t,r,n){var i=e.arguments;if(a(i)){var o=s(i,r),p=u.arrayExpression([u.literal(null)]);return i=u.callExpression(u.memberExpression(p,u.identifier("concat")),o),u.newExpression(u.callExpression(u.memberExpression(n.addHelper("bind"),u.identifier("apply")),[e.callee,i]),[])}}};r.visitor=l},{179:179}],113:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){return v.blockStatement([v.returnStatement(e)])}r.__esModule=!0;var o=e(415),u=i(o),p=e(43),l=n(p),c=e(406),f=i(c),d=e(182),h=n(d),m=e(414),y=i(m),g=e(179),v=n(g),b={group:"builtin-trailing"};r.metadata=b;var E={Function:function(e,t,r,n){if(!e.generator&&!e.async){var i=new x(this,r,n);i.run()}}};r.visitor=E;var E={enter:function(e,t){v.isTryStatement(t)&&(e===t.block?this.skip():t.finalizer&&e!==t.finalizer&&this.skip())},ReturnStatement:function(e,t,r,n){return n.subTransform(e.argument)},Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){n.vars.push(e)},ThisExpression:function(e,t,r,n){n.isShadowed||(n.needsThis=!0,n.thisPaths.push(this))},ReferencedIdentifier:function(e,t,r,n){"arguments"!==e.name||n.isShadowed&&!e._shadowedFunctionLiteral||(n.needsArguments=!0,n.argumentsPaths.push(this))}},x=function(){function e(t,r,n){a(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.argumentsPaths=[],this.setsArguments=!1,this.needsThis=!1,this.thisPaths=[],this.isShadowed=t.isArrowFunctionExpression()||t.is("shadow"),this.ownerId=t.node.id,this.vars=[],this.scope=r,this.path=t,this.file=n,this.node=t.node}return e.prototype.getArgumentsId=function(){return this.argumentsId=this.argumentsId||this.scope.generateUidIdentifier("arguments")},e.prototype.getThisId=function(){return this.thisId=this.thisId||this.scope.generateUidIdentifier("this")},e.prototype.getLeftId=function(){return this.leftId=this.leftId||this.scope.generateUidIdentifier("left")},e.prototype.getFunctionId=function(){return this.functionId=this.functionId||this.scope.generateUidIdentifier("function")},e.prototype.getAgainId=function(){return this.againId=this.againId||this.scope.generateUidIdentifier("again")},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var t=0;t<e.length;t++){var r=e[t];r._isDefaultPlaceholder||this.paramDecls.push(v.variableDeclarator(r,e[t]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBinding(this.ownerId.name);return e&&!e.constant},e.prototype.run=function(){var e=this.node,t=this.ownerId;if(t&&(this.path.traverse(E,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.log.deopt(e,l.get("tailCallReassignmentDeopt"));for(var r=this.path.ensureBlock().body,n=0;n<r.length;n++){var i=r[n];v.isFunctionDeclaration(i)&&(i=r[n]=v.variableDeclaration("var",[v.variableDeclarator(i.id,v.toExpression(i))]),i._blockHoist=2)}var a=this.paramDecls;if(a.length>0){var s=v.variableDeclaration("var",a);s._blockHoist=1/0,r.unshift(s)}r.unshift(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!1)))),e.body=h.template("tail-call-body",{FUNCTION_ID:this.getFunctionId(),AGAIN_ID:this.getAgainId(),BLOCK:e.body});var o=[];if(this.needsThis){for(var u=this.thisPaths,p=0;p<u.length;p++){var c=u[p];c.replaceWith(this.getThisId())}o.push(v.variableDeclarator(this.getThisId(),v.thisExpression()))}if(this.needsArguments||this.setsArguments){for(var f=this.argumentsPaths,d=0;d<f.length;d++){var m=f[d];m.replaceWith(this.argumentsId)}var y=v.variableDeclarator(this.argumentsId);this.argumentsId&&(y.init=v.identifier("arguments"),y.init._shadowedFunctionLiteral=this.path),o.push(y)}var g=this.leftId;g&&o.push(v.variableDeclarator(g)),o.length>0&&e.body.body.unshift(v.variableDeclaration("var",o))}},e.prototype.subTransform=function(e){if(e){var t=this["subTransform"+e.type];return t?t.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var t=this.subTransform(e.consequent),r=this.subTransform(e.alternate);return t||r?(e.type="IfStatement",e.consequent=t?v.toBlock(t):s(e.consequent),r?e.alternate=v.isIfStatement(r)?r:v.toBlock(r):e.alternate=s(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var t=this.subTransform(e.right);if(t){var r=this.getLeftId(),n=v.assignmentExpression("=",r,e.left);return"&&"===e.operator&&(n=v.unaryExpression("!",n)),[v.ifStatement(n,s(r))].concat(t)}},e.prototype.subTransformSequenceExpression=function(e){var t=e.expressions,r=this.subTransform(t[t.length-1]);return r?(1===--t.length&&(e=t[0]),[v.expressionStatement(e)].concat(r)):void 0},e.prototype.subTransformCallExpression=function(e){var t,r,n=e.callee;if(v.isMemberExpression(n,{computed:!1})&&v.isIdentifier(n.property)){switch(n.property.name){case"call":r=v.arrayExpression(e.arguments.slice(1));break;case"apply":r=e.arguments[1]||v.identifier("undefined"),this.needsArguments=!0;break;default:return}t=e.arguments[0],n=n.object}if(v.isIdentifier(n)&&this.scope.bindingIdentifierEquals(n.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var i=[];this.needsThis&&!v.isThisExpression(t)&&i.push(v.expressionStatement(v.assignmentExpression("=",this.getThisId(),t||v.identifier("undefined")))),r||(r=v.arrayExpression(e.arguments));var a=this.getArgumentsId(),s=this.getParams();if(this.needsArguments&&i.push(v.expressionStatement(v.assignmentExpression("=",a,r))),v.isArrayExpression(r)){for(var o=r.elements;o.length<s.length;)o.push(v.identifier("undefined"));for(var p=0;p<o.length;p++){var l=s[p],c=o[p];l&&!l._isDefaultPlaceholder&&(o[p]=v.assignmentExpression("=",l,c))}if(!this.needsArguments)for(var d=o,h=0;h<d.length;h++){var c=d[h];this.scope.isPure(c)||i.push(v.expressionStatement(c))}}else{this.setsArguments=!0;for(var p=0;p<s.length;p++){var l=s[p];l._isDefaultPlaceholder||i.push(v.expressionStatement(v.assignmentExpression("=",l,v.memberExpression(a,v.literal(p),!0))))}}if(i.push(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!0)))),this.vars.length>0){var m=f["default"](y["default"](this.vars,function(e){return e.declarations})),g=u["default"](m,function(e,t){return v.assignmentExpression("=",t.id,e)},v.identifier("undefined")),b=v.expressionStatement(g);i.push(b)}return i.push(v.continueStatement(this.getFunctionId())),i}},e}()},{179:179,182:182,406:406,414:414,415:415,43:43}],114:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return o.isLiteral(e)&&"string"==typeof e.value}function a(e,t){var r=o.binaryExpression("+",e,t);return r._templateLiteralProduced=!0,r}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={TaggedTemplateExpression:function(e,t,r,n){for(var i=e.quasi,a=[],s=[],u=[],p=i.quasis,l=0;l<p.length;l++){var c=p[l];s.push(o.literal(c.value.cooked)),u.push(o.literal(c.value.raw))}s=o.arrayExpression(s),u=o.arrayExpression(u);var f="tagged-template-literal";n.isLoose("es6.templateLiterals")&&(f+="-loose");var d=n.addTemplateObject(f,s,u);return a.push(d),a=a.concat(i.expressions),o.callExpression(e.tag,a)},TemplateLiteral:function(e,t,r,n){for(var s=[],u=e.quasis,p=0;p<u.length;p++){var l=u[p];s.push(o.literal(l.value.cooked));var c=e.expressions.shift();c&&s.push(c)}if(s=s.filter(function(e){return!o.isLiteral(e,{value:""})}),i(s[0])||i(s[1])||s.unshift(o.literal("")),!(s.length>1))return s[0];for(var f=a(s.shift(),s.shift()),d=s,h=0;h<d.length;h++){var m=d[h];f=a(f,m)}this.replaceWith(f)}};r.visitor=p},{179:179}],115:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:3};r.metadata=n},{}],116:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:1,dependencies:["es6.classes"]};r.metadata=n},{}],117:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=[],r=h.functionExpression(null,[],h.blockStatement(t),!0);return r.shadow=!0,t.push(u["default"](e,function(){return h.expressionStatement(h.yieldExpression(e.body))})),h.callExpression(r,[])}function s(e,t,r){var n=r.generateUidIdentifierBasedOnNode(t),i=f.template("array-comprehension-container",{KEY:n});i.callee.shadow=!0;var a=i.callee.body,s=a.body;l["default"].hasType(e,r,"YieldExpression",h.FUNCTION_TYPES)&&(i.callee.generator=!0,i=h.yieldExpression(i,!0));var o=s.pop();return s.push(u["default"](e,function(){return f.template("array-push",{STATEMENT:e.body,KEY:n},!0)})),s.push(o),i}r.__esModule=!0;var o=e(54),u=i(o),p=e(148),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={stage:0};r.metadata=m;var y={ComprehensionExpression:function(e,t,r){var n=s;return e.generator&&(n=a),n(e,t,r)}};r.visitor=y},{148:148,179:179,182:182,54:54}],118:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(60),s=i(a),o=e(57),u=n(o),p=e(179),l=n(p),c={dependencies:["es6.classes"],optional:!0,stage:1};r.metadata=c;var f={ObjectExpression:function(e,t,r,n){for(var i=!1,a=0;a<e.properties.length;a++){var o=e.properties[a];if(o.decorators){i=!0;break}}if(i){for(var p={},a=0;a<e.properties.length;a++){var o=e.properties[a];o.decorators&&s["default"](o.decorators,r),"init"!==o.kind||o.method||(o.kind="",o.value=l.functionExpression(null,[],l.blockStatement([l.returnStatement(o.value)]))),u.push(p,o,"initializer",n)}var c=u.toClassObject(p);return c=u.toComputedObjectFromClass(c),l.callExpression(n.addHelper("create-decorated-object"),[c])}}};r.visitor=f},{179:179,57:57,60:60}],119:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,stage:0};r.metadata=s;var o={DoExpression:function(e){var t=e.body.body;return t.length?t:a.identifier("undefined")}};r.visitor=o},{179:179}],120:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(53),s=i(a),o=e(179),u=n(o),p={stage:3};r.metadata=p;var l=u.memberExpression(u.identifier("Math"),u.identifier("pow")),c=s["default"]({operator:"**",build:function(e,t){return u.callExpression(l,[e,t])}});r.visitor=c},{179:179,53:53}],121:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){var n=e.specifiers[0];if(s.isExportNamespaceSpecifier(n)||s.isExportDefaultSpecifier(n)){var a,o=e.specifiers.shift(),u=r.generateUidIdentifier(o.exported.name);a=s.isExportNamespaceSpecifier(o)?s.importNamespaceSpecifier(u):s.importDefaultSpecifier(u),t.push(s.importDeclaration([a],e.source)),t.push(s.exportNamedDeclaration(null,[s.exportSpecifier(u,o.exported)])),i(e,t,r)}}r.__esModule=!0;var a=e(179),s=n(a),o={stage:1};r.metadata=o;var u={ExportNamedDeclaration:function(e,t,r){var n=[];return i(e,n,r),n.length?(e.specifiers.length>=1&&n.push(e),n):void 0}};r.visitor=u},{179:179}],122:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.path.getData("functionBind");return t?t:(t=e.generateDeclaredUidIdentifier("context"),e.path.setData("functionBind",t))}function a(e,t){var r=e.object||e.callee.object;return t.isStatic(r)&&r}function s(e,t){var r=a(e,t);if(r)return r;var n=i(t);return e.object?e.callee=u.sequenceExpression([u.assignmentExpression("=",n,e.object),e.callee]):e.callee.object=u.assignmentExpression("=",n,e.callee.object),n}r.__esModule=!0;var o=e(179),u=n(o),p={optional:!0,stage:0};r.metadata=p;var l={CallExpression:function(e,t,r){var n=e.callee;if(u.isBindExpression(n)){var i=s(n,r);e.callee=u.memberExpression(n.callee,u.identifier("call")),e.arguments.unshift(i)}},BindExpression:function(e,t,r){var n=s(e,r);return u.callExpression(u.memberExpression(e.callee,u.identifier("bind")),[n])}};r.visitor=l},{179:179}],123:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={stage:2,dependencies:["es6.destructuring"]};r.metadata=s;var o=function(e){for(var t=0;t<e.properties.length;t++)if(a.isSpreadProperty(e.properties[t]))return!0;return!1},u={ObjectExpression:function(e,t,r,n){if(o(e)){for(var i=[],s=[],u=function(){s.length&&(i.push(a.objectExpression(s)),s=[])},p=0;p<e.properties.length;p++){var l=e.properties[p];a.isSpreadProperty(l)?(u(),i.push(l.argument)):s.push(l)}return u(),a.isObjectExpression(i[0])||i.unshift(a.objectExpression([])),a.callExpression(n.addHelper("extends"),i)}}};r.visitor=u},{179:179}],124:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:2};r.metadata=n},{}],125:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"_"===e.key[0]?!0:void 0}function a(e,t){var r=t.blacklist;return r.length&&l["default"](r,e.key)?!1:void 0}function s(e,t){var r=t.whitelist;return r?l["default"](r,e.key):void 0}function o(e,t){var r=e.metadata.stage;return null!=r&&r>=t.stage?!0:void 0}function u(e,t){return e.metadata.optional&&!l["default"](t.optional,e.key)?!1:void 0}r.__esModule=!0,r.internal=i,r.blacklist=a,r.whitelist=s,r.stage=o,r.optional=u;var p=e(413),l=n(p)},{413:413}],126:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={"minification.constantFolding":e(183),strict:e(142),eval:e(185),_validation:e(132),_hoistDirectives:e(128),"minification.removeDebugger":e(194),"minification.removeConsole":e(193),"utility.inlineEnvironmentVariables":e(186),"minification.deadCodeElimination":e(184),_modules:e(130),"react.displayName":e(192),"es6.spec.modules":e(109),"es6.spec.arrowFunctions":e(107),"es6.spec.templateLiterals":e(111),"es6.templateLiterals":e(114),"es6.literals":e(97),"validation.undeclaredVariableCheck":e(197),"spec.functionName":e(144),"es7.classProperties":e(116),"es7.trailingFunctionCommas":e(124),"es7.asyncFunctions":e(115),"es7.decorators":e(118),"validation.react":e(145),"es6.arrowFunctions":e(89),"spec.blockScopedFunctions":e(143),"optimisation.react.constantElements":e(191),"optimisation.react.inlineElements":e(135),"es7.comprehensions":e(117),"es6.classes":e(91),asyncToGenerator:e(136),bluebirdCoroutines:e(137),"es6.objectSuper":e(99),"es7.objectRestSpread":e(123),"es7.exponentiationOperator":e(120),"es5.properties.mutators":e(88),"es6.properties.shorthand":e(104),"es6.properties.computed":e(103),"optimisation.flow.forOf":e(133),"es6.forOf":e(96),"es6.regex.sticky":e(105),"es6.regex.unicode":e(106),"es6.constants":e(94),"es7.exportExtensions":e(121),"spec.protoToAssign":e(190),"es7.doExpressions":e(119),"es6.spec.symbols":e(110),"es7.functionBind":e(122),"spec.undefinedToVoid":e(199),"es6.spread":e(112),"es6.parameters":e(101),"es6.destructuring":e(95),"es6.blockScoping":e(90),"es6.spec.blockScoping":e(108),reactCompat:e(139),react:e(140),regenerator:e(141),runtime:e(196),"es6.modules":e(98),_moduleFormatter:e(129),"es6.tailCall":e(113),_shadowFunctions:e(131),"es3.propertyLiterals":e(87),"es3.memberExpressionLiterals":e(86),"minification.memberExpressionLiterals":e(188),"minification.propertyLiterals":e(189),_blockHoist:e(127),jscript:e(187),flow:e(138),"optimisation.modules.system":e(134)},t.exports=r["default"]},{101:101,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,145:145,183:183,184:184,185:185,186:186,187:187,188:188,189:189,190:190,191:191,192:192,193:193,194:194,196:196,197:197,199:199,86:86,87:87,88:88,89:89,90:90,91:91,94:94,95:95,96:96,97:97,98:98,99:99}],127:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(417),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={Block:{exit:function(e){for(var t=!1,r=0;r<e.body.length;r++){var n=e.body[r];if(n&&null!=n._blockHoist){t=!0;break}}t&&(e.body=a["default"](e.body,function(e){var t=e&&e._blockHoist;return null==t&&(t=1),t===!0&&(t=2),-1*t}))}}};r.visitor=o},{417:417}],128:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre"};r.metadata=s;var o={Block:{exit:function(e){for(var t=0;t<e.body.length;t++){var r=e.body[t];if(!a.isExpressionStatement(r)||!a.isLiteral(r.expression))return; r._blockHoist=1/0}}}};r.visitor=o},{179:179}],129:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-modules"};r.metadata=n;var i={Program:{exit:function(e,t,r,n){for(var i=n.dynamicImports,a=0;a<i.length;a++){var s=i[a];s._blockHoist=3}e.body=n.dynamicImports.concat(e.body),n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.transform&&n.moduleFormatter.transform(e)}}};r.visitor=i},{}],130:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.declaration;return u.inheritsComments(t,e),u.removeComments(e),t._ignoreUserWhitespace=!0,t}function a(e){return u.exportSpecifier(s(e),s(e))}function s(e){var t=e.name,r=e.loc,n=u.identifier(t);return n._loc=r,n}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-pre"};r.metadata=p;var l={ExportDefaultDeclaration:function(e,t,r){var n=e.declaration;if(u.isClassDeclaration(n)){var a=[i(e),e];return e.declaration=n.id,a}if(u.isClassExpression(n)){var s=r.generateUidIdentifier("default");e.declaration=u.variableDeclaration("var",[u.variableDeclarator(s,n)]);var a=[i(e),e];return e.declaration=s,a}if(u.isFunctionDeclaration(n)){e._blockHoist=2;var a=[i(e),e];return e.declaration=n.id,a}},ExportNamedDeclaration:function(e){var t=e.declaration;if(u.isClassDeclaration(t)){e.specifiers=[a(t.id)];var r=[i(e),e];return e.declaration=null,r}if(u.isFunctionDeclaration(t)){var n=u.exportNamedDeclaration(null,[a(t.id)]);return n._blockHoist=2,[i(e),n]}if(u.isVariableDeclaration(t)){var s=[],o=this.get("declaration").getBindingIdentifiers();for(var p in o)s.push(a(o[p]));return[t,u.exportNamedDeclaration(null,s)]}},Program:{enter:function(e){for(var t=[],r=[],n=0;n<e.body.length;n++){var i=e.body[n];u.isImportDeclaration(i)?t.push(i):r.push(i)}e.body=t.concat(r)},exit:function(e,t,r,n){n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.setup&&n.moduleFormatter.setup()}}};r.visitor=l},{179:179}],131:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return e.is("_forceShadow")?!0:t&&!t.isArrowFunctionExpression()}function a(e,t,r){var n=e.inShadow(t);if(i(e,n)){var a,s=e.node._shadowedFunctionLiteral,o=e.findParent(function(e){return(e.isProgram()||e.isFunction())&&(a=a||e),e.isProgram()?!0:e.isFunction()?s?e===s||e.node===s.node:!e.is("shadow"):!1});if(o!==a){var u=o.getData(t);if(u)return u;var p=r(),l=e.scope.generateUidIdentifier(t);return o.setData(t,l),o.scope.push({id:l,init:p}),l}}}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-trailing"};r.metadata=u;var p={ThisExpression:function(){return a(this,"this",function(){return o.thisExpression()})},ReferencedIdentifier:function(e){return"arguments"===e.name?a(this,"arguments",function(){return o.identifier("arguments")}):void 0}};r.visitor=p},{179:179}],132:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={ForXStatement:function(e,t,r,n){var i=e.left;if(o.isVariableDeclaration(i)){var s=i.declarations[0];if(s.init)throw n.errorWithNode(s,a.get("noAssignmentsInForHead"))}},Property:function(e,t,r,n){if("set"===e.kind){var i=e.value.params[0];if(o.isRestElement(i))throw n.errorWithNode(i,a.get("settersNoRest"))}}};r.visitor=p},{179:179,43:43}],133:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(96),i={optional:!0};r.metadata=i;var a={ForOfStatement:function(e,t,r,i){return this.get("right").isGenericType("Array")?n._ForOfStatementArray.call(this,e,r,i):void 0}};r.visitor=a},{96:96}],134:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-trailing"};r.metadata=s;var o={Program:function(e,t,r,n){n.moduleFormatter._setters&&r.traverse(n.moduleFormatter._setters,u,{exportFunctionIdentifier:n.moduleFormatter.exportIdentifier})}};r.visitor=o;var u={FunctionExpression:{enter:function(e,t,r,n){n.hasExports=!1,n.exportObjectIdentifier=r.generateUidIdentifier("exportObj")},exit:function(e,t,r,n){n.hasExports&&(e.body.body.unshift(a.variableDeclaration("var",[a.variableDeclarator(a.cloneDeep(n.exportObjectIdentifier),a.objectExpression([]))])),e.body.body.push(a.expressionStatement(a.callExpression(a.cloneDeep(n.exportFunctionIdentifier),[a.cloneDeep(n.exportObjectIdentifier)]))))}},CallExpression:function(e,t,r,n){if(a.isIdentifier(e.callee,{name:n.exportFunctionIdentifier.name})){n.hasExports=!0;var i=a.memberExpression(a.cloneDeep(n.exportObjectIdentifier),e.arguments[0],!0);return a.assignmentExpression("=",i,e.arguments[1])}}}},{179:179}],135:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=0;t<e.length;t++){var r=e[t];if(p.isJSXSpreadAttribute(r))return!0;if(a(r,"ref"))return!0}return!1}function a(e,t){return p.isJSXAttribute(e)&&p.isJSXIdentifier(e.name,{name:t})}r.__esModule=!0;var s=e(62),o=n(s),u=e(179),p=n(u),l={optional:!0};r.metadata=l;var c={JSXElement:function(e,t,r,n){function s(e,t){u(d.properties,p.identifier(e),t)}function u(e,t,r){e.push(p.property("init",t,r))}var l=e.openingElement;if(!i(l.attributes)){var c=!0,f=p.objectExpression([]),d=p.objectExpression([]),h=p.literal(null),m=l.name;if(p.isJSXIdentifier(m)&&o.isCompatTag(m.name)&&(m=p.literal(m.name),c=!1),e.children.length){var y=o.buildChildren(e);y=1===y.length?y[0]:p.arrayExpression(y),u(f.properties,p.identifier("children"),y)}for(var g=0;g<l.attributes.length;g++){var v=l.attributes[g];a(v,"key")?h=v.value:u(f.properties,v.name,v.value||p.identifier("true"))}return c&&(f=p.callExpression(n.addHelper("default-props"),[p.memberExpression(m,p.identifier("defaultProps")),f])),s("$$typeof",n.addHelper("typeof-react-element")),s("type",m),s("key",h),s("ref",p.literal(null)),s("props",f),s("_owner",p.literal(null)),d}}};r.visitor=c},{179:179,62:62}],136:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(64),a=n(i),s=e(137);r.manipulateOptions=s.manipulateOptions;var o={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=o;var u={Function:function(e,t,r,n){return e.async&&!e.generator?a["default"](this,n.addHelper("async-to-generator")):void 0}};r.visitor=u},{137:137,64:64}],137:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){e.blacklist.push("regenerator")}r.__esModule=!0,r.manipulateOptions=a;var s=e(64),o=i(s),u=e(179),p=n(u),l={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=l;var c={Function:function(e,t,r,n){return e.async&&!e.generator?o["default"](this,p.memberExpression(n.addImport("bluebird",null,"absolute"),p.identifier("coroutine"))):void 0}};r.visitor=c},{179:179,64:64}],138:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o="@flow",u={Program:function(e,t,r,n){for(var i=n.ast.comments,a=0;a<i.length;a++){var s=i[a];s.value.indexOf(o)>=0&&(s.value=s.value.replace(o,""),s.value.replace(/\*/g,"").trim()||(s._displayed=!0))}},Flow:function(){this.dangerouslyRemove()},ClassProperty:function(e){e.typeAnnotation=null,e.value||this.dangerouslyRemove()},Class:function(e){e["implements"]=null},Function:function(e){for(var t=0;t<e.params.length;t++){var r=e.params[t];r.optional=!1}},TypeCastExpression:function(e){do e=e.expression;while(a.isTypeCastExpression(e));return e}};r.visitor=u},{179:179}],139:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){e.blacklist.push("react")}r.__esModule=!0,r.manipulateOptions=i;var a=e(62),s=n(a),o=e(179),u=n(o),p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){e.callee=e.tagExpr},post:function(e){s.isCompatTag(e.tagName)&&(e.call=u.callExpression(u.memberExpression(u.memberExpression(u.identifier("React"),u.identifier("DOM")),e.tagExpr,u.isLiteral(e.tagExpr)),e.args))}});r.visitor=l},{179:179,55:55,62:62}],140:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u=/^\*\s*@jsx\s+([^\s]+)/,p={group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){var t=e.tagName,r=e.args;a.isCompatTag(t)?r.push(o.literal(t)):r.push(e.tagExpr)},post:function(e,t){e.callee=t.get("jsxIdentifier")}});r.visitor=l,l.Program=function(e,t,r,n){for(var i=n.opts.jsxPragma,a=0;a<n.ast.comments.length;a++){var s=n.ast.comments[a],p=u.exec(s.value);if(p){if(i=p[1],"React.DOM"===i)throw n.errorWithNode(s,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}n.set("jsxIdentifier",i.split(".").map(o.identifier).reduce(function(e,t){return o.memberExpression(e,t)}))}},{179:179,55:55,62:62}],141:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){for(var t,r=[];e;){var n=e.parentPath,i=n&&n.node;if(i){if(r.push(e.key),i!==e.container){var a=Object.keys(i).some(function(t){return i[t]===e.container?(r.push(t),!0):void 0});if(!a)throw new Error("Failed to find container object in parent node")}if(p.isProgram(i)){t=i;break}}e=n}if(!t)throw new Error("Failed to find root Program node");for(var s=new l(t);r.length>0;)s=s.get(r.pop());return s}r.__esModule=!0;var s=e(535),o=i(s),u=e(179),p=n(u),l=o["default"].types.NodePath,c={group:"builtin-advanced"};r.metadata=c;var f={Function:{exit:function(e){(e.async||e.generator)&&o["default"].transform(a(this))}}};r.visitor=f},{179:179,535:535}],142:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return s.isLiteral(e)?e.raw&&e.rawValue===e.value?"use strict"===e.rawValue:"use strict"===e.value:!1}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-pre"};r.metadata=o;var u=["FunctionExpression","FunctionDeclaration","ClassProperty"],p={Program:{enter:function(e){var t,r=e.body[0];s.isExpressionStatement(r)&&i(r.expression)?t=r:(t=s.expressionStatement(s.literal("use strict")),this.unshiftContainer("body",t),r&&(t.leadingComments=r.leadingComments,r.leadingComments=[])),t._blockHoist=1/0}},ThisExpression:function(){return this.findParent(function(e){return!e.is("shadow")&&u.indexOf(e.type)>=0})?void 0:s.identifier("undefined")}};r.visitor=p},{179:179}],143:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=t.get(e),n=0;n<r.length;n++){var i=r[n],a=i.node;if(s.isFunctionDeclaration(a)){var o=s.variableDeclaration("let",[s.variableDeclarator(a.id,s.toExpression(a))]);o._blockHoist=2,a.id=null,i.replaceWith(o)}}}r.__esModule=!0;var a=e(179),s=n(a),o={BlockStatement:function(e,t){s.isFunction(t)&&t.body===e||s.isExportDeclaration(t)||i("body",this)},SwitchCase:function(){i("consequent",this)}};r.visitor=o},{179:179}],144:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(61),i={group:"builtin-basic"};r.metadata=i;var a={"ArrowFunctionExpression|FunctionExpression":{exit:function(){return this.parentPath.isProperty()?void 0:n.bare.apply(this,arguments)}},ObjectExpression:function(){for(var e=this.get("properties"),t=e,r=0;r<t.length;r++){var i=t[r],a=i.get("value");if(a.isFunction()){var s=n.bare(a.node,i.node,a.scope);s&&a.replaceWith(s)}}}};r.visitor=a},{61:61}],145:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(u.isLiteral(e)){var r=e.value,n=r.toLowerCase();if("react"===n&&r!==n)throw t.errorWithNode(e,s.get("didYouMean","react"))}}r.__esModule=!0;var a=e(43),s=n(a),o=e(179),u=n(o),p={CallExpression:function(e,t,r,n){this.get("callee").isIdentifier({name:"require"})&&1===e.arguments.length&&i(e.arguments[0],n)},ModuleDeclaration:function(e,t,r,n){i(e.source,n)}};r.visitor=p},{179:179,43:43}],146:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(155),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n,i){a(this,e),this.queue=null,this.parentPath=i,this.scope=t,this.state=n,this.opts=r}return e.prototype.shouldVisit=function(e){var t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;var r=p.VISITOR_KEYS[e.type];if(!r||!r.length)return!1;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e[a])return!0}return!1},e.prototype.create=function(e,t,r,n){var i=o["default"].get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n});return i.unshiftContext(this),i},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=this.queue=[],a=!1,s=0;s<e.length;s++){var o=e[s];o&&this.shouldVisit(o)&&i.push(this.create(t,e,s,r))}for(var u=i,p=0;p<u.length;p++){var l=u[p];if(l.resync(),!(n.indexOf(l.node)>=0)&&(n.push(l.node),l.visit())){a=!0;break}}for(var c=i,f=0;f<c.length;f++){var l=c[f];l.shiftContext()}return this.queue=null,a},e.prototype.visitSingle=function(e,t){if(this.shouldVisit(e[t])){var r=this.create(e,e,t);r.visit(),r.shiftContext()}},e.prototype.visit=function(e,t){var r=e[t];if(r)return Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t)},e}();r["default"]=l,t.exports=r["default"]},{155:155,179:179}],147:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function a(e){n(this,a),this.file=e};r["default"]=i,t.exports=r["default"]},{}],148:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(f.get("traverseNeedsParent",e.type));if(l.explode(t),Array.isArray(e))for(var s=0;s<e.length;s++)a.node(e[s],t,r,n,i);else a.node(e,t,r,n,i)}}function s(e,t,r,n){e.type===n.type&&(n.has=!0,this.skip())}r.__esModule=!0,r["default"]=a;var o=e(146),u=i(o),p=e(168),l=n(p),c=e(43),f=n(c),d=e(413),h=i(d),m=e(179),y=n(m);a.visitors=l,a.verify=l.verify,a.explode=l.explode,a.node=function(e,t,r,n,i,a){var s=y.VISITOR_KEYS[e.type];if(s)for(var o=new u["default"](r,t,n,i),p=s,l=0;l<p.length;l++){var c=p[l];if((!a||!a[c])&&o.visit(e,c))return}};var g=y.COMMENT_KEYS.concat(["_scopeInfo","_paths","tokens","comments","start","end","loc","raw","rawValue"]);a.clearNode=function(e){for(var t=0;t<g.length;t++){var r=g[t];null!=e[r]&&(e[r]=void 0)}};var v={noScope:!0,exit:a.clearNode};a.removeProperties=function(e){return a(e,v),a.clearNode(e),e},a.hasType=function(e,t,r,n){if(h["default"](n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return a(e,{blacklist:n,enter:s},t,i),i.has},t.exports=r["default"]},{146:146,168:168,179:179,413:413,43:43}],149:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null}function s(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})}function o(){var e=this;do if(Array.isArray(e.container))return e;while(e=e.parentPath)}function u(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){for(var n,i=h.VISITOR_KEYS[e.type],a=r,s=0;s<a.length;s++){var o=a[s],u=o[t+1];if(n)if(u.listKey&&n.listKey===u.listKey&&u.key<n.key)n=u;else{var p=i.indexOf(n.parentKey),l=i.indexOf(u.parentKey);p>l&&(n=u)}else n=u}return n})}function p(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n,i,a=1/0,s=e.map(function(e){var t=[];do t.unshift(e);while((e=e.parentPath)&&e!==r);return t.length<a&&(a=t.length),t}),o=s[0];e:for(var u=0;a>u;u++){for(var p=o[u],l=s,c=0;c<l.length;c++){var f=l[c];if(f[u]!==p)break e}n=u,i=p}if(i)return t?t(i,n,s):i;throw new Error("Couldn't find intersection")}function l(){var e=this,t=[];do t.push(e);while(e=e.parentPath);return t}function c(){for(var e=this;e;){for(var t=arguments,r=0;r<t.length;r++){var n=t[r];if(e.node.type===n)return!0}e=e.parentPath}return!1}function f(e){var t=this;do if(t.isFunction()){var r=t.node.shadow;if(r){if(!e||r[e]!==!1)return t}else if(t.isArrowFunctionExpression())return t;return null}while(t=t.parentPath);return null}r.__esModule=!0,r.findParent=a,r.getFunctionParent=s,r.getStatementParent=o,r.getEarliestCommonAncestorFrom=u,r.getDeepestCommonAncestorFrom=p,r.getAncestry=l,r.inType=c,r.inShadow=f;var d=e(179),h=i(d),m=e(155);n(m)},{155:155,179:179}],150:[function(e,t,r){"use strict";function n(){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}function i(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])}function a(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}r.__esModule=!0,r.shareCommentsWithSiblings=n,r.addComment=i,r.addComments=a},{}],151:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=this.node;if(t)for(var r=this.opts,n=[r[e],r[t.type]&&r[t.type][e]],i=0;i<n.length;i++){var a=n[i];if(a)for(var s=a,o=0;o<s.length;o++){var u=s[o];if(u){var p=this.node;if(!p)return;var l=this.type,c=u.call(this,p,this.parent,this.scope,this.state);if(c&&this.replaceWith(c,!0),this.shouldStop||this.shouldSkip||this.removed)return;if(l!==this.type)return void this.queueNode(this)}}}}function a(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1}function s(){if(this.isBlacklisted())return!1;if(this.opts.shouldSkip&&this.opts.shouldSkip(this))return!1;if(this.call("enter"),this.shouldSkip)return this.shouldStop;var e=this.node,t=this.opts;if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)A["default"].node(e[r],t,this.scope,this.state,this,this.skipKeys);else A["default"].node(e,t,this.scope,this.state,this,this.skipKeys),this.call("exit");return this.shouldStop}function o(){this.shouldSkip=!0}function u(e){this.skipKeys[e]=!0}function p(){this.shouldStop=!0,this.shouldSkip=!0}function l(){if(!this.opts||!this.opts.noScope){var e=this.context||this.parentPath;this.scope=this.getScope(e&&e.scope),this.scope&&this.scope.init()}}function c(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this}function f(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())}function d(){this.parentPath&&(this.parent=this.parentPath.node)}function h(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e<this.container.length;e++)if(this.container[e]===this.node)return this.setKey(e)}else for(var t in this.container)if(this.container[t]===this.node)return this.setKey(t);this.key=null}}function m(){var e=this.listKey,t=this.parentPath;if(e&&t){var r=t.node[e];this.container!==r&&(r?this.container=r:this.container=null)}}function y(){null!=this.key&&this.container&&this.container[this.key]===this.node||this._markRemoved()}function g(){this.contexts.shift(),this.setContext(this.contexts[0])}function v(e){this.contexts.unshift(e),this.setContext(e)}function b(e,t,r,n){this.inList=!!r,this.listKey=r,this.parentKey=r||n,this.container=t,this.parentPath=e||this.parentPath,this.setKey(n)}function E(e){this.key=e,this.node=this.container[this.key],this.type=this.node&&this.node.type}function x(e){for(var t=this.contexts,r=0;r<t.length;r++){var n=t[r];n.queue&&n.queue.push(e)}}r.__esModule=!0,r.call=i,r.isBlacklisted=a,r.visit=s,r.skip=o,r.skipKey=u,r.stop=p,r.setScope=l,r.setContext=c,r.resync=f,r._resyncParent=d,r._resyncKey=h,r._resyncList=m,r._resyncRemoved=y,r.shiftContext=g,r.unshiftContext=v,r.setup=b,r.setKey=E,r.queueNode=x;var S=e(148),A=n(S)},{148:148}],152:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){var e,t=this.node;if(this.isMemberExpression())e=t.property;else{if(!this.isProperty())throw new ReferenceError("todo");e=t.key}return t.computed||o.isIdentifier(e)&&(e=o.literal(e.name)),e}function a(){return o.ensureBlock(this.node)}r.__esModule=!0,r.toComputedKey=i,r.ensureBlock=a;var s=e(179),o=n(s)},{179:179}],153:[function(e,t,r){(function(e){"use strict";function t(){var e=this.evaluate();return e.confident?!!e.value:void 0}function n(){function t(n){if(r){var a=n.node;if(n.isSequenceExpression()){var s=n.get("expressions");return t(s[s.length-1])}if(n.isLiteral()&&!a.regex)return a.value;if(n.isConditionalExpression())return t(t(n.get("test"))?n.get("consequent"):n.get("alternate"));if(n.isTypeCastExpression())return t(n.get("expression"));if(n.isIdentifier()&&!n.scope.hasBinding(a.name,!0)){if("undefined"===a.name)return void 0;if("Infinity"===a.name)return 1/0;if("NaN"===a.name)return NaN}if(n.isMemberExpression()&&!n.parentPath.isCallExpression({callee:a})){var o=n.get("property"),u=n.get("object");if(u.isLiteral()&&o.isIdentifier()){var p=u.node.value,l=typeof p;if("number"===l||"string"===l)return p[o.node.name]}}if(n.isReferencedIdentifier()){var c=n.scope.getBinding(a.name);if(c&&c.hasValue)return c.value;var f=n.resolve();return f===n?r=!1:t(f)}if(n.isUnaryExpression({prefix:!0})){var d=n.get("argument"),h=t(d);switch(a.operator){case"void":return void 0;case"!":return!h;case"+":return+h;case"-":return-h;case"~":return~h;case"typeof":return d.isFunction()?"function":typeof h}}if(n.isArrayExpression()||n.isObjectExpression(),n.isLogicalExpression()){var m=r,y=t(n.get("left")),g=r;r=m;var v=t(n.get("right")),b=r,E=g!==b;switch(r=g&&b,a.operator){case"||":return(y||v)&&E&&(r=!0),y||v;case"&&":return(!y&&g||!v&&b)&&(r=!0),y&&v}}if(n.isBinaryExpression()){var y=t(n.get("left")),v=t(n.get("right"));switch(a.operator){case"-":return y-v;case"+":return y+v;case"/":return y/v;case"*":return y*v;case"%":return y%v;case"**":return Math.pow(y,v);case"<":return v>y;case">":return y>v;case"<=":return v>=y;case">=":return y>=v;case"==":return y==v;case"!=":return y!=v;case"===":return y===v;case"!==":return y!==v;case"|":return y|v;case"&":return y&v;case"^":return y^v;case"<<":return y<<v;case">>":return y>>v;case">>>":return y>>>v}}if(n.isCallExpression()){var x,S,A=n.get("callee");if(A.isIdentifier()&&!n.scope.getBinding(A.node.name,!0)&&i.indexOf(A.node.name)>=0&&(S=e[a.callee.name]),A.isMemberExpression()){var u=A.get("object"),D=A.get("property");if(u.isIdentifier()&&D.isIdentifier()&&i.indexOf(u.node.name)>=0&&(x=e[u.node.name],S=x[D.node.name]),u.isLiteral()&&D.isIdentifier()){var l=typeof u.node.value;("string"===l||"number"===l)&&(x=u.node.value,S=x[D.node.name])}}if(S){var C=n.get("arguments").map(t);if(!r)return;return S.apply(x,C)}}r=!1}}var r=!0,n=t(this);return r||(n=void 0),{confident:r,value:n}}r.__esModule=!0,r.evaluateTruthy=t,r.evaluate=n;var i=["String","Number","Math"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],154:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e}function s(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0}function o(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e}function u(e){return h["default"].get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})}function p(e,t){t===!0&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)}function l(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(a,s){return h["default"].get({listKey:e,parentPath:r,parent:n,container:i,key:s}).setContext(t)}):h["default"].get({parentPath:this,parent:n,container:n,key:e}).setContext(t)}function c(e,t){for(var r=this,n=e,i=0;i<n.length;i++){var a=n[i];r="."===a?r.parentPath:Array.isArray(r)?r[a]:r.get(a,t)}return r}function f(e){return y.getBindingIdentifiers(this.node,e)}r.__esModule=!0,r.getStatementParent=a,r.getOpposite=s,r.getCompletionRecords=o,r.getSibling=u,r.get=p,r._getKey=l,r._getPattern=c,r.getBindingIdentifiers=f;var d=e(155),h=i(d),m=e(179),y=n(m)},{155:155,179:179}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(162),o=i(s),u=e(148),p=n(u),l=e(509),c=n(l),f=e(167),d=n(f),h=e(179),m=i(h),y=function(){function e(t,r){a(this,e),this.contexts=[],this.parent=r,this.data={},this.hub=t,this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.state=null,this.opts=null,this.skipKeys=null,this.parentPath=null,this.context=null,this.container=null,this.listKey=null,this.inList=!1,this.parentKey=null,this.key=null,this.node=null,this.scope=null,this.type=null,this.typeAnnotation=null}return e.get=function(t){var r=t.hub,n=t.parentPath,i=t.parent,a=t.container,s=t.listKey,o=t.key;!r&&n&&(r=n.hub);for(var u,p=a[o],l=i._paths=i._paths||[],c=0;c<l.length;c++){var f=l[c];if(f.node===p){u=f;break}}return u||(u=new e(r,i),l.push(u)),u.setup(n,a,s,o),u},e.prototype.getScope=function(e){var t=e;return this.isScope()&&(t=new d["default"](this,e)),t},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e,t){var r=this.data[e];return!r&&t&&(r=this.data[e]=t),r},e.prototype.errorWithNode=function(e){var t=arguments.length<=1||void 0===arguments[1]?SyntaxError:arguments[1];return this.hub.file.errorWithNode(this.node,e,t)},e.prototype.traverse=function(e,t){p["default"](this.node,e,this.scope,t,this)},e}();r["default"]=y,c["default"](y.prototype,e(149)),c["default"](y.prototype,e(156)),c["default"](y.prototype,e(165)),c["default"](y.prototype,e(153)),c["default"](y.prototype,e(152)),c["default"](y.prototype,e(159)),c["default"](y.prototype,e(151)),c["default"](y.prototype,e(164)),c["default"](y.prototype,e(163)),c["default"](y.prototype,e(154)),c["default"](y.prototype,e(150));for(var g=m.TYPES,v=function(){var e=g[b],t="is"+e;y.prototype[t]=function(e){return m[t](this.node,e)}},b=0;b<g.length;b++)v();var E=function(e){return"_"===e[0]?"continue":(m.TYPES.indexOf(e)<0&&m.TYPES.push(e),void(y.prototype["is"+e]=function(t){return o[e].checkPath(this,t)}))};for(var x in o){E(x)}t.exports=r["default"]},{148:148,149:149,150:150,151:151,152:152,153:153,154:154,156:156,159:159,162:162,163:163,164:164,165:165,167:167,179:179,509:509}],156:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||h.anyTypeAnnotation();return h.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e}function a(){var e=this.node;{if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=f[e.type];return t?t.call(this,e):(t=f[this.parentPath.type],t&&t.validParent?this.parentPath.getTypeAnnotation():void 0)}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?h.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?h.anyTypeAnnotation():h.voidTypeAnnotation()}}}function s(e,t){return o(e,this.getTypeAnnotation(),t)}function o(e,t,r){if("string"===e)return h.isStringTypeAnnotation(t);if("number"===e)return h.isNumberTypeAnnotation(t);if("boolean"===e)return h.isBooleanTypeAnnotation(t);if("any"===e)return h.isAnyTypeAnnotation(t);if("mixed"===e)return h.isMixedTypeAnnotation(t);if("void"===e)return h.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}function u(e){var t=this.getTypeAnnotation();if(h.isAnyTypeAnnotation(t))return!0;if(h.isUnionTypeAnnotation(t)){for(var r=t.types,n=0;n<r.length;n++){var i=r[n];if(h.isAnyTypeAnnotation(i)||o(e,i,!0))return!0}return!1}return o(e,t,!0)}function p(e){var t=this.getTypeAnnotation();return e=e.getTypeAnnotation(),!h.isAnyTypeAnnotation()&&h.isFlowBaseAnnotation(t)?e.type===t.type:void 0}function l(e){var t=this.getTypeAnnotation();return h.isGenericTypeAnnotation(t)&&h.isIdentifier(t.id,{name:e})}r.__esModule=!0,r.getTypeAnnotation=i,r._getTypeAnnotation=a,r.isBaseType=s,r.couldBeBaseType=u,r.baseTypeStrictlyMatches=p,r.isGenericType=l;var c=e(158),f=n(c),d=e(179),h=n(d)},{158:158,179:179}],157:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=e.scope.getBinding(t),n=[];e.typeAnnotation=l.unionTypeAnnotation(n);var i=[],s=a(r,e,i),o=u(e,t);if(o){var p=a(r,o.ifStatement);s=s.filter(function(e){return p.indexOf(e)<0}),n.push(o.typeAnnotation)}if(s.length){var c=s.reverse(),f=[];s=[];for(var d=c,h=0;h<d.length;h++){var m=d[h],y=m.scope;if(!(f.indexOf(y)>=0)&&(f.push(y), s.push(m),y===e.scope)){s=[m];break}}s=s.concat(i);for(var g=s,v=0;v<g.length;v++){var m=g[v];n.push(m.getTypeAnnotation())}}return n.length?l.createUnionTypeAnnotation(n):void 0}function a(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){e=e.resolve();var n=e._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n})}function s(e,t){var r,n=t.node.operator,i=t.get("right").resolve(),a=t.get("left").resolve();if(a.isIdentifier({name:e})?r=i:i.isIdentifier({name:e})&&(r=a),r)return"==="===n?r.getTypeAnnotation():l.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(n)>=0?l.numberTypeAnnotation():void 0;if("==="===n){var s,o;if(a.isUnaryExpression({operator:"typeof"})?(s=a,o=i):i.isUnaryExpression({operator:"typeof"})&&(s=i,o=a),(o||s)&&(o=o.resolve(),o.isLiteral())){var u=o.node.value;if("string"==typeof u&&s.get("argument").isIdentifier({name:e}))return l.createTypeAnnotationBasedOnTypeof(o.node.value)}}}function o(e){for(var t;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}function u(e,t){var r=o(e);if(r){var n=r.get("test"),i=[n],a=[];do{var p=i.shift().resolve();if(p.isLogicalExpression()&&(i.push(p.get("left")),i.push(p.get("right"))),p.isBinaryExpression()){var c=s(t,p);c&&a.push(c)}}while(i.length);return a.length?{typeAnnotation:l.createUnionTypeAnnotation(a),ifStatement:r}:u(r,t)}}r.__esModule=!0;var p=e(179),l=n(p);r["default"]=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:i(this,e.name):"undefined"===e.name?l.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?l.numberTypeAnnotation():void("arguments"===e.name)}},t.exports=r["default"]},{179:179}],158:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(){var e=this.get("id");return e.isIdentifier()?this.get("init").getTypeAnnotation():void 0}function s(e){return e.typeAnnotation}function o(e){return this.get("callee").isIdentifier()?C.genericTypeAnnotation(e.callee):void 0}function u(){return C.stringTypeAnnotation()}function p(e){var t=e.operator;return"void"===t?C.voidTypeAnnotation():C.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?C.numberTypeAnnotation():C.STRING_UNARY_OPERATORS.indexOf(t)>=0?C.stringTypeAnnotation():C.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?C.booleanTypeAnnotation():void 0}function l(e){var t=e.operator;if(C.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return C.numberTypeAnnotation();if(C.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return C.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?C.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?C.stringTypeAnnotation():C.unionTypeAnnotation([C.stringTypeAnnotation(),C.numberTypeAnnotation()])}}function c(){return C.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])}function f(){return C.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])}function d(){return this.get("expressions").pop().getTypeAnnotation()}function h(){return this.get("right").getTypeAnnotation()}function m(e){var t=e.operator;return"++"===t||"--"===t?C.numberTypeAnnotation():void 0}function y(e){var t=e.value;return"string"==typeof t?C.stringTypeAnnotation():"number"==typeof t?C.numberTypeAnnotation():"boolean"==typeof t?C.booleanTypeAnnotation():null===t?C.voidTypeAnnotation():e.regex?C.genericTypeAnnotation(C.identifier("RegExp")):void 0}function g(){return C.genericTypeAnnotation(C.identifier("Object"))}function v(){return C.genericTypeAnnotation(C.identifier("Array"))}function b(){return v()}function E(){return C.genericTypeAnnotation(C.identifier("Function"))}function x(){return A(this.get("callee"))}function S(){return A(this.get("tag"))}function A(e){if(e=e.resolve(),e.isFunction()){if(e.is("async"))return e.is("generator")?C.genericTypeAnnotation(C.identifier("AsyncIterator")):C.genericTypeAnnotation(C.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.VariableDeclarator=a,r.TypeCastExpression=s,r.NewExpression=o,r.TemplateLiteral=u,r.UnaryExpression=p,r.BinaryExpression=l,r.LogicalExpression=c,r.ConditionalExpression=f,r.SequenceExpression=d,r.AssignmentExpression=h,r.UpdateExpression=m,r.Literal=y,r.ObjectExpression=g,r.ArrayExpression=v,r.RestElement=b,r.CallExpression=x,r.TaggedTemplateExpression=S;var D=e(179),C=i(D),w=e(157);r.Identifier=n(w),s.validParent=!0,b.validParent=!0,r.Function=E,r.Class=E},{157:157,179:179}],159:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){function r(e){var t=n[a];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],a=0;i.length;){var s=i.shift();if(t&&a===n.length)return!0;if(A.isIdentifier(s)){if(!r(s.name))return!1}else if(A.isLiteral(s)){if(!r(s.value))return!1}else{if(A.isMemberExpression(s)){if(s.computed&&!A.isLiteral(s.property))return!1;i.unshift(s.property),i.unshift(s.object);continue}if(!A.isThisExpression(s))return!1;if(!r("this"))return!1}if(++a>n.length)return!1}return a===n.length}function s(e){var t=this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}function o(e){return!this.has(e)}function u(e,t){return this.node[e]===t}function p(e){return A.isType(this.type,e)}function l(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()}function c(e){return"body"===this.key&&this.parentPath.isArrowFunctionExpression()?this.isExpression()?A.isBlockStatement(e):this.isBlockStatement()?A.isExpression(e):!1:!1}function f(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0}function d(){return this.parentPath.isLabeledStatement()||A.isBlockStatement(this.container)?!1:x["default"](A.STATEMENT_OR_BLOCK_KEYS,this.key)}function h(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return i.isImportDeclaration()?i.node.source.value!==e?!1:t?n.isImportDefaultSpecifier()&&"default"===t?!0:n.isImportNamespaceSpecifier()&&"*"===t?!0:n.isImportSpecifier()&&n.node.imported.name===t?!0:!1:!0:!1}function m(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""}function y(e){return"after"!==this._guessExecutionStatusRelativeTo(e)}function g(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t!==r)return"function";var n,i,a,s=e.getAncestry(),o=this.getAncestry();for(a=0;a<o.length;a++){var u=o[a];if(i=s.indexOf(u),i>=0){n=u;break}}if(!n)return"before";var p=s[i-1],l=o[a-1];if(!p||!l)return"before";if(p.listKey&&p.container===l.container)return p.key>l.key?"before":"after";var c=A.VISITOR_KEYS[p.type].indexOf(p.key),f=A.VISITOR_KEYS[l.type].indexOf(l.key);return c>f?"before":"after"}function v(e,t){return this._resolve(e,t)||this}function b(e,t){if(!(t&&t.indexOf(this)>=0))if(t=t||[],t.push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var r=this.scope.getBinding(this.node.name);if(!r)return;if(!r.constant)return;if("module"===r.kind)return;if(r.path!==this)return r.path.resolve(e,t)}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var n=this.toComputedKey();if(!A.isLiteral(n))return;var i=n.value,a=this.get("object").resolve(e,t);if(a.isObjectExpression())for(var s=a.get("properties"),o=s,u=0;u<o.length;u++){var p=o[u];if(p.isProperty()){var l=p.get("key"),c=p.isnt("computed")&&l.isIdentifier({name:i});if(c=c||l.isLiteral({value:i}))return p.get("value").resolve(e,t)}}else if(a.isArrayExpression()&&!isNaN(+i)){var f=a.get("elements"),d=f[i];if(d)return d.resolve(e,t)}}}}r.__esModule=!0,r.matchesPattern=a,r.has=s,r.isnt=o,r.equals=u,r.isNodeType=p,r.canHaveVariableDeclarationOrExpression=l,r.canSwapBetweenExpressionAndStatement=c,r.isCompletionRecord=f,r.isStatementOrBlock=d,r.referencesImport=h,r.getSource=m,r.willIMaybeExecuteBefore=y,r._guessExecutionStatusRelativeTo=g,r.resolve=v,r._resolve=b;var E=e(413),x=i(E),S=e(179),A=n(S),D=s;r.is=D},{179:179,413:413}],160:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(62),s=n(a),o=e(179),u=n(o),p={ReferencedIdentifier:function(e,t,r,n){if(!this.isJSXIdentifier()||!s.isCompatTag(e.name)){var i=r.getBinding(e.name);if(i&&i===n.scope.getBinding(e.name))if(i.constant)n.bindings[e.name]=i;else for(var a=i.constantViolations,o=0;o<a.length;o++){var u=a[o];n.breakOnScopePaths=n.breakOnScopePaths.concat(u.getAncestry())}}}},l=function(){function e(t,r){i(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this.scopes,t=e.pop();if(t){if(t.path.isFunction()){if(this.hasOwnParamBindings(t)){if(this.scope===t)return;return t.path.get("body").get("body")[0]}return this.getNextScopeStatementParent()}return t.path.isProgram()?this.getNextScopeStatementParent():void 0}},e.prototype.getNextScopeStatementParent=function(){var e=this.scopes.pop();return e?e.path.getStatementParent():void 0},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(p,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref");t.insertBefore([u.variableDeclaration("var",[u.variableDeclarator(r,this.path.node)])]);var n=this.path.parentPath;n.isJSXElement()&&this.path.container===n.node.children&&(r=u.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,62:62}],161:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=[function(e){return"body"===e.key&&(e.isBlockStatement()||e.isClassBody())?(e.node.body=[],!0):void 0},function(e,t){var r=!1;return r=r||"body"===e.key&&t.isArrowFunctionExpression(),r=r||"argument"===e.key&&t.isThrowStatement(),r?(e.replaceWith(a.identifier("undefined")),!0):void 0}];r.pre=s;var o=[function(e,t){var r=!1;return r=r||"test"===e.key&&(t.isWhile()||t.isSwitchCase()),r=r||"declaration"===e.key&&t.isExportDeclaration(),r=r||"body"===e.key&&t.isLabeledStatement(),r=r||"declarations"===e.listKey&&t.isVariableDeclaration()&&0===t.node.declarations.length,r=r||"expression"===e.key&&t.isExpressionStatement(),r=r||"test"===e.key&&t.isIfStatement(),r?(t.dangerouslyRemove(),!0):void 0},function(e,t){return t.isSequenceExpression()&&1===t.node.expressions.length?(t.replaceWith(t.node.expressions[0]),!0):void 0},function(e,t){return t.isBinary()?("left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0):void 0}];r.post=o},{179:179}],162:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,n=e.parent;if(!o.isIdentifier(r,t)){if(!o.isJSXIdentifier(r,t))return!1;if(a.isCompatTag(r.name))return!1}return o.isReferenced(r,n)}};r.ReferencedIdentifier=u;var p={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return o.isBinding(t,r)}};r.BindingIdentifier=p;var l={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(o.isStatement(t)){if(o.isVariableDeclaration(t)){if(o.isForXStatement(r,{left:t}))return!1;if(o.isForStatement(r,{init:t}))return!1}return!0}return!1}};r.Statement=l;var c={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():o.isExpression(e.node)}};r.Expression=c;var f={types:["Scopable"],checkPath:function(e){return o.isScope(e.node,e.parent)}};r.Scope=f;var d={checkPath:function(e){return o.isReferenced(e.node,e.parent)}};r.Referenced=d;var h={checkPath:function(e){return o.isBlockScoped(e.node)}};r.BlockScoped=h;var m={types:["VariableDeclaration"],checkPath:function(e){return o.isVar(e.node)}};r.Var=m;var y={types:["Literal"],checkPath:function(e){return e.isLiteral()&&e.parentPath.isExpressionStatement()}};r.DirectiveLiteral=y;var g={types:["ExpressionStatement"],checkPath:function(e){return e.get("expression").isLiteral()}};r.Directive=g;var v={checkPath:function(e){return e.node&&!!e.node.loc}};r.User=v;var b={checkPath:function(e){return!e.isUser()}};r.Generated=b;var E={types:["Flow","ImportDeclaration","ExportDeclaration"],checkPath:function(e){var t=e.node;return o.isFlow(t)?!0:o.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:o.isExportDeclaration(t)?"type"===t.exportKind:!1}};r.Flow=E},{179:179,62:62}],163:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function s(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n<t.length;n++){var i=e+n,a=t[n];if(this.container.splice(i,0,a),this.context){var s=this.context.create(this.parent,this.container,i,this.listKey);r.push(s),this.queueNode(s)}else r.push(b["default"].get({parentPath:this,parent:a,container:this.container,listKey:this.listKey,key:i}))}return r}function o(e){return this._containerInsert(this.key,e)}function u(e){return this._containerInsert(this.key+1,e)}function p(e){var t=e[e.length-1];x.isExpressionStatement(t)&&x.isIdentifier(t.expression)&&!this.isCompletionRecord()&&e.pop()}function l(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(x.expressionStatement(x.assignmentExpression("=",t,this.node))),e.push(x.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function c(e,t){for(var r=this.parent._paths,n=0;n<r.length;n++){var i=r[n];i.key>=e&&(i.key+=t)}}function f(e){e.constructor!==Array&&(e=[e]);for(var t=0;t<e.length;t++){var r=e[t];if(!r)throw new Error("Node list has falsy node with the index of "+t);if("object"!=typeof r)throw new Error("Node list contains a non-object node with the index of "+t);if(!r.type)throw new Error("Node list contains a node without a type with the index of "+t);r instanceof b["default"]&&(e[t]=r.node)}return e}function d(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:0});return n.insertBefore(t)}function h(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=r.length,i=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:n});return i.replaceWith(t,!0)}function m(){var e=arguments.length<=0||void 0===arguments[0]?this.scope:arguments[0],t=new g["default"](this,e);return t.run()}r.__esModule=!0,r.insertBefore=a,r._containerInsert=s,r._containerInsertBefore=o,r._containerInsertAfter=u,r._maybePopFromStatements=p,r.insertAfter=l,r.updateSiblingKeys=c,r._verifyNodeList=f,r.unshiftContainer=d,r.pushContainer=h,r.hoist=m;var y=e(160),g=i(y),v=e(155),b=i(v),E=e(179),x=n(E)},{155:155,160:160,179:179}],164:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){return console.trace("Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it."),this.dangerouslyRemove()}function a(){return this._assertUnremoved(),this.resync(),this._callRemovalHooks("pre")?void this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),this._markRemoved(),void this._callRemovalHooks("post"))}function s(e){for(var t=c[e],r=0;r<t.length;r++){var n=t[r];if(n(this,this.parentPath))return!0}}function o(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this.container[this.key]=null}function u(){this.shouldSkip=!0,this.removed=!0,this.node=null}function p(){if(this.removed)throw this.errorWithNode("NodePath has been removed so is read-only.")}r.__esModule=!0,r.remove=i,r.dangerouslyRemove=a,r._callRemovalHooks=s,r._remove=o,r._markRemoved=u,r._assertUnremoved=p;var l=e(161),c=n(l)},{161:161}],165:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){this.resync(),e=this._verifyNodeList(e),b.inheritLeadingComments(e[0],this.node),b.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node||this.dangerouslyRemove()}function s(e){this.resync();try{e="("+e+")",e=g["default"](e)}catch(t){var r=t.loc;throw r&&(t.message+=" - make sure this is an expression.",t.message+="\n"+c["default"](e,r.line,r.column+1)),t}return e=e.program.body[0].expression,d["default"].removeProperties(e),this.replaceWith(e)}function o(e,t){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof m["default"]&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead");if(this.node!==e){if(this.isProgram()&&!b.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(b.isProgram(e)&&!this.isProgram()&&(e=e.body,t=!0),Array.isArray(e)){if(t)return this.replaceWithMultiple(e);throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`")}if("string"==typeof e)return this.replaceWithSourceString();if(this.isNodeType("Statement")&&b.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||(e=b.expressionStatement(e))),this.isNodeType("Expression")&&b.isStatement(e)&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var r=this.node;r&&b.inheritsComments(e,r),this.node=this.container[this.key]=e,this.type=e.type,this.setScope()}}function u(e){this.resync();var t=b.toSequenceExpression(e,this.scope);if(t)return this.replaceWith(t);var r=b.functionExpression(null,[],b.blockStatement(e));r.shadow=!0,this.replaceWith(b.callExpression(r,[])),this.traverse(E);for(var n=this.get("callee").getCompletionRecords(),i=n,a=0;a<i.length;a++){var s=i[a];if(s.isExpressionStatement()){var o=s.findParent(function(e){return e.isLoop()});if(o){var u=this.get("callee").scope.generateDeclaredUidIdentifier("ret");this.get("callee.body").pushContainer("body",b.returnStatement(u)),s.get("expression").replaceWith(b.assignmentExpression("=",u,s.node.expression))}else s.replaceWith(b.returnStatement(s.node.expression))}}return this.node}function p(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.dangerouslyRemove()):this.replaceWithMultiple(e):this.replaceWith(e)}r.__esModule=!0,r.replaceWithMultiple=a,r.replaceWithSourceString=s,r.replaceWith=o,r.replaceExpressionWithStatements=u,r.replaceInline=p;var l=e(38),c=i(l),f=e(148),d=i(f),h=e(155),m=i(h),y=e(42),g=i(y),v=e(179),b=n(v),E={Function:function(){this.skip()},VariableDeclaration:function(e,t,r){if("var"===e.kind){var n=this.getBindingIdentifiers();for(var i in n)r.push({id:n[i]});for(var a=[],s=e.declarations,o=0;o<s.length;o++){var u=s[o];u.init&&a.push(b.expressionStatement(b.assignmentExpression("=",u.id,u.init)))}return a}}}},{148:148,155:155,179:179,38:38,42:42}],166:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t){var r=t.existing,i=t.identifier,a=t.scope,s=t.path,o=t.kind;n(this,e),this.constantViolations=[],this.constant=!0,this.identifier=i,this.references=0,this.referenced=!1,this.scope=a,this.path=s,this.kind=o,this.hasValue=!1,this.hasDeoptedValue=!1,this.value=null,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,this.constantViolations.push(e)},e.prototype.reference=function(){this.referenced=!0,this.references++},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r["default"]=i,t.exports=r["default"]},{}],167:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(413),u=i(o),p=e(584),l=i(p),c=e(148),f=i(c),d=e(510),h=i(d),m=e(43),y=n(m),g=e(166),v=i(g),b=e(397),E=i(b),x=e(406),S=i(x),A=e(511),D=i(A),C=e(41),w=i(C),I=e(179),_=n(I),F={For:function(){for(var e=_.FOR_INIT_KEYS,t=0;t<e.length;t++){var r=e[t],n=this.get(r);n.isVar()&&this.scope.getFunctionParent().registerBinding("var",n)}},Declaration:function(){this.isBlockScoped()||this.isExportDeclaration()&&this.get("declaration").isDeclaration()||this.scope.getFunctionParent().registerDeclaration(this)},ReferencedIdentifier:function(e,t,r,n){n.references.push(this)},ForXStatement:function(e,t,r,n){var i=this.get("left");(i.isPattern()||i.isIdentifier())&&n.constantViolations.push(i)},ExportDeclaration:{exit:function(e,t,r){var n=e.declaration;if(_.isClassDeclaration(n)||_.isFunctionDeclaration(n)){var i=r.getBinding(n.id.name);i&&i.reference()}else if(_.isVariableDeclaration(n))for(var a=n.declarations,s=0;s<a.length;s++){var o=a[s],u=_.getBindingIdentifiers(o);for(var p in u){var i=r.getBinding(p);i&&i.reference()}}}},LabeledStatement:function(){this.scope.getProgramParent().addGlobal(this.node),this.scope.getBlockParent().registerDeclaration(this)},AssignmentExpression:function(e,t,r,n){n.assignments.push(this)},UpdateExpression:function(e,t,r,n){n.constantViolations.push(this.get("argument"))},UnaryExpression:function(e,t,r,n){"delete"===this.node.operator&&n.constantViolations.push(this.get("argument"))},BlockScoped:function(){var e=this.scope;e.path===this&&(e=e.parent),e.getBlockParent().registerDeclaration(this)},ClassDeclaration:function(){var e=this.node.id.name;this.scope.bindings[e]=this.scope.getBinding(e)},Block:function(){for(var e=this.get("body"),t=e,r=0;r<t.length;r++){var n=t[r];n.isFunctionDeclaration()&&this.scope.getBlockParent().registerDeclaration(n)}}},k={ReferencedIdentifier:function(e,t,r,n){e.name===n.oldName&&(e.name=n.newName)},Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.oldName,n.binding)||this.skip()},"AssignmentExpression|Declaration":function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)a===n.oldName&&(i[a].name=n.newName)}},P=function(){function e(t,r){if(a(this,e),r&&r.block===t.node)return r;var n=t.getData("scope");return n&&n.parent===r&&n.block===t.node?n:(t.setData("scope",this),this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,void(this.path=t))}return e.prototype.traverse=function(e,t,r){f["default"](e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length<=0||void 0===arguments[0]?"temp":arguments[0],t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(e){return _.identifier(this.generateUid(e))},e.prototype.generateUid=function(e){e=_.toIdentifier(e).replace(/^_+/,"");var t,r=0;do t=this._generateUid(e,r),r++;while(this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;_.isAssignmentExpression(e)?r=e.left:_.isVariableDeclarator(e)?r=e.id:_.isProperty(r)&&(r=r.key);var n=[],i=function s(e){if(_.isModuleDeclaration(e))if(e.source)s(e.source);else if(e.specifiers&&e.specifiers.length)for(var t=e.specifiers,r=0;r<t.length;r++){var i=t[r];s(i)}else e.declaration&&s(e.declaration);else if(_.isModuleSpecifier(e))s(e.local);else if(_.isMemberExpression(e))s(e.object),s(e.property);else if(_.isIdentifier(e))n.push(e.name);else if(_.isLiteral(e))n.push(e.value);else if(_.isCallExpression(e))s(e.callee);else if(_.isObjectExpression(e)||_.isObjectPattern(e))for(var a=e.properties,o=0;o<a.length;o++){var u=a[o];s(u.key||u.argument)}};i(r);var a=n.join("$");return a=a.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(a)},e.prototype.isStatic=function(e){if(_.isThisExpression(e)||_.isSuper(e))return!0;if(_.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&("hoisted"!==t||"let"!==e.kind)){var i=!1;if(i||(i="let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind),i||(i="param"===e.kind&&("let"===t||"const"===t)),i)throw this.hub.file.errorWithNode(n,y.get("scopeDuplicateDeclaration",r),TypeError)}},e.prototype.rename=function(e,t,r){t=t||this.generateUidIdentifier(e).name;var n=this.getBinding(e);if(n){var i={newName:t,oldName:e,binding:n.identifier,info:n},a=n.scope;a.traverse(r||a.block,k,i),r||(a.removeOwnBinding(e),a.bindings[t]=n,i.binding.name=t);var s=this.hub.file;s&&this._renameFromMap(s.moduleFormatter.localImports,e,t,i.binding)}},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=l["default"]("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(_.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(_.isArrayExpression(e))return e;if(_.isIdentifier(e,{name:"arguments"}))return _.callExpression(_.memberExpression(r.addHelper("slice"),_.identifier("call")),[e]);var i="to-array",a=[e];return t===!0?i="to-consumable-array":t&&(a.push(_.literal(t)),i="sliced-to-array",this.hub.file.isLoose("es6.forOf")&&(i+="-loose")),_.callExpression(r.addHelper(i),a)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerBinding("label",e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"),e);else if(e.isVariableDeclaration())for(var t=e.get("declarations"),r=t,n=0;n<r.length;n++){var i=r[n];this.registerBinding(e.node.kind,i)}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration())for(var a=e.get("specifiers"),s=a,o=0;o<s.length;o++){var u=s[o];this.registerBinding("module",u)}else if(e.isExportDeclaration()){var i=e.get("declaration");(i.isClassDeclaration()||i.isFunctionDeclaration()||i.isVariableDeclaration())&&this.registerDeclaration(i)}else this.registerBinding("unknown",e)},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r);n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?t:arguments[2];return function(){if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration())for(var n=t.get("declarations"),i=n,a=0;a<i.length;a++){var s=i[a];this.registerBinding(e,s)}else{var o=this.getProgramParent(),u=t.getBindingIdentifiers(!0);for(var p in u)for(var l=u[p],c=0;c<l.length;c++){var f=l[c],d=this.getOwnBinding(p);if(d){if(d.identifier===f)continue;this.checkBlockScopedCollisions(d,e,p,f)}o.references[p]=!0,this.bindings[p]=new v["default"]({identifier:f,existing:d,scope:this,path:r,kind:e})}}}.apply(this,arguments)},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do if(t.uids[e])return!0;while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;do if(t.globals[e])return!0;while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do if(t.references[e])return!0;while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(_.isIdentifier(e)){var r=this.getBinding(e.name);return r?t?r.constant:!0:!1}if(_.isClass(e))return!e.superClass||this.isPure(e.superClass,t);if(_.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t); if(_.isArrayExpression(e)){for(var n=e.elements,i=0;i<n.length;i++){var a=n[i];if(!this.isPure(a,t))return!1}return!0}if(_.isObjectExpression(e)){for(var s=e.properties,o=0;o<s.length;o++){var u=s[o];if(!this.isPure(u,t))return!1}return!0}return _.isProperty(e)?e.computed&&!this.isPure(e.key,t)?!1:this.isPure(e.value,t):_.isPure(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{var r=t.data[e];null!=r&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){var e=this.path,t=this.block._scopeInfo;if(t)return D["default"](this,t);if(t=this.block._scopeInfo={references:w["default"](),bindings:w["default"](),globals:w["default"](),uids:w["default"](),data:w["default"]()},D["default"](this,t),e.isLoop())for(var r=_.FOR_INIT_KEYS,n=0;n<r.length;n++){var i=r[n],a=e.get(i);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(e.isFunctionExpression()&&e.has("id")&&this.registerBinding("local",e.get("id"),e),e.isClassExpression()&&e.has("id")&&this.registerBinding("local",e),e.isFunction())for(var s=e.get("params"),o=s,u=0;u<o.length;u++){var p=o[u];this.registerBinding("param",p)}e.isCatchClause()&&this.registerBinding("let",e),e.isComprehensionExpression()&&this.registerBinding("let",e);var l=this.getProgramParent();if(!l.crawling){var c={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(F,c),this.crawling=!1;for(var f=c.assignments,d=Array.isArray(f),h=0,f=d?f:f[Symbol.iterator]();;){var m;if(d){if(h>=f.length)break;m=f[h++]}else{if(h=f.next(),h.done)break;m=h.value}var y=m,g=y.getBindingIdentifiers(),v=void 0;for(var b in g)y.scope.getBinding(b)||(v=v||y.scope.getProgramParent(),v.addGlobal(g[b]));y.scope.registerConstantViolation(y)}for(var E=c.references,x=Array.isArray(E),S=0,E=x?E:E[Symbol.iterator]();;){var A;if(x){if(S>=E.length)break;A=E[S++]}else{if(S=E.next(),S.done)break;A=S.value}var C=A,I=C.scope.getBinding(C.node.name);I?I.reference(C):C.scope.getProgramParent().addGlobal(C.node)}for(var k=c.constantViolations,P=Array.isArray(k),B=0,k=P?k:k[Symbol.iterator]();;){var T;if(P){if(B>=k.length)break;T=k[B++]}else{if(B=k.next(),B.done)break;T=B.value}var M=T;M.scope.registerConstantViolation(M)}}},e.prototype.push=function(e){var t=this.path;t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(_.ensureBlock(t.node),t=t.get("body")),t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path);var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,a="declaration:"+n+":"+i,s=!r&&t.getData(a);if(!s){var o=_.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i,this.hub.file.attachAuxiliaryComment(o);var u=t.unshiftContainer("body",[o]);s=u[0],r||t.setData(a,s)}var p=_.variableDeclarator(e.id,e.init);s.node.declarations.push(p),this.registerBinding(n,s.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do if(e.path.isProgram())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do if(e.path.isFunctionParent())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do if(e.path.isBlockParent())return e;while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=w["default"](),t=this;do h["default"](e,t.bindings),t=t.parent;while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=w["default"](),t=arguments,r=0;r<t.length;r++){var n=t[r],i=this;do{for(var a in i.bindings){var s=i.bindings[a];s.kind===n&&(e[a]=s)}i=i.parent}while(i)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return r}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.bindings[e]},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return t?this.hasOwnBinding(t)?!0:this.parentHasBinding(t,r)?!0:this.hasUid(t)?!0:!r&&u["default"](e.globals,t)?!0:!r&&u["default"](e.contextVariables,t)?!0:!1:!1},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do r.uids[e]&&(r.uids[e]=!1);while(r=r.parent)},s(e,null,[{key:"globals",value:S["default"]([E["default"].builtin,E["default"].browser,E["default"].node].map(Object.keys)),enumerable:!0},{key:"contextVariables",value:["arguments","undefined","Infinity","NaN"],enumerable:!0}]),e}();r["default"]=P,t.exports=r["default"]},{148:148,166:166,179:179,397:397,406:406,41:41,413:413,43:43,510:510,511:511,584:584}],168:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!c(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];for(var i=r,a=0;a<i.length;a++){var o=i[a];e[o]=n}}}s(e),delete e.__esModule,u(e),p(e);for(var d=Object.keys(e),m=0;m<d.length;m++){var t=d[m];if(!c(t)){var y=h[t];if(y){var n=e[t];for(var g in n)n[g]=l(y,n[g]);if(delete e[t],y.types)for(var b=y.types,x=0;x<b.length;x++){var g=b[x];e[g]?f(e[g],n):e[g]=n}else f(e,n)}}}for(var t in e)if(!c(t)){var n=e[t],S=v.FLIPPED_ALIAS_KEYS[t];if(S){delete e[t];for(var A=S,D=0;D<A.length;D++){var C=A[D],w=e[C];w?f(w,n):e[C]=E["default"](n)}}}for(var t in e)c(t)||p(e[t]);return e}function s(e){if(!e._verified){if("function"==typeof e)throw new Error(y.get("traverseVerifyRootFunction"));for(var t in e)if(!c(t)){if(v.TYPES.indexOf(t)<0)throw new Error(y.get("traverseVerifyNodeType",t));var r=e[t];if("object"==typeof r)for(var n in r)if("enter"!==n&&"exit"!==n)throw new Error(y.get("traverseVerifyVisitorProperty",t,n))}e._verified=!0}}function o(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];a(i);for(var s in i){var o=t[s]=t[s]||{};f(o,i[s])}}return t}function u(e){for(var t in e)if(!c(t)){var r=e[t];"function"==typeof r&&(e[t]={enter:r})}}function p(e){e.enter&&!Array.isArray(e.enter)&&(e.enter=[e.enter]),e.exit&&!Array.isArray(e.exit)&&(e.exit=[e.exit])}function l(e,t){return function(){return e.checkPath(this)?t.apply(this,arguments):void 0}}function c(e){return"_"===e[0]?!0:"enter"===e||"exit"===e||"shouldSkip"===e?!0:"blacklist"===e||"noScope"===e||"skipKeys"===e?!0:!1}function f(e,t){for(var r in t)e[r]=[].concat(e[r]||[],t[r])}r.__esModule=!0,r.explode=a,r.verify=s,r.merge=o;var d=e(162),h=i(d),m=e(43),y=i(m),g=e(179),v=i(g),b=e(494),E=n(b)},{162:162,179:179,43:43,494:494}],169:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?e.key||e.property:arguments[1];return function(){return e.computed||C.isIdentifier(t)&&(t=C.literal(t.name)),t}()}function s(e,t){function r(e){for(var t=!1,a=[],s=e,o=0;o<s.length;o++){var u=s[o];if(C.isExpression(u))a.push(u);else if(C.isExpressionStatement(u))a.push(u.expression);else{if(C.isVariableDeclaration(u)){if("var"!==u.kind)return i=!0;for(var p=u.declarations,l=0;l<p.length;l++){var c=p[l],f=C.getBindingIdentifiers(c);for(var d in f)n.push({kind:u.kind,id:f[d]});c.init&&a.push(C.assignmentExpression("=",c.id,c.init))}t=!0;continue}if(C.isIfStatement(u)){var h=u.consequent?r([u.consequent]):C.identifier("undefined"),m=u.alternate?r([u.alternate]):C.identifier("undefined");if(!h||!m)return i=!0;a.push(C.conditionalExpression(u.test,h,m))}else{if(!C.isBlockStatement(u)){if(C.isEmptyStatement(u)){t=!0;continue}return i=!0}a.push(r(u.body))}}t=!1}return t&&a.push(C.identifier("undefined")),1===a.length?a[0]:C.sequenceExpression(a)}var n=[],i=!1,a=r(e);if(!i){for(var s=0;s<n.length;s++)t.push(n[s]);return a}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?e.key:arguments[1];return function(){var r;return"method"===e.kind?o.uid++:(r=C.isIdentifier(t)?t.name:C.isLiteral(t)?JSON.stringify(t.value):JSON.stringify(A["default"].removeProperties(C.cloneDeep(t))),e.computed&&(r="["+r+"]"),r)}()}function u(e){return C.isIdentifier(e)?e.name:(e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),C.isValidIdentifier(e)||(e="_"+e),e||"_")}function p(e){return e=u(e),("eval"===e||"arguments"===e)&&(e="_"+e),e}function l(e,t){if(C.isStatement(e))return e;var r,n=!1;if(C.isClass(e))n=!0,r="ClassDeclaration";else if(C.isFunction(e))n=!0,r="FunctionDeclaration";else if(C.isAssignmentExpression(e))return C.expressionStatement(e);if(n&&!e.id&&(r=!1),!r){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=r,e}function c(e){if(C.isExpressionStatement(e)&&(e=e.expression),C.isClass(e)?e.type="ClassExpression":C.isFunction(e)&&(e.type="FunctionExpression"),C.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")}function f(e,t){return C.isBlockStatement(e)?e:(C.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(C.isStatement(e)||(e=C.isFunction(t)?C.returnStatement(e):C.expressionStatement(e)),e=[e]),C.blockStatement(e))}function d(e){if(void 0===e)return C.identifier("undefined");if(e===!0||e===!1||null===e||x["default"](e)||g["default"](e)||b["default"](e))return C.literal(e);if(Array.isArray(e))return C.arrayExpression(e.map(C.valueToNode));if(m["default"](e)){var t=[];for(var r in e){var n;n=C.isValidIdentifier(r)?C.identifier(r):C.literal(r),t.push(C.property("init",n,C.valueToNode(e[r])))}return C.objectExpression(t)}throw new Error("don't know how to turn this value into a node")}r.__esModule=!0,r.toComputedKey=a,r.toSequenceExpression=s,r.toKeyAlias=o,r.toIdentifier=u,r.toBindingIdentifierName=p,r.toStatement=l,r.toExpression=c,r.toBlock=f,r.valueToNode=d;var h=e(504),m=i(h),y=e(502),g=i(y),v=e(505),b=i(v),E=e(506),x=i(E),S=e(148),A=i(S),D=e(179),C=n(D);o.uid=0},{148:148,179:179,502:502,504:504,505:505,506:506}],170:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("ArrayExpression",{visitor:["elements"],aliases:["Expression"]}),a["default"]("AssignmentExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),a["default"]("BinaryExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("BlockStatement",{visitor:["body"],aliases:["Scopable","BlockParent","Block","Statement"]}),a["default"]("BreakStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("CallExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("CatchClause",{visitor:["param","body"],aliases:["Scopable"]}),a["default"]("ConditionalExpression",{visitor:["test","consequent","alternate"],aliases:["Expression"]}),a["default"]("ContinueStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("DebuggerStatement",{aliases:["Statement"]}),a["default"]("DoWhileStatement",{visitor:["body","test"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("EmptyStatement",{aliases:["Statement"]}),a["default"]("ExpressionStatement",{visitor:["expression"],aliases:["Statement"]}),a["default"]("File",{builder:["program","comments","tokens"],visitor:["program"]}),a["default"]("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"]}),a["default"]("FunctionDeclaration",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Statement","Pure","Declaration"]}),a["default"]("FunctionExpression",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression"]}),a["default"]("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement"]}),a["default"]("LabeledStatement",{visitor:["label","body"],aliases:["Statement"]}),a["default"]("Literal",{builder:["value"],aliases:["Expression","Pure"]}),a["default"]("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("MemberExpression",{builder:{object:null,property:null,computed:!1},visitor:["object","property"],aliases:["Expression"]}),a["default"]("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("ObjectExpression",{visitor:["properties"],aliases:["Expression"]}),a["default"]("Program",{visitor:["body"],aliases:["Scopable","BlockParent","Block","FunctionParent"]}),a["default"]("Property",{builder:{kind:"init",key:null,value:null,computed:!1},visitor:["key","value","decorators"],aliases:["UserWhitespacable"]}),a["default"]("RestElement",{visitor:["argument","typeAnnotation"]}),a["default"]("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("SequenceExpression",{visitor:["expressions"],aliases:["Expression"]}),a["default"]("SwitchCase",{visitor:["test","consequent"]}),a["default"]("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"]}),a["default"]("ThisExpression",{aliases:["Expression"]}),a["default"]("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("TryStatement",{builder:["block","handler","finalizer"],visitor:["block","handlers","handler","guardedHandlers","finalizer"],aliases:["Statement"]}),a["default"]("UnaryExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["UnaryLike","Expression"]}),a["default"]("UpdateExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["Expression"]}),a["default"]("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"]}),a["default"]("VariableDeclarator",{visitor:["id","init"]}),a["default"]("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("WithStatement",{visitor:["object","body"],aliases:["Statement"]})},{174:174}],171:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern"]}),a["default"]("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern"]}),a["default"]("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("ClassBody",{visitor:["body"]}),a["default"]("ClassDeclaration",{visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration"]}),a["default"]("ClassExpression",{visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Expression"]}),a["default"]("ExportAllDeclaration",{visitor:["source","exported"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"]}),a["default"]("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"]}),a["default"]("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"]}),a["default"]("MetaProperty",{visitor:["meta","property"],aliases:["Expression"]}),a["default"]("MethodDefinition",{builder:{key:null,value:null,kind:"method",computed:!1,"static":!1},visitor:["key","value","decorators"]}),a["default"]("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern"]}),a["default"]("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"]}),a["default"]("Super",{aliases:["Expression"]}),a["default"]("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"]}),a["default"]("TemplateElement"),a["default"]("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression"]}),a["default"]("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"]})},{174:174}],172:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AwaitExpression",{builder:["argument","all"],visitor:["argument"],aliases:["Expression","Terminatorless"]}),a["default"]("BindExpression",{visitor:["object","callee"]}),a["default"]("ComprehensionBlock",{visitor:["left","right"]}),a["default"]("ComprehensionExpression",{visitor:["filter","blocks","body"],aliases:["Expression","Scopable"]}),a["default"]("Decorator",{visitor:["expression"]}),a["default"]("DoExpression",{visitor:["body"],aliases:["Expression"]}),a["default"]("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"]})},{174:174}],173:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"]}),a["default"]("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("BooleanLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],aliases:["Flow"]}),a["default"]("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"]}),a["default"]("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"]}),a["default"]("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("NumberLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("StringLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"]}),a["default"]("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"]}),a["default"]("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"]}),a["default"]("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"]}),a["default"]("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"]}),a["default"]("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]})},{174:174}],174:[function(e,t,r){"use strict";function n(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];t[i]=null}return t}function i(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.visitor=t.visitor||[],t.aliases=t.aliases||[],t.builder||(t.builder=n(t.visitor)),Array.isArray(t.builder)&&(t.builder=n(t.builder)),a[e]=t.visitor,s[e]=t.aliases,o[e]=t.builder}r.__esModule=!0,r["default"]=i;var a={};r.VISITOR_KEYS=a;var s={};r.ALIAS_KEYS=s;var o={};r.BUILDER_KEYS=o},{}],175:[function(e,t,r){"use strict";e(174),e(170),e(171),e(173),e(176),e(177),e(172)},{170:170,171:171,172:172,173:173,174:174,176:176,177:177}],176:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"]}),a["default"]("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"]}),a["default"]("JSXElement",{visitor:["openingElement","closingElement","children"],aliases:["JSX","Immutable","Expression"]}),a["default"]("JSXEmptyExpression",{aliases:["JSX","Expression"]}),a["default"]("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"]}),a["default"]("JSXIdentifier",{aliases:["JSX","Expression"]}),a["default"]("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"]}),a["default"]("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"]}),a["default"]("JSXOpeningElement",{visitor:["name","attributes"],aliases:["JSX","Immutable"]}),a["default"]("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"]})},{174:174}],177:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("Noop",{visitor:[]}),a["default"]("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression"]})},{174:174}],178:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=a(e);return 1===t.length?t[0]:u.unionTypeAnnotation(t)}function a(e){for(var t={},r={},n=[],i=[],s=0;s<e.length;s++){var o=e[s];if(o&&!(i.indexOf(o)>=0)){if(u.isAnyTypeAnnotation(o))return[o];if(u.isFlowBaseAnnotation(o))r[o.type]=o;else if(u.isUnionTypeAnnotation(o))n.indexOf(o.types)<0&&(e=e.concat(o.types),n.push(o.types));else if(u.isGenericTypeAnnotation(o)){var p=o.id.name;if(t[p]){var l=t[p];l.typeParameters?o.typeParameters&&(l.typeParameters.params=a(l.typeParameters.params.concat(o.typeParameters.params))):l=o.typeParameters}else t[p]=o}else i.push(o)}}for(var c in r)i.push(r[c]);for(var f in t)i.push(t[f]);return i}function s(e){if("string"===e)return u.stringTypeAnnotation();if("number"===e)return u.numberTypeAnnotation();if("undefined"===e)return u.voidTypeAnnotation();if("boolean"===e)return u.booleanTypeAnnotation();if("function"===e)return u.genericTypeAnnotation(u.identifier("Function"));if("object"===e)return u.genericTypeAnnotation(u.identifier("Object"));if("symbol"===e)return u.genericTypeAnnotation(u.identifier("Symbol"));throw new Error("Invalid typeof value")}r.__esModule=!0,r.createUnionTypeAnnotation=i,r.removeTypeDuplicates=a,r.createTypeAnnotationBasedOnTypeof=s;var o=e(179),u=n(o)},{179:179}],179:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=B["is"+e]=function(r,n){return B.is(e,r,n,t)};B["assert"+e]=function(t,n){if(n=n||{},!r(t,n))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(n))}}function a(e,t,r,n){if(!t)return!1;var i=s(t.type,e);return i?"undefined"==typeof r?!0:B.shallowEqual(t,r):!1}function s(e,t){if(e===t)return!0;var r=B.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e===a)return!0}}return!1}function o(e,t){for(var r=Object.keys(t),n=r,i=0;i<n.length;i++){var a=n[i];if(e[a]!==t[a])return!1}return!0}function u(e,t,r){return e.object=B.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e}function p(e,t){return e.object=B.memberExpression(t,e.object),e}function l(e){var t=arguments.length<=1||void 0===arguments[1]?"body":arguments[1];return e[t]=B.toBlock(e[t],e)}function c(e){var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function f(e){var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=B.cloneDeep(n):Array.isArray(n)&&(n=n.map(B.cloneDeep))),t[r]=n}return t}function d(e,t){var r=e.split(".");return function(e){if(!B.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var a=n.shift();if(t&&i===r.length)return!0;if(B.isIdentifier(a)){if(r[i]!==a.name)return!1}else{if(!B.isLiteral(a)){if(B.isMemberExpression(a)){if(a.computed&&!B.isLiteral(a.property))return!1;n.push(a.object),n.push(a.property);continue}return!1}if(r[i]!==a.value)return!1}if(++i>r.length)return!1}return!0}}function h(e){for(var t=j,r=0;r<t.length;r++){var n=t[r];delete e[n]}return e}function m(e,t){return y(e,t),g(e,t),v(e,t),e}function y(e,t){b("trailingComments",e,t)}function g(e,t){b("leadingComments",e,t)}function v(e,t){b("innerComments",e,t)}function b(e,t,r){t&&r&&(t[e]=k["default"](D["default"]([].concat(t[e],r[e]))))}function E(e,t){if(!e||!t)return e;for(var r=B.INHERIT_KEYS.optional,n=0;n<r.length;n++){var i=r[n];null==e[i]&&(e[i]=t[i])}for(var a=B.INHERIT_KEYS.force,s=0;s<a.length;s++){var i=a[s];e[i]=t[i]}return B.inheritsComments(e,t),e}r.__esModule=!0,r.is=a,r.isType=s,r.shallowEqual=o,r.appendToMemberExpression=u,r.prependToMemberExpression=p,r.ensureBlock=l,r.clone=c,r.cloneDeep=f,r.buildMatchMemberExpression=d,r.removeComments=h,r.inheritsComments=m,r.inheritTrailingComments=y,r.inheritLeadingComments=g,r.inheritInnerComments=v,r.inherits=E;var x=e(600),S=n(x),A=e(405),D=n(A),C=e(509),w=n(C),I=e(411),_=n(I),F=e(409),k=n(F);e(175);var P=e(174),B=r,T=["consequent","body","alternate"];r.STATEMENT_OR_BLOCK_KEYS=T;var M=["body","expressions"];r.FLATTENABLE_KEYS=M;var O=["left","init"];r.FOR_INIT_KEYS=O;var j=["leadingComments","trailingComments","innerComments"];r.COMMENT_KEYS=j;var L={optional:["typeAnnotation","typeParameters","returnType"],force:["_scopeInfo","_paths","start","loc","end"]};r.INHERIT_KEYS=L;var N=[">","<",">=","<="];r.BOOLEAN_NUMBER_BINARY_OPERATORS=N;var R=["==","===","!=","!=="];r.EQUALITY_BINARY_OPERATORS=R;var V=R.concat(["in","instanceof"]);r.COMPARISON_BINARY_OPERATORS=V;var U=[].concat(V,N);r.BOOLEAN_BINARY_OPERATORS=U;var q=["-","/","*","**","&","|",">>",">>>","<<","^"];r.NUMBER_BINARY_OPERATORS=q;var G=["delete","!"];r.BOOLEAN_UNARY_OPERATORS=G;var H=["+","-","++","--","~"];r.NUMBER_UNARY_OPERATORS=H;var W=["typeof"];r.STRING_UNARY_OPERATORS=W,r.VISITOR_KEYS=P.VISITOR_KEYS,r.BUILDER_KEYS=P.BUILDER_KEYS,r.ALIAS_KEYS=P.ALIAS_KEYS,_["default"](B.VISITOR_KEYS,function(e,t){i(t,!0)}),B.FLIPPED_ALIAS_KEYS={},_["default"](B.ALIAS_KEYS,function(e,t){_["default"](e,function(e){var r=B.FLIPPED_ALIAS_KEYS[e]=B.FLIPPED_ALIAS_KEYS[e]||[];r.push(t)})}),_["default"](B.FLIPPED_ALIAS_KEYS,function(e,t){B[t.toUpperCase()+"_TYPES"]=e,i(t,!1)});var X=Object.keys(B.VISITOR_KEYS).concat(Object.keys(B.FLIPPED_ALIAS_KEYS));r.TYPES=X,_["default"](B.VISITOR_KEYS,function(e,t){if(!B.BUILDER_KEYS[t]){var r={};_["default"](e,function(e){r[e]=null}),B.BUILDER_KEYS[t]=r}}),_["default"](B.BUILDER_KEYS,function(e,t){var r=function(){var r={};r.type=t;var n=0;for(var i in e){var a=arguments[n++];void 0===a&&(a=e[i]),r[i]=a}return r};B[t]=r,B[t[0].toLowerCase()+t.slice(1)]=r}),S["default"](B),S["default"](B.VISITOR_KEYS),w["default"](B,e(180)),w["default"](B,e(181)),w["default"](B,e(169)),w["default"](B,e(178))},{169:169,174:174,175:175,178:178,180:180,181:181,405:405,409:409,411:411,509:509,600:600}],180:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=[].concat(e),n=Object.create(null);r.length;){var i=r.shift();if(i){var a=s.getBindingIdentifiers.keys[i.type];if(s.isIdentifier(i))if(t){var o=n[i.name]=n[i.name]||[];o.push(i)}else n[i.name]=i;else if(s.isExportDeclaration(i))s.isDeclaration(e.declaration)&&r.push(e.declaration);else if(a)for(var u=0;u<a.length;u++){var p=a[u];i[p]&&(r=r.concat(i[p]))}}}return n}r.__esModule=!0,r.getBindingIdentifiers=i;var a=e(179),s=n(a);i.keys={DeclareClass:["id"],DeclareFunction:["id"],DeclareModule:["id"],DeclareVariable:["id"],InterfaceDeclaration:["id"],TypeAlias:["id"],ComprehensionExpression:["blocks"],ComprehensionBlock:["left"],CatchClause:["param"],LabeledStatement:["label"],UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],ImportDeclaration:["specifiers"],FunctionDeclaration:["id","params"],FunctionExpression:["id","params"],ClassDeclaration:["id"],ClassExpression:["id"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],AssignmentPattern:["left"],ArrayPattern:["elements"],ObjectPattern:["properties"],VariableDeclaration:["declarations"],VariableDeclarator:["id"]}},{179:179}],181:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]); return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=h.getBindingIdentifiers.keys[t.type];if(r)for(var n=0;n<r.length;n++){var i=r[n],a=t[i];if(Array.isArray(a)){if(a.indexOf(e)>=0)return!0}else if(a===e)return!0}return!1}function s(e,t){switch(t.type){case"MemberExpression":case"JSXMemberExpression":return t.property===e&&t.computed?!0:t.object===e?!0:!1;case"MetaProperty":return!1;case"Property":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var r=t.params,n=0;n<r.length;n++){var i=r[n];if(i===e)return!1}return t.id!==e;case"ExportSpecifier":return t.source?!1:t.local===e;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"MethodDefinition":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":return t.right===e;case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0}function o(e){return"string"!=typeof e||y["default"].keyword.isReservedWordES6(e,!0)?!1:y["default"].keyword.isIdentifierNameES6(e)}function u(e){return v.isVariableDeclaration(e)&&("var"!==e.kind||e._let)}function p(e){return v.isFunctionDeclaration(e)||v.isClassDeclaration(e)||v.isLet(e)}function l(e){return v.isVariableDeclaration(e,{kind:"var"})&&!e._let}function c(e){return v.isImportDefaultSpecifier(e)||v.isIdentifier(e.imported||e.exported,{name:"default"})}function f(e,t){return v.isBlockStatement(e)&&v.isFunction(t,{body:e})?!1:v.isScopable(e)}function d(e){return v.isType(e.type,"Immutable")?!0:v.isLiteral(e)?e.regex?!1:!0:v.isIdentifier(e)&&"undefined"===e.name?!0:!1}r.__esModule=!0,r.isBinding=a,r.isReferenced=s,r.isValidIdentifier=o,r.isLet=u,r.isBlockScoped=p,r.isVar=l,r.isSpecifierDefault=c,r.isScope=f,r.isImmutable=d;var h=e(180),m=e(395),y=i(m),g=e(179),v=n(g)},{179:179,180:180,395:395}],182:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=t||a.EXTENSIONS,n=V["default"].extname(e);return _["default"](r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function o(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(y["default"]).join("|"),"i")),B["default"](e)){e=J["default"](e),(v["default"](e,"./")||v["default"](e,"*/"))&&(e=e.slice(2)),v["default"](e,"**/")&&(e=e.slice(3));var t=w["default"].makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if(M["default"](e))return e;throw new TypeError("illegal type for regexify")}function u(e,t){return e?S["default"](e)?u([e],t):B["default"](e)?u(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function p(e){return"true"===e?!0:"false"===e?!1:e}function l(e,t,r){if(e=J["default"](e),r){for(var n=r,i=0;i<n.length;i++){var a=n[i];if(c(a,e))return!1}return!0}if(t.length)for(var s=t,o=0;o<s.length;o++){var a=s[o];if(c(a,e))return!0}return!1}function c(e,t){return"function"==typeof e?e(t):e.test(t)}function f(e,t,n){var i=r.templates[e];if(!i)throw new ReferenceError("unknown template "+e);if(t===!0&&(n=!0,t=null),i=E["default"](i),j["default"](t)||k["default"](i,Q,null,t),i.body.length>1)return i.body;var a=i.body[0];return!n&&X.isExpressionStatement(a)?a.expression:a}function d(e,t){var r=N["default"](t,{filename:e,looseModules:!0}).program;return r=k["default"].removeProperties(r)}function h(){var e={},r=V["default"].join(t,"transformation/templates");if(!K["default"].sync(r))throw new ReferenceError(D.get("missingTemplatesDirectory"));for(var n=H["default"].readdirSync(r),i=0;i<n.length;i++){var a=n[i];if("."===a[0])return;var s=V["default"].basename(a,V["default"].extname(a)),o=V["default"].join(r,a),u=H["default"].readFileSync(o,"utf8");e[s]=d(o,u)}return e}r.__esModule=!0,r.canCompile=a,r.list=s,r.regexify=o,r.arrayify=u,r.booleanify=p,r.shouldIgnore=l,r.template=f,r.parseTemplate=d;var m=e(518),y=i(m),g=e(519),v=i(g),b=e(495),E=i(b),x=e(498),S=i(x),A=e(43),D=n(A),C=e(522),w=i(C),I=e(410),_=i(I),F=e(148),k=i(F),P=e(506),B=i(P),T=e(505),M=i(T),O=e(499),j=i(O),L=e(42),N=i(L),R=e(9),V=i(R),U=e(512),q=i(U),G=e(1),H=i(G),W=e(179),X=n(W),Y=e(588),J=i(Y),z=e(526),K=i(z),$=e(13);r.inherits=$.inherits,r.inspect=$.inspect,a.EXTENSIONS=[".js",".jsx",".es6",".es"];var Q={noScope:!0,enter:function(e,t,r,n){X.isExpressionStatement(e)&&(e=e.expression),X.isIdentifier(e)&&q["default"](n,e.name)&&(this.skip(),this.replaceInline(n[e.name]))},exit:function(e){k["default"].clearNode(e)}};try{r.templates=e(604)}catch(Z){if("MODULE_NOT_FOUND"!==Z.code)throw Z;r.templates=h()}}).call(this,"/lib")},{1:1,13:13,148:148,179:179,410:410,42:42,43:43,495:495,498:498,499:499,505:505,506:506,512:512,518:518,519:519,522:522,526:526,588:588,604:604,9:9}],183:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("constant-folding",{metadata:{group:"builtin-prepass",experimental:!0},visitor:{AssignmentExpression:function(){var e=this.get("left");if(e.isIdentifier()){var t=this.scope.getBinding(e.node.name);if(t&&!t.hasDeoptValue){var r=this.get("right").evaluate();r.confident?t.setValue(r.value):t.deoptValue()}}},IfStatement:function(){var e=this.get("test").evaluate();return e.confident?void(e.value?this.skipKey("alternate"):this.skipKey("consequent")):this.skip()},Scopable:{enter:function(){var e=this.scope.getFunctionParent();for(var t in this.scope.bindings){var r=this.scope.bindings[t],n=!1,i=!0,a=!1,s=void 0;try{for(var o,u=r.constantViolations[Symbol.iterator]();!(i=(o=u.next()).done);i=!0){var p=o.value,l=p.scope.getFunctionParent();if(l!==e){n=!0;break}}}catch(c){a=!0,s=c}finally{try{!i&&u["return"]&&u["return"]()}finally{if(a)throw s}}n&&r.deoptValue()}},exit:function(){for(var e in this.scope.bindings){var t=this.scope.bindings[e];t.clearValue()}}},Expression:{exit:function(){var e=this.evaluate();return e.confident?r.valueToNode(e.value):void 0}}}})},t.exports=r["default"]},{}],184:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e){if(n.isBlockStatement(e)){for(var t=!1,r=0;r<e.body.length;r++){var i=e.body[r];n.isBlockScoped(i)&&(t=!0)}if(!t)return e.body}return e}var r=e.Plugin,n=e.types,i={ReferencedIdentifier:function(e,t,r){var i=r.getBinding(e.name);if(i&&!(i.references>1)&&i.constant&&"param"!==i.kind&&"module"!==i.kind){var a=i.path.node;if(n.isVariableDeclarator(a)&&(a=a.init),a&&r.isPure(a,!0)&&(!n.isClass(a)&&!n.isFunction(a)||i.path.scope.parent===r)&&!this.findParent(function(e){return e.node===a}))return n.toExpression(a),r.removeBinding(e.name),i.path.dangerouslyRemove(),a}},"ClassDeclaration|FunctionDeclaration":function(e,t,r){var n=r.getBinding(e.id.name);n&&!n.referenced&&this.dangerouslyRemove()},VariableDeclarator:function(e,t,r){n.isIdentifier(e.id)&&r.isPure(e.init,!0)&&i["ClassDeclaration|FunctionDeclaration"].apply(this,arguments)},ConditionalExpression:function(e){var t=this.get("test").evaluateTruthy();return t===!0?e.consequent:t===!1?e.alternate:void 0},BlockStatement:function(){for(var e=this.get("body"),t=!1,r=0;r<e.length;r++){var n=e[r];t||!n.isCompletionStatement()?t&&!n.isFunctionDeclaration()&&n.dangerouslyRemove():t=!0}},IfStatement:{exit:function(e){var r=e.consequent,i=e.alternate,a=e.test,s=this.get("test").evaluateTruthy();return s===!0?t(r):s===!1?i?t(i):this.dangerouslyRemove():(n.isBlockStatement(i)&&!i.body.length&&(i=e.alternate=null),void(n.isBlockStatement(r)&&!r.body.length&&n.isBlockStatement(i)&&i.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=n.unaryExpression("!",a,!0))))}}};return new r("dead-code-elimination",{metadata:{group:"builtin-pre",experimental:!0},visitor:i})},t.exports=r["default"]},{}],185:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.parse,n=e.traverse;return new t("eval",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(e){if(this.get("callee").isIdentifier({name:"eval"})&&1===e.arguments.length){var t=this.get("arguments")[0].evaluate();if(!t.confident)return;var i=t.value;if("string"!=typeof i)return;var a=r(i);return n.removeProperties(a),a.program}}}})},t.exports=r["default"]},{}],186:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(t){var r=t.Plugin,n=t.types;return new r("inline-environment-variables",{metadata:{group:"builtin-pre"},visitor:{MemberExpression:function(t){if(this.get("object").matchesPattern("process.env")){var r=this.toComputedKey();if(n.isLiteral(r))return n.valueToNode(e.env[r.value])}}}})},t.exports=r["default"]}).call(this,e(10))},{10:10}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("jscript",{metadata:{group:"builtin-trailing"},visitor:{FunctionExpression:{exit:function(e){return e.id?(e._ignoreUserWhitespace=!0,r.callExpression(r.functionExpression(null,[],r.blockStatement([r.toStatement(e),r.returnStatement(e.id)])),[])):void 0}}}})},t.exports=r["default"]},{}],188:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("member-expression-literals",{metadata:{group:"builtin-trailing"},visitor:{MemberExpression:{exit:function(e){var t=e.property;e.computed&&r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.property=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],189:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("property-literals",{metadata:{group:"builtin-trailing"},visitor:{Property:{exit:function(e){var t=e.key;r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.key=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],190:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(408),a=n(i);r["default"]=function(e){function t(e){return s.isLiteral(s.toComputedKey(e,e.key),{value:"__proto__"})}function r(e){var t=e.left;return s.isMemberExpression(t)&&s.isLiteral(s.toComputedKey(t,t.property),{value:"__proto__"})}function n(e,t,r){return s.expressionStatement(s.callExpression(r.addHelper("defaults"),[t,e.right]))}var i=e.Plugin,s=e.types;return new i("proto-to-assign",{metadata:{secondPass:!0},visitor:{AssignmentExpression:function(e,t,i,a){if(r(e)){var o=[],u=e.left.object,p=i.maybeGenerateMemoised(u);return p&&o.push(s.expressionStatement(s.assignmentExpression("=",p,u))),o.push(n(e,p||u,a)),p&&o.push(p),o}},ExpressionStatement:function(e,t,i,a){var o=e.expression;if(s.isAssignmentExpression(o,{operator:"="}))return r(o)?n(o,o.left.object,a):void 0},ObjectExpression:function(e,r,n,i){for(var o,u=0;u<e.properties.length;u++){var p=e.properties[u];t(p)&&(o=p.value,a["default"](e.properties,p))}if(o){var l=[s.objectExpression([]),o];return e.properties.length&&l.push(e),s.callExpression(i.addHelper("extends"),l)}}}})},t.exports=r["default"]},{408:408}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r={enter:function(e,t,r,n){var i=this,a=function(){n.isImmutable=!1,i.stop()};return this.isJSXClosingElement()?void this.skip():this.isJSXIdentifier({name:"ref"})&&this.parentPath.isJSXAttribute({name:e})?a():void(this.isJSXIdentifier()||this.isIdentifier()||this.isJSXMemberExpression()||this.isImmutable()||a())}};return new t("react-constant-elements",{metadata:{group:"builtin-basic"},visitor:{JSXElement:function(e){if(!e._hoisted){var t={isImmutable:!0};this.traverse(r,t),t.isImmutable?this.hoist():e._hoisted=!0}}}})},t.exports=r["default"]},{}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e,t){for(var r=t.arguments[0].properties,n=!0,a=0;a<r.length;a++){var s=r[a],o=i.toComputedKey(s);if(i.isLiteral(o,{value:"displayName"})){n=!1;break}}n&&r.unshift(i.property("init",i.identifier("displayName"),i.literal(e)))}function r(e){if(!e||!i.isCallExpression(e))return!1;if(!a(e.callee))return!1;var t=e.arguments;if(1!==t.length)return!1;var r=t[0];return i.isObjectExpression(r)?!0:!1}var n=e.Plugin,i=e.types,a=i.buildMatchMemberExpression("React.createClass");return new n("react-display-name",{metadata:{group:"builtin-pre"},visitor:{ExportDefaultDeclaration:function(e,n,i,a){r(e.declaration)&&t(a.opts.basename,e.declaration)},"AssignmentExpression|Property|VariableDeclarator":function(e){var n,a;i.isAssignmentExpression(e)?(n=e.left,a=e.right):i.isProperty(e)?(n=e.key,a=e.value):i.isVariableDeclarator(e)&&(n=e.id,a=e.init),i.isMemberExpression(n)&&(n=n.property),i.isIdentifier(n)&&r(a)&&t(n.name,a)}}})},t.exports=r["default"]},{}],193:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-console",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(){this.get("callee").matchesPattern("console",!0)&&this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],194:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-debugger",{metadata:{group:"builtin-pre"},visitor:{DebuggerStatement:function(){this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],195:[function(e,t,r){t.exports={builtins:{Symbol:"symbol",Promise:"promise",Map:"map",WeakMap:"weak-map",Set:"set",WeakSet:"weak-set"},methods:{Array:{concat:"array/concat",copyWithin:"array/copy-within",entries:"array/entries",every:"array/every",fill:"array/fill",filter:"array/filter",findIndex:"array/find-index",find:"array/find",forEach:"array/for-each",from:"array/from",includes:"array/includes",indexOf:"array/index-of",join:"array/join",keys:"array/keys",lastIndexOf:"array/last-index-of",map:"array/map",of:"array/of",pop:"array/pop",push:"array/push",reduceRight:"array/reduce-right",reduce:"array/reduce",reverse:"array/reverse",shift:"array/shift",slice:"array/slice",some:"array/some",sort:"array/sort",splice:"array/splice",turn:"array/turn",unshift:"array/unshift",values:"array/values"},Object:{assign:"object/assign",classof:"object/classof",create:"object/create",define:"object/define",defineProperties:"object/define-properties",defineProperty:"object/define-property",entries:"object/entries",freeze:"object/freeze",getOwnPropertyDescriptor:"object/get-own-property-descriptor",getOwnPropertyDescriptors:"object/get-own-property-descriptors",getOwnPropertyNames:"object/get-own-property-names",getOwnPropertySymbols:"object/get-own-property-symbols",getPrototypePf:"object/get-prototype-of",index:"object/index",isExtensible:"object/is-extensible",isFrozen:"object/is-frozen",isObject:"object/is-object",isSealed:"object/is-sealed",is:"object/is",keys:"object/keys",make:"object/make",preventExtensions:"object/prevent-extensions",seal:"object/seal",setPrototypeOf:"object/set-prototype-of",values:"object/values"},RegExp:{escape:"regexp/escape"},Function:{only:"function/only",part:"function/part"},Math:{acosh:"math/acosh",asinh:"math/asinh",atanh:"math/atanh",cbrt:"math/cbrt",clz32:"math/clz32",cosh:"math/cosh",expm1:"math/expm1",fround:"math/fround",hypot:"math/hypot",pot:"math/pot",imul:"math/imul",log10:"math/log10",log1p:"math/log1p",log2:"math/log2",sign:"math/sign",sinh:"math/sinh",tanh:"math/tanh",trunc:"math/trunc"},Date:{addLocale:"date/add-locale",formatUTC:"date/format-utc",format:"date/format"},Symbol:{"for":"symbol/for",hasInstance:"symbol/has-instance","is-concat-spreadable":"symbol/is-concat-spreadable",iterator:"symbol/iterator",keyFor:"symbol/key-for",match:"symbol/match",replace:"symbol/replace",search:"symbol/search",species:"symbol/species",split:"symbol/split",toPrimitive:"symbol/to-primitive",toStringTag:"symbol/to-string-tag",unscopables:"symbol/unscopables"},String:{at:"string/at",codePointAt:"string/code-point-at",endsWith:"string/ends-with",escapeHTML:"string/escape-html",fromCodePoint:"string/from-code-point",includes:"string/includes",raw:"string/raw",repeat:"string/repeat",startsWith:"string/starts-with",unescapeHTML:"string/unescape-html"},Number:{EPSILON:"number/epsilon",isFinite:"number/is-finite",isInteger:"number/is-integer",isNaN:"number/is-nan",isSafeInteger:"number/is-safe-integer",MAX_SAFE_INTEGER:"number/max-safe-integer",MIN_SAFE_INTEGER:"number/min-safe-integer",parseFloat:"number/parse-float",parseInt:"number/parse-int",random:"number/random"},Reflect:{apply:"reflect/apply",construct:"reflect/construct",defineProperty:"reflect/define-property",deleteProperty:"reflect/delete-property",enumerate:"reflect/enumerate",getOwnPropertyDescriptor:"reflect/get-own-property-descriptor",getPrototypeOf:"reflect/get-prototype-of",get:"reflect/get",has:"reflect/has",isExtensible:"reflect/is-extensible",ownKeys:"reflect/own-keys",preventExtensions:"reflect/prevent-extensions",setPrototypeOf:"reflect/set-prototype-of",set:"reflect/set"}}}},{}],196:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(195),a=n(i);r["default"]=function(e){function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var r=e.Plugin,n=e.types,i="babel-runtime";return new r("runtime",{metadata:{group:"builtin-post-modules"},pre:function(e){e.set("helperGenerator",function(t){return e.addImport(i+"/helpers/"+t,t,"absoluteDefault")}),e.setDynamic("regeneratorIdentifier",function(){return e.addImport(i+"/regenerator","regeneratorRuntime","absoluteDefault")})},visitor:{ReferencedIdentifier:function(e,r,s,o){if("regeneratorRuntime"===e.name)return o.get("regeneratorIdentifier");if(!n.isMemberExpression(r)&&t(a["default"].builtins,e.name)&&!s.getBindingIdentifier(e.name)){var u=a["default"].builtins[e.name];return o.addImport(i+"/core-js/"+u,e.name,"absoluteDefault")}},CallExpression:function(e,t,r,a){if(!e.arguments.length){var s=e.callee;if(n.isMemberExpression(s)&&s.computed&&this.get("callee.property").matchesPattern("Symbol.iterator"))return n.callExpression(a.addImport(i+"/core-js/get-iterator","getIterator","absoluteDefault"),[s.object])}},BinaryExpression:function(e,t,r,a){return"in"===e.operator&&this.get("left").matchesPattern("Symbol.iterator")?n.callExpression(a.addImport(i+"/core-js/is-iterable","isIterable","absoluteDefault"),[e.right]):void 0},MemberExpression:{enter:function(e,r,s,o){if(this.isReferenced()){var u=e.object,p=e.property;if(n.isReferenced(u,e)&&!e.computed&&t(a["default"].methods,u.name)){var l=a["default"].methods[u.name];if(t(l,p.name)&&!s.getBindingIdentifier(u.name)){if("Object"===u.name&&"defineProperty"===p.name&&this.parentPath.isCallExpression()){var c=this.parentPath.node;if(3===c.arguments.length&&n.isLiteral(c.arguments[1]))return}var f=l[p.name];return o.addImport(i+"/core-js/"+f,u.name+"$"+p.name,"absoluteDefault")}}}},exit:function(e,r,s,o){if(this.isReferenced()){var u=e.property,p=e.object;if(t(a["default"].builtins,p.name)&&!s.getBindingIdentifier(p.name)){var l=a["default"].builtins[p.name];return n.memberExpression(o.addImport(i+"/core-js/"+l,""+p.name,"absoluteDefault"),u,e.computed)}}}}}})},t.exports=r["default"]},{195:195}],197:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(198),a=n(i);r["default"]=function(e){var t=e.Plugin,r=(e.types,e.messages);return new t("undeclared-variables-check",{metadata:{group:"builtin-pre"},visitor:{ReferencedIdentifier:function(e,t,n){var i=n.getBinding(e.name);if(i&&"type"===i.kind&&!this.parentPath.isFlow())throw this.errorWithNode(r.get("undeclaredVariableType",e.name),ReferenceError);if(!n.hasBinding(e.name)){var s,o=n.getAllBindings(),u=-1;for(var p in o){var l=a["default"](e.name,p);0>=l||l>3||u>=l||(s=p,u=l)}var c;throw c=s?r.get("undeclaredVariableSuggestion",e.name,s):r.get("undeclaredVariable",e.name),this.errorWithNode(c,ReferenceError)}}}})},t.exports=r["default"]},{198:198}],198:[function(e,t,r){"use strict";var n=[],i=[];t.exports=function(e,t){if(e===t)return 0;var r=e.length,a=t.length;if(0===r)return a;if(0===a)return r;for(var s,o,u,p,l=0,c=0;r>l;)i[l]=e.charCodeAt(l),n[l]=++l;for(;a>c;)for(s=t.charCodeAt(c),u=c++,o=c,l=0;r>l;l++)p=s===i[l]?u:u+1,u=n[l],o=n[l]=u>o?p>o?o+1:p:p>u?u+1:p;return o}},{}],199:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("undefined-to-void",{metadata:{group:"builtin-basic"},visitor:{ReferencedIdentifier:function(e,t){return"undefined"===e.name?r.unaryExpression("void",r.literal(0),!0):void 0}}})},t.exports=r["default"]},{}],200:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:c}function i(e){var t=function(){return a.apply(t,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=m,t}function a(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;t>n;n++)r+=" "+e[n];if(!this.enabled||!r)return r;var i=this._styles,a=i.length,s=u.dim.open;for(!d||-1===i.indexOf("gray")&&-1===i.indexOf("grey")||(u.dim.open="");a--;){var o=u[i[a]];r=o.open+r.replace(o.closeRe,o.open)+o.close}return u.dim.open=s,r}function s(){var e={};return Object.keys(h).forEach(function(t){e[t]={get:function(){return i.call(this,[t])}}}),e}var o=e(202),u=e(201),p=e(205),l=e(203),c=e(207),f=Object.defineProperties,d="win32"===r.platform&&!/^xterm/i.test(r.env.TERM);d&&(u.blue.open="");var h=function(){var e={};return Object.keys(u).forEach(function(t){u[t].closeRe=new RegExp(o(u[t].close),"g"),e[t]={get:function(){return i.call(this,this._styles.concat(t))}}}),e}(),m=f(function(){},h);f(n.prototype,s()),t.exports=new n,t.exports.styles=u,t.exports.hasColor=l,t.exports.stripColor=p,t.exports.supportsColor=c}).call(this,e(10))},{10:10,201:201,202:202,203:203,205:205,207:207}],201:[function(e,t,r){"use strict";function n(){var e={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]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}Object.defineProperty(t,"exports",{enumerable:!0,get:n})},{}],202:[function(e,t,r){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],203:[function(e,t,r){"use strict";var n=e(204),i=new RegExp(n().source);t.exports=i.test.bind(i)},{204:204}],204:[function(e,t,r){"use strict";t.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g}},{}],205:[function(e,t,r){"use strict";var n=e(206)();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{206:206}],206:[function(e,t,r){arguments[4][204][0].apply(r,arguments)},{204:204}],207:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1!==n?n>t:!0)};t.exports=function(){return"FORCE_COLOR"in e.env?!0:i("no-color")||i("no-colors")||i("color=false")?!1:i("color")||i("colors")||i("color=true")||i("color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e(10))},{10:10}],208:[function(e,t,r){(function(t){"use strict";function n(e){return new t(e,"base64").toString()}function i(e){return e.split(",").pop()}function a(e,t){var r=c.exec(e);c.lastIndex=0;var n=r[1]||r[2],i=p.join(t,n);try{return u.readFileSync(i,"utf8")}catch(a){throw new Error("An error occurred while trying to read the map file at "+i+"\n"+a)}}function s(e,t){t=t||{},t.isFileComment&&(e=a(e,t.commentFileDir)),t.hasComment&&(e=i(e)),t.isEncoded&&(e=n(e)),(t.isJSON||t.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}function o(e){for(var t,n=e.split("\n"),i=n.length-1;i>0;i--)if(t=n[i],~t.indexOf("sourceMappingURL=data:"))return r.fromComment(t)}var u=e(1),p=e(9),l=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/gm,c=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;s.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},s.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},s.prototype.toComment=function(e){var t=this.toBase64(),r="sourceMappingURL=data:application/json;base64,"+t;return e&&e.multiline?"/*# "+r+" */":"//# "+r},s.prototype.toObject=function(){return JSON.parse(this.toJSON())},s.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},s.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},s.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new s(e)},r.fromJSON=function(e){return new s(e,{isJSON:!0})},r.fromBase64=function(e){return new s(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new s(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new s(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e,t){if(t)return o(e);var n=e.match(l);return l.lastIndex=0,n?r.fromComment(n.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(c);return c.lastIndex=0,n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return l.lastIndex=0,e.replace(l,"")},r.removeMapFileComments=function(e){return c.lastIndex=0,e.replace(c,"")},Object.defineProperty(r,"commentRegex",{get:function(){return l.lastIndex=0,l}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return c.lastIndex=0,c}})}).call(this,e(3).Buffer)},{1:1,3:3,9:9}],209:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],210:[function(e,t,r){var n=e(240);t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{240:240}],211:[function(e,t,r){var n=e(277),i=e(278),a=e(275);t.exports=function(e){return function(t,r,s){var o,u=n(t),p=i(u.length),l=a(s,p);if(e&&r!=r){for(;p>l;)if(o=u[l++],o!=o)return!0}else for(;p>l;l++)if((e||l in u)&&u[l]===r)return e||l;return!e&&-1}}},{275:275,277:277,278:278}],212:[function(e,t,r){var n=e(221),i=e(237),a=e(279),s=e(278);t.exports=function(e){var t=1==e,r=2==e,o=3==e,u=4==e,p=6==e,l=5==e||p;return function(c,f,d){for(var h,m,y=a(c),g=i(y),v=n(f,d,3),b=s(g.length),E=0,x=t?Array(b):r?[]:void 0;b>E;E++)if((l||E in g)&&(h=g[E],m=v(h,E,y),e))if(t)x[E]=m;else if(m)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:x.push(h)}else if(u)return!1;return p?-1:o||u?u:x}}},{221:221,237:237,278:278,279:279}],213:[function(e,t,r){var n=e(279),i=e(237),a=e(225);t.exports=e(227)(function(){return Symbol()in Object.assign({})})?function(e,t){for(var r=n(e),s=arguments.length,o=1;s>o;)for(var u,p=i(arguments[o++]),l=a(p),c=l.length,f=0;c>f;)r[u=l[f++]]=p[u];return r}:Object.assign},{225:225,227:227,237:237,279:279}],214:[function(e,t,r){var n=e(215),i=e(282)("toStringTag"),a="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,r,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=(t=Object(e))[i])?r:a?n(t):"Object"==(s=n(t))&&"function"==typeof t.callee?"Arguments":s}},{215:215,282:282}],215:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],216:[function(e,t,r){"use strict";var n=e(247),i=e(234),a=e(221),s=e(265),o=e(266),u=e(223),p=e(230),l=e(245),c=e(280)("id"),f=e(233),d=e(240),h=Object.isExtensible||d,m=e(272),y=m?"_s":"size",g=0,v=function(e,t){if(!d(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!f(e,c)){if(!h(e))return"F";if(!t)return"E";i(e,c,++g)}return"O"+e[c]},b=function(e,t){var r,n=v(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(t,r,i,s){var l=t(function(e,t){o(e,l,r),e._i=n.create(null),e._f=void 0,e._l=void 0,e[y]=0,void 0!=t&&p(t,i,e[s],e)});return e(252)(l.prototype,{clear:function(){for(var e=this,t=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e._f=e._l=void 0,e[y]=0},"delete":function(e){var t=this,r=b(t,e);if(r){var n=r.n,i=r.p;delete t._i[r.i],r.r=!0,i&&(i.n=n),n&&(n.p=i),t._f==r&&(t._f=n),t._l==r&&(t._l=i),t[y]--}return!!r},forEach:function(e){for(var t,r=a(e,arguments[1],3);t=t?t.n:this._f;)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!b(this,e)}}),m&&n.setDesc(l.prototype,"size",{get:function(){return u(this[y])}}),l},def:function(e,t,r){var n,i,a=b(e,t);return a?a.v=r:(e._l=a={i:i=v(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=a),n&&(n.n=a),e[y]++,"F"!==i&&(e._i[i]=a)),e},getEntry:b,setStrong:function(t,r,n){e(243)(t,r,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?l(0,r.k):"values"==t?l(0,r.v):l(0,[r.k,r.v]):(e._t=void 0,l(1))},n?"entries":"values",!n,!0),s(t),s(e(220)[r])}}},{220:220,221:221,223:223,230:230,233:233,234:234,240:240,243:243,245:245,247:247,252:252,265:265,266:266,272:272,280:280}],217:[function(e,t,r){var n=e(230),i=e(214);t.exports=function(e){return function(){if(i(this)!=e)throw TypeError(e+"#toJSON isn't generic");var t=[];return n(this,!1,t.push,t),t}}},{214:214,230:230}],218:[function(e,t,r){"use strict";var n=e(234),i=e(210),a=e(266),s=e(230),o=e(212),u=e(280)("weak"),p=e(240),l=e(233),c=Object.isExtensible||p,f=o(5),d=o(6),h=0,m=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return f(e.a,function(e){return e[0]===t})};y.prototype={get:function(e){var t=g(this,e);return t?t[1]:void 0},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},"delete":function(e){var t=d(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(t,r,n,i){var o=t(function(e,t){a(e,o,r),e._i=h++,e._l=void 0,void 0!=t&&s(t,n,e[i],e)});return e(252)(o.prototype,{"delete":function(e){return p(e)?c(e)?l(e,u)&&l(e[u],this._i)&&delete e[u][this._i]:m(this)["delete"](e):!1},has:function(e){return p(e)?c(e)?l(e,u)&&l(e[u],this._i):m(this).has(e):!1}}),o},def:function(e,t,r){return c(i(t))?(l(t,u)||n(t,u,{}),t[u][e._i]=r):m(e).set(t,r),e},frozenStore:m,WEAK:u}},{210:210,212:212,230:230,233:233,234:234,240:240,252:252,266:266,280:280}],219:[function(e,t,r){"use strict";var n=e(232),i=e(222),a=e(230),s=e(266);t.exports=function(t,r,o,u,p,l){var c=n[t],f=c,d=p?"set":"add",h=f&&f.prototype,m={},y=function(t){var r=h[t];e(259)(h,t,"delete"==t?function(e){ return r.call(this,0===e?0:e)}:"has"==t?function(e){return r.call(this,0===e?0:e)}:"get"==t?function(e){return r.call(this,0===e?0:e)}:"add"==t?function(e){return r.call(this,0===e?0:e),this}:function(e,t){return r.call(this,0===e?0:e,t),this})};if("function"==typeof f&&(l||h.forEach&&!e(227)(function(){(new f).entries().next()}))){var g,v=new f,b=v[d](l?{}:-0,1);e(244)(function(e){new f(e)})||(f=r(function(e,r){s(e,f,t);var n=new c;return void 0!=r&&a(r,p,n[d],n),n}),f.prototype=h,h.constructor=f),l||v.forEach(function(e,t){g=1/t===-(1/0)}),g&&(y("delete"),y("has"),p&&y("get")),(g||b!==v)&&y(d),l&&h.clear&&delete h.clear}else f=u.getConstructor(r,t,p,d),e(252)(f.prototype,o);return e(273)(f,t),m[t]=f,i(i.G+i.W+i.F*(f!=c),m),l||u.setStrong(f,t,p),f}},{222:222,227:227,230:230,232:232,244:244,252:252,259:259,266:266,273:273}],220:[function(e,t,r){var n=t.exports={};"number"==typeof __e&&(__e=n)},{}],221:[function(e,t,r){var n=e(209);t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{209:209}],222:[function(e,t,r){var n=e(232),i=e(220),a=e(234),s=e(259),o="prototype",u=function(e,t){return function(){return e.apply(t,arguments)}},p=function(e,t,r){var l,c,f,d,h=e&p.G,m=e&p.P,y=h?n:e&p.S?n[t]||(n[t]={}):(n[t]||{})[o],g=h?i:i[t]||(i[t]={});h&&(r=t);for(l in r)c=!(e&p.F)&&y&&l in y,f=(c?y:r)[l],d=e&p.B&&c?u(f,n):m&&"function"==typeof f?u(Function.call,f):f,y&&!c&&s(y,l,f),g[l]!=f&&a(g,l,d),m&&((g[o]||(g[o]={}))[l]=f)};n.core=i,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,t.exports=p},{220:220,232:232,234:234,259:259}],223:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],224:[function(e,t,r){var n=e(240),i=e(232).document,a=n(i)&&n(i.createElement);t.exports=function(e){return a?i.createElement(e):{}}},{232:232,240:240}],225:[function(e,t,r){var n=e(247);t.exports=function(e){var t=n.getKeys(e),r=n.getSymbols;if(r)for(var i,a=r(e),s=n.isEnum,o=0;a.length>o;)s.call(e,i=a[o++])&&t.push(i);return t}},{247:247}],226:[function(e,t,r){t.exports=Math.expm1||function(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:Math.exp(e)-1}},{}],227:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],228:[function(e,t,r){"use strict";t.exports=function(t,r,n){var i=e(223),a=e(282)(t),s=""[t];e(227)(function(){var e={};return e[a]=function(){return 7},7!=""[t](e)})&&(e(259)(String.prototype,t,n(i,a,s)),e(234)(RegExp.prototype,a,2==r?function(e,t){return s.call(e,this,t)}:function(e){return s.call(e,this)}))}},{223:223,227:227,234:234,259:259,282:282}],229:[function(e,t,r){"use strict";var n=e(210);t.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},{210:210}],230:[function(e,t,r){var n=e(221),i=e(241),a=e(238),s=e(210),o=e(278),u=e(283);t.exports=function(e,t,r,p){var l,c,f,d=u(e),h=n(r,p,t?2:1),m=0;if("function"!=typeof d)throw TypeError(e+" is not iterable!");if(a(d))for(l=o(e.length);l>m;m++)t?h(s(c=e[m])[0],c[1]):h(e[m]);else for(f=d.call(e);!(c=f.next()).done;)i(f,h,c.value,t)}},{210:210,221:221,238:238,241:241,278:278,283:283}],231:[function(e,t,r){var n={}.toString,i=e(277),a=e(247).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(e){try{return a(e)}catch(t){return s.slice()}};t.exports.get=function(e){return s&&"[object Window]"==n.call(e)?o(e):a(i(e))}},{247:247,277:277}],232:[function(e,t,r){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},{}],233:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],234:[function(e,t,r){var n=e(247),i=e(258);t.exports=e(272)?function(e,t,r){return n.setDesc(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{247:247,258:258,272:272}],235:[function(e,t,r){t.exports=e(232).document&&document.documentElement},{232:232}],236:[function(e,t,r){t.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},{}],237:[function(e,t,r){var n=e(215);t.exports=0 in Object("z")?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{215:215}],238:[function(e,t,r){var n=e(246),i=e(282)("iterator");t.exports=function(e){return(n.Array||Array.prototype[i])===e}},{246:246,282:282}],239:[function(e,t,r){var n=e(240),i=Math.floor;t.exports=function(e){return!n(e)&&isFinite(e)&&i(e)===e}},{240:240}],240:[function(e,t,r){t.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},{}],241:[function(e,t,r){var n=e(210);t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(a){var s=e["return"];throw void 0!==s&&n(s.call(e)),a}}},{210:210}],242:[function(e,t,r){"use strict";var n=e(247),i={};e(234)(i,e(282)("iterator"),function(){return this}),t.exports=function(t,r,a){t.prototype=n.create(i,{next:e(258)(1,a)}),e(273)(t,r+" Iterator")}},{234:234,247:247,258:258,273:273,282:282}],243:[function(e,t,r){"use strict";var n=e(249),i=e(222),a=e(259),s=e(234),o=e(233),u=e(282)("iterator"),p=e(246),l=!([].keys&&"next"in[].keys()),c="@@iterator",f="keys",d="values",h=function(){return this};t.exports=function(t,r,m,y,g,v,b){e(242)(m,r,y);var E,x,S=function(e){switch(e){case f:return function(){return new m(this,e)};case d:return function(){return new m(this,e)}}return function(){return new m(this,e)}},A=r+" Iterator",D=t.prototype,C=D[u]||D[c]||g&&D[g],w=C||S(g);if(C){var I=e(247).getProto(w.call(new t));e(273)(I,A,!0),!n&&o(D,c)&&s(I,u,h)}if((!n||b)&&s(D,u,w),p[r]=w,p[A]=h,g)if(E={keys:v?w:S(f),values:g==d?w:S(d),entries:g!=d?w:S("entries")},b)for(x in E)x in D||a(D,x,E[x]);else i(i.P+i.F*l,r,E)}},{222:222,233:233,234:234,242:242,246:246,247:247,249:249,259:259,273:273,282:282}],244:[function(e,t,r){var n=e(282)("iterator"),i=!1;try{var a=[7][n]();a["return"]=function(){i=!0},Array.from(a,function(){throw 2})}catch(s){}t.exports=function(e){if(!i)return!1;var t=!1;try{var r=[7],a=r[n]();a.next=function(){t=!0},r[n]=function(){return a},e(r)}catch(s){}return t}},{282:282}],245:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],246:[function(e,t,r){t.exports={}},{}],247:[function(e,t,r){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},{}],248:[function(e,t,r){var n=e(247),i=e(277);t.exports=function(e,t){for(var r,a=i(e),s=n.getKeys(a),o=s.length,u=0;o>u;)if(a[r=s[u++]]===t)return r}},{247:247,277:277}],249:[function(e,t,r){t.exports=!1},{}],250:[function(e,t,r){t.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:Math.log(1+e)}},{}],251:[function(e,t,r){var n,i,a,s=e(232),o=e(274).set,u=s.MutationObserver||s.WebKitMutationObserver,p=s.process,l="process"==e(215)(p),c=function(){var e,t;for(l&&(e=p.domain)&&(p.domain=null,e.exit());n;)t=n.domain,t&&t.enter(),n.fn.call(),t&&t.exit(),n=n.next;i=void 0,e&&e.enter()};if(l)a=function(){p.nextTick(c)};else if(u){var f=1,d=document.createTextNode("");new u(c).observe(d,{characterData:!0}),a=function(){d.data=f=-f}}else a=function(){o.call(s,c)};t.exports=function(e){var t={fn:e,next:void 0,domain:l&&p.domain};i&&(i.next=t),n||(n=t,a()),i=t}},{215:215,232:232,274:274}],252:[function(e,t,r){var n=e(259);t.exports=function(e,t){for(var r in t)n(e,r,t[r]);return e}},{259:259}],253:[function(e,t,r){t.exports=function(t,r){var n=e(222),i=(e(220).Object||{})[t]||Object[t],a={};a[t]=r(i),n(n.S+n.F*e(227)(function(){i(1)}),"Object",a)}},{220:220,222:222,227:227}],254:[function(e,t,r){var n=e(247),i=e(277);t.exports=function(e){return function(t){var r,a=i(t),s=n.getKeys(a),o=s.length,u=0,p=Array(o);if(e)for(;o>u;)p[u]=[r=s[u++],a[r]];else for(;o>u;)p[u]=a[s[u++]];return p}}},{247:247,277:277}],255:[function(e,t,r){var n=e(247),i=e(210),a=e(232).Reflect;t.exports=a&&a.ownKeys||function(e){var t=n.getNames(i(e)),r=n.getSymbols;return r?t.concat(r(e)):t}},{210:210,232:232,247:247}],256:[function(e,t,r){"use strict";var n=e(257),i=e(236),a=e(209);t.exports=function(){for(var e=a(this),t=arguments.length,r=Array(t),s=0,o=n._,u=!1;t>s;)(r[s]=arguments[s++])===o&&(u=!0);return function(){var n,a=this,s=arguments.length,p=0,l=0;if(!u&&!s)return i(e,r,a);if(n=r.slice(),u)for(;t>p;p++)n[p]===o&&(n[p]=arguments[l++]);for(;s>l;)n.push(arguments[l++]);return i(e,n,a)}}},{209:209,236:236,257:257}],257:[function(e,t,r){t.exports=e(232)},{232:232}],258:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],259:[function(e,t,r){var n=e(232),i=e(234),a=e(280)("src"),s="toString",o=Function[s],u=(""+o).split(s);e(220).inspectSource=function(e){return o.call(e)},(t.exports=function(e,t,r,s){"function"==typeof r&&(i(r,a,e[t]?""+e[t]:u.join(String(t))),"name"in r||(r.name=t)),e===n?e[t]=r:(s||delete e[t],i(e,t,r))})(Function.prototype,s,function(){return"function"==typeof this&&this[a]||o.call(this)})},{220:220,232:232,234:234,280:280}],260:[function(e,t,r){t.exports=function(e,t){var r=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,r)}}},{}],261:[function(e,t,r){t.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},{}],262:[function(e,t,r){var n=e(247).getDesc,i=e(240),a=e(210),s=function(e,t){if(a(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r){try{r=e(221)(Function.call,n(Object.prototype,"__proto__").set,2),r({},[])}catch(i){t=!0}return function(e,n){return s(e,n),t?e.__proto__=n:r(e,n),e}}():void 0),check:s}},{210:210,221:221,240:240,247:247}],263:[function(e,t,r){var n=e(232),i="__core-js_shared__",a=n[i]||(n[i]={});t.exports=function(e){return a[e]||(a[e]={})}},{232:232}],264:[function(e,t,r){t.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1}},{}],265:[function(e,t,r){"use strict";var n=e(247),i=e(282)("species");t.exports=function(t){!e(272)||i in t||n.setDesc(t,i,{configurable:!0,get:function(){return this}})}},{247:247,272:272,282:282}],266:[function(e,t,r){t.exports=function(e,t,r){if(!(e instanceof t))throw TypeError(r+": use the 'new' operator!");return e}},{}],267:[function(e,t,r){var n=e(276),i=e(223);t.exports=function(e){return function(t,r){var a,s,o=String(i(t)),u=n(r),p=o.length;return 0>u||u>=p?e?"":void 0:(a=o.charCodeAt(u),55296>a||a>56319||u+1===p||(s=o.charCodeAt(u+1))<56320||s>57343?e?o.charAt(u):a:e?o.slice(u,u+2):(a-55296<<10)+(s-56320)+65536)}}},{223:223,276:276}],268:[function(e,t,r){var n=e(223),i=e(215);t.exports=function(e,t,r){if("RegExp"==i(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(n(e))}},{215:215,223:223}],269:[function(e,t,r){var n=e(278),i=e(270),a=e(223);t.exports=function(e,t,r,s){var o=String(a(e)),u=o.length,p=void 0===r?" ":String(r),l=n(t);if(u>=l)return o;""==p&&(p=" ");var c=l-u,f=i.call(p,Math.ceil(c/p.length));return f.length>c&&(f=s?f.slice(f.length-c):f.slice(0,c)),s?f+o:o+f}},{223:223,270:270,278:278}],270:[function(e,t,r){"use strict";var n=e(276),i=e(223);t.exports=function(e){var t=String(i(this)),r="",a=n(e);if(0>a||a==1/0)throw RangeError("Count can't be negative");for(;a>0;(a>>>=1)&&(t+=t))1&a&&(r+=t);return r}},{223:223,276:276}],271:[function(e,t,r){var n=function(e,t){return e=String(a(e)),1&t&&(e=e.replace(p,"")),2&t&&(e=e.replace(l,"")),e},i=e(222),a=e(223),s=" \n \f\r   ᠎              \u2028\u2029\ufeff",o="["+s+"]",u="​…",p=RegExp("^"+o+o+"*"),l=RegExp(o+o+"*$");t.exports=function(t,r){var a={};a[t]=r(n),i(i.P+i.F*e(227)(function(){return!!s[t]()||u[t]()!=u}),"String",a)}},{222:222,223:223,227:227}],272:[function(e,t,r){t.exports=!e(227)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{227:227}],273:[function(e,t,r){var n=e(233),i=e(234),a=e(282)("toStringTag");t.exports=function(e,t,r){e&&!n(e=r?e:e.prototype,a)&&i(e,a,t)}},{233:233,234:234,282:282}],274:[function(e,t,r){"use strict";var n,i,a,s=e(221),o=e(236),u=e(235),p=e(224),l=e(232),c=l.process,f=l.setImmediate,d=l.clearImmediate,h=l.MessageChannel,m=0,y={},g="onreadystatechange",v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},b=function(e){v.call(e.data)};f&&d||(f=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return y[++m]=function(){o("function"==typeof e?e:Function(e),t)},n(m),m},d=function(e){delete y[e]},"process"==e(215)(c)?n=function(e){c.nextTick(s(v,e,1))}:h?(i=new h,a=i.port2,i.port1.onmessage=b,n=s(a.postMessage,a,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScript?(n=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):n=g in p("script")?function(e){u.appendChild(p("script"))[g]=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(s(v,e,1),0)}),t.exports={set:f,clear:d}},{215:215,221:221,224:224,232:232,235:235,236:236}],275:[function(e,t,r){var n=e(276),i=Math.max,a=Math.min;t.exports=function(e,t){return e=n(e),0>e?i(e+t,0):a(e,t)}},{276:276}],276:[function(e,t,r){var n=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},{}],277:[function(e,t,r){var n=e(237),i=e(223);t.exports=function(e){return n(i(e))}},{223:223,237:237}],278:[function(e,t,r){var n=e(276),i=Math.min;t.exports=function(e){return e>0?i(n(e),9007199254740991):0}},{276:276}],279:[function(e,t,r){var n=e(223);t.exports=function(e){return Object(n(e))}},{223:223}],280:[function(e,t,r){var n=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},{}],281:[function(e,t,r){var n=e(282)("unscopables");n in[]||e(234)(Array.prototype,n,{}),t.exports=function(e){[][n][e]=!0}},{234:234,282:282}],282:[function(e,t,r){var n=e(263)("wks"),i=e(232).Symbol;t.exports=function(t){return n[t]||(n[t]=i&&i[t]||(i||e(280))("Symbol."+t))}},{232:232,263:263,280:280}],283:[function(e,t,r){var n=e(214),i=e(282)("iterator"),a=e(246);t.exports=e(220).getIteratorMethod=function(e){return void 0!=e?e[i]||e["@@iterator"]||a[n(e)]:void 0}},{214:214,220:220,246:246,282:282}],284:[function(e,t,r){"use strict";var n,i=e(247),a=e(272),s=e(258),o=e(235),u=e(224),p=e(233),l=e(215),c=e(222),f=e(236),d=e(212),h=e(280)("__proto__"),m=e(240),y=e(210),g=e(209),v=e(279),b=e(277),E=e(276),x=e(275),S=e(278),A=e(237),D=e(227),C=Object.prototype,w=[],I=w.slice,_=w.join,F=i.setDesc,k=i.getDesc,P=i.setDescs,B=e(211)(!1),T={};a||(n=!D(function(){return 7!=F(u("div"),"a",{get:function(){return 7}}).a}),i.setDesc=function(e,t,r){if(n)try{return F(e,t,r)}catch(i){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(y(e)[t]=r.value),e},i.getDesc=function(e,t){if(n)try{return k(e,t)}catch(r){}return p(e,t)?s(!C.propertyIsEnumerable.call(e,t),e[t]):void 0},i.setDescs=P=function(e,t){y(e);for(var r,n=i.getKeys(t),a=n.length,s=0;a>s;)i.setDesc(e,r=n[s++],t[r]);return e}),c(c.S+c.F*!a,"Object",{getOwnPropertyDescriptor:i.getDesc,defineProperty:i.setDesc,defineProperties:P});var M="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),O=M.concat("length","prototype"),j=M.length,L=function(){var e,t=u("iframe"),r=j,n=">";for(t.style.display="none",o.appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script"+n),e.close(),L=e.F;r--;)delete L.prototype[M[r]];return L()},N=function(e,t){return function(r){var n,i=b(r),a=0,s=[];for(n in i)n!=h&&p(i,n)&&s.push(n);for(;t>a;)p(i,n=e[a++])&&(~B(s,n)||s.push(n));return s}},R=function(){};c(c.S,"Object",{getPrototypeOf:i.getProto=i.getProto||function(e){return e=v(e),p(e,h)?e[h]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?C:null},getOwnPropertyNames:i.getNames=i.getNames||N(O,O.length,!0),create:i.create=i.create||function(e,t){var r;return null!==e?(R.prototype=y(e),r=new R,R.prototype=null,r[h]=e):r=L(),void 0===t?r:P(r,t)},keys:i.getKeys=i.getKeys||N(M,j,!1)});var V=function(e,t,r){if(!(t in T)){for(var n=[],i=0;t>i;i++)n[i]="a["+i+"]";T[t]=Function("F,a","return new F("+n.join(",")+")")}return T[t](e,r)};c(c.P,"Function",{bind:function(e){var t=g(this),r=I.call(arguments,1),n=function(){var i=r.concat(I.call(arguments));return this instanceof n?V(t,i.length,i):f(t,i,e)};return m(t.prototype)&&(n.prototype=t.prototype),n}});var U=D(function(){o&&I.call(o)});c(c.P+c.F*U,"Array",{slice:function(e,t){var r=S(this.length),n=l(this);if(t=void 0===t?r:t,"Array"==n)return I.call(this,e,t);for(var i=x(e,r),a=x(t,r),s=S(a-i),o=Array(s),u=0;s>u;u++)o[u]="String"==n?this.charAt(i+u):this[i+u];return o}}),c(c.P+c.F*(A!=Object),"Array",{join:function(){return _.apply(A(this),arguments)}}),c(c.S,"Array",{isArray:function(e){return"Array"==l(e)}});var q=function(e){return function(t,r){g(t);var n=A(this),i=S(n.length),a=e?i-1:0,s=e?-1:1;if(arguments.length<2)for(;;){if(a in n){r=n[a],a+=s;break}if(a+=s,e?0>a:a>=i)throw TypeError("Reduce of empty array with no initial value")}for(;e?a>=0:i>a;a+=s)a in n&&(r=t(r,n[a],a,this));return r}},G=function(e){return function(t){return e(this,t,arguments[1])}};c(c.P,"Array",{forEach:i.each=i.each||G(d(0)),map:G(d(1)),filter:G(d(2)),some:G(d(3)),every:G(d(4)),reduce:q(!1),reduceRight:q(!0),indexOf:G(B),lastIndexOf:function(e,t){var r=b(this),n=S(r.length),i=n-1;for(arguments.length>1&&(i=Math.min(i,E(t))),0>i&&(i=S(n+i));i>=0;i--)if(i in r&&r[i]===e)return i;return-1}}),c(c.S,"Date",{now:function(){return+new Date}});var H=function(e){return e>9?e:"0"+e},W=new Date(-5e13-1),X=!(W.toISOString&&"0385-07-25T07:06:39.999Z"==W.toISOString()&&D(function(){new Date(NaN).toISOString()}));c(c.P+c.F*X,"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),r=e.getUTCMilliseconds(),n=0>t?"-":t>9999?"+":"";return n+("00000"+Math.abs(t)).slice(n?-6:-4)+"-"+H(e.getUTCMonth()+1)+"-"+H(e.getUTCDate())+"T"+H(e.getUTCHours())+":"+H(e.getUTCMinutes())+":"+H(e.getUTCSeconds())+"."+(r>99?r:"0"+H(r))+"Z"}})},{209:209,210:210,211:211,212:212,215:215,222:222,224:224,227:227,233:233,235:235,236:236,237:237,240:240,247:247,258:258,272:272,275:275,276:276,277:277,278:278,279:279,280:280}],285:[function(e,t,r){"use strict";var n=e(222),i=e(279),a=e(275),s=e(278);n(n.P,"Array",{copyWithin:function(e,t){var r=i(this),n=s(r.length),o=a(e,n),u=a(t,n),p=arguments[2],l=void 0===p?n:a(p,n),c=Math.min(l-u,n-o),f=1;for(o>u&&u+c>o&&(f=-1,u=u+c-1,o=o+c-1);c-->0;)u in r?r[o]=r[u]:delete r[o],o+=f,u+=f;return r}}),e(281)("copyWithin")},{222:222,275:275,278:278,279:279,281:281}],286:[function(e,t,r){"use strict";var n=e(222),i=e(279),a=e(275),s=e(278);n(n.P,"Array",{fill:function(e){for(var t=i(this,!0),r=s(t.length),n=a(arguments[1],r),o=arguments[2],u=void 0===o?r:a(o,r);u>n;)t[n++]=e;return t}}),e(281)("fill")},{222:222,275:275,278:278,279:279,281:281}],287:[function(e,t,r){"use strict";var n="findIndex",i=e(222),a=!0,s=e(212)(6);n in[]&&Array(1)[n](function(){a=!1}),i(i.P+i.F*a,"Array",{findIndex:function(e){return s(this,e,arguments[1])}}),e(281)(n)},{212:212,222:222,281:281}],288:[function(e,t,r){"use strict";var n="find",i=e(222),a=!0,s=e(212)(5);n in[]&&Array(1)[n](function(){a=!1}),i(i.P+i.F*a,"Array",{find:function(e){return s(this,e,arguments[1])}}),e(281)(n)},{212:212,222:222,281:281}],289:[function(e,t,r){"use strict";var n=e(221),i=e(222),a=e(279),s=e(241),o=e(238),u=e(278),p=e(283);i(i.S+i.F*!e(244)(function(e){Array.from(e)}),"Array",{from:function(e){var t,r,i,l,c=a(e),f="function"==typeof this?this:Array,d=arguments[1],h=void 0!==d,m=0,y=p(c);if(h&&(d=n(d,arguments[2],2)),void 0==y||f==Array&&o(y))for(r=new f(t=u(c.length));t>m;m++)r[m]=h?d(c[m],m):c[m];else for(l=y.call(c),r=new f;!(i=l.next()).done;m++)r[m]=h?s(l,d,[i.value,m],!0):i.value;return r.length=m,r}})},{221:221,222:222,238:238,241:241,244:244,278:278,279:279,283:283}],290:[function(e,t,r){"use strict";var n=e(281),i=e(245),a=e(246),s=e(277);e(243)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,r):"values"==t?i(0,e[r]):i(0,[r,e[r]])},"values"),a.Arguments=a.Array,n("keys"),n("values"),n("entries")},{243:243,245:245,246:246,277:277,281:281}],291:[function(e,t,r){"use strict";var n=e(222);n(n.S+n.F*e(227)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,r=new("function"==typeof this?this:Array)(t);t>e;)r[e]=arguments[e++];return r.length=t,r}})},{222:222,227:227}],292:[function(e,t,r){e(265)(Array)},{265:265}],293:[function(e,t,r){"use strict";var n=e(247),i=e(240),a=e(282)("hasInstance"),s=Function.prototype;a in s||n.setDesc(s,a,{value:function(e){if("function"!=typeof this||!i(e))return!1;if(!i(this.prototype))return e instanceof this;for(;e=n.getProto(e);)if(this.prototype===e)return!0;return!1}})},{240:240,247:247,282:282}],294:[function(e,t,r){var n=e(247).setDesc,i=e(258),a=e(233),s=Function.prototype,o=/^\s*function ([^ (]*)/,u="name";u in s||e(272)&&n(s,u,{configurable:!0,get:function(){var e=(""+this).match(o),t=e?e[1]:"";return a(this,u)||n(this,u,i(5,t)),t}})},{233:233,247:247,258:258,272:272}],295:[function(e,t,r){"use strict";var n=e(216);e(219)("Map",function(e){return function(){return e(this,arguments[0])}},{get:function(e){var t=n.getEntry(this,e);return t&&t.v},set:function(e,t){return n.def(this,0===e?0:e,t)}},n,!0)},{216:216,219:219}],296:[function(e,t,r){var n=e(222),i=e(250),a=Math.sqrt,s=Math.acosh;n(n.S+n.F*!(s&&710==Math.floor(s(Number.MAX_VALUE))),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:i(e-1+a(e-1)*a(e+1))}})},{222:222,250:250}],297:[function(e,t,r){function n(e){return isFinite(e=+e)&&0!=e?0>e?-n(-e):Math.log(e+Math.sqrt(e*e+1)):e}var i=e(222);i(i.S,"Math",{asinh:n})},{222:222}],298:[function(e,t,r){var n=e(222);n(n.S,"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},{222:222}],299:[function(e,t,r){var n=e(222),i=e(264);n(n.S,"Math",{cbrt:function(e){return i(e=+e)*Math.pow(Math.abs(e),1/3)}})},{222:222,264:264}],300:[function(e,t,r){var n=e(222);n(n.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},{222:222}],301:[function(e,t,r){var n=e(222),i=Math.exp;n(n.S,"Math",{cosh:function(e){return(i(e=+e)+i(-e))/2}})},{222:222}],302:[function(e,t,r){var n=e(222);n(n.S,"Math",{expm1:e(226)})},{222:222,226:226}],303:[function(e,t,r){var n=e(222),i=e(264),a=Math.pow,s=a(2,-52),o=a(2,-23),u=a(2,127)*(2-o),p=a(2,-126),l=function(e){return e+1/s-1/s};n(n.S,"Math",{fround:function(e){var t,r,n=Math.abs(e),a=i(e);return p>n?a*l(n/p/o)*p*o:(t=(1+o/s)*n,r=t-(t-n),r>u||r!=r?a*(1/0):a*r)}})},{222:222,264:264}],304:[function(e,t,r){var n=e(222),i=Math.abs;n(n.S,"Math",{hypot:function(e,t){for(var r,n,a=0,s=0,o=arguments.length,u=0;o>s;)r=i(arguments[s++]),r>u?(n=u/r,a=a*n*n+1,u=r):r>0?(n=r/u,a+=n*n):a+=r;return u===1/0?1/0:u*Math.sqrt(a)}})},{222:222}],305:[function(e,t,r){var n=e(222);n(n.S+n.F*e(227)(function(){return-5!=Math.imul(4294967295,5)}),"Math",{imul:function(e,t){var r=65535,n=+e,i=+t,a=r&n,s=r&i;return 0|a*s+((r&n>>>16)*s+a*(r&i>>>16)<<16>>>0)}})},{222:222,227:227}],306:[function(e,t,r){var n=e(222);n(n.S,"Math",{log10:function(e){return Math.log(e)/Math.LN10}})},{222:222}],307:[function(e,t,r){var n=e(222);n(n.S,"Math",{log1p:e(250)})},{222:222,250:250}],308:[function(e,t,r){var n=e(222);n(n.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},{222:222}],309:[function(e,t,r){var n=e(222);n(n.S,"Math",{sign:e(264)})},{222:222,264:264}],310:[function(e,t,r){var n=e(222),i=e(226),a=Math.exp;n(n.S,"Math",{sinh:function(e){return Math.abs(e=+e)<1?(i(e)-i(-e))/2:(a(e-1)-a(-e-1))*(Math.E/2)}})},{222:222,226:226}],311:[function(e,t,r){var n=e(222),i=e(226),a=Math.exp;n(n.S,"Math",{tanh:function(e){var t=i(e=+e),r=i(-e);return t==1/0?1:r==1/0?-1:(t-r)/(a(e)+a(-e))}})},{222:222,226:226}],312:[function(e,t,r){var n=e(222);n(n.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},{222:222}],313:[function(e,t,r){"use strict";var n=e(247),i=e(232),a=e(233),s=e(215),o=e(240),u=e(227),p="Number",l=i[p],c=l,f=l.prototype,d=s(n.create(f))==p,h=function(e){var t,r;if("function"==typeof(t=e.valueOf)&&!o(r=t.call(e)))return r;if("function"==typeof(t=e.toString)&&!o(r=t.call(e)))return r;throw TypeError("Can't convert object to number")},m=function(e){if(o(e)&&(e=h(e)),"string"==typeof e&&e.length>2&&48==e.charCodeAt(0)){var t=!1;switch(e.charCodeAt(1)){case 66:case 98:t=!0;case 79:case 111:return parseInt(e.slice(2),t?2:8)}}return+e};l("0o1")&&l("0b1")||(l=function(e){var t=this;return t instanceof l&&(d?u(function(){f.valueOf.call(t)}):s(t)!=p)?new c(m(e)):m(e)},n.each.call(e(272)?n.getNames(c):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),function(e){a(c,e)&&!a(l,e)&&n.setDesc(l,e,n.getDesc(c,e))}),l.prototype=f,f.constructor=l,e(259)(i,p,l))},{215:215,227:227,232:232,233:233,240:240,247:247,259:259,272:272}],314:[function(e,t,r){var n=e(222);n(n.S,"Number",{EPSILON:Math.pow(2,-52)})},{222:222}],315:[function(e,t,r){var n=e(222),i=e(232).isFinite;n(n.S,"Number",{isFinite:function(e){return"number"==typeof e&&i(e)}})},{222:222,232:232}],316:[function(e,t,r){var n=e(222);n(n.S,"Number",{isInteger:e(239)})},{222:222,239:239}],317:[function(e,t,r){var n=e(222);n(n.S,"Number",{isNaN:function(e){return e!=e}})},{222:222}],318:[function(e,t,r){var n=e(222),i=e(239),a=Math.abs;n(n.S,"Number",{isSafeInteger:function(e){return i(e)&&a(e)<=9007199254740991}})},{222:222,239:239}],319:[function(e,t,r){var n=e(222);n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{222:222}],320:[function(e,t,r){var n=e(222);n(n.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{222:222}],321:[function(e,t,r){var n=e(222);n(n.S,"Number",{parseFloat:parseFloat})},{222:222}],322:[function(e,t,r){var n=e(222);n(n.S,"Number",{parseInt:parseInt})},{222:222}],323:[function(e,t,r){var n=e(222);n(n.S+n.F,"Object",{assign:e(213)})},{213:213,222:222}],324:[function(e,t,r){var n=e(240);e(253)("freeze",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],325:[function(e,t,r){var n=e(277);e(253)("getOwnPropertyDescriptor",function(e){return function(t,r){return e(n(t),r)}})},{253:253,277:277}],326:[function(e,t,r){e(253)("getOwnPropertyNames",function(){return e(231).get})},{231:231,253:253}],327:[function(e,t,r){var n=e(279);e(253)("getPrototypeOf",function(e){return function(t){return e(n(t))}})},{253:253,279:279}],328:[function(e,t,r){var n=e(240);e(253)("isExtensible",function(e){return function(t){return n(t)?e?e(t):!0:!1}})},{240:240,253:253}],329:[function(e,t,r){var n=e(240);e(253)("isFrozen",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{240:240,253:253}],330:[function(e,t,r){var n=e(240);e(253)("isSealed",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{240:240,253:253}],331:[function(e,t,r){var n=e(222);n(n.S,"Object",{is:e(261)})},{222:222,261:261}],332:[function(e,t,r){var n=e(279);e(253)("keys",function(e){return function(t){return e(n(t))}})},{253:253,279:279}],333:[function(e,t,r){var n=e(240);e(253)("preventExtensions",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],334:[function(e,t,r){var n=e(240);e(253)("seal",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],335:[function(e,t,r){var n=e(222);n(n.S,"Object",{setPrototypeOf:e(262).set})},{222:222,262:262}],336:[function(e,t,r){"use strict";var n=e(214),i={};i[e(282)("toStringTag")]="z",i+""!="[object z]"&&e(259)(Object.prototype,"toString",function(){return"[object "+n(this)+"]"},!0)},{214:214,259:259,282:282}],337:[function(e,t,r){"use strict";var n,i=e(247),a=e(249),s=e(232),o=e(221),u=e(214),p=e(222),l=e(240),c=e(210),f=e(209),d=e(266),h=e(230),m=e(262).set,y=e(261),g=e(265),v=e(282)("species"),b=e(280)("record"),E=e(251),x="Promise",S=s.process,A="process"==u(S),D=s[x],C=function(e){var t=new D(function(){});return e&&(t.constructor=Object),D.resolve(t)===t},w=function(){function t(e){var r=new D(e);return m(r,t.prototype),r}var r=!1;try{if(r=D&&D.resolve&&C(),m(t,D),t.prototype=i.create(D.prototype,{constructor:{value:t}}),t.resolve(5).then(function(){})instanceof t||(r=!1),r&&e(272)){var n=!1;D.resolve(i.setDesc({},"then",{get:function(){n=!0}})),r=n}}catch(a){r=!1}return r}(),I=function(e){return l(e)&&(w?"Promise"==u(e):b in e)},_=function(e,t){return a&&e===D&&t===n?!0:y(e,t)},F=function(e){var t=c(e)[v];return void 0!=t?t:e},k=function(e){var t;return l(e)&&"function"==typeof(t=e.then)?t:!1},P=function(e,t){if(!e.n){e.n=!0;var r=e.c;E(function(){for(var n=e.v,i=1==e.s,a=0,o=function(t){var r,a,s=i?t.ok:t.fail;try{s?(i||(e.h=!0),r=s===!0?n:s(n),r===t.P?t.rej(TypeError("Promise-chain cycle")):(a=k(r))?a.call(r,t.res,t.rej):t.res(r)):t.rej(n)}catch(o){t.rej(o)}};r.length>a;)o(r[a++]);r.length=0,e.n=!1,t&&setTimeout(function(){B(e.p)&&(A?S.emit("unhandledRejection",n,e.p):s.console&&console.error&&console.error("Unhandled promise rejection",n)),e.a=void 0},1)})}},B=function(e){var t,r=e[b],n=r.a||r.c,i=0;if(r.h)return!1;for(;n.length>i;)if(t=n[i++],t.fail||!B(t.P))return!1;return!0},T=function(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,t.a=t.c.slice(),P(t,!0))},M=function(e){var t,r=this;if(!r.d){r.d=!0,r=r.r||r;try{(t=k(e))?E(function(){var n={r:r,d:!1};try{t.call(e,o(M,n,1),o(T,n,1))}catch(i){T.call(n,i)}}):(r.v=e,r.s=1,P(r,!1))}catch(n){T.call({r:r,d:!1},n)}}};w||(D=function(e){f(e);var t={p:d(this,D,x),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[b]=t;try{e(o(M,t,1),o(T,t,1))}catch(r){T.call(t,r)}},e(252)(D.prototype,{then:function(e,t){var r=c(c(this).constructor)[v],n={ok:"function"==typeof e?e:!0,fail:"function"==typeof t?t:!1},i=n.P=new(void 0!=r?r:D)(function(e,t){n.res=f(e),n.rej=f(t)}),a=this[b];return a.c.push(n),a.a&&a.a.push(n),a.s&&P(a,!1),i},"catch":function(e){return this.then(void 0,e)}})),p(p.G+p.W+p.F*!w,{Promise:D}),e(273)(D,x),g(D),g(n=e(220)[x]),p(p.S+p.F*!w,x,{reject:function(e){return new this(function(t,r){r(e)})}}),p(p.S+p.F*(!w||C(!0)),x,{resolve:function(e){return I(e)&&_(e.constructor,this)?e:new this(function(t){t(e)})}}),p(p.S+p.F*!(w&&e(244)(function(e){D.all(e)["catch"](function(){})})),x,{all:function(e){var t=F(this),r=[];return new t(function(n,a){h(e,!1,r.push,r);var s=r.length,o=Array(s);s?i.each.call(r,function(e,r){t.resolve(e).then(function(e){o[r]=e,--s||n(o)},a)}):n(o)})},race:function(e){var t=F(this);return new t(function(r,n){h(e,!1,function(e){t.resolve(e).then(r,n)})})}})},{209:209,210:210,214:214,220:220,221:221,222:222,230:230,232:232,240:240,244:244,247:247,249:249,251:251,252:252,261:261,262:262,265:265,266:266,272:272,273:273,280:280,282:282}],338:[function(e,t,r){var n=e(222),i=Function.apply;n(n.S,"Reflect",{apply:function(e,t,r){return i.call(e,t,r)}})},{222:222}],339:[function(e,t,r){var n=e(247),i=e(222),a=e(209),s=e(210),o=e(240),u=Function.bind||e(220).Function.prototype.bind;i(i.S+i.F*e(227)(function(){function e(){}return!(Reflect.construct(function(){},[],e)instanceof e)}),"Reflect",{ construct:function(e,t){a(e);var r=arguments.length<3?e:a(arguments[2]);if(e==r){if(void 0!=t)switch(s(t).length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var i=[null];return i.push.apply(i,t),new(u.apply(e,i))}var p=r.prototype,l=n.create(o(p)?p:Object.prototype),c=Function.apply.call(e,l,t);return o(c)?c:l}})},{209:209,210:210,220:220,222:222,227:227,240:240,247:247}],340:[function(e,t,r){var n=e(247),i=e(222),a=e(210);i(i.S+i.F*e(227)(function(){Reflect.defineProperty(n.setDesc({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,r){a(e);try{return n.setDesc(e,t,r),!0}catch(i){return!1}}})},{210:210,222:222,227:227,247:247}],341:[function(e,t,r){var n=e(222),i=e(247).getDesc,a=e(210);n(n.S,"Reflect",{deleteProperty:function(e,t){var r=i(a(e),t);return r&&!r.configurable?!1:delete e[t]}})},{210:210,222:222,247:247}],342:[function(e,t,r){"use strict";var n=e(222),i=e(210),a=function(e){this._t=i(e),this._i=0;var t,r=this._k=[];for(t in e)r.push(t)};e(242)(a,"Object",function(){var e,t=this,r=t._k;do if(t._i>=r.length)return{value:void 0,done:!0};while(!((e=r[t._i++])in t._t));return{value:e,done:!1}}),n(n.S,"Reflect",{enumerate:function(e){return new a(e)}})},{210:210,222:222,242:242}],343:[function(e,t,r){var n=e(247),i=e(222),a=e(210);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return n.getDesc(a(e),t)}})},{210:210,222:222,247:247}],344:[function(e,t,r){var n=e(222),i=e(247).getProto,a=e(210);n(n.S,"Reflect",{getPrototypeOf:function(e){return i(a(e))}})},{210:210,222:222,247:247}],345:[function(e,t,r){function n(e,t){var r,s,p=arguments.length<3?e:arguments[2];return u(e)===p?e[t]:(r=i.getDesc(e,t))?a(r,"value")?r.value:void 0!==r.get?r.get.call(p):void 0:o(s=i.getProto(e))?n(s,t,p):void 0}var i=e(247),a=e(233),s=e(222),o=e(240),u=e(210);s(s.S,"Reflect",{get:n})},{210:210,222:222,233:233,240:240,247:247}],346:[function(e,t,r){var n=e(222);n(n.S,"Reflect",{has:function(e,t){return t in e}})},{222:222}],347:[function(e,t,r){var n=e(222),i=e(210),a=Object.isExtensible;n(n.S,"Reflect",{isExtensible:function(e){return i(e),a?a(e):!0}})},{210:210,222:222}],348:[function(e,t,r){var n=e(222);n(n.S,"Reflect",{ownKeys:e(255)})},{222:222,255:255}],349:[function(e,t,r){var n=e(222),i=e(210),a=Object.preventExtensions;n(n.S,"Reflect",{preventExtensions:function(e){i(e);try{return a&&a(e),!0}catch(t){return!1}}})},{210:210,222:222}],350:[function(e,t,r){var n=e(222),i=e(262);i&&n(n.S,"Reflect",{setPrototypeOf:function(e,t){i.check(e,t);try{return i.set(e,t),!0}catch(r){return!1}}})},{222:222,262:262}],351:[function(e,t,r){function n(e,t,r){var s,l,c=arguments.length<4?e:arguments[3],f=i.getDesc(u(e),t);if(!f){if(p(l=i.getProto(e)))return n(l,t,r,c);f=o(0)}return a(f,"value")?f.writable!==!1&&p(c)?(s=i.getDesc(c,t)||o(0),s.value=r,i.setDesc(c,t,s),!0):!1:void 0===f.set?!1:(f.set.call(c,r),!0)}var i=e(247),a=e(233),s=e(222),o=e(258),u=e(210),p=e(240);s(s.S,"Reflect",{set:n})},{210:210,222:222,233:233,240:240,247:247,258:258}],352:[function(e,t,r){var n=e(247),i=e(232),a=e(215),s=e(229),o=i.RegExp,u=o,p=o.prototype,l=/a/g,c=new o(l)!==l,f=function(){try{return"/a/i"==o(l,"i")}catch(e){}}();e(272)&&(c&&f||(o=function(e,t){var r="RegExp"==a(e),n=void 0===t;return this instanceof o||!r||!n?c?new u(r&&!n?e.source:e,t):new u(r?e.source:e,r&&n?s.call(e):t):e},n.each.call(n.getNames(u),function(e){e in o||n.setDesc(o,e,{configurable:!0,get:function(){return u[e]},set:function(t){u[e]=t}})}),p.constructor=o,o.prototype=p,e(259)(i,"RegExp",o))),e(265)(o)},{215:215,229:229,232:232,247:247,259:259,265:265,272:272}],353:[function(e,t,r){var n=e(247);e(272)&&"g"!=/./g.flags&&n.setDesc(RegExp.prototype,"flags",{configurable:!0,get:e(229)})},{229:229,247:247,272:272}],354:[function(e,t,r){e(228)("match",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{228:228}],355:[function(e,t,r){e(228)("replace",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{228:228}],356:[function(e,t,r){e(228)("search",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{228:228}],357:[function(e,t,r){e(228)("split",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{228:228}],358:[function(e,t,r){"use strict";var n=e(216);e(219)("Set",function(e){return function(){return e(this,arguments[0])}},{add:function(e){return n.def(this,e=0===e?0:e,e)}},n)},{216:216,219:219}],359:[function(e,t,r){"use strict";var n=e(222),i=e(267)(!1);n(n.P,"String",{codePointAt:function(e){return i(this,e)}})},{222:222,267:267}],360:[function(e,t,r){"use strict";var n=e(222),i=e(278),a=e(268);n(n.P+n.F*!e(227)(function(){"q".endsWith(/./)}),"String",{endsWith:function(e){var t=a(this,e,"endsWith"),r=arguments[1],n=i(t.length),s=void 0===r?n:Math.min(i(r),n),o=String(e);return t.slice(s-o.length,s)===o}})},{222:222,227:227,268:268,278:278}],361:[function(e,t,r){var n=e(222),i=e(275),a=String.fromCharCode,s=String.fromCodePoint;n(n.S+n.F*(!!s&&1!=s.length),"String",{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,s=0;n>s;){if(t=+arguments[s++],i(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(65536>t?a(t):a(((t-=65536)>>10)+55296,t%1024+56320))}return r.join("")}})},{222:222,275:275}],362:[function(e,t,r){"use strict";var n=e(222),i=e(268);n(n.P,"String",{includes:function(e){return!!~i(this,e,"includes").indexOf(e,arguments[1])}})},{222:222,268:268}],363:[function(e,t,r){"use strict";var n=e(267)(!0);e(243)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},{243:243,267:267}],364:[function(e,t,r){var n=e(222),i=e(277),a=e(278);n(n.S,"String",{raw:function(e){for(var t=i(e.raw),r=a(t.length),n=arguments.length,s=[],o=0;r>o;)s.push(String(t[o++])),n>o&&s.push(String(arguments[o]));return s.join("")}})},{222:222,277:277,278:278}],365:[function(e,t,r){var n=e(222);n(n.P,"String",{repeat:e(270)})},{222:222,270:270}],366:[function(e,t,r){"use strict";var n=e(222),i=e(278),a=e(268);n(n.P+n.F*!e(227)(function(){"q".startsWith(/./)}),"String",{startsWith:function(e){var t=a(this,e,"startsWith"),r=i(Math.min(arguments[1],t.length)),n=String(e);return t.slice(r,r+n.length)===n}})},{222:222,227:227,268:268,278:278}],367:[function(e,t,r){"use strict";e(271)("trim",function(e){return function(){return e(this,3)}})},{271:271}],368:[function(e,t,r){"use strict";var n=e(247),i=e(232),a=e(233),s=e(272),o=e(222),u=e(259),p=e(263),l=e(273),c=e(280),f=e(282),d=e(248),h=e(231),m=e(225),y=e(240),g=e(210),v=e(277),b=e(258),E=n.getDesc,x=n.setDesc,S=n.create,A=h.get,D=i.Symbol,C=!1,w=f("_hidden"),I=n.isEnum,_=p("symbol-registry"),F=p("symbols"),k="function"==typeof D,P=Object.prototype,B=s?function(){try{return S(x({},w,{get:function(){return x(this,w,{value:!1})[w]}}))[w]||x}catch(e){return function(e,t,r){var n=E(P,t);n&&delete P[t],x(e,t,r),n&&e!==P&&x(P,t,n)}}}():x,T=function(e){var t=F[e]=S(D.prototype);return t._k=e,s&&C&&B(P,e,{configurable:!0,set:function(t){a(this,w)&&a(this[w],e)&&(this[w][e]=!1),B(this,e,b(1,t))}}),t},M=function(e,t,r){return r&&a(F,t)?(r.enumerable?(a(e,w)&&e[w][t]&&(e[w][t]=!1),r=S(r,{enumerable:b(0,!1)})):(a(e,w)||x(e,w,b(1,{})),e[w][t]=!0),B(e,t,r)):x(e,t,r)},O=function(e,t){g(e);for(var r,n=m(t=v(t)),i=0,a=n.length;a>i;)M(e,r=n[i++],t[r]);return e},j=function(e,t){return void 0===t?S(e):O(S(e),t)},L=function(e){var t=I.call(this,e);return t||!a(this,e)||!a(F,e)||a(this,w)&&this[w][e]?t:!0},N=function(e,t){var r=E(e=v(e),t);return!r||!a(F,t)||a(e,w)&&e[w][t]||(r.enumerable=!0),r},R=function(e){for(var t,r=A(v(e)),n=[],i=0;r.length>i;)a(F,t=r[i++])||t==w||n.push(t);return n},V=function(e){for(var t,r=A(v(e)),n=[],i=0;r.length>i;)a(F,t=r[i++])&&n.push(F[t]);return n};k||(D=function(){if(this instanceof D)throw TypeError("Symbol is not a constructor");return T(c(arguments[0]))},u(D.prototype,"toString",function(){return this._k}),n.create=j,n.isEnum=L,n.getDesc=N,n.setDesc=M,n.setDescs=O,n.getNames=h.get=R,n.getSymbols=V,s&&!e(249)&&u(P,"propertyIsEnumerable",L,!0)),(!k||e(227)(function(){return"[{},[null]]"!=JSON.stringify([{a:D()},[D()]])}))&&u(D.prototype,"toJSON",function(){return k&&y(this)?this:void 0});var U={"for":function(e){return a(_,e+="")?_[e]:_[e]=D(e)},keyFor:function(e){return d(_,e)},useSetter:function(){C=!0},useSimple:function(){C=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(e){var t=f(e);U[e]=k?t:T(t)}),C=!0,o(o.G+o.W,{Symbol:D}),o(o.S,"Symbol",U),o(o.S+o.F*!k,"Object",{create:j,defineProperty:M,defineProperties:O,getOwnPropertyDescriptor:N,getOwnPropertyNames:R,getOwnPropertySymbols:V}),l(D,"Symbol"),l(Math,"Math",!0),l(i.JSON,"JSON",!0)},{210:210,222:222,225:225,227:227,231:231,232:232,233:233,240:240,247:247,248:248,249:249,258:258,259:259,263:263,272:272,273:273,277:277,280:280,282:282}],369:[function(e,t,r){"use strict";var n=e(247),i=e(218),a=e(240),s=e(233),o=i.frozenStore,u=i.WEAK,p=Object.isExtensible||a,l={},c=e(219)("WeakMap",function(e){return function(){return e(this,arguments[0])}},{get:function(e){if(a(e)){if(!p(e))return o(this).get(e);if(s(e,u))return e[u][this._i]}},set:function(e,t){return i.def(this,e,t)}},i,!0,!0);7!=(new c).set((Object.freeze||Object)(l),7).get(l)&&n.each.call(["delete","has","get","set"],function(t){var r=c.prototype,n=r[t];e(259)(r,t,function(e,r){if(a(e)&&!p(e)){var i=o(this)[t](e,r);return"set"==t?this:i}return n.call(this,e,r)})})},{218:218,219:219,233:233,240:240,247:247,259:259}],370:[function(e,t,r){"use strict";var n=e(218);e(219)("WeakSet",function(e){return function(){return e(this,arguments[0])}},{add:function(e){return n.def(this,e,!0)}},n,!1,!0)},{218:218,219:219}],371:[function(e,t,r){"use strict";var n=e(222),i=e(211)(!0);n(n.P,"Array",{includes:function(e){return i(this,e,arguments[1])}}),e(281)("includes")},{211:211,222:222,281:281}],372:[function(e,t,r){var n=e(222);n(n.P,"Map",{toJSON:e(217)("Map")})},{217:217,222:222}],373:[function(e,t,r){var n=e(222),i=e(254)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},{222:222,254:254}],374:[function(e,t,r){var n=e(247),i=e(222),a=e(255),s=e(277),o=e(258);i(i.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,r,i=s(e),u=n.setDesc,p=n.getDesc,l=a(i),c={},f=0;l.length>f;)r=p(i,t=l[f++]),t in c?u(c,t,o(0,r)):c[t]=r;return c}})},{222:222,247:247,255:255,258:258,277:277}],375:[function(e,t,r){var n=e(222),i=e(254)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},{222:222,254:254}],376:[function(e,t,r){var n=e(222),i=e(260)(/[\\^$*+?.()|[\]{}]/g,"\\$&");n(n.S,"RegExp",{escape:function(e){return i(e)}})},{222:222,260:260}],377:[function(e,t,r){var n=e(222);n(n.P,"Set",{toJSON:e(217)("Set")})},{217:217,222:222}],378:[function(e,t,r){"use strict";var n=e(222),i=e(267)(!0);n(n.P,"String",{at:function(e){return i(this,e)}})},{222:222,267:267}],379:[function(e,t,r){"use strict";var n=e(222),i=e(269);n(n.P,"String",{padLeft:function(e){return i(this,e,arguments[1],!0)}})},{222:222,269:269}],380:[function(e,t,r){"use strict";var n=e(222),i=e(269);n(n.P,"String",{padRight:function(e){return i(this,e,arguments[1],!1)}})},{222:222,269:269}],381:[function(e,t,r){"use strict";e(271)("trimLeft",function(e){return function(){return e(this,1)}})},{271:271}],382:[function(e,t,r){"use strict";e(271)("trimRight",function(e){return function(){return e(this,2)}})},{271:271}],383:[function(e,t,r){var n=e(247),i=e(222),a=e(220).Array||Array,s={},o=function(t,r){n.each.call(t.split(","),function(t){void 0==r&&t in a?s[t]=a[t]:t in[]&&(s[t]=e(221)(Function.call,[][t],r))})};o("pop,reverse,shift,keys,values,entries",1),o("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),o("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill"),i(i.S,"Array",s)},{220:220,221:221,222:222,247:247}],384:[function(e,t,r){e(290);var n=e(232),i=e(234),a=e(246),s=e(282)("iterator"),o=n.NodeList,u=n.HTMLCollection,p=o&&o.prototype,l=u&&u.prototype,c=a.NodeList=a.HTMLCollection=a.Array;!o||s in p||i(p,s,c),!u||s in l||i(l,s,c)},{232:232,234:234,246:246,282:282,290:290}],385:[function(e,t,r){var n=e(222),i=e(274);n(n.G+n.B,{setImmediate:i.set,clearImmediate:i.clear})},{222:222,274:274}],386:[function(e,t,r){var n=e(232),i=e(222),a=e(236),s=e(256),o=n.navigator,u=!!o&&/MSIE .\./.test(o.userAgent),p=function(e){return u?function(t,r){return e(a(s,[].slice.call(arguments,2),"function"==typeof t?t:Function(t)),r)}:e};i(i.G+i.B+i.F*u,{setTimeout:p(n.setTimeout),setInterval:p(n.setInterval)})},{222:222,232:232,236:236,256:256}],387:[function(e,t,r){e(284),e(368),e(323),e(331),e(335),e(336),e(324),e(334),e(333),e(329),e(330),e(328),e(325),e(327),e(332),e(326),e(294),e(293),e(313),e(314),e(315),e(316),e(317),e(318),e(319),e(320),e(321),e(322),e(296),e(297),e(298),e(299),e(300),e(301),e(302),e(303),e(304),e(305),e(306),e(307),e(308),e(309),e(310),e(311),e(312),e(361),e(364),e(367),e(363),e(359),e(360),e(362),e(365),e(366),e(289),e(291),e(290),e(292),e(285),e(286),e(288),e(287),e(352),e(353),e(354),e(355),e(356),e(357),e(337),e(295),e(358),e(369),e(370),e(338),e(339),e(340),e(341),e(342),e(345),e(343),e(344),e(346),e(347),e(348),e(349),e(351),e(350),e(371),e(378),e(379),e(380),e(381),e(382),e(376),e(374),e(375),e(373),e(372),e(377),e(383),e(386),e(385),e(384),t.exports=e(220)},{220:220,284:284,285:285,286:286,287:287,288:288,289:289,290:290,291:291,292:292,293:293,294:294,295:295,296:296,297:297,298:298,299:299,300:300,301:301,302:302,303:303,304:304,305:305,306:306,307:307,308:308,309:309,310:310,311:311,312:312,313:313,314:314,315:315,316:316,317:317,318:318,319:319,320:320,321:321,322:322,323:323,324:324,325:325,326:326,327:327,328:328,329:329,330:330,331:331,332:332,333:333,334:334,335:335,336:336,337:337,338:338,339:339,340:340,341:341,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,350:350,351:351,352:352,353:353,354:354,355:355,356:356,357:357,358:358,359:359,360:360,361:361,362:362,363:363,364:364,365:365,366:366,367:367,368:368,369:369,370:370,371:371,372:372,373:373,374:374,375:375,376:376,377:377,378:378,379:379,380:380,381:381,382:382,383:383,384:384,385:385,386:386}],388:[function(e,t,r){function n(){return r.colors[l++%r.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,a=t-(p||t);e.diff=a,e.prev=p,e.curr=t,p=t,null==e.useColors&&(e.useColors=r.useColors()),null==e.color&&e.useColors&&(e.color=n());var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var o=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if("%%"===t)return t;o++;var i=r.formatters[n];if("function"==typeof i){var a=s[o];t=i.call(e,a),s.splice(o,1),o--}return t}),"function"==typeof r.formatArgs&&(s=r.formatArgs.apply(e,s));var u=i.log||r.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,i.enabled=!0;var a=r.enabled(e)?i:t;return a.namespace=e,a}function a(e){r.save(e);for(var t=(e||"").split(/[\s,]+/),n=t.length,i=0;n>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){r.enable("")}function o(e){var t,n;for(t=0,n=r.skips.length;n>t;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;n>t;t++)if(r.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=i,r.coerce=u,r.disable=s,r.enable=a,r.enabled=o,r.humanize=e(390),r.names=[],r.skips=[],r.formatters={};var p,l=0},{390:390}],389:[function(e,t,r){(function(n){function i(){var e=(n.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?l.isatty(f):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function a(){var e=arguments,t=this.useColors,n=this.namespace;if(t){var i=this.color;e[0]=" [3"+i+";1m"+n+" "+e[0]+"[3"+i+"m +"+r.humanize(this.diff)+""}else e[0]=(new Date).toUTCString()+" "+n+" "+e[0];return e}function s(){return d.write(c.format.apply(this,arguments)+"\n")}function o(e){null==e?delete n.env.DEBUG:n.env.DEBUG=e}function u(){return n.env.DEBUG}function p(t){var r,i=n.binding("tty_wrap");switch(i.guessHandleType(t)){case"TTY":r=new l.WriteStream(t),r._type="tty",r._handle&&r._handle.unref&&r._handle.unref();break;case"FILE":var a=e(1);r=new a.SyncWriteStream(t,{autoClose:!1}),r._type="fs";break;case"PIPE":case"TCP":var s=e(1);r=new s.Socket({fd:t,readable:!1,writable:!0}),r.readable=!1,r.read=null,r._type="pipe",r._handle&&r._handle.unref&&r._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return r.fd=t,r._isStdio=!0,r}var l=e(11),c=e(13);r=t.exports=e(388),r.log=s,r.formatArgs=a,r.save=o,r.load=u,r.useColors=i,r.colors=[6,2,3,4,5,1];var f=parseInt(n.env.DEBUG_FD,10)||2,d=1===f?n.stdout:2===f?n.stderr:p(f),h=4===c.inspect.length?function(e,t){return c.inspect(e,void 0,void 0,t)}:function(e,t){return c.inspect(e,{colors:t})};r.formatters.o=function(e){return h(e,this.useColors).replace(/\s*\n\s*/g," ")},r.enable(u())}).call(this,e(10))},{1:1,10:10,11:11,13:13,388:388}],390:[function(e,t,r){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*p;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function i(e){return e>=l?Math.round(e/l)+"d":e>=p?Math.round(e/p)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function a(e){return s(e,l,"day")||s(e,p,"hour")||s(e,u,"minute")||s(e,o,"second")||e+" ms"}function s(e,t,r){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var o=1e3,u=60*o,p=60*u,l=24*p,c=365.25*l;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?a(e):i(e)}},{}],391:[function(e,t,r){"use strict";function n(e){var t=0,r=0,n=0;for(var i in e){var a=e[i],s=a[0],o=a[1];(s>r||s===r&&o>n)&&(r=s,n=o,t=+i)}return t}var i=e(584),a=/^(?:( )+|\t+)/;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,r,s=0,o=0,u=0,p={};e.split(/\n/g).forEach(function(e){if(e){var n,i=e.match(a);i?(n=i[0].length,i[1]?o++:s++):n=0;var l=n-u;u=n,l?(r=l>0,t=p[r?l:-l],t?t[0]++:t=p[l]=[1,0]):t&&(t[1]+=+r)}});var l,c,f=n(p);return f?o>=s?(l="space",c=i(" ",f)):(l="tab",c=i(" ",f)):(l=null,c=""),{amount:f,type:l,indent:c}}},{584:584}],392:[function(e,t,r){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function r(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function n(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function i(e){return n(e)||null!=e&&"FunctionDeclaration"===e.type}function a(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function s(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=a(t)}while(t);return!1}t.exports={isExpression:e,isStatement:n,isIterationStatement:r,isSourceElement:i,isProblematicIfStatement:s,trailingStatement:a}}()},{}],393:[function(e,t,r){!function(){"use strict";function e(e){return e>=48&&57>=e}function r(e){return e>=48&&57>=e||e>=97&&102>=e||e>=65&&70>=e}function n(e){return e>=48&&55>=e}function i(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&d.indexOf(e)>=0}function a(e){return 10===e||13===e||8232===e||8233===e}function s(e){if(65535>=e)return String.fromCharCode(e);var t=String.fromCharCode(Math.floor((e-65536)/1024)+55296),r=String.fromCharCode((e-65536)%1024+56320);return t+r}function o(e){return 128>e?h[e]:f.NonAsciiIdentifierStart.test(s(e))}function u(e){return 128>e?m[e]:f.NonAsciiIdentifierPart.test(s(e))}function p(e){return 128>e?h[e]:c.NonAsciiIdentifierStart.test(s(e))}function l(e){return 128>e?m[e]:c.NonAsciiIdentifierPart.test(s(e))}var c,f,d,h,m,y;for(f={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},c={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/, NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},d=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],h=new Array(128),y=0;128>y;++y)h[y]=y>=97&&122>=y||y>=65&&90>=y||36===y||95===y;for(m=new Array(128),y=0;128>y;++y)m[y]=y>=97&&122>=y||y>=65&&90>=y||y>=48&&57>=y||36===y||95===y;t.exports={isDecimalDigit:e,isHexDigit:r,isOctalDigit:n,isWhiteSpace:i,isLineTerminator:a,isIdentifierStartES5:o,isIdentifierPartES5:u,isIdentifierStartES6:p,isIdentifierPartES6:l}}()},{}],394:[function(e,t,r){!function(){"use strict";function r(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function n(e,t){return t||"yield"!==e?i(e,t):!1}function i(e,t){if(t&&r(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function a(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function s(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function o(e){return"eval"===e||"arguments"===e}function u(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!d.isIdentifierStartES5(n))return!1;for(t=1,r=e.length;r>t;++t)if(n=e.charCodeAt(t),!d.isIdentifierPartES5(n))return!1;return!0}function p(e,t){return 1024*(e-55296)+(t-56320)+65536}function l(e){var t,r,n,i,a;if(0===e.length)return!1;for(a=d.isIdentifierStartES6,t=0,r=e.length;r>t;++t){if(n=e.charCodeAt(t),n>=55296&&56319>=n){if(++t,t>=r)return!1;if(i=e.charCodeAt(t),!(i>=56320&&57343>=i))return!1;n=p(n,i)}if(!a(n))return!1;a=d.isIdentifierPartES6}return!0}function c(e,t){return u(e)&&!a(e,t)}function f(e,t){return l(e)&&!s(e,t)}var d=e(393);t.exports={isKeywordES5:n,isKeywordES6:i,isReservedWordES5:a,isReservedWordES6:s,isRestrictedWord:o,isIdentifierNameES5:u,isIdentifierNameES6:l,isIdentifierES5:c,isIdentifierES6:f}}()},{393:393}],395:[function(e,t,r){!function(){"use strict";r.ast=e(392),r.code=e(393),r.keyword=e(394)}()},{392:392,393:393,394:394}],396:[function(e,t,r){t.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},nonstandard:{escape:!1,unescape:!1},browser:{addEventListener:!1,alert:!1,applicationCache:!1,atob:!1,Audio:!1,AudioProcessingEvent:!1,BeforeUnloadEvent:!1,Blob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,crypto:!1,CSS:!1,CustomEvent:!1,DataView:!1,Debug:!1,defaultStatus:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DOMParser:!1,DragEvent:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,FileReader:!1,fetch:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!1,history:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,navigator:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProgressEvent:!1,prompt:!1,Range:!1,Request:!1,Response:!1,removeEventListener:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,screen:!1,screenX:!1,screenY:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,self:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,showModalDialog:!1,status:!1,stop:!1,StorageEvent:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,TouchEvent:!1,UIEvent:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},worker:{importScripts:!0,postMessage:!0,self:!0},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,DataView:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1}}},{}],397:[function(e,t,r){t.exports=e(396)},{396:396}],398:[function(e,t,r){var n=e(399);t.exports=Number.isInteger||function(e){return"number"==typeof e&&n(e)&&Math.floor(e)===e}},{399:399}],399:[function(e,t,r){"use strict";var n=e(400);t.exports=Number.isFinite||function(e){return!("number"!=typeof e||n(e)||e===1/0||e===-(1/0))}},{400:400}],400:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!==e}},{}],401:[function(e,t,r){t.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g,t.exports.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},{}],402:[function(e,t,r){var n="object"==typeof r?r:{};n.parse=function(){"use strict";var e,t,r,n,i={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=[" "," ","\r","\n"," ","\f"," ","\ufeff"],s=function(t){var n=new SyntaxError;throw n.message=t,n.at=e,n.text=r,n},o=function(n){return n&&n!==t&&s("Expected '"+n+"' instead of '"+t+"'"),t=r.charAt(e),e+=1,t},u=function(){return r.charAt(e)},p=function(){var e=t;for("_"!==t&&"$"!==t&&("a">t||t>"z")&&("A">t||t>"Z")&&s("Bad identifier");o()&&("_"===t||"$"===t||t>="a"&&"z">=t||t>="A"&&"Z">=t||t>="0"&&"9">=t);)e+=t;return e},l=function(){var e,r="",n="",i=10;if(("-"===t||"+"===t)&&(r=t,o(t)),"I"===t)return e=y(),("number"!=typeof e||isNaN(e))&&s("Unexpected word for number"),"-"===r?-e:e;if("N"===t)return e=y(),isNaN(e)||s("expected word to be NaN"),e;switch("0"===t&&(n+=t,o(),"x"===t||"X"===t?(n+=t,o(),i=16):t>="0"&&"9">=t&&s("Octal literal")),i){case 10:for(;t>="0"&&"9">=t;)n+=t,o();if("."===t)for(n+=".";o()&&t>="0"&&"9">=t;)n+=t;if("e"===t||"E"===t)for(n+=t,o(),("-"===t||"+"===t)&&(n+=t,o());t>="0"&&"9">=t;)n+=t,o();break;case 16:for(;t>="0"&&"9">=t||t>="A"&&"F">=t||t>="a"&&"f">=t;)n+=t,o()}return e="-"===r?-n:+n,isFinite(e)?e:void s("Bad number")},c=function(){var e,r,n,a,p="";if('"'===t||"'"===t)for(n=t;o();){if(t===n)return o(),p;if("\\"===t)if(o(),"u"===t){for(a=0,r=0;4>r&&(e=parseInt(o(),16),isFinite(e));r+=1)a=16*a+e;p+=String.fromCharCode(a)}else if("\r"===t)"\n"===u()&&o();else{if("string"!=typeof i[t])break;p+=i[t]}else{if("\n"===t)break;p+=t}}s("Bad string")},f=function(){"/"!==t&&s("Not an inline comment");do if(o(),"\n"===t||"\r"===t)return void o();while(t)},d=function(){"*"!==t&&s("Not a block comment");do for(o();"*"===t;)if(o("*"),"/"===t)return void o("/");while(t);s("Unterminated block comment")},h=function(){"/"!==t&&s("Not a comment"),o("/"),"/"===t?f():"*"===t?d():s("Unrecognized comment")},m=function(){for(;t;)if("/"===t)h();else{if(!(a.indexOf(t)>=0))return;o()}},y=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;case"I":return o("I"),o("n"),o("f"),o("i"),o("n"),o("i"),o("t"),o("y"),1/0;case"N":return o("N"),o("a"),o("N"),NaN}s("Unexpected '"+t+"'")},g=function(){var e=[];if("["===t)for(o("["),m();t;){if("]"===t)return o("]"),e;if(","===t?s("Missing array element"):e.push(n()),m(),","!==t)return o("]"),e;o(","),m()}s("Bad array")},v=function(){var e,r={};if("{"===t)for(o("{"),m();t;){if("}"===t)return o("}"),r;if(e='"'===t||"'"===t?c():p(),m(),o(":"),r[e]=n(),m(),","!==t)return o("}"),r;o(","),m()}s("Bad object")};return n=function(){switch(m(),t){case"{":return v();case"[":return g();case'"':case"'":return c();case"-":case"+":case".":return l();default:return t>="0"&&"9">=t?l():y()}},function(i,a){var o;return r=String(i),e=0,t=" ",o=n(),m(),t&&s("Syntax error"),"function"==typeof a?function u(e,t){var r,n,i=e[t];if(i&&"object"==typeof i)for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n=u(i,r),void 0!==n?i[r]=n:delete i[r]);return a.call(e,t,i)}({"":o},""):o}}(),n.stringify=function(e,t,r){function i(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||e>="0"&&"9">=e||"_"===e||"$"===e}function a(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e||"$"===e}function s(e){if("string"!=typeof e)return!1;if(!a(e[0]))return!1;for(var t=1,r=e.length;r>t;){if(!i(e[t]))return!1;t++}return!0}function o(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function u(e){return"[object Date]"===Object.prototype.toString.call(e)}function p(e){for(var t=0;t<m.length;t++)if(m[t]===e)throw new TypeError("Converting circular structure to JSON")}function l(e,t,r){if(!e)return"";e.length>10&&(e=e.substring(0,10));for(var n=r?"":"\n",i=0;t>i;i++)n+=e;return n}function c(e){return y.lastIndex=0,y.test(e)?'"'+e.replace(y,function(e){var t=g[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function f(e,t,r){var n,i,a=d(e,t,r);switch(a&&!u(a)&&(a=a.valueOf()),typeof a){case"boolean":return a.toString();case"number":return isNaN(a)||!isFinite(a)?"null":a.toString();case"string":return c(a.toString());case"object":if(null===a)return"null";if(o(a)){p(a),n="[",m.push(a);for(var y=0;y<a.length;y++)i=f(a,y,!1),n+=l(h,m.length),n+=null===i||"undefined"==typeof i?"null":i,y<a.length-1?n+=",":h&&(n+="\n");m.pop(),n+=l(h,m.length,!0)+"]"}else{p(a),n="{";var g=!1;m.push(a);for(var v in a)if(a.hasOwnProperty(v)){var b=f(a,v,!1);if(r=!1,"undefined"!=typeof b&&null!==b){n+=l(h,m.length),g=!0;var t=s(v)?v:c(v);n+=t+":"+(h?" ":"")+b+","}}m.pop(),n=g?n.substring(0,n.length-1)+l(h,m.length)+"}":"{}"}return n;default:return void 0}}if(t&&"function"!=typeof t&&!o(t))throw new Error("Replacer must be a function or an array");var d=function(e,r,n){var i=e[r];return i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),"function"==typeof t?t.call(e,r,i):t?n||o(e)||t.indexOf(r)>=0?i:void 0:i};n.isWord=s,isNaN=isNaN||function(e){return"number"==typeof e&&e!==e};var h,m=[];r&&("string"==typeof r?h=r:"number"==typeof r&&r>=0&&(h=l(" ",r,!0)));var y=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v={"":e};return void 0===e?d(v,"",!0):f(v,"",!0)}},{}],403:[function(e,t,r){function n(e,t,r){return t in e?e[t]:r}function i(e,t){var r=n.bind(null,t||{}),i=r("transform",Function.prototype),s=r("padding"," "),o=r("before"," "),u=r("after"," | "),p=r("start",1),l=Array.isArray(e),c=l?e:e.split("\n"),f=p+c.length-1,d=String(f).length,h=c.map(function(e,t){var r=p+t,n={before:o,number:r,width:d,after:u,line:e};return i(n),n.before+a(n.number,d,s)+n.after+n.line});return l?h:h.join("\n")}var a=e(404);t.exports=i},{404:404}],404:[function(e,t,r){function n(e,t,r){e=String(e);var n=-1;for(r||(r=" "),t-=e.length;++n<t;)e=r+e;return e}t.exports=n},{}],405:[function(e,t,r){function n(e){for(var t=-1,r=e?e.length:0,n=-1,i=[];++t<r;){var a=e[t];a&&(i[++n]=a)}return i}t.exports=n},{}],406:[function(e,t,r){function n(e,t,r){var n=e?e.length:0;return r&&a(e,t,r)&&(t=!1),n?i(e,t):[]}var i=e(435),a=e(485);t.exports=n},{435:435,485:485}],407:[function(e,t,r){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}t.exports=n},{}],408:[function(e,t,r){function n(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var r=0,n=i,a=e.length;++r<a;)for(var o=0,u=e[r];(o=n(t,u,o))>-1;)s.call(t,o,1);return t}var i=e(442),a=Array.prototype,s=a.splice;t.exports=n},{442:442}],409:[function(e,t,r){function n(e,t,r,n){var u=e?e.length:0;return u?(null!=t&&"boolean"!=typeof t&&(n=r,r=s(e,t,n)?void 0:t,t=!1),r=null==r?r:i(r,n,3),t?o(e,r):a(e,r)):[]}var i=e(429),a=e(458),s=e(485),o=e(491);t.exports=n},{429:429,458:458,485:485,491:491}],410:[function(e,t,r){t.exports=e(413)},{413:413}],411:[function(e,t,r){t.exports=e(412)},{412:412}],412:[function(e,t,r){var n=e(421),i=e(433),a=e(470),s=a(n,i);t.exports=s},{421:421,433:433,470:470}],413:[function(e,t,r){function n(e,t,r,n){var f=e?a(e):0;return u(f)||(e=l(e),f=e.length),r="number"!=typeof r||n&&o(t,r,n)?0:0>r?c(f+r,0):r||0,"string"==typeof e||!s(e)&&p(e)?f>=r&&e.indexOf(t,r)>-1:!!f&&i(e,t,r)>-1}var i=e(442),a=e(476),s=e(497),o=e(485),u=e(487),p=e(506),l=e(517),c=Math.max;t.exports=n},{442:442,476:476,485:485,487:487,497:497,506:506,517:517}],414:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return t=a(t,r,3),n(e,t)}var i=e(422),a=e(429),s=e(446),o=e(497);t.exports=n},{422:422,429:429,446:446,497:497}],415:[function(e,t,r){var n=e(424),i=e(434),a=e(471),s=a(n,i);t.exports=s},{424:424,434:434,471:471}],416:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return r&&u(e,t,r)&&(t=void 0),("function"!=typeof t||void 0!==r)&&(t=a(t,r,3)),n(e,t)}var i=e(425),a=e(429),s=e(455),o=e(497),u=e(485);t.exports=n},{425:425,429:429,455:455,485:485,497:497}],417:[function(e,t,r){function n(e,t,r){if(null==e)return[];r&&u(e,t,r)&&(t=void 0);var n=-1;t=i(t,r,3);var p=a(e,function(e,r,i){return{criteria:t(e,r,i),index:++n,value:e}});return s(p,o)}var i=e(429),a=e(446),s=e(456),o=e(464),u=e(485);t.exports=n},{429:429,446:446,456:456,464:464,485:485}],418:[function(e,t,r){function n(e,t){if("function"!=typeof e)throw new TypeError(i);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,i=a(r.length-t,0),s=Array(i);++n<i;)s[n]=r[t+n];switch(t){case 0:return e.call(this,s);case 1:return e.call(this,r[0],s);case 2:return e.call(this,r[0],r[1],s)}var o=Array(t+1);for(n=-1;++n<t;)o[n]=r[n];return o[t]=s,e.apply(this,o)}}var i="Expected a function",a=Math.max;t.exports=n},{}],419:[function(e,t,r){(function(r){function n(e){var t=e?e.length:0;for(this.data={hash:o(null),set:new s};t--;)this.push(e[t])}var i=e(463),a=e(478),s=a(r,"Set"),o=a(Object,"create");n.prototype.push=i,t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{463:463,478:478}],420:[function(e,t,r){function n(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}t.exports=n},{}],421:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n&&t(e[r],r,e)!==!1;);return e}t.exports=n},{}],422:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}t.exports=n},{}],423:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}t.exports=n},{}],424:[function(e,t,r){function n(e,t,r,n){ var i=e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}t.exports=n},{}],425:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}t.exports=n},{}],426:[function(e,t,r){function n(e,t){return void 0===e?t:e}t.exports=n},{}],427:[function(e,t,r){function n(e,t,r){for(var n=-1,a=i(t),s=a.length;++n<s;){var o=a[n],u=e[o],p=r(u,t[o],o,e,t);(p===p?p===u:u!==u)&&(void 0!==u||o in e)||(e[o]=p)}return e}var i=e(513);t.exports=n},{513:513}],428:[function(e,t,r){function n(e,t){return null==t?e:i(t,a(t),e)}var i=e(432),a=e(513);t.exports=n},{432:432,513:513}],429:[function(e,t,r){function n(e,t,r){var n=typeof e;return"function"==n?void 0===t?e:s(e,t,r):null==e?o:"object"==n?i(e):void 0===t?u(e):a(e,t)}var i=e(447),a=e(448),s=e(460),o=e(520),u=e(521);t.exports=n},{447:447,448:448,460:460,520:520,521:521}],430:[function(e,t,r){function n(e,t,r,h,m,y,g){var b;if(r&&(b=m?r(e,h,m):r(e)),void 0!==b)return b;if(!f(e))return e;var E=c(e);if(E){if(b=u(e),!t)return i(e,b)}else{var S=N.call(e),A=S==v;if(S!=x&&S!=d&&(!A||m))return j[S]?p(e,S,t):m?e:{};if(b=l(A?{}:e),!t)return s(b,e)}y||(y=[]),g||(g=[]);for(var D=y.length;D--;)if(y[D]==e)return g[D];return y.push(e),g.push(b),(E?a:o)(e,function(i,a){b[a]=n(i,t,r,a,e,y,g)}),b}var i=e(420),a=e(421),s=e(428),o=e(438),u=e(480),p=e(481),l=e(482),c=e(497),f=e(503),d="[object Arguments]",h="[object Array]",m="[object Boolean]",y="[object Date]",g="[object Error]",v="[object Function]",b="[object Map]",E="[object Number]",x="[object Object]",S="[object RegExp]",A="[object Set]",D="[object String]",C="[object WeakMap]",w="[object ArrayBuffer]",I="[object Float32Array]",_="[object Float64Array]",F="[object Int8Array]",k="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",T="[object Uint8ClampedArray]",M="[object Uint16Array]",O="[object Uint32Array]",j={};j[d]=j[h]=j[w]=j[m]=j[y]=j[I]=j[_]=j[F]=j[k]=j[P]=j[E]=j[x]=j[S]=j[D]=j[B]=j[T]=j[M]=j[O]=!0,j[g]=j[v]=j[b]=j[A]=j[C]=!1;var L=Object.prototype,N=L.toString;t.exports=n},{420:420,421:421,428:428,438:438,480:480,481:481,482:482,497:497,503:503}],431:[function(e,t,r){function n(e,t){if(e!==t){var r=null===e,n=void 0===e,i=e===e,a=null===t,s=void 0===t,o=t===t;if(e>t&&!a||!i||r&&!s&&o||n&&o)return 1;if(t>e&&!r||!o||a&&!n&&i||s&&i)return-1}return 0}t.exports=n},{}],432:[function(e,t,r){function n(e,t,r){r||(r={});for(var n=-1,i=t.length;++n<i;){var a=t[n];r[a]=e[a]}return r}t.exports=n},{}],433:[function(e,t,r){var n=e(438),i=e(466),a=i(n);t.exports=a},{438:438,466:466}],434:[function(e,t,r){var n=e(439),i=e(466),a=i(n,!0);t.exports=a},{439:439,466:466}],435:[function(e,t,r){function n(e,t,r,p){p||(p=[]);for(var l=-1,c=e.length;++l<c;){var f=e[l];u(f)&&o(f)&&(r||s(f)||a(f))?t?n(f,t,r,p):i(p,f):r||(p[p.length]=f)}return p}var i=e(423),a=e(496),s=e(497),o=e(483),u=e(488);t.exports=n},{423:423,483:483,488:488,496:496,497:497}],436:[function(e,t,r){var n=e(467),i=n();t.exports=i},{467:467}],437:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(436),a=e(514);t.exports=n},{436:436,514:514}],438:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(436),a=e(513);t.exports=n},{436:436,513:513}],439:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(440),a=e(513);t.exports=n},{440:440,513:513}],440:[function(e,t,r){var n=e(467),i=n(!0);t.exports=i},{467:467}],441:[function(e,t,r){function n(e,t,r){if(null!=e){void 0!==r&&r in i(e)&&(t=[r]);for(var n=0,a=t.length;null!=e&&a>n;)e=e[t[n++]];return n&&n==a?e:void 0}}var i=e(492);t.exports=n},{492:492}],442:[function(e,t,r){function n(e,t,r){if(t!==t)return i(e,r);for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var i=e(479);t.exports=n},{479:479}],443:[function(e,t,r){function n(e,t,r,o,u,p){return e===t?!0:null==e||null==t||!a(e)&&!s(t)?e!==e&&t!==t:i(e,t,n,r,o,u,p)}var i=e(444),a=e(503),s=e(488);t.exports=n},{444:444,488:488,503:503}],444:[function(e,t,r){function n(e,t,r,n,f,m,y){var g=o(e),v=o(t),b=l,E=l;g||(b=h.call(e),b==p?b=c:b!=c&&(g=u(e))),v||(E=h.call(t),E==p?E=c:E!=c&&(v=u(t)));var x=b==c,S=E==c,A=b==E;if(A&&!g&&!x)return a(e,t,b);if(!f){var D=x&&d.call(e,"__wrapped__"),C=S&&d.call(t,"__wrapped__");if(D||C)return r(D?e.value():e,C?t.value():t,n,f,m,y)}if(!A)return!1;m||(m=[]),y||(y=[]);for(var w=m.length;w--;)if(m[w]==e)return y[w]==t;m.push(e),y.push(t);var I=(g?i:s)(e,t,r,n,f,m,y);return m.pop(),y.pop(),I}var i=e(472),a=e(473),s=e(474),o=e(497),u=e(507),p="[object Arguments]",l="[object Array]",c="[object Object]",f=Object.prototype,d=f.hasOwnProperty,h=f.toString;t.exports=n},{472:472,473:473,474:474,497:497,507:507}],445:[function(e,t,r){function n(e,t,r){var n=t.length,s=n,o=!r;if(null==e)return!s;for(e=a(e);n--;){var u=t[n];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++n<s;){u=t[n];var p=u[0],l=e[p],c=u[1];if(o&&u[2]){if(void 0===l&&!(p in e))return!1}else{var f=r?r(l,c,p):void 0;if(!(void 0===f?i(c,l,r,!0):f))return!1}}return!0}var i=e(443),a=e(492);t.exports=n},{443:443,492:492}],446:[function(e,t,r){function n(e,t){var r=-1,n=a(e)?Array(e.length):[];return i(e,function(e,i,a){n[++r]=t(e,i,a)}),n}var i=e(433),a=e(483);t.exports=n},{433:433,483:483}],447:[function(e,t,r){function n(e){var t=a(e);if(1==t.length&&t[0][2]){var r=t[0][0],n=t[0][1];return function(e){return null==e?!1:e[r]===n&&(void 0!==n||r in s(e))}}return function(e){return i(e,t)}}var i=e(445),a=e(477),s=e(492);t.exports=n},{445:445,477:477,492:492}],448:[function(e,t,r){function n(e,t){var r=o(e),n=u(e)&&p(t),d=e+"";return e=f(e),function(o){if(null==o)return!1;var u=d;if(o=c(o),(r||!n)&&!(u in o)){if(o=1==e.length?o:i(o,s(e,0,-1)),null==o)return!1;u=l(e),o=c(o)}return o[u]===t?void 0!==t||u in o:a(t,o[u],void 0,!0)}}var i=e(441),a=e(443),s=e(454),o=e(497),u=e(486),p=e(489),l=e(407),c=e(492),f=e(493);t.exports=n},{407:407,441:441,443:443,454:454,486:486,489:489,492:492,493:493,497:497}],449:[function(e,t,r){function n(e,t,r,f,d){if(!u(e))return e;var h=o(t)&&(s(t)||l(t)),m=h?void 0:c(t);return i(m||t,function(i,s){if(m&&(s=i,i=t[s]),p(i))f||(f=[]),d||(d=[]),a(e,t,s,n,r,f,d);else{var o=e[s],u=r?r(o,i,s,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||s in e)||!l&&(u===u?u===o:o!==o)||(e[s]=u)}}),e}var i=e(421),a=e(450),s=e(497),o=e(483),u=e(503),p=e(488),l=e(507),c=e(513);t.exports=n},{421:421,450:450,483:483,488:488,497:497,503:503,507:507,513:513}],450:[function(e,t,r){function n(e,t,r,n,c,f,d){for(var h=f.length,m=t[r];h--;)if(f[h]==m)return void(e[r]=d[h]);var y=e[r],g=c?c(y,m,r,e,t):void 0,v=void 0===g;v&&(g=m,o(m)&&(s(m)||p(m))?g=s(y)?y:o(y)?i(y):[]:u(m)||a(m)?g=a(y)?l(y):u(y)?y:{}:v=!1),f.push(m),d.push(g),v?e[r]=n(g,m,c,f,d):(g===g?g!==y:y===y)&&(e[r]=g)}var i=e(420),a=e(496),s=e(497),o=e(483),u=e(504),p=e(507),l=e(508);t.exports=n},{420:420,483:483,496:496,497:497,504:504,507:507,508:508}],451:[function(e,t,r){function n(e){return function(t){return null==t?void 0:t[e]}}t.exports=n},{}],452:[function(e,t,r){function n(e){var t=e+"";return e=a(e),function(r){return i(r,e,t)}}var i=e(441),a=e(493);t.exports=n},{441:441,493:493}],453:[function(e,t,r){function n(e,t,r,n,i){return i(e,function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)}),r}t.exports=n},{}],454:[function(e,t,r){function n(e,t,r){var n=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),r=void 0===r||r>i?i:+r||0,0>r&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a}t.exports=n},{}],455:[function(e,t,r){function n(e,t){var r;return i(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}var i=e(433);t.exports=n},{433:433}],456:[function(e,t,r){function n(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}t.exports=n},{}],457:[function(e,t,r){function n(e){return null==e?"":e+""}t.exports=n},{}],458:[function(e,t,r){function n(e,t){var r=-1,n=i,u=e.length,p=!0,l=p&&u>=o,c=l?s():null,f=[];c?(n=a,p=!1):(l=!1,c=t?[]:f);e:for(;++r<u;){var d=e[r],h=t?t(d,r,e):d;if(p&&d===d){for(var m=c.length;m--;)if(c[m]===h)continue e;t&&c.push(h),f.push(d)}else n(c,h,0)<0&&((t||l)&&c.push(h),f.push(d))}return f}var i=e(442),a=e(462),s=e(468),o=200;t.exports=n},{442:442,462:462,468:468}],459:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e[t[r]];return i}t.exports=n},{}],460:[function(e,t,r){function n(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,a){return e.call(t,r,n,i,a)};case 5:return function(r,n,i,a,s){return e.call(t,r,n,i,a,s)}}return function(){return e.apply(t,arguments)}}var i=e(520);t.exports=n},{520:520}],461:[function(e,t,r){(function(e){function r(e){var t=new n(e.byteLength),r=new i(t);return r.set(new i(e)),t}var n=e.ArrayBuffer,i=e.Uint8Array;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],462:[function(e,t,r){function n(e,t){var r=e.data,n="string"==typeof t||i(t)?r.set.has(t):r.hash[t];return n?0:-1}var i=e(503);t.exports=n},{503:503}],463:[function(e,t,r){function n(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=e(503);t.exports=n},{503:503}],464:[function(e,t,r){function n(e,t){return i(e.criteria,t.criteria)||e.index-t.index}var i=e(431);t.exports=n},{431:431}],465:[function(e,t,r){function n(e){return s(function(t,r){var n=-1,s=null==t?0:r.length,o=s>2?r[s-2]:void 0,u=s>2?r[2]:void 0,p=s>1?r[s-1]:void 0;for("function"==typeof o?(o=i(o,p,5),s-=2):(o="function"==typeof p?p:void 0,s-=o?1:0),u&&a(r[0],r[1],u)&&(o=3>s?void 0:o,s=1);++n<s;){var l=r[n];l&&e(t,l,o)}return t})}var i=e(460),a=e(485),s=e(418);t.exports=n},{418:418,460:460,485:485}],466:[function(e,t,r){function n(e,t){return function(r,n){var o=r?i(r):0;if(!a(o))return e(r,n);for(var u=t?o:-1,p=s(r);(t?u--:++u<o)&&n(p[u],u,p)!==!1;);return r}}var i=e(476),a=e(487),s=e(492);t.exports=n},{476:476,487:487,492:492}],467:[function(e,t,r){function n(e){return function(t,r,n){for(var a=i(t),s=n(t),o=s.length,u=e?o:-1;e?u--:++u<o;){var p=s[u];if(r(a[p],p,a)===!1)break}return t}}var i=e(492);t.exports=n},{492:492}],468:[function(e,t,r){(function(r){function n(e){return o&&s?new i(e):null}var i=e(419),a=e(478),s=a(r,"Set"),o=a(Object,"create");t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{419:419,478:478}],469:[function(e,t,r){function n(e,t){return i(function(r){var n=r[0];return null==n?n:(r.push(t),e.apply(void 0,r))})}var i=e(418);t.exports=n},{418:418}],470:[function(e,t,r){function n(e,t){return function(r,n,s){return"function"==typeof n&&void 0===s&&a(r)?e(r,n):t(r,i(n,s,3))}}var i=e(460),a=e(497);t.exports=n},{460:460,497:497}],471:[function(e,t,r){function n(e,t){return function(r,n,o,u){var p=arguments.length<3;return"function"==typeof n&&void 0===u&&s(r)?e(r,n,o,p):a(r,i(n,u,4),o,p,t)}}var i=e(429),a=e(453),s=e(497);t.exports=n},{429:429,453:453,497:497}],472:[function(e,t,r){function n(e,t,r,n,a,s,o){var u=-1,p=e.length,l=t.length;if(p!=l&&!(a&&l>p))return!1;for(;++u<p;){var c=e[u],f=t[u],d=n?n(a?f:c,a?c:f,u):void 0;if(void 0!==d){if(d)continue;return!1}if(a){if(!i(t,function(e){return c===e||r(c,e,n,a,s,o)}))return!1}else if(c!==f&&!r(c,f,n,a,s,o))return!1}return!0}var i=e(425);t.exports=n},{425:425}],473:[function(e,t,r){function n(e,t,r){switch(r){case i:case a:return+e==+t;case s:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;case u:case p:return e==t+""}return!1}var i="[object Boolean]",a="[object Date]",s="[object Error]",o="[object Number]",u="[object RegExp]",p="[object String]";t.exports=n},{}],474:[function(e,t,r){function n(e,t,r,n,a,o,u){var p=i(e),l=p.length,c=i(t),f=c.length;if(l!=f&&!a)return!1;for(var d=l;d--;){var h=p[d];if(!(a?h in t:s.call(t,h)))return!1}for(var m=a;++d<l;){h=p[d];var y=e[h],g=t[h],v=n?n(a?g:y,a?y:g,h):void 0;if(!(void 0===v?r(y,g,n,a,o,u):v))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,E=t.constructor;if(b!=E&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof E&&E instanceof E))return!1}return!0}var i=e(513),a=Object.prototype,s=a.hasOwnProperty;t.exports=n},{513:513}],475:[function(e,t,r){function n(e,t,r){return t?e=i[e]:r&&(e=a[e]),"\\"+e}var i={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},a={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};t.exports=n},{}],476:[function(e,t,r){var n=e(451),i=n("length");t.exports=i},{451:451}],477:[function(e,t,r){function n(e){for(var t=a(e),r=t.length;r--;)t[r][2]=i(t[r][1]);return t}var i=e(489),a=e(516);t.exports=n},{489:489,516:516}],478:[function(e,t,r){function n(e,t){var r=null==e?void 0:e[t];return i(r)?r:void 0}var i=e(501);t.exports=n},{501:501}],479:[function(e,t,r){function n(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}t.exports=n},{}],480:[function(e,t,r){function n(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&a.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var i=Object.prototype,a=i.hasOwnProperty;t.exports=n},{}],481:[function(e,t,r){function n(e,t,r){var n=e.constructor;switch(t){case l:return i(e);case a:case s:return new n(+e);case c:case f:case d:case h:case m:case y:case g:case v:case b:var x=e.buffer;return new n(r?i(x):x,e.byteOffset,e.length);case o:case p:return new n(e);case u:var S=new n(e.source,E.exec(e));S.lastIndex=e.lastIndex}return S}var i=e(461),a="[object Boolean]",s="[object Date]",o="[object Number]",u="[object RegExp]",p="[object String]",l="[object ArrayBuffer]",c="[object Float32Array]",f="[object Float64Array]",d="[object Int8Array]",h="[object Int16Array]",m="[object Int32Array]",y="[object Uint8Array]",g="[object Uint8ClampedArray]",v="[object Uint16Array]",b="[object Uint32Array]",E=/\w*$/;t.exports=n},{461:461}],482:[function(e,t,r){function n(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}t.exports=n},{}],483:[function(e,t,r){function n(e){return null!=e&&a(i(e))}var i=e(476),a=e(487);t.exports=n},{476:476,487:487}],484:[function(e,t,r){function n(e,t){return e="number"==typeof e||i.test(e)?+e:-1,t=null==t?a:t,e>-1&&e%1==0&&t>e}var i=/^\d+$/,a=9007199254740991;t.exports=n},{}],485:[function(e,t,r){function n(e,t,r){if(!s(r))return!1;var n=typeof t;if("number"==n?i(r)&&a(t,r.length):"string"==n&&t in r){var o=r[t];return e===e?e===o:o!==o}return!1}var i=e(483),a=e(484),s=e(503);t.exports=n},{483:483,484:484,503:503}],486:[function(e,t,r){function n(e,t){var r=typeof e;if("string"==r&&o.test(e)||"number"==r)return!0;if(i(e))return!1;var n=!s.test(e);return n||null!=t&&e in a(t)}var i=e(497),a=e(492),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,o=/^\w*$/;t.exports=n},{492:492,497:497}],487:[function(e,t,r){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=n},{}],488:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],489:[function(e,t,r){function n(e){return e===e&&!i(e)}var i=e(503);t.exports=n},{503:503}],490:[function(e,t,r){function n(e){for(var t=u(e),r=t.length,n=r&&e.length,p=!!n&&o(n)&&(a(e)||i(e)),c=-1,f=[];++c<r;){var d=t[c];(p&&s(d,n)||l.call(e,d))&&f.push(d)}return f}var i=e(496),a=e(497),s=e(484),o=e(487),u=e(514),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{484:484,487:487,496:496,497:497,514:514}],491:[function(e,t,r){function n(e,t){for(var r,n=-1,i=e.length,a=-1,s=[];++n<i;){var o=e[n],u=t?t(o,n,e):o;n&&r===u||(r=u,s[++a]=o)}return s}t.exports=n},{}],492:[function(e,t,r){function n(e){return i(e)?e:Object(e)}var i=e(503);t.exports=n},{503:503}],493:[function(e,t,r){function n(e){if(a(e))return e;var t=[];return i(e).replace(s,function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)}),t}var i=e(457),a=e(497),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,o=/\\(\\)?/g;t.exports=n},{457:457,497:497}],494:[function(e,t,r){function n(e,t,r,n){return t&&"boolean"!=typeof t&&s(e,t,r)?t=!1:"function"==typeof t&&(n=r,r=t,t=!1),"function"==typeof r?i(e,t,a(r,n,3)):i(e,t)}var i=e(430),a=e(460),s=e(485);t.exports=n},{430:430,460:460,485:485}],495:[function(e,t,r){function n(e,t,r){return"function"==typeof t?i(e,!0,a(t,r,3)):i(e,!0)}var i=e(430),a=e(460);t.exports=n},{430:430,460:460}],496:[function(e,t,r){function n(e){return a(e)&&i(e)&&o.call(e,"callee")&&!u.call(e,"callee")}var i=e(483),a=e(488),s=Object.prototype,o=s.hasOwnProperty,u=s.propertyIsEnumerable;t.exports=n},{483:483,488:488}],497:[function(e,t,r){var n=e(478),i=e(487),a=e(488),s="[object Array]",o=Object.prototype,u=o.toString,p=n(Array,"isArray"),l=p||function(e){return a(e)&&i(e.length)&&u.call(e)==s};t.exports=l},{478:478,487:487,488:488}],498:[function(e,t,r){function n(e){return e===!0||e===!1||i(e)&&o.call(e)==a}var i=e(488),a="[object Boolean]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],499:[function(e,t,r){function n(e){return null==e?!0:s(e)&&(a(e)||p(e)||i(e)||u(e)&&o(e.splice))?!e.length:!l(e).length}var i=e(496),a=e(497),s=e(483),o=e(500),u=e(488),p=e(506),l=e(513);t.exports=n},{483:483,488:488,496:496,497:497,500:500,506:506,513:513}],500:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(503),a="[object Function]",s=Object.prototype,o=s.toString;t.exports=n},{503:503}],501:[function(e,t,r){function n(e){return null==e?!1:i(e)?l.test(u.call(e)):a(e)&&s.test(e)}var i=e(500),a=e(488),s=/^\[object .+?Constructor\]$/,o=Object.prototype,u=Function.prototype.toString,p=o.hasOwnProperty,l=RegExp("^"+u.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},{488:488,500:500}],502:[function(e,t,r){function n(e){return"number"==typeof e||i(e)&&o.call(e)==a}var i=e(488),a="[object Number]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],503:[function(e,t,r){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=n},{}],504:[function(e,t,r){function n(e){var t;if(!s(e)||l.call(e)!=o||a(e)||!p.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var r;return i(e,function(e,t){r=t}),void 0===r||p.call(e,r)}var i=e(437),a=e(496),s=e(488),o="[object Object]",u=Object.prototype,p=u.hasOwnProperty,l=u.toString;t.exports=n},{437:437,488:488,496:496}],505:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(503),a="[object RegExp]",s=Object.prototype,o=s.toString;t.exports=n},{503:503}],506:[function(e,t,r){function n(e){return"string"==typeof e||i(e)&&o.call(e)==a}var i=e(488),a="[object String]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],507:[function(e,t,r){function n(e){return a(e)&&i(e.length)&&!!F[P.call(e)]}var i=e(487),a=e(488),s="[object Arguments]",o="[object Array]",u="[object Boolean]",p="[object Date]",l="[object Error]",c="[object Function]",f="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",y="[object Set]",g="[object String]",v="[object WeakMap]",b="[object ArrayBuffer]",E="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",C="[object Uint8Array]",w="[object Uint8ClampedArray]",I="[object Uint16Array]",_="[object Uint32Array]",F={};F[E]=F[x]=F[S]=F[A]=F[D]=F[C]=F[w]=F[I]=F[_]=!0,F[s]=F[o]=F[b]=F[u]=F[p]=F[l]=F[c]=F[f]=F[d]=F[h]=F[m]=F[y]=F[g]=F[v]=!1;var k=Object.prototype,P=k.toString;t.exports=n},{487:487,488:488}],508:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(432),a=e(514);t.exports=n},{432:432,514:514}],509:[function(e,t,r){var n=e(427),i=e(428),a=e(465),s=a(function(e,t,r){return r?n(e,t,r):i(e,t)});t.exports=s},{427:427,428:428,465:465}],510:[function(e,t,r){var n=e(509),i=e(426),a=e(469),s=a(n,i);t.exports=s},{426:426,469:469,509:509}],511:[function(e,t,r){t.exports=e(509)},{509:509}],512:[function(e,t,r){function n(e,t){if(null==e)return!1;var r=h.call(e,t);if(!r&&!p(t)){if(t=f(t),e=1==t.length?e:i(e,a(t,0,-1)),null==e)return!1;t=c(t),r=h.call(e,t)}return r||l(e.length)&&u(t,e.length)&&(o(e)||s(e))}var i=e(441),a=e(454),s=e(496),o=e(497),u=e(484),p=e(486),l=e(487),c=e(407),f=e(493),d=Object.prototype,h=d.hasOwnProperty;t.exports=n},{407:407,441:441,454:454,484:484,486:486,487:487,493:493,496:496,497:497}],513:[function(e,t,r){var n=e(478),i=e(483),a=e(503),s=e(490),o=n(Object,"keys"),u=o?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?s(e):a(e)?o(e):[]}:s;t.exports=u},{478:478,483:483,490:490,503:503}],514:[function(e,t,r){function n(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&o(t)&&(a(e)||i(e))&&t||0;for(var r=e.constructor,n=-1,p="function"==typeof r&&r.prototype===e,c=Array(t),f=t>0;++n<t;)c[n]=n+"";for(var d in e)f&&s(d,t)||"constructor"==d&&(p||!l.call(e,d))||c.push(d);return c}var i=e(496),a=e(497),s=e(484),o=e(487),u=e(503),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{484:484,487:487,496:496,497:497,503:503}],515:[function(e,t,r){var n=e(449),i=e(465),a=i(n);t.exports=a},{449:449,465:465}],516:[function(e,t,r){function n(e){e=a(e);for(var t=-1,r=i(e),n=r.length,s=Array(n);++t<n;){var o=r[t];s[t]=[o,e[o]]}return s}var i=e(513),a=e(492);t.exports=n},{492:492,513:513}],517:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(459),a=e(513);t.exports=n},{459:459,513:513}],518:[function(e,t,r){function n(e){return e=i(e),e&&o.test(e)?e.replace(s,a):e||"(?:)"}var i=e(457),a=e(475),s=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,o=RegExp(s.source);t.exports=n},{457:457,475:475}],519:[function(e,t,r){function n(e,t,r){return e=i(e),r=null==r?0:a(0>r?0:+r||0,e.length),e.lastIndexOf(t,r)==r}var i=e(457),a=Math.min;t.exports=n},{457:457}],520:[function(e,t,r){function n(e){return e}t.exports=n},{}],521:[function(e,t,r){function n(e){return s(e)?i(e):a(e)}var i=e(451),a=e(452),s=e(486);t.exports=n},{451:451,452:452,486:486}],522:[function(e,t,r){function n(e){return e.split("").reduce(function(e,t){return e[t]=!0,e},{})}function i(e,t){return t=t||{},function(r,n,i){return s(r,e,t)}}function a(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function s(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),r.nocomment||"#"!==t.charAt(0)?""===t.trim()?""===e:new o(t,r).match(e):!1}function o(e,t){if(!(this instanceof o))return new o(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==y.sep&&(e=e.split(y.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function u(){if(!this._made){var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(C)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r}}function p(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=e.length;a>i&&"!"===e.charAt(i);i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}}function l(e,t){if(t||(t=this instanceof o?this.options:{}),e="undefined"==typeof e?this.pattern:e,"undefined"==typeof e)throw new Error("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:b(e)}function c(e,t){function r(){if(a){switch(a){case"*":o+=x,u=!0;break;case"?":o+=E,u=!0;break;default:o+="\\"+a}g.debug("clearStateChar %j %j",a,o),a=!1}}var n=this.options;if(!n.noglobstar&&"**"===e)return v;if(""===e)return"";for(var i,a,s,o="",u=!!n.nocase,p=!1,l=[],c=[],f=!1,d=-1,m=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,b=0,S=e.length;S>b&&(s=e.charAt(b));b++)if(this.debug("%s %s %s %j",e,b,o,s),p&&D[s])o+="\\"+s,p=!1;else switch(s){case"/":return!1;case"\\":r(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,b,o,s),f){this.debug(" in class"),"!"===s&&b===m+1&&(s="^"),o+=s;continue}g.debug("call clearStateChar %j",a),r(),a=s,n.noext&&r();continue;case"(":if(f){o+="(";continue}if(!a){o+="\\(";continue}i=a,l.push({type:i,start:b-1,reStart:o.length}),o+="!"===a?"(?:(?!(?:":"(?:",this.debug("plType %j %j",a,o),a=!1;continue;case")":if(f||!l.length){o+="\\)";continue}r(),u=!0,o+=")";var A=l.pop();switch(i=A.type){case"!":c.push(A),o+=")[^/]*?)",A.reEnd=o.length;break;case"?":case"+":case"*":o+=i;break;case"@":}continue;case"|":if(f||!l.length||p){o+="\\|",p=!1;continue}r(),o+="|";continue;case"[":if(r(),f){o+="\\"+s;continue}f=!0,m=b,d=o.length,o+=s;continue;case"]":if(b===m+1||!f){o+="\\"+s,p=!1;continue}if(f){var C=e.substring(m+1,b);try{RegExp("["+C+"]")}catch(I){var _=this.parse(C,w);o=o.substr(0,d)+"\\["+_[0]+"\\]",u=u||_[1],f=!1;continue}}u=!0,f=!1,o+=s;continue;default:r(),p?p=!1:!D[s]||"^"===s&&f||(o+="\\"),o+=s}for(f&&(C=e.substr(m+1),_=this.parse(C,w),o=o.substr(0,d)+"\\["+_[0],u=u||_[1]),A=l.pop();A;A=l.pop()){var F=o.slice(A.reStart+3);F=F.replace(/((?:\\{2})*)(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",F,F);var k="*"===A.type?x:"?"===A.type?E:"\\"+A.type;u=!0,o=o.slice(0,A.reStart)+k+"\\("+F}r(),p&&(o+="\\\\");var P=!1;switch(o.charAt(0)){case".":case"[":case"(":P=!0}for(var B=c.length-1;B>-1;B--){var T=c[B],M=o.slice(0,T.reStart),O=o.slice(T.reStart,T.reEnd-8),j=o.slice(T.reEnd-8,T.reEnd),L=o.slice(T.reEnd);j+=L;var N=M.split("(").length-1,R=L;for(b=0;N>b;b++)R=R.replace(/\)[+*?]?/,"");L=R;var V="";""===L&&t!==w&&(V="$");var U=M+O+L+V+j;o=U}if(""!==o&&u&&(o="(?=.)"+o),P&&(o=y+o),t===w)return[o,u];if(!u)return h(e);var q=n.nocase?"i":"",G=new RegExp("^"+o+"$",q);return G._glob=e,G._src=o,G}function f(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?x:t.dot?S:A,n=t.nocase?"i":"",i=e.map(function(e){return e.map(function(e){return e===v?r:"string"==typeof e?m(e):e._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch(a){this.regexp=!1}return this.regexp}function d(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==y.sep&&(e=e.split(y.sep).join("/")),e=e.split(C),this.debug(this.pattern,"split",e);var n=this.set;this.debug(this.pattern,"set",n);var i,a;for(a=e.length-1;a>=0&&!(i=e[a]);a--);for(a=0;a<n.length;a++){var s=n[a],o=e;r.matchBase&&1===s.length&&(o=[i]);var u=this.matchOne(o,s,t);if(u)return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}function h(e){return e.replace(/\\(.)/g,"$1")}function m(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}t.exports=s,s.Minimatch=o;var y={sep:"/"};try{y=e(9)}catch(g){}var v=s.GLOBSTAR=o.GLOBSTAR={},b=e(523),E="[^/]",x=E+"*?",S="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",A="(?:(?!(?:\\/|^)\\.).)*?",D=n("().*{}+?[]^$\\!"),C=/\/+/;s.filter=i,s.defaults=function(e){if(!e||!Object.keys(e).length)return s;var t=s,r=function(r,n,i){return t.minimatch(r,n,a(e,i))};return r.Minimatch=function(r,n){return new t.Minimatch(r,a(e,n))},r},o.defaults=function(e){return e&&Object.keys(e).length?s.defaults(e).Minimatch:o},o.prototype.debug=function(){},o.prototype.make=u,o.prototype.parseNegate=p,s.braceExpand=function(e,t){return l(e,t)},o.prototype.braceExpand=l,o.prototype.parse=c;var w={};s.makeRe=function(e,t){return new o(e,t||{}).makeRe()},o.prototype.makeRe=f,s.match=function(e,t,r){r=r||{};var n=new o(t,r);return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},o.prototype.match=d,o.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{"this":this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,s=e.length,o=t.length;s>i&&o>a;i++,a++){this.debug("matchOne loop");var u=t[a],p=e[i];if(this.debug(t,u,p),u===!1)return!1;if(u===v){this.debug("GLOBSTAR",[t,u,p]);var l=i,c=a+1;if(c===o){for(this.debug("** at the end");s>i;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;s>l;){var f=e[l];if(this.debug("\nglobstar while",e,l,t,c,f),this.matchOne(e.slice(l),t.slice(c),r))return this.debug("globstar found match!",l,s,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,l,t,c);break}this.debug("globstar swallow a segment, and continue"),l++}return r&&(this.debug("\n>>> no match, partial?",e,l,t,c),l===s)?!0:!1}var d;if("string"==typeof u?(d=n.nocase?p.toLowerCase()===u.toLowerCase():p===u,this.debug("string match",u,p,d)):(d=p.match(u),this.debug("pattern match",u,p,d)),!d)return!1}if(i===s&&a===o)return!0;if(i===s)return r;if(a===o){var h=i===s-1&&""===e[i];return h}throw new Error("wtf?")}},{523:523,9:9}],523:[function(e,t,r){function n(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function i(e){return e.split("\\\\").join(m).split("\\{").join(y).split("\\}").join(g).split("\\,").join(v).split("\\.").join(b)}function a(e){return e.split(m).join("\\").split(y).join("{").split(g).join("}").split(v).join(",").split(b).join(".")}function s(e){if(!e)return[""];var t=[],r=h("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,o=n.split(",");o[o.length-1]+="{"+i+"}";var u=s(a);return a.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),t.push.apply(t,o),t}function o(e){return e?f(i(e),!0).map(a):[]}function u(e){return"{"+e+"}"}function p(e){return/^-?0\d/.test(e)}function l(e,t){return t>=e}function c(e,t){return e>=t}function f(e,t){var r=[],i=h("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=a||o,y=/^(.*,)+(.+)?$/.test(i.body);if(!m&&!y)return i.post.match(/,.*}/)?(e=i.pre+"{"+i.body+g+i.post,f(e)):[e];var v;if(m)v=i.body.split(/\.\./);else if(v=s(i.body),1===v.length&&(v=f(v[0],!1).map(u),1===v.length)){var b=i.post.length?f(i.post,!1):[""];return b.map(function(e){return i.pre+v[0]+e})}var E,x=i.pre,b=i.post.length?f(i.post,!1):[""];if(m){var S=n(v[0]),A=n(v[1]),D=Math.max(v[0].length,v[1].length),C=3==v.length?Math.abs(n(v[2])):1,w=l,I=S>A;I&&(C*=-1,w=c);var _=v.some(p);E=[];for(var F=S;w(F,A);F+=C){var k;if(o)k=String.fromCharCode(F),"\\"===k&&(k="");else if(k=String(F),_){var P=D-k.length;if(P>0){var B=new Array(P+1).join("0");k=0>F?"-"+B+k.slice(1):B+k}}E.push(k)}}else E=d(v,function(e){return f(e,!1)});for(var T=0;T<E.length;T++)for(var M=0;M<b.length;M++){var O=x+E[T]+b[M];(!t||m||O)&&r.push(O)}return r}var d=e(525),h=e(524);t.exports=o;var m="\x00SLASH"+Math.random()+"\x00",y="\x00OPEN"+Math.random()+"\x00",g="\x00CLOSE"+Math.random()+"\x00",v="\x00COMMA"+Math.random()+"\x00",b="\x00PERIOD"+Math.random()+"\x00"},{524:524,525:525}],524:[function(e,t,r){function n(e,t,r){for(var i=0,a={},s=!1,o=0;o<r.length;o++)if(e==r.substr(o,e.length))"start"in a||(a.start=o),i++;else if(t==r.substr(o,t.length)&&"start"in a&&(s=!0,i--,!i))return a.end=o,a.pre=r.substr(0,a.start),a.body=a.end-a.start>1?r.substring(a.start+e.length,a.end):"",a.post=r.slice(a.end+t.length),a;if(i&&s){var u=a.start+e.length;return a=n(e,t,r.substr(u)),a&&(a.start+=u,a.end+=u,a.pre=r.slice(0,u)+a.pre),a}}t.exports=n},{}],525:[function(e,t,r){t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a); }return r};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],526:[function(e,t,r){"use strict";var n=e(1);t.exports=function(e,t){var r="function"==typeof n.access?n.access:n.stat;r(e,function(e){t(null,!e)})},t.exports.sync=function(e){var t="function"==typeof n.accessSync?n.accessSync:n.statSync;try{return t(e),!0}catch(r){return!1}}},{1:1}],527:[function(e,t,r){(function(e){"use strict";function r(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",i=!!n&&":"!==n.charAt(1);return!!r[2]||i}t.exports="win32"===e.platform?n:r,t.exports.posix=r,t.exports.win32=n}).call(this,e(10))},{10:10}],528:[function(e,t,r){"use strict";function n(e,t,r){if(c)try{c.call(l,e,t,{value:r})}catch(n){e[t]=r}else e[t]=r}function i(e){return e&&(n(e,"call",e.call),n(e,"apply",e.apply)),e}function a(e){return f?f.call(l,e):(y.prototype=e||null,new y)}function s(){do var e=o(m.call(h.call(g(),36),2));while(d.call(v,e));return v[e]=e}function o(e){var t={};return t[e]=!0,Object.keys(t)[0]}function u(e){return a(null)}function p(e){function t(t){function r(r,n){return r===o?n?a=null:a||(a=e(t)):void 0}var a;n(t,i,r)}function r(e){return d.call(e,i)||t(e),e[i](o)}var i=s(),o=a(null);return e=e||u,r.forget=function(e){d.call(e,i)&&e[i](o,!0)},r}var l=Object,c=Object.defineProperty,f=Object.create;i(c),i(f);var d=i(Object.prototype.hasOwnProperty),h=i(Number.prototype.toString),m=i(String.prototype.slice),y=function(){},g=Math.random,v=a(null);n(r,"makeUniqueKey",s);var b=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var t=b(e),r=0,n=0,i=t.length;i>r;++r)d.call(v,t[r])||(r>n&&(t[n]=t[r]),++n);return t.length=n,t},n(r,"makeAccessor",p)},{}],529:[function(e,t,r){function n(e){u.ok(this instanceof n),c.Identifier.assert(e),this.nextTempId=0,Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:i()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new f.LeapManager(this)}})}function i(){return l.literal(-1)}function a(e){return c.BreakStatement.check(e)||c.ContinueStatement.check(e)||c.ReturnStatement.check(e)||c.ThrowStatement.check(e)}function s(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function o(e){var t=e.type;return"normal"===t?!y.call(e,"target"):"break"===t||"continue"===t?!y.call(e,"value")&&c.Literal.check(e.target):"return"===t||"throw"===t?y.call(e,"value")&&!y.call(e,"target"):!1}var u=e(2),p=e(560).types,l=(p.builtInTypes.array,p.builders),c=p.namedTypes,f=e(531),d=e(532),h=e(533),m=h.runtimeProperty,y=Object.prototype.hasOwnProperty,g=n.prototype;r.Emitter=n,g.mark=function(e){c.Literal.assert(e);var t=this.listing.length;return-1===e.value?e.value=t:u.strictEqual(e.value,t),this.marked[t]=!0,e},g.emit=function(e){c.Expression.check(e)&&(e=l.expressionStatement(e)),c.Statement.assert(e),this.listing.push(e)},g.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},g.assign=function(e,t){return l.expressionStatement(l.assignmentExpression("=",e,t))},g.contextProperty=function(e,t){return l.memberExpression(this.contextId,t?l.literal(e):l.identifier(e),!!t)},g.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},g.setReturnValue=function(e){c.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},g.clearPendingException=function(e,t){c.Literal.assert(e);var r=l.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,r):this.emit(r)},g.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(l.breakStatement())},g.jumpIf=function(e,t){c.Expression.assert(e),c.Literal.assert(t),this.emit(l.ifStatement(e,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.jumpIfNot=function(e,t){c.Expression.assert(e),c.Literal.assert(t);var r;r=c.UnaryExpression.check(e)&&"!"===e.operator?e.argument:l.unaryExpression("!",e),this.emit(l.ifStatement(r,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)},g.getContextFunction=function(e){return l.functionExpression(e||null,[this.contextId],l.blockStatement([this.getDispatchLoop()]),!1,!1)},g.getDispatchLoop=function(){var e,t=this,r=[],n=!1;return t.listing.forEach(function(i,s){t.marked.hasOwnProperty(s)&&(r.push(l.switchCase(l.literal(s),e=[])),n=!1),n||(e.push(i),a(i)&&(n=!0))}),this.finalLoc.value=this.listing.length,r.push(l.switchCase(this.finalLoc,[]),l.switchCase(l.literal("end"),[l.returnStatement(l.callExpression(this.contextProperty("stop"),[]))])),l.whileStatement(l.literal(1),l.switchStatement(l.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))},g.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return l.arrayExpression(this.tryEntries.map(function(t){var r=t.firstLoc.value;u.ok(r>=e,"try entries out of order"),e=r;var n=t.catchEntry,i=t.finallyEntry,a=[t.firstLoc,n?n.firstLoc:null];return i&&(a[2]=i.firstLoc,a[3]=i.afterLoc),l.arrayExpression(a)}))},g.explode=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Node.assert(r),c.Statement.check(r))return n.explodeStatement(e);if(c.Expression.check(r))return n.explodeExpression(e,t);if(c.Declaration.check(r))throw s(r);switch(r.type){case"Program":return e.get("body").map(n.explodeStatement,n);case"VariableDeclarator":throw s(r);case"Property":case"SwitchCase":case"CatchClause":throw new Error(r.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(r.type))}},g.explodeStatement=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Statement.assert(r),t?c.Identifier.assert(t):t=null,c.BlockStatement.check(r))return e.get("body").each(n.explodeStatement,n);if(!d.containsLeap(r))return void n.emit(r);switch(r.type){case"ExpressionStatement":n.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var a=i();n.leapManager.withEntry(new f.LabeledEntry(a,r.label),function(){n.explodeStatement(e.get("body"),r.label)}),n.mark(a);break;case"WhileStatement":var s=i(),a=i();n.mark(s),n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,s,t),function(){n.explodeStatement(e.get("body"))}),n.jump(s),n.mark(a);break;case"DoWhileStatement":var o=i(),y=i(),a=i();n.mark(o),n.leapManager.withEntry(new f.LoopEntry(a,y,t),function(){n.explode(e.get("body"))}),n.mark(y),n.jumpIf(n.explodeExpression(e.get("test")),o),n.mark(a);break;case"ForStatement":var g=i(),v=i(),a=i();r.init&&n.explode(e.get("init"),!0),n.mark(g),r.test&&n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,v,t),function(){n.explodeStatement(e.get("body"))}),n.mark(v),r.update&&n.explode(e.get("update"),!0),n.jump(g),n.mark(a);break;case"ForInStatement":var g=i(),a=i(),b=n.makeTempVar();n.emitAssign(b,l.callExpression(m("keys"),[n.explodeExpression(e.get("right"))])),n.mark(g);var E=n.makeTempVar();n.jumpIf(l.memberExpression(l.assignmentExpression("=",E,l.callExpression(b,[])),l.identifier("done"),!1),a),n.emitAssign(r.left,l.memberExpression(E,l.identifier("value"),!1)),n.leapManager.withEntry(new f.LoopEntry(a,g,t),function(){n.explodeStatement(e.get("body"))}),n.jump(g),n.mark(a);break;case"BreakStatement":n.emitAbruptCompletion({type:"break",target:n.leapManager.getBreakLoc(r.label)});break;case"ContinueStatement":n.emitAbruptCompletion({type:"continue",target:n.leapManager.getContinueLoc(r.label)});break;case"SwitchStatement":for(var x=n.emitAssign(n.makeTempVar(),n.explodeExpression(e.get("discriminant"))),a=i(),S=i(),A=S,D=[],C=r.cases||[],w=C.length-1;w>=0;--w){var I=C[w];c.SwitchCase.assert(I),I.test?A=l.conditionalExpression(l.binaryExpression("===",x,I.test),D[w]=i(),A):D[w]=S}n.jump(n.explodeExpression(new p.NodePath(A,e,"discriminant"))),n.leapManager.withEntry(new f.SwitchEntry(a),function(){e.get("cases").each(function(e){var t=(e.value,e.name);n.mark(D[t]),e.get("consequent").each(n.explodeStatement,n)})}),n.mark(a),-1===S.value&&(n.mark(S),u.strictEqual(a.value,S.value));break;case"IfStatement":var _=r.alternate&&i(),a=i();n.jumpIfNot(n.explodeExpression(e.get("test")),_||a),n.explodeStatement(e.get("consequent")),_&&(n.jump(a),n.mark(_),n.explodeStatement(e.get("alternate"))),n.mark(a);break;case"ReturnStatement":n.emitAbruptCompletion({type:"return",value:n.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var a=i(),F=r.handler;!F&&r.handlers&&(F=r.handlers[0]||null);var k=F&&i(),P=k&&new f.CatchEntry(k,F.param),B=r.finalizer&&i(),T=B&&new f.FinallyEntry(B,a),M=new f.TryEntry(n.getUnmarkedCurrentLoc(),P,T);n.tryEntries.push(M),n.updateContextPrevLoc(M.firstLoc),n.leapManager.withEntry(M,function(){if(n.explodeStatement(e.get("block")),k){B?n.jump(B):n.jump(a),n.updateContextPrevLoc(n.mark(k));var t=e.get("handler","body"),r=n.makeTempVar();n.clearPendingException(M.firstLoc,r);var i=t.scope,s=F.param.name;c.CatchClause.assert(i.node),u.strictEqual(i.lookup(s),i),p.visit(t,{visitIdentifier:function(e){return h.isReference(e,s)&&e.scope.lookup(s)===i?r:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(s)?!1:void this.traverse(e)}}),n.leapManager.withEntry(P,function(){n.explodeStatement(t)})}B&&(n.updateContextPrevLoc(n.mark(B)),n.leapManager.withEntry(T,function(){n.explodeStatement(e.get("finalizer"))}),n.emit(l.returnStatement(l.callExpression(n.contextProperty("finish"),[T.firstLoc]))))}),n.mark(a);break;case"ThrowStatement":n.emit(l.throwStatement(n.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(r.type))}},g.emitAbruptCompletion=function(e){o(e)||u.ok(!1,"invalid completion record: "+JSON.stringify(e)),u.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=[l.literal(e.type)];"break"===e.type||"continue"===e.type?(c.Literal.assert(e.target),t[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(c.Expression.assert(e.value),t[1]=e.value),this.emit(l.returnStatement(l.callExpression(this.contextProperty("abrupt"),t)))},g.getUnmarkedCurrentLoc=function(){return l.literal(this.listing.length)},g.updateContextPrevLoc=function(e){e?(c.Literal.assert(e),-1===e.value?e.value=this.listing.length:u.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},g.explodeExpression=function(e,t){function r(e){return c.Expression.assert(e),t?void o.emit(e):e}function n(e,t,r){u.ok(t instanceof p.NodePath),u.ok(!r||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var n=o.explodeExpression(t,r);return r||(e||f&&!c.Literal.check(n))&&(n=o.emitAssign(e||o.makeTempVar(),n)),n}u.ok(e instanceof p.NodePath);var a=e.value;if(!a)return a;c.Expression.assert(a);var s,o=this;if(!d.containsLeap(a))return r(a);var f=d.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return r(l.memberExpression(o.explodeExpression(e.get("object")),a.computed?n(null,e.get("property")):a.property,a.computed));case"CallExpression":var h,m=e.get("callee"),y=e.get("arguments"),g=[],v=!1;if(y.each(function(e){v=v||d.containsLeap(e.value)}),c.MemberExpression.check(m.value))if(v){var b=n(o.makeTempVar(),m.get("object")),E=m.value.computed?n(null,m.get("property")):m.value.property;g.unshift(b),h=l.memberExpression(l.memberExpression(b,E,m.value.computed),l.identifier("call"),!1)}else h=o.explodeExpression(m);else h=o.explodeExpression(m),c.MemberExpression.check(h)&&(h=l.sequenceExpression([l.literal(0),h]));return y.each(function(e){g.push(n(null,e))}),r(l.callExpression(h,g));case"NewExpression":return r(l.newExpression(n(null,e.get("callee")),e.get("arguments").map(function(e){return n(null,e)})));case"ObjectExpression":return r(l.objectExpression(e.get("properties").map(function(e){return l.property(e.value.kind,e.value.key,n(null,e.get("value")))})));case"ArrayExpression":return r(l.arrayExpression(e.get("elements").map(function(e){return n(null,e)})));case"SequenceExpression":var x=a.expressions.length-1;return e.get("expressions").each(function(e){e.name===x?s=o.explodeExpression(e,t):o.explodeExpression(e,!0)}),s;case"LogicalExpression":var S=i();t||(s=o.makeTempVar());var A=n(s,e.get("left"));return"&&"===a.operator?o.jumpIfNot(A,S):(u.strictEqual(a.operator,"||"),o.jumpIf(A,S)),n(s,e.get("right"),t),o.mark(S),s;case"ConditionalExpression":var D=i(),S=i(),C=o.explodeExpression(e.get("test"));return o.jumpIfNot(C,D),t||(s=o.makeTempVar()),n(s,e.get("consequent"),t),o.jump(S),o.mark(D),n(s,e.get("alternate"),t),o.mark(S),s;case"UnaryExpression":return r(l.unaryExpression(a.operator,o.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return r(l.binaryExpression(a.operator,n(null,e.get("left")),n(null,e.get("right"))));case"AssignmentExpression":return r(l.assignmentExpression(a.operator,o.explodeExpression(e.get("left")),o.explodeExpression(e.get("right"))));case"UpdateExpression":return r(l.updateExpression(a.operator,o.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":var S=i(),w=a.argument&&o.explodeExpression(e.get("argument"));if(w&&a.delegate){var s=o.makeTempVar();return o.emit(l.returnStatement(l.callExpression(o.contextProperty("delegateYield"),[w,l.literal(s.property.name),S]))),o.mark(S),s}return o.emitAssign(o.contextProperty("next"),S),o.emit(l.returnStatement(w||null)),o.mark(S),o.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{2:2,531:531,532:532,533:533,560:560}],530:[function(e,t,r){var n=e(2),i=e(560).types,a=i.namedTypes,s=i.builders,o=Object.prototype.hasOwnProperty;r.hoist=function(e){function t(e,t){a.VariableDeclaration.assert(e);var n=[];return e.declarations.forEach(function(e){r[e.id.name]=e.id,e.init?n.push(s.assignmentExpression("=",e.id,e.init)):t&&n.push(e.id)}),0===n.length?null:1===n.length?n[0]:s.sequenceExpression(n)}n.ok(e instanceof i.NodePath),a.Function.assert(e.value);var r={};i.visit(e.get("body"),{visitVariableDeclaration:function(e){var r=t(e.value,!1);return null!==r?s.expressionStatement(r):(e.replace(),!1)},visitForStatement:function(e){var r=e.value.init;a.VariableDeclaration.check(r)&&e.get("init").replace(t(r,!1)),this.traverse(e)},visitForInStatement:function(e){var r=e.value.left;a.VariableDeclaration.check(r)&&e.get("left").replace(t(r,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var t=e.value;r[t.id.name]=t.id;var n=(e.parent.node,s.expressionStatement(s.assignmentExpression("=",t.id,s.functionExpression(t.id,t.params,t.body,t.generator,t.expression))));return a.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(n),e.replace()):e.replace(n),!1},visitFunctionExpression:function(e){return!1}});var u={};e.get("params").each(function(e){var t=e.value;a.Identifier.check(t)&&(u[t.name]=t)});var p=[];return Object.keys(r).forEach(function(e){o.call(u,e)||p.push(s.variableDeclarator(r[e],null))}),0===p.length?null:s.variableDeclaration("var",p)}},{2:2,560:560}],531:[function(e,t,r){function n(){f.ok(this instanceof n)}function i(e){n.call(this),h.Literal.assert(e),this.returnLoc=e}function a(e,t,r){n.call(this),h.Literal.assert(e),h.Literal.assert(t),r?h.Identifier.assert(r):r=null,this.breakLoc=e,this.continueLoc=t,this.label=r}function s(e){n.call(this),h.Literal.assert(e),this.breakLoc=e}function o(e,t,r){n.call(this),h.Literal.assert(e),t?f.ok(t instanceof u):t=null,r?f.ok(r instanceof p):r=null,f.ok(t||r),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=r}function u(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.firstLoc=e,this.paramId=t}function p(e,t){n.call(this),h.Literal.assert(e),h.Literal.assert(t),this.firstLoc=e,this.afterLoc=t}function l(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.breakLoc=e,this.label=t}function c(t){f.ok(this instanceof c);var r=e(529).Emitter;f.ok(t instanceof r),this.emitter=t,this.entryStack=[new i(t.finalLoc)]}var f=e(2),d=e(560).types,h=d.namedTypes,m=(d.builders,e(13).inherits);Object.prototype.hasOwnProperty;m(i,n),r.FunctionEntry=i,m(a,n),r.LoopEntry=a,m(s,n),r.SwitchEntry=s,m(o,n),r.TryEntry=o,m(u,n),r.CatchEntry=u,m(p,n),r.FinallyEntry=p,m(l,n),r.LabeledEntry=l;var y=c.prototype;r.LeapManager=c,y.withEntry=function(e,t){f.ok(e instanceof n),this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();f.strictEqual(r,e)}},y._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var n=this.entryStack[r],i=n[e];if(i)if(t){if(n.label&&n.label.name===t.name)return i}else if(!(n instanceof l))return i}return null},y.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},y.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{13:13,2:2,529:529,560:560}],532:[function(e,t,r){function n(e,t){function r(e){function t(e){return r||(o.check(e)?e.some(t):u.Node.check(e)&&(i.strictEqual(r,!1),r=n(e))),r}u.Node.assert(e);var r=!1;return s.eachField(e,function(e,r){t(r)}),r}function n(n){u.Node.assert(n);var i=a(n);return p.call(i,e)?i[e]:p.call(l,n.type)?i[e]=!1:p.call(t,n.type)?i[e]=!0:i[e]=r(n)}return n.onlyChildren=r,n}var i=e(2),a=e(528).makeAccessor(),s=e(560).types,o=s.builtInTypes.array,u=s.namedTypes,p=Object.prototype.hasOwnProperty,l={FunctionExpression:!0},c={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},f={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var d in f)p.call(f,d)&&(c[d]=f[d]);r.hasSideEffects=n("hasSideEffects",c),r.containsLeap=n("containsLeap",f)},{2:2,528:528,560:560}],533:[function(e,t,r){var n=(e(2),e(560).types),i=n.namedTypes,a=n.builders,s=Object.prototype.hasOwnProperty;r.defaults=function(e){for(var t,r=arguments.length,n=1;r>n;++n)if(t=arguments[n])for(var i in t)s.call(t,i)&&!s.call(e,i)&&(e[i]=t[i]);return e},r.runtimeProperty=function(e){return a.memberExpression(a.identifier("regeneratorRuntime"),a.identifier(e),!1)},r.isReference=function(e,t){var r=e.value;if(!i.Identifier.check(r))return!1;if(t&&r.name!==t)return!1;var n=e.parent.value;switch(n.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||n.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:"params"===e.parentPath.name&&n.params===e.parentPath.value&&n.params[e.name]===r?!1:!0;case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{2:2,560:560}],534:[function(e,t,r){function n(t){f.Program.assert(t);var r=e(535).runtime.path,n=p.readFileSync(r,"utf8"),i=l.parse(n,{sourceFileName:r}).program.body,a=t.body;a.unshift.apply(a,i)}function i(e){var t=e.value;if(f.Function.assert(t),t.generator&&f.FunctionDeclaration.check(t)){for(var r=e.parent;r&&!f.BlockStatement.check(r.value)&&!f.Program.check(r.value);)r=r.parent;if(!r)return t.id;var n=a(r),i=n.declarations[0].id,s=n.declarations[0].init.callee.object;f.ArrayExpression.assert(s);var o=s.elements.length;return s.elements.push(t.id),d.memberExpression(i,d.literal(o),!0)}return t.id||(t.id=e.scope.parent.declareTemporary("callee$"))}function a(e){u.ok(e instanceof m);var t=e.node;h.assert(t.body);var r=E(t);if(r.decl)return r.decl;r.decl=d.variableDeclaration("var",[d.variableDeclarator(e.scope.declareTemporary("marked"),d.callExpression(d.memberExpression(d.arrayExpression([]),d.identifier("map"),!1),[b("mark")]))]);for(var n=0;n<t.body.length&&s(e.get("body",n));++n);return e.get("body").insertAt(n,r.decl),r.decl}function s(e){var t=e.value;return f.Statement.assert(t),f.ExpressionStatement.check(t)&&f.Literal.check(t.expression)&&"use strict"===t.expression.value}function o(e,t){u.ok(e instanceof c.NodePath);var r=e.value,n=!1;return l.visit(e,{visitFunction:function(e){return e.value!==r?!1:void this.traverse(e)},visitIdentifier:function(e){return"arguments"===e.value.name&&v.isReference(e)?(e.replace(t),n=!0,!1):void this.traverse(e)}}),n}var u=e(2),p=e(1),l=e(560),c=l.types,f=c.namedTypes,d=c.builders,h=c.builtInTypes.array,m=(c.builtInTypes.object,c.NodePath),y=e(530).hoist,g=e(529).Emitter,v=e(533),b=v.runtimeProperty,E=e(528).makeAccessor();r.transform=function(e,t){t=t||{};var r=e instanceof m?e:new m(e);return x.visit(r,t),e=r.value,(t.includeRuntime===!0||"if used"===t.includeRuntime&&x.wasChangeReported())&&n(f.File.check(e)?e.program:e),t.madeChanges=x.wasChangeReported(),e};var x=c.PathVisitor.fromMethodsObject({reset:function(e,t){this.options=t},visitFunction:function(e){this.traverse(e);var t=e.value,r=t.async&&!this.options.disableAsync;if(t.generator||r){this.reportChanged(),t.expression&&(t.expression=!1,t.body=d.blockStatement([d.returnStatement(t.body)])),r&&S.visit(e.get("body"));var n=[],a=[],s=e.get("body","body");s.each(function(e){var t=e.value;t&&null!=t._blockHoist?n.push(t):a.push(t)}),n.length>0&&s.replace(a);var u=i(e);f.Identifier.assert(t.id);var p=d.identifier(t.id.name+"$"),l=e.scope.declareTemporary("context$"),c=e.scope.declareTemporary("args$"),h=y(e),m=o(e,c);m&&(h=h||d.variableDeclaration("var",[]),h.declarations.push(d.variableDeclarator(c,d.identifier("arguments"))));var v=new g(l);v.explode(e.get("body")),h&&h.declarations.length>0&&n.push(h);var E=[v.getContextFunction(p),t.generator?u:d.literal(null),d.thisExpression()],x=v.getTryLocsList();x&&E.push(x);var A=d.callExpression(b(r?"async":"wrap"),E);n.push(d.returnStatement(A)),t.body=d.blockStatement(n);var D=t.generator;return D&&(t.generator=!1),r&&(t.async=!1),D&&f.Expression.check(t)?d.callExpression(b("mark"),[t]):void 0}},visitForOfStatement:function(e){this.traverse(e);var t,r=e.value,n=e.scope.declareTemporary("t$"),i=d.variableDeclarator(n,d.callExpression(b("values"),[r.right])),a=e.scope.declareTemporary("t$"),s=d.variableDeclarator(a,null),o=r.left;f.VariableDeclaration.check(o)?(t=o.declarations[0].id,o.declarations.push(i,s)):(t=o,o=d.variableDeclaration("var",[i,s])),f.Identifier.assert(t);var u=d.expressionStatement(d.assignmentExpression("=",t,d.memberExpression(a,d.identifier("value"),!1)));return f.BlockStatement.check(r.body)?r.body.body.unshift(u):r.body=d.blockStatement([u,r.body]),d.forStatement(o,d.unaryExpression("!",d.memberExpression(d.assignmentExpression("=",a,d.callExpression(d.memberExpression(n,d.identifier("next"),!1),[])),d.identifier("done"),!1)),null,r.body)}}),S=c.PathVisitor.fromMethodsObject({visitFunction:function(e){return!1},visitAwaitExpression:function(e){var t=e.value.argument;return e.value.all&&(t=d.callExpression(d.memberExpression(d.identifier("Promise"),d.identifier("all"),!1),[t])),d.yieldExpression(d.callExpression(b("awrap"),[t]),!1)}})},{1:1,2:2,528:528,529:529,530:530,533:533,535:535,560:560}],535:[function(e,t,r){(function(r){function n(e,t){function r(e){i.push(e)}function n(){this.queue(a(i.join(""),t).code),this.queue(null)}var i=[];return h(r,n)}function i(){e(577)}function a(e,t){if(t=s(t),!b.test(e))return{code:(t.includeRuntime===!0?d.readFileSync(f.join(r,"runtime.js"),"utf-8")+"\n":"")+e};var n=o(t),i=g.parse(e,n),a=new v.NodePath(i),p=a.get("program");return u(e,t)&&l(p.node),m(p,t),g.print(a,n)}function s(t){return t=y.defaults(t||{},{includeRuntime:!1,supportBlockBinding:!0}),t.esprima||(t.esprima=e(1)),c.ok(/harmony/.test(t.esprima.version),"Bad esprima version: "+t.esprima.version),t}function o(e){function t(t){t in e&&(r[t]=e[t])}var r={range:!0};return t("esprima"),t("sourceFileName"),t("sourceMapName"),t("inputSourceMap"),t("sourceRoot"),r}function u(e,t){var r=!!t.supportBlockBinding;return r&&(E.test(e)||(r=!1)),r}function p(e,t){var r=o(s(t)),n=g.parse(e,r);return l(n.program),g.print(n,r).code}function l(t){v.namedTypes.Program.assert(t);var r=e(536)(t,{ast:!0,disallowUnknownReferences:!1,disallowDuplicated:!1,disallowVars:!1,loopClosures:"iife"});if(r.errors)throw new Error(r.errors.join("\n"));return t}var c=e(2),f=e(9),d=e(1),h=e(1),m=e(534).transform,y=e(533),g=e(560),v=g.types,b=/\bfunction\s*\*|\basync\b/,E=/\b(let|const)\s+/;t.exports=n,n.runtime=i,i.path=f.join(r,"runtime.js"),n.varify=p,n.types=v,n.compile=a,n.transform=m}).call(this,"/node_modules/regenerator")},{1:1,2:2,533:533,534:534,536:536,560:560,577:577,9:9}],536:[function(e,t,r){"use strict";function n(e){return D.someof(e,["const","let"])}function i(e){return D.someof(e,["var","const","let"])}function a(e){return"BlockStatement"===e.type&&D.noneof(e.$parent.type,["FunctionDeclaration","FunctionExpression"])}function s(e){return"ForStatement"===e.type&&e.init&&"VariableDeclaration"===e.init.type&&n(e.init.kind)}function o(e){return u(e)&&"VariableDeclaration"===e.left.type&&n(e.left.kind)}function u(e){return D.someof(e.type,["ForInStatement","ForOfStatement"])}function p(e){return D.someof(e.type,["FunctionDeclaration","FunctionExpression"])}function l(e){return D.someof(e.type,["ForStatement","ForInStatement","ForOfStatement","WhileStatement","DoWhileStatement"])}function c(e){var t=e.$parent;return e.$refToScope||"Identifier"===e.type&&!("VariableDeclarator"===t.type&&t.id===e)&&!("MemberExpression"===t.type&&t.computed===!1&&t.property===e)&&!("Property"===t.type&&t.key===e)&&!("LabeledStatement"===t.type&&t.label===e)&&!("CatchClause"===t.type&&t.param===e)&&!(p(t)&&t.id===e)&&!(p(t)&&D.someof(e,t.params))&&!0}function f(e){return c(e)&&("AssignmentExpression"===e.$parent.type&&e.$parent.left===e||"UpdateExpression"===e.$parent.type&&e.$parent.argument===e)}function d(e,t){if(A(!e.$scope),e.$parent=t,e.$scope=e.$parent?e.$parent.$scope:null,"Program"===e.type)e.$scope=new P({kind:"hoist",node:e,parent:null});else if(p(e))e.$scope=new P({kind:"hoist",node:e,parent:e.$parent.$scope}),e.id&&(A("Identifier"===e.id.type),"FunctionDeclaration"===e.type?e.$parent.$scope.add(e.id.name,"fun",e.id,null):"FunctionExpression"===e.type?e.$scope.add(e.id.name,"fun",e.id,null):A(!1)),e.params.forEach(function(t){e.$scope.add(t.name,"param",t,null)});else if("VariableDeclaration"===e.type)A(i(e.kind)),e.declarations.forEach(function(t){A("VariableDeclarator"===t.type);var r=t.id.name;M.disallowVars&&"var"===e.kind&&B(T(t),"var {0} is not allowed (use let or const)",r),e.$scope.add(r,e.kind,t.id,t.range[1])});else if(s(e)||o(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if(a(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if("CatchClause"===e.type){var r=e.param;e.$scope=new P({kind:"catch-block",node:e,parent:e.$parent.$scope}),e.$scope.add(r.name,"caught",r,null),e.$scope.closestHoistScope().markPropagates(r.name)}}function h(e,t,r){function n(e){for(var t in e){var r=e[t],n=r?"var":"const";i.hasOwn(t)&&i.remove(t),i.add(t,n,{loc:{start:{line:-1}}},-1)}}var i=new P({kind:"hoist",node:{},parent:null}),a={undefined:!1,Infinity:!1,console:!1};return n(a),n(j.reservedVars),n(j.ecmaIdentifiers),t&&t.forEach(function(e){j[e]?n(j[e]):B(-1,'environment "{0}" not found',e)}),r&&n(r),e.parent=i,i.children.push(e),i}function m(e,t,r){function n(e){if(c(e)){t.add(e.name);var r=e.$scope.lookup(e.name);if(i&&!r&&M.disallowUnknownReferences&&B(T(e),"reference to unknown global variable {0}",e.name),i&&r&&D.someof(r.getKind(e.name),["const","let"])){var n=r.getFromPos(e.name),a=e.range[0];A(D.finitenumber(n)),A(D.finitenumber(a)),n>a&&(e.$scope.hasFunctionScopeBetween(r)||B(T(e),"{0} is referenced before its declaration",e.name))}e.$refToScope=r}}var i=D.own(r,"analyze")?r.analyze:!0;F(e,{pre:n})}function y(e,t,r,i){function a(e){A(r.has(e));for(var t=0;;t++){var n=e+"$"+String(t);if(!r.has(n))return n}}function s(e){if("VariableDeclaration"===e.type&&n(e.kind)){var s=e.$scope.closestHoistScope(),o=e.$scope;i.push({start:e.range[0],end:e.range[0]+e.kind.length,str:"var"}),e.declarations.forEach(function(n){A("VariableDeclarator"===n.type);var u=n.id.name;t.declarator(e.kind);var p=o!==s&&(s.hasOwn(u)||s.doesPropagate(u)),l=p?a(u):u;o.remove(u),s.add(l,"var",n.id,n.range[1]),o.moves=o.moves||w(),o.moves.set(u,{name:l,scope:s}),r.add(l),l!==u&&(t.rename(u,l,T(n)),n.id.originalName=u,n.id.name=l,i.push({start:n.id.range[0],end:n.id.range[1],str:l}))}),e.kind="var"}}function o(e){if(e.$refToScope){var t=e.$refToScope.moves&&e.$refToScope.moves.get(e.name);if(t&&(e.$refToScope=t.scope,e.name!==t.name))if(e.originalName=e.name,e.name=t.name,e.alterop){for(var r=null,n=0;n<i.length;n++){var a=i[n];if(a.node===e){r=a;break}}A(r),r.str=t.name}else i.push({start:e.range[0],end:e.range[1],str:t.name})}}F(e,{pre:s}),F(e,{pre:o}),e.$scope.traverse({pre:function(e){delete e.moves}})}function g(e){function t(e,t){return k(function(r){return F(e,{pre:function(e){if(p(e))return!1;var n=!0,i="loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}";"BreakStatement"===e.type?B(T(t),i,t.name,"break",T(e)):"ContinueStatement"===e.type?B(T(t),i,t.name,"continue",T(e)):"ReturnStatement"===e.type?B(T(t),i,t.name,"return",T(e)):"YieldExpression"===e.type?B(T(t),i,t.name,"yield",T(e)):"Identifier"===e.type&&"arguments"===e.name?B(T(t),i,t.name,"arguments",T(e)):"VariableDeclaration"===e.type&&"var"===e.kind?B(T(t),i,t.name,"var",T(e)):n=!1,n&&r(!0)}}),!1})}function r(e){var r=null;if(c(e)&&e.$refToScope&&n(e.$refToScope.getKind(e.name))){for(var i=e.$refToScope.node;;){if(p(i))return;if(l(i)){r=i;break}if(i=i.$parent,!i)return}A(l(r));for(var a=e.$refToScope,s="iife"===M.loopClosures,o=e.$scope;o;o=o.parent){if(o===a)return;if(p(o.node)){if(!s){var u='loop-variable {0} is captured by a loop-closure. Tried "loopClosures": "iife" in defs-config.json?';return B(T(e),u,e.name)}if("ForStatement"===r.type&&a.node===r){var f=a.getNode(e.name);return B(T(f),"Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure",f.name)}if(t(r.body,e))return;r.$iify=!0}}}}F(e,{pre:r})}function v(e,t,r){function n(e,r,n){var i={start:e,end:e,str:r};n&&(i.node=n),t.push(i)}F(e,{pre:function(e){if(e.$iify){var t="BlockStatement"===e.body.type,i=t?e.body.range[0]+1:e.body.range[0],a=t?e.body.range[1]-1:e.body.range[1],s=u(e)&&e.left.declarations[0].id.name,o=C("(function({0}){",s?s:""),p=C("}).call(this{0});",s?", "+s:""),l=r.parse(o+p),c=l.body[0],f=c.expression.callee.object.body;if(t){var d=e.body,h=d.body;d.body=[c],f.body=h}else{var m=e.body;e.body=c,f.body[0]=m}if(n(i,o),s){n(a,"}).call(this, ");var y=c.expression.arguments,g=y[1];g.alterop=!0,n(a,s,g),n(a,");")}else n(a,p)}}})}function b(e){F(e,{pre:function(e){if(f(e)){var t=e.$scope.lookup(e.name);t&&"const"===t.getKind(e.name)&&B(T(e),"can't assign to const variable {0}",e.name)}}})}function E(e,t){F(e,{pre:d});var r=h(e.$scope,M.environments,M.globals),n=I();return r.traverse({pre:function(e){n.addMany(e.decls.keys())}}),m(e,n,t),n}function x(e){F(e,{pre:function(e){for(var t in e)"$"===t[0]&&delete e[t]}})}function S(e,t){for(var r in t)M[r]=t[r];var n;if(D.object(e)){if(!M.ast)return{errors:["Can't produce string output when input is an AST. Did you forget to set options.ast = true?"]};n=e}else{if(!D.string(e))return{errors:["Input was neither an AST object nor a string."]};try{n=M.parse(e,{loc:!0,range:!0})}catch(i){return{errors:[C("line {0} column {1}: Error during input file parsing\n{2}\n{3}",i.lineNumber,i.column,e.split("\n")[i.lineNumber-1],C.repeat(" ",i.column-1)+"^")] }}}var a=n;B.reset();var s=E(a,{});g(a),b(a);var o=[];if(v(a,o,M),B.errors.length>=1)return{errors:B.errors};o.length>0&&(x(a),s=E(a,{analyze:!1})),A(0===B.errors.length);var u=new O;if(y(a,u,s,o),M.ast)return x(a),{stats:u,ast:a};var p=_(e,o);return{stats:u,src:p}}var A=e(2),D=e(547),C=e(546),w=e(548),I=e(549),_=e(542),F=e(544),k=e(545),P=e(540),B=e(537),T=B.getline,M=e(539),O=e(541),j=e(538);t.exports=S},{2:2,537:537,538:538,539:539,540:540,541:541,542:542,544:544,545:545,546:546,547:547,548:548,549:549}],537:[function(e,t,r){"use strict";function n(e,t){a(arguments.length>=2);var r=2===arguments.length?String(t):i.apply(i,Array.prototype.slice.call(arguments,1));n.errors.push(-1===e?r:i("line {0}: {1}",e,r))}var i=e(546),a=e(2);n.reset=function(){n.errors=[]},n.getline=function(e){return e&&e.loc&&e.loc.start?e.loc.start.line:-1},n.reset(),t.exports=n},{2:2,546:546}],538:[function(e,t,r){"use strict";r.reservedVars={arguments:!1,NaN:!1},r.ecmaIdentifiers={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Map:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,Set:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1,WeakMap:!1},r.browser={ArrayBuffer:!1,ArrayBufferView:!1,Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,DataView:!1,DOMParser:!1,defaultStatus:!1,document:!1,Element:!1,event:!1,FileReader:!1,Float32Array:!1,Float64Array:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Image:!1,length:!1,localStorage:!1,location:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,top:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},r.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},r.worker={importScripts:!0,postMessage:!0,self:!0},r.nonstandard={escape:!1,unescape:!1},r.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},r.node={__filename:!1,__dirname:!1,Buffer:!1,DataView:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setTimeout:!1,clearTimeout:!1,setInterval:!1,clearInterval:!1},r.phantom={phantom:!0,require:!0,WebPage:!0},r.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},r.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},r.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},r.jquery={$:!1,jQuery:!1},r.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,Iframe:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},r.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},r.yui={YUI:!1,Y:!1,YUI_config:!1}},{}],539:[function(e,t,r){t.exports={disallowVars:!1,disallowDuplicated:!0,disallowUnknownReferences:!0,parse:e(1).parse}},{1:1}],540:[function(e,t,r){"use strict";function n(e){i(o.someof(e.kind,["hoist","block","catch-block"])),i(o.object(e.node)),i(null===e.parent||o.object(e.parent)),this.kind=e.kind,this.node=e.node,this.parent=e.parent,this.children=[],this.decls=a(),this.written=s(),this.propagates="hoist"===this.kind?s():null,this.parent&&this.parent.children.push(this)}var i=e(2),a=e(548),s=e(549),o=e(547),u=e(546),p=e(537),l=p.getline,c=e(539);n.prototype.print=function(e){e=e||0;var t=this,r=this.decls.keys().map(function(e){return u("{0} [{1}]",e,t.decls.get(e).kind)}).join(", "),n=this.propagates?this.propagates.items().join(", "):"";console.log(u("{0}{1}: {2}. propagates: {3}",u.repeat(" ",e),this.node.type,r,n)),this.children.forEach(function(t){t.print(e+2)})},n.prototype.add=function(e,t,r,n){function a(e){return o.someof(e,["const","let"])}i(o.someof(t,["fun","param","var","caught","const","let"]));var s=this;if(o.someof(t,["fun","param","var"]))for(;"hoist"!==s.kind;){if(s.decls.has(e)&&a(s.decls.get(e).kind))return p(l(r),"{0} is already declared",e);s=s.parent}if(s.decls.has(e)&&(c.disallowDuplicated||a(s.decls.get(e).kind)||a(t)))return p(l(r),"{0} is already declared",e);var u={kind:t,node:r};n&&(i(o.someof(t,["var","const","let"])),u.from=n),s.decls.set(e,u)},n.prototype.getKind=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.kind:null},n.prototype.getNode=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.node:null},n.prototype.getFromPos=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.from:null},n.prototype.hasOwn=function(e){return this.decls.has(e)},n.prototype.remove=function(e){return this.decls.remove(e)},n.prototype.doesPropagate=function(e){return this.propagates.has(e)},n.prototype.markPropagates=function(e){this.propagates.add(e)},n.prototype.closestHoistScope=function(){for(var e=this;"hoist"!==e.kind;)e=e.parent;return e},n.prototype.hasFunctionScopeBetween=function(e){function t(e){return o.someof(e.type,["FunctionDeclaration","FunctionExpression"])}for(var r=this;r;r=r.parent){if(r===e)return!1;if(t(r.node))return!0}throw new Error("wasn't inner scope of outer")},n.prototype.lookup=function(e){for(var t=this;t;t=t.parent){if(t.decls.has(e))return t;"hoist"===t.kind&&t.propagates.add(e)}return null},n.prototype.markWrite=function(e){i(o.string(e)),this.written.add(e)},n.prototype.detectUnmodifiedLets=function(){function e(r){r!==t&&r.decls.keys().forEach(function(e){return"let"!==r.getKind(e)||r.written.has(e)?void 0:p(l(r.getNode(e)),"{0} is declared as let but never modified so could be const",e)}),r.children.forEach(function(t){e(t)})}var t=this;e(this)},n.prototype.traverse=function(e){function t(e){r&&r(e),e.children.forEach(function(e){t(e)}),n&&n(e)}e=e||{};var r=e.pre,n=e.post;t(this)},t.exports=n},{2:2,537:537,539:539,546:546,547:547,548:548,549:549}],541:[function(e,t,r){function n(){this.lets=0,this.consts=0,this.renames=[]}var i=e(546),a=e(547),s=e(2);n.prototype.declarator=function(e){s(a.someof(e,["const","let"])),"const"===e?this.consts++:this.lets++},n.prototype.rename=function(e,t,r){this.renames.push({oldName:e,newName:t,line:r})},n.prototype.toString=function(){var e=this.renames.map(function(e){return e}).sort(function(e,t){return e.line-t.line}),t=e.map(function(e){return i("\nline {0}: {1} => {2}",e.line,e.oldName,e.newName)}).join(""),r=this.consts+this.lets,n=0===r?"can't calculate const coverage (0 consts, 0 lets)":i("{0}% const coverage ({1} consts, {2} lets)",Math.floor(100*this.consts/r),this.consts,this.lets);return n+t+"\n"},t.exports=n},{2:2,546:546,547:547}],542:[function(e,t,r){function n(e,t){"use strict";var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};i("string"==typeof e),i(r(t));for(var n=a(t,function(e,t){return e.start-t.start}),s=[],o=0,u=0;u<n.length;u++){var p=n[u];i(o<=p.start),i(p.start<=p.end),s.push(e.slice(o,p.start)),s.push(p.str),o=p.end}return o<e.length&&s.push(e.slice(o)),s.join("")}var i=e(2),a=e(543);"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{2:2,543:543}],543:[function(e,t,r){!function(){function e(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(1>=r)return e;for(var i=new Array(r),a=1;r>a;a*=2){n(e,t,a,i);var s=e;e=i,i=s}return e}var r=function(t,r){return e(t.slice(),r)};r.inplace=function(t,r){var i=e(t,r);return i!==t&&n(i,null,t.length,t),t};var n=function(e,t,r,n){var i,a,s,o,u,p=e.length,l=0,c=2*r;for(i=0;p>i;i+=c)for(a=i+r,s=a+r,a>p&&(a=p),s>p&&(s=p),o=i,u=a;;)if(a>o&&s>u)t(e[o],e[u])<=0?n[l++]=e[o++]:n[l++]=e[u++];else if(a>o)n[l++]=e[o++];else{if(!(s>u))break;n[l++]=e[u++]}};"undefined"!=typeof t?t.exports=r:window.stable=r}()},{}],544:[function(e,t,r){function n(e,t){"use strict";function r(e,t,s,o){if(e&&"string"==typeof e.type){var u=void 0;if(n&&(u=n(e,t,s,o)),u!==!1)for(var s in e)if(a?!a(s,e):"$"!==s[0]){var p=e[s];if(Array.isArray(p))for(var l=0;l<p.length;l++)r(p[l],e,s,l);else r(p,e,s)}i&&i(e,t,s,o)}}t=t||{};var n=t.pre,i=t.post,a=t.skipProperty;r(e,null)}"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],545:[function(e,t,r){var n=function(){"use strict";function e(e,t){this.val=e,this.brk=t}function t(){return function t(r){throw new e(r,t)}}function r(r){var n=t();try{return r(n)}catch(i){if(i instanceof e&&i.brk===n)return i.val;throw i}}return r}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],546:[function(e,t,r){var n=function(){"use strict";function e(e,t){var r=Array.prototype.slice.call(arguments,1);return e.replace(/\{(\d+)\}/g,function(e,t){return t in r?r[t]:e})}function t(e,t){return e.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g,function(e,r){return r in t?t[r]:e})}function r(e,t){return new Array(t+1).join(e)}return e.fmt=e,e.obj=t,e.repeat=r,e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],547:[function(e,t,r){var n=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=void 0;return{nan:function(e){return e!==e},"boolean":function(e){return"boolean"==typeof e},number:function(e){return"number"==typeof e},string:function(e){return"string"==typeof e},fn:function(e){return"function"==typeof e},object:function(e){return null!==e&&"object"==typeof e},primitive:function(e){var t=typeof e;return null===e||e===r||"boolean"===t||"number"===t||"string"===t},array:Array.isArray||function(e){return"[object Array]"===t.call(e)},finitenumber:function(e){return"number"==typeof e&&isFinite(e)},someof:function(e,t){return t.indexOf(e)>=0},noneof:function(e,t){return-1===t.indexOf(e)},own:function(t,r){return e.call(t,r)}}}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],548:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,this.proto=void 0,void(t&&this.setMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.get=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.proto:t.call(this.obj,e)?this.obj[e]:void 0},e.prototype.set=function(e,t){if("string"!=typeof e)throw new Error("StringMap expected string key");"__proto__"===e?(this.hasProto=!0,this.proto=t):this.obj[e]=t},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");var t=this.has(e);return"__proto__"===e?(this.hasProto=!1,this.proto=void 0):delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.keys=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.values=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(this.obj[r]);return this.hasProto&&e.push(this.proto),e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push([r,this.obj[r]]);return this.hasProto&&e.push(["__proto__",this.proto]),e},e.prototype.setMany=function(e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new Error("StringMap expected Object");for(var r in e)t.call(e,r)&&this.set(r,e[r]);return this},e.prototype.merge=function(e){for(var t=e.keys(),r=0;r<t.length;r++){var n=t[r];this.set(n,e.get(n))}return this},e.prototype.map=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];t[r]=e(this.get(n),n)}return t},e.prototype.forEach=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];e(this.get(n),n)}},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){var e=this;return"{"+this.keys().map(function(t){return JSON.stringify(t)+":"+JSON.stringify(e.get(t))}).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],549:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,void(t&&this.addMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.add=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");"__proto__"===e?this.hasProto=!0:this.obj[e]=!0},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");var t=this.has(e);return"__proto__"===e?this.hasProto=!1:delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.addMany=function(e){if(!Array.isArray(e))throw new Error("StringSet expected array");for(var t=0;t<e.length;t++)this.add(e[t]);return this},e.prototype.merge=function(e){return this.addMany(e.items()),this},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){return"{"+this.items().map(JSON.stringify).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],550:[function(e,t,r){function n(e,t){if(e){if(E.fixFaultyLocations(e),t){if(h.Node.check(e)&&h.SourceLocation.check(e.loc)){for(var r=t.length-1;r>=0&&!(x(t[r].loc.end,e.loc.start)<=0);--r);return void t.splice(r+1,0,e)}}else if(e[S])return e[S];var i;if(m.check(e))i=Object.keys(e);else{if(!y.check(e))return;i=d.getFieldNames(e)}t||Object.defineProperty(e,S,{value:t=[],enumerable:!1});for(var r=0,a=i.length;a>r;++r)n(e[i[r]],t);return t}}function i(e,t){for(var r=n(e),a=0,s=r.length;s>a;){var o=a+s>>1,u=r[o];if(x(u.loc.start,t.loc.start)<=0&&x(t.loc.end,u.loc.end)<=0)return void i(t.enclosingNode=u,t);if(x(u.loc.end,t.loc.start)<=0){var p=u;a=o+1}else{if(!(x(t.loc.end,u.loc.start)<=0))throw new Error("Comment location overlaps with node location");var l=u;s=o}}p&&(t.precedingNode=p),l&&(t.followingNode=l)}function a(e,t){var r=e.length;if(0!==r){for(var n=e[0].precedingNode,i=e[0].followingNode,a=i.loc.start,s=r;s>0;--s){var u=e[s-1];f.strictEqual(u.precedingNode,n),f.strictEqual(u.followingNode,i);var l=t.sliceString(u.loc.end,a);if(/\S/.test(l))break;a=u.loc.start}for(;r>=s&&(u=e[s])&&"Line"===u.type&&u.loc.start.column>i.loc.start.column;)++s;e.forEach(function(e,t){s>t?p(n,e):o(i,e)}),e.length=0}}function s(e,t){var r=e.comments||(e.comments=[]);r.push(t)}function o(e,t){t.leading=!0,t.trailing=!1,s(e,t)}function u(e,t){t.leading=!1,t.trailing=!1,s(e,t)}function p(e,t){t.leading=!1,t.trailing=!0,s(e,t)}function l(e,t){var r=e.getValue();h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[t(e)];if(r.trailing)a.push("\n");else if(i instanceof v){var s=i.slice(n.end,i.skipSpaces(n.end));1===s.length?a.push(s):a.push(new Array(s.length).join("\n"))}else a.push("\n");return b(a)}function c(e,t){var r=e.getValue(e);h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[];if(i instanceof v){var s=i.skipSpaces(n.start,!0)||i.firstPos(),o=i.slice(s,n.start);1===o.length?a.push(o):a.push(new Array(o.length).join("\n"))}return a.push(t(e)),b(a)}var f=e(2),d=e(558),h=d.namedTypes,m=d.builtInTypes.array,y=d.builtInTypes.object,g=e(552),v=(g.fromString,g.Lines),b=g.concat,E=e(559),x=E.comparePos,S=e(528).makeUniqueKey();r.attach=function(e,t,r){if(m.check(e)){var n=[];e.forEach(function(e){e.loc.lines=r,i(t,e);var s=e.precedingNode,l=e.enclosingNode,c=e.followingNode;if(s&&c){var d=n.length;if(d>0){var h=n[d-1];f.strictEqual(h.precedingNode===e.precedingNode,h.followingNode===e.followingNode),h.followingNode!==e.followingNode&&a(n,r)}n.push(e)}else if(s)a(n,r),p(s,e);else if(c)a(n,r),o(c,e);else{if(!l)throw new Error("AST contains no nodes at all?");a(n,r),u(l,e)}}),a(n,r),e.forEach(function(e){delete e.precedingNode,delete e.enclosingNode,delete e.followingNode})}},r.printComments=function(e,t){var r=e.getValue(),n=t(e),i=h.Node.check(r)&&d.getFieldValue(r,"comments");if(!i||0===i.length)return n;var a=[],s=[n];return e.each(function(e){var r=e.getValue(),n=d.getFieldValue(r,"leading"),i=d.getFieldValue(r,"trailing");n||i&&"Block"!==r.type?a.push(l(e,t)):i&&(f.strictEqual(r.type,"Block"),s.push(c(e,t)))},"comments"),a.push.apply(a,s),b(a)}},{2:2,528:528,552:552,558:558,559:559}],551:[function(e,t,r){function n(e){o.ok(this instanceof n),this.stack=[e]}function i(e,t){for(var r=e.stack,n=r.length-1;n>=0;n-=2){var i=r[n];if(p.Node.check(i)&&--t<0)return i}return null}function a(e){return p.BinaryExpression.check(e)||p.LogicalExpression.check(e)}function s(e){return p.CallExpression.check(e)?!0:l.check(e)?e.some(s):p.Node.check(e)?u.someField(e,function(e,t){return s(t)}):!1}var o=e(2),u=e(558),p=u.namedTypes,l=(p.Node,u.builtInTypes.array),c=u.builtInTypes.number,f=n.prototype;t.exports=n,n.from=function(e){if(e instanceof n)return e.copy();if(e instanceof u.NodePath){for(var t,r=Object.create(n.prototype),i=[e.value];t=e.parentPath;e=t)i.push(e.name,t.value);return r.stack=i.reverse(),r}return new n(e)},f.copy=function h(){var h=Object.create(n.prototype);return h.stack=this.stack.slice(0),h},f.getName=function(){var e=this.stack,t=e.length;return t>1?e[t-2]:null},f.getValue=function(){var e=this.stack;return e[e.length-1]},f.getNode=function(e){return i(this,~~e)},f.getParentNode=function(e){return i(this,~~e+1)},f.getRootValue=function(){var e=this.stack;return e.length%2===0?e[1]:e[0]},f.call=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}var o=e(this);return t.length=r,o},f.each=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),e(this),t.length-=2);t.length=r},f.map=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var o=new Array(n.length),a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),o[a]=e(this,a),t.length-=2);return t.length=r,o},f.needsParens=function(e){var t=this.getParentNode();if(!t)return!1;var r=this.getName(),n=this.getNode();if(this.getValue()!==n)return!1;if(!p.Expression.check(n))return!1;if("Identifier"===n.type)return!1;if("ParenthesizedExpression"===t.type)return!1;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===r&&t.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":var i=t.operator,u=d[i],l=n.operator,f=d[l];if(u>f)return!0;if(u===f&&"right"===r)return o.strictEqual(t.right,n),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===t.type&&c.check(n.value)&&"object"===r&&t.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===r&&t.callee===n;case"ConditionalExpression":return"test"===r&&t.test===n;case"MemberExpression":return"object"===r&&t.object===n;default:return!1}case"ArrowFunctionExpression":return a(t);case"ObjectExpression":if("ArrowFunctionExpression"===t.type&&"body"===r)return!0;default:if("NewExpression"===t.type&&"callee"===r&&t.callee===n)return s(n)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var d={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){d[e]=t})}),f.canBeFirstInStatement=function(){var e=this.getNode();return!p.FunctionExpression.check(e)&&!p.ObjectExpression.check(e)},f.firstInStatement=function(){for(var e,t,r,n,i=this.stack,s=i.length-1;s>=0;s-=2)if(p.Node.check(i[s])&&(r=e,n=t,e=i[s-1],t=i[s]),t&&n){if(p.BlockStatement.check(t)&&"body"===e&&0===r)return o.strictEqual(t.body[0],n),!0;if(p.ExpressionStatement.check(t)&&"expression"===r)return o.strictEqual(t.expression,n),!0;if(p.SequenceExpression.check(t)&&"expressions"===e&&0===r)o.strictEqual(t.expressions[0],n);else if(p.CallExpression.check(t)&&"callee"===r)o.strictEqual(t.callee,n);else if(p.MemberExpression.check(t)&&"object"===r)o.strictEqual(t.object,n);else if(p.ConditionalExpression.check(t)&&"test"===r)o.strictEqual(t.test,n);else if(a(t)&&"left"===r)o.strictEqual(t.left,n);else{if(!p.UnaryExpression.check(t)||t.prefix||"argument"!==r)return!1;o.strictEqual(t.argument,n)}}return!0}},{2:2,558:558}],552:[function(e,t,r){function n(e){return e[d]}function i(e,t){l.ok(this instanceof i),l.ok(e.length>0),t?m.assert(t):t=null,Object.defineProperty(this,d,{value:{infos:e,mappings:[],name:t,cachedSourceMap:null}}),t&&n(this).mappings.push(new g(this,{start:this.firstPos(),end:this.lastPos()}))}function a(e){return{line:e.line,indent:e.indent,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}function s(e,t){for(var r=0,n=e.length,i=0;n>i;++i)switch(e.charCodeAt(i)){case 9:l.strictEqual(typeof t,"number"),l.ok(t>0);var a=Math.ceil(r/t)*t;a===r?r+=t:r=a;break;case 11:case 12:case 13:case 65279:break;case 32:default:r+=1}return r}function o(e,t){if(e instanceof i)return e;e+="";var r=t&&t.tabWidth,n=e.indexOf(" ")<0,a=!t&&n&&e.length<=x;if(l.ok(r||n,"No tab width specified but encountered tabs in string\n"+e),a&&E.call(b,e))return b[e];var o=new i(e.split(A).map(function(e){var t=S.exec(e)[0];return{line:e,indent:s(t,r),sliceStart:t.length,sliceEnd:e.length}}),f(t).sourceFileName);return a&&(b[e]=o),o}function u(e){return!/\S/.test(e)}function p(e,t,r){var n=e.sliceStart,i=e.sliceEnd,a=Math.max(e.indent,0),s=a+i-n;return"undefined"==typeof r&&(r=s),t=Math.max(t,0),r=Math.min(r,s),r=Math.max(r,t),a>r?(a=r,i=n):i-=s-r,s=r,s-=t,a>t?a-=t:(t-=a,a=0,n+=t),l.ok(a>=0),l.ok(i>=n),l.strictEqual(s,a+i-n),e.indent===a&&e.sliceStart===n&&e.sliceEnd===i?e:{line:e.line,indent:a,sliceStart:n,sliceEnd:i}}var l=e(2),c=e(599),f=e(554).normalize,d=e(528).makeUniqueKey(),h=e(558),m=h.builtInTypes.string,y=e(559).comparePos,g=e(553);r.Lines=i;var v=i.prototype;Object.defineProperties(v,{length:{get:function(){return n(this).infos.length}},name:{get:function(){return n(this).name}}});var b={},E=b.hasOwnProperty,x=10;r.countSpaces=s;var S=/^\s*/,A=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;r.fromString=o,v.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)},v.getSourceMap=function(e,t){function r(r){return r=r||{},m.assert(e),r.file=e,t&&(m.assert(t),r.sourceRoot=t),r}if(!e)return null;var i=this,a=n(i);if(a.cachedSourceMap)return r(a.cachedSourceMap.toJSON());var s=new c.SourceMapGenerator(r()),o={};return a.mappings.forEach(function(e){for(var t=e.sourceLines.skipSpaces(e.sourceLoc.start)||e.sourceLines.lastPos(),r=i.skipSpaces(e.targetLoc.start)||i.lastPos();y(t,e.sourceLoc.end)<0&&y(r,e.targetLoc.end)<0;){var n=e.sourceLines.charAt(t),a=i.charAt(r);l.strictEqual(n,a);var u=e.sourceLines.name;if(s.addMapping({source:u,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column}}),!E.call(o,u)){var p=e.sourceLines.toString();s.setSourceContent(u,p),o[u]=p}i.nextPos(r,!0),e.sourceLines.nextPos(t,!0)}}),a.cachedSourceMap=s,s.toJSON()},v.bootstrapCharAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,n=this.toString().split(A),i=n[t-1];return"undefined"==typeof i?"":r===i.length&&t<n.length?"\n":r>=i.length?"":i.charAt(r)},v.charAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,i=n(this),a=i.infos,s=a[t-1],o=r;if("undefined"==typeof s||0>o)return"";var u=this.getIndentAt(t);return u>o?" ":(o+=s.sliceStart-u,o===s.sliceEnd&&t<this.length?"\n":o>=s.sliceEnd?"":s.line.charAt(o))},v.stripMargin=function(e,t){if(0===e)return this;if(l.ok(e>0,"negative margin: "+e),t&&1===this.length)return this;var r=n(this),s=new i(r.infos.map(function(r,n){return r.line&&(n>0||!t)&&(r=a(r),r.indent=Math.max(0,r.indent-e)),r}));if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){o.push(r.indent(e,t,!0))})}return s},v.indent=function(e){if(0===e)return this;var t=n(this),r=new i(t.infos.map(function(t){return t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e))})}return r},v.indentTail=function(e){if(0===e)return this;if(this.length<2)return this;var t=n(this),r=new i(t.infos.map(function(t,r){return r>0&&t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e,!0))})}return r},v.getIndentAt=function(e){l.ok(e>=1,"no line "+e+" (line numbers start from 1)");var t=n(this),r=t.infos[e-1];return Math.max(r.indent,0)},v.guessTabWidth=function(){var e=n(this);if(E.call(e,"cachedTabWidth"))return e.cachedTabWidth;for(var t=[],r=0,i=1,a=this.length;a>=i;++i){var s=e.infos[i-1],o=s.line.slice(s.sliceStart,s.sliceEnd);if(!u(o)){var p=Math.abs(s.indent-r);t[p]=~~t[p]+1,r=s.indent}}for(var l=-1,c=2,f=1;f<t.length;f+=1)E.call(t,f)&&t[f]>l&&(l=t[f],c=f);return e.cachedTabWidth=c},v.isOnlyWhitespace=function(){return u(this.toString())},v.isPrecededOnlyByWhitespace=function(e){var t=n(this),r=t.infos[e.line-1],i=Math.max(r.indent,0),a=e.column-i;if(0>=a)return!0;var s=r.sliceStart,o=Math.min(s+a,r.sliceEnd),p=r.line.slice(s,o);return u(p)},v.getLineLength=function(e){var t=n(this),r=t.infos[e-1];return this.getIndentAt(e)+r.sliceEnd-r.sliceStart},v.nextPos=function(e,t){var r=Math.max(e.line,0),n=Math.max(e.column,0);return n<this.getLineLength(r)?(e.column+=1,t?!!this.skipSpaces(e,!1,!0):!0):r<this.length?(e.line+=1,e.column=0,t?!!this.skipSpaces(e,!1,!0):!0):!1},v.prevPos=function(e,t){var r=e.line,n=e.column;if(1>n){if(r-=1,1>r)return!1;n=this.getLineLength(r)}else n=Math.min(n-1,this.getLineLength(r));return e.line=r,e.column=n,t?!!this.skipSpaces(e,!0,!0):!0},v.firstPos=function(){return{line:1,column:0}},v.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}},v.skipSpaces=function(e,t,r){if(e=e?r?e:{line:e.line,column:e.column}:t?this.lastPos():this.firstPos(),t){for(;this.prevPos(e);)if(!u(this.charAt(e))&&this.nextPos(e))return e;return null}for(;u(this.charAt(e));)if(!this.nextPos(e))return null;return e},v.trimLeft=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);return e?this.slice(e):D},v.trimRight=function(){var e=this.skipSpaces(this.lastPos(),!0,!0);return e?this.slice(this.firstPos(),e):D},v.trim=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);if(null===e)return D;var t=this.skipSpaces(this.lastPos(),!0,!0);return l.notStrictEqual(t,null),this.slice(e,t)},v.eachPos=function(e,t,r){ var n=this.firstPos();if(t&&(n.line=t.line,n.column=t.column),!r||this.skipSpaces(n,!1,!0))do e.call(this,n);while(this.nextPos(n,r))},v.bootstrapSlice=function(e,t){var r=this.toString().split(A).slice(e.line-1,t.line);return r.push(r.pop().slice(0,t.column)),r[0]=r[0].slice(e.column),o(r.join("\n"))},v.slice=function(e,t){if(!t){if(!e)return this;t=this.lastPos()}var r=n(this),a=r.infos.slice(e.line-1,t.line);e.line===t.line?a[0]=p(a[0],e.column,t.column):(l.ok(e.line<t.line),a[0]=p(a[0],e.column),a.push(p(a.pop(),0,t.column)));var s=new i(a);if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){var n=r.slice(this,e,t);n&&o.push(n)},this)}return s},v.bootstrapSliceString=function(e,t,r){return this.slice(e,t).toString(r)},v.sliceString=function(e,t,r){if(!t){if(!e)return this;t=this.lastPos()}r=f(r);for(var i=n(this).infos,a=[],o=r.tabWidth,l=e.line;l<=t.line;++l){var c=i[l-1];l===e.line?c=l===t.line?p(c,e.column,t.column):p(c,e.column):l===t.line&&(c=p(c,0,t.column));var d=Math.max(c.indent,0),h=c.line.slice(0,c.sliceStart);if(r.reuseWhitespace&&u(h)&&s(h,r.tabWidth)===d)a.push(c.line.slice(0,c.sliceEnd));else{var m=0,y=d;r.useTabs&&(m=Math.floor(d/o),y-=m*o);var g="";m>0&&(g+=new Array(m+1).join(" ")),y>0&&(g+=new Array(y+1).join(" ")),g+=c.line.slice(c.sliceStart,c.sliceEnd),a.push(g)}}return a.join(r.lineTerminator)},v.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1},v.join=function(e){function t(e){if(null!==e){if(s){var t=e.infos[0],r=new Array(t.indent+1).join(" "),n=l.length,i=Math.max(s.indent,0)+s.sliceEnd-s.sliceStart;s.line=s.line.slice(0,s.sliceEnd)+r+t.line.slice(t.sliceStart,t.sliceEnd),s.sliceEnd=s.line.length,e.mappings.length>0&&e.mappings.forEach(function(e){c.push(e.add(n,i))})}else e.mappings.length>0&&c.push.apply(c,e.mappings);e.infos.forEach(function(e,t){(!s||t>0)&&(s=a(e),l.push(s))})}}function r(e,r){r>0&&t(p),t(e)}var s,u=this,p=n(u),l=[],c=[];if(e.map(function(e){var t=o(e);return t.isEmpty()?null:n(t)}).forEach(u.isEmpty()?t:r),l.length<1)return D;var f=new i(l);return n(f).mappings=c,f},r.concat=function(e){return D.join(e)},v.concat=function(e){var t=arguments,r=[this];return r.push.apply(r,t),l.strictEqual(r.length,t.length+1),D.join(r)};var D=o("")},{2:2,528:528,553:553,554:554,558:558,559:559,599:599}],553:[function(e,t,r){function n(e,t,r){o.ok(this instanceof n),o.ok(e instanceof f.Lines),l.assert(t),r?o.ok(p.check(r.start.line)&&p.check(r.start.column)&&p.check(r.end.line)&&p.check(r.end.column)):r=t,Object.defineProperties(this,{sourceLines:{value:e},sourceLoc:{value:t},targetLoc:{value:r}})}function i(e,t,r){return{line:e.line+t-1,column:1===e.line?e.column+r:e.column}}function a(e,t,r){return{line:e.line-t+1,column:e.line===t?e.column-r:e.column}}function s(e,t,r,n,i){o.ok(e instanceof f.Lines),o.ok(r instanceof f.Lines),c.assert(t),c.assert(n),c.assert(i);var a=d(n,i);if(0===a)return t;if(0>a){var s=e.skipSpaces(t),u=r.skipSpaces(n),p=i.line-u.line;for(s.line+=p,u.line+=p,p>0?(s.column=0,u.column=0):o.strictEqual(p,0);d(u,i)<0&&r.nextPos(u,!0);)o.ok(e.nextPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}else{var s=e.skipSpaces(t,!0),u=r.skipSpaces(n,!0),p=i.line-u.line;for(s.line+=p,u.line+=p,0>p?(s.column=e.getLineLength(s.line),u.column=r.getLineLength(u.line)):o.strictEqual(p,0);d(i,u)<0&&r.prevPos(u,!0);)o.ok(e.prevPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}return s}var o=e(2),u=e(558),p=(u.builtInTypes.string,u.builtInTypes.number),l=u.namedTypes.SourceLocation,c=u.namedTypes.Position,f=e(552),d=e(559).comparePos,h=n.prototype;t.exports=n,h.slice=function(e,t,r){function i(n){var i=p[n],a=l[n],c=t;return"end"===n?c=r:o.strictEqual(n,"start"),s(u,i,e,a,c)}o.ok(e instanceof f.Lines),c.assert(t),r?c.assert(r):r=e.lastPos();var u=this.sourceLines,p=this.sourceLoc,l=this.targetLoc;if(d(t,l.start)<=0)if(d(l.end,r)<=0)l={start:a(l.start,t.line,t.column),end:a(l.end,t.line,t.column)};else{if(d(r,l.start)<=0)return null;p={start:p.start,end:i("end")},l={start:a(l.start,t.line,t.column),end:a(r,t.line,t.column)}}else{if(d(l.end,t)<=0)return null;d(l.end,r)<=0?(p={start:i("start"),end:p.end},l={start:{line:1,column:0},end:a(l.end,t.line,t.column)}):(p={start:i("start"),end:i("end")},l={start:{line:1,column:0},end:a(r,t.line,t.column)})}return new n(this.sourceLines,p,l)},h.add=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:i(this.targetLoc.start,e,t),end:i(this.targetLoc.end,e,t)})},h.subtract=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:a(this.targetLoc.start,e,t),end:a(this.targetLoc.end,e,t)})},h.indent=function(e,t,r){if(0===e)return this;var i=this.targetLoc,a=i.start.line,s=i.end.line;if(t&&1===a&&1===s)return this;if(i={start:i.start,end:i.end},!t||a>1){var o=i.start.column+e;i.start={line:a,column:r?Math.max(0,o):o}}if(!t||s>1){var u=i.end.column+e;i.end={line:s,column:r?Math.max(0,u):u}}return new n(this.sourceLines,this.sourceLoc,i)}},{2:2,552:552,558:558,559:559}],554:[function(e,t,r){var n={esprima:e(1),tabWidth:4,useTabs:!1,reuseWhitespace:!0,lineTerminator:e(8).EOL,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:!1,tolerant:!0,quote:null,trailingComma:!1},i=n.hasOwnProperty;r.normalize=function(e){function t(t){return i.call(e,t)?e[t]:n[t]}return e=e||n,{tabWidth:+t("tabWidth"),useTabs:!!t("useTabs"),reuseWhitespace:!!t("reuseWhitespace"),lineTerminator:t("lineTerminator"),wrapColumn:Math.max(t("wrapColumn"),0),sourceFileName:t("sourceFileName"),sourceMapName:t("sourceMapName"),sourceRoot:t("sourceRoot"),inputSourceMap:t("inputSourceMap"),esprima:t("esprima"),range:t("range"),tolerant:t("tolerant"),quote:t("quote"),trailingComma:t("trailingComma")}}},{1:1,8:8}],555:[function(e,t,r){function n(e){i.ok(this instanceof n),this.lines=e,this.indent=0}var i=e(2),a=e(558),s=(a.namedTypes,a.builders),o=a.builtInTypes.object,u=a.builtInTypes.array,p=(a.builtInTypes["function"],e(556).Patcher,e(554).normalize),l=e(552).fromString,c=e(550).attach,f=e(559);r.parse=function(e,t){t=p(t);var r=l(e,t),i=r.toString({tabWidth:t.tabWidth,reuseWhitespace:!1,useTabs:!1}),a=[],o=t.esprima.parse(i,{loc:!0,locations:!0,range:t.range,comment:!0,onComment:a,tolerant:t.tolerant,ecmaVersion:6,sourceType:"module"});o.loc=o.loc||{start:r.firstPos(),end:r.lastPos()},o.loc.lines=r,o.loc.indent=0;var u=f.getTrueLoc(o,r);o.loc.start=u.start,o.loc.end=u.end,o.comments&&(a=o.comments,delete o.comments);var d=s.file(o);return d.loc={lines:r,indent:0,start:r.firstPos(),end:r.lastPos()},c(a,o.body.length?d.program:d,r),new n(r).copy(d)};var d=n.prototype;d.copy=function(e){if(u.check(e))return e.map(this.copy,this);if(!o.check(e))return e;f.fixFaultyLocations(e);var t=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:!1,enumerable:!1,writable:!0}}),r=e.loc,n=this.indent,i=n;r&&(("Block"===e.type||"Line"===e.type||this.lines.isPrecededOnlyByWhitespace(r.start))&&(i=this.indent=r.start.column),r.lines=this.lines,r.indent=i);for(var a=Object.keys(e),s=a.length,p=0;s>p;++p){var l=a[p];"loc"===l?t[l]=e[l]:t[l]=this.copy(e[l])}return this.indent=n,t}},{2:2,550:550,552:552,554:554,556:556,558:558,559:559}],556:[function(e,t,r){function n(e){d.ok(this instanceof n),d.ok(e instanceof h.Lines);var t=this,r=[];t.replace=function(e,t){D.check(t)&&(t=h.fromString(t)),r.push({lines:t,start:e.start,end:e.end})},t.get=function(t){function n(t,r){d.ok(E(t,r)<=0),a.push(e.slice(t,r))}t=t||{start:{line:1,column:0},end:{line:e.length,column:e.getLineLength(e.length)}};var i=t.start,a=[];return r.sort(function(e,t){return E(e.start,t.start)}).forEach(function(e){E(i,e.start)>0||(n(i,e.start),a.push(e.lines),i=e.end)}),n(i,t.end),h.concat(a)}}function i(e){var t=[];return e.comments&&e.comments.length>0&&e.comments.forEach(function(e){(e.leading||e.trailing)&&t.push(e)}),t}function a(e,t){var r=e.getValue();y.assert(r);var n=r.original;if(y.assert(n),d.deepEqual(t,[]),r.type!==n.type)return!1;var i=new x(n),a=f(e,i,t);return a||(t.length=0),a}function s(e,t,r){var n=e.getValue(),i=t.getValue();return n===i?!0:A.check(n)?o(e,t,r):S.check(n)?u(e,t,r):!1}function o(e,t,r){var n=e.getValue(),i=t.getValue();A.assert(n);var a=n.length;if(!A.check(i)||i.length!==a)return!1;for(var o=0;a>o;++o){e.stack.push(o,n[o]),t.stack.push(o,i[o]);var u=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!u)return!1}return!0}function u(e,t,r){var n=e.getValue();if(S.assert(n),null===n.original)return!1;var i=t.getValue();if(!S.check(i))return!1;if(y.check(n)){if(!y.check(i))return!1;if(n.type===i.type){var a=[];if(f(e,t,a))r.push.apply(r,a);else{if(!i.loc)return!1;r.push({oldPath:t.copy(),newPath:e.copy()})}return!0}return g.check(n)&&g.check(i)&&i.loc?(r.push({oldPath:t.copy(),newPath:e.copy()}),!0):!1}return f(e,t,r)}function p(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;for(i.line=r.start.line,i.column=r.start.column;n.prevPos(i);){var a=n.charAt(i);if("("===a)return E(e.getRootValue().loc.start,i)<=0;if(_.test(a))return!1}}return!1}function l(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;i.line=r.end.line,i.column=r.end.column;do{var a=n.charAt(i);if(")"===a)return E(i,e.getRootValue().loc.end)<=0;if(_.test(a))return!1}while(n.nextPos(i))}return!1}function c(e){return p(e)&&l(e)}function f(e,t,r){var n=e.getValue(),i=t.getValue();if(S.assert(n),S.assert(i),null===n.original)return!1;if(!e.canBeFirstInStatement()&&e.firstInStatement()&&!p(t))return!1;if(e.needsParens(!0)&&!c(t))return!1;for(var a in b.getUnionOfKeys(n,i))if("loc"!==a){e.stack.push(a,m.getFieldValue(n,a)),t.stack.push(a,m.getFieldValue(i,a));var o=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!o)return!1}return!0}var d=e(2),h=e(552),m=e(558),y=(m.getFieldValue,m.namedTypes.Printable),g=m.namedTypes.Expression,v=m.namedTypes.SourceLocation,b=e(559),E=b.comparePos,x=e(551),S=m.builtInTypes.object,A=m.builtInTypes.array,D=m.builtInTypes.string,C=/[0-9a-z_$]/i;r.Patcher=n;var w=n.prototype;w.tryToReprintComments=function(e,t,r){var n=this;if(!e.comments&&!t.comments)return!0;var a=x.from(e),s=x.from(t);a.stack.push("comments",i(e)),s.stack.push("comments",i(t));var u=[],p=o(a,s,u);return p&&u.length>0&&u.forEach(function(e){var t=e.oldPath.getValue();d.ok(t.leading||t.trailing),n.replace(t.loc,r(e.newPath).indentTail(t.loc.indent))}),p},w.deleteComments=function(e){if(e.comments){var t=this;e.comments.forEach(function(r){r.leading?t.replace({start:r.loc.start,end:e.loc.lines.skipSpaces(r.loc.end,!1,!1)},""):r.trailing&&t.replace({start:e.loc.lines.skipSpaces(r.loc.start,!0,!1),end:r.loc.end},"")})}},r.getReprinter=function(e){d.ok(e instanceof x);var t=e.getValue();if(y.check(t)){var r=t.original,i=r&&r.loc,s=i&&i.lines,o=[];if(s&&a(e,o))return function(e){var t=new n(s);return o.forEach(function(r){var n=r.newPath.getValue(),i=r.oldPath.getValue();v.assert(i.loc,!0);var a=!t.tryToReprintComments(n,i,e);a&&t.deleteComments(i);var o=b.copyPos(i.loc.start),u=s.prevPos(o)&&C.test(s.charAt(o)),p=e(r.newPath,a).indentTail(i.loc.indent),l=C.test(s.charAt(i.loc.end));if(u||l){var c=[];u&&c.push(" "),c.push(p),l&&c.push(" "),p=h.concat(c)}t.replace(i.loc,p)}),t.get(i).indentTail(-r.loc.indent)}}};var I={line:1,column:0},_=/\S/},{2:2,551:551,552:552,558:558,559:559}],557:[function(e,t,r){function n(e,t){E.ok(this instanceof n),F.assert(e),this.code=e,t&&(k.assert(t),this.map=t)}function i(e){function t(e){return E.ok(e instanceof P),x(e,r)}function r(e,r){if(r)return t(e);if(E.ok(e instanceof P),!l){var n=c.tabWidth,i=e.getNode().loc;if(i&&i.lines&&i.lines.guessTabWidth){c.tabWidth=i.lines.guessTabWidth();var a=o(e);return c.tabWidth=n,a}}return o(e)}function o(e){var t=w(e);return t?a(e,t(r)):u(e)}function u(e){return s(e,c,t)}function p(e){return s(e,c,p)}E.ok(this instanceof i);var l=e&&e.tabWidth,c=C(e);E.notStrictEqual(c,e),c.sourceFileName=null,this.print=function(e){if(!e)return O;var t=r(P.from(e),!0);return new n(t.toString(c),B.composeSourceMaps(c.inputSourceMap,t.getSourceMap(c.sourceMapName,c.sourceRoot)))},this.printGenerically=function(e){if(!e)return O;var t=P.from(e),r=c.reuseWhitespace;c.reuseWhitespace=!1;var i=new n(p(t).toString(c));return c.reuseWhitespace=r,i}}function a(e,t){return e.needsParens()?D(["(",t,")"]):t}function s(e,t,r){return E.ok(e instanceof P),a(e,o(e,t,r))}function o(e,t,r){var n=e.getValue();if(!n)return A("");if("string"==typeof n)return A(n,t);switch(_.Printable.assert(n),n.type){case"File":return e.call(r,"program");case"Program":return e.call(function(e){return u(e,t,r)},"body");case"Noop":case"EmptyStatement":return A("");case"ExpressionStatement":return D([e.call(r,"expression"),";"]);case"ParenthesizedExpression":return D(["(",e.call(r,"expression"),")"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return A(" ").join([e.call(r,"left"),n.operator,e.call(r,"right")]);case"AssignmentPattern":return D([e.call(r,"left"),"=",e.call(r,"right")]);case"MemberExpression":var i=[e.call(r,"object")],a=e.call(r,"property");return n.computed?i.push("[",a,"]"):i.push(".",a),D(i);case"MetaProperty":return D([e.call(r,"meta"),".",e.call(r,"property")]);case"BindExpression":var i=[];return n.object&&i.push(e.call(r,"object")),i.push("::",e.call(r,"callee")),D(i);case"Path":return A(".").join(n.body);case"Identifier":return D([A(n.name,t),e.call(r,"typeAnnotation")]);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":return D(["...",e.call(r,"argument")]);case"FunctionDeclaration":case"FunctionExpression":var i=[];return n.async&&i.push("async "),i.push("function"),n.generator&&i.push("*"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),i.push("(",d(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),D(i);case"ArrowFunctionExpression":var i=[];return n.async&&i.push("async "),1!==n.params.length||n.rest||"SpreadElementPattern"===n.params[0].type||"RestElement"===n.params[0].type?i.push("(",d(e,t,r),")"):i.push(e.call(r,"params",0)),i.push(" => ",e.call(r,"body")),D(i);case"MethodDefinition":var i=[];return n["static"]&&i.push("static "),i.push(c(e,t,r)),D(i);case"YieldExpression":var i=["yield"];return n.delegate&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"AwaitExpression":var i=["await"];return n.all&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"ModuleDeclaration":var i=["module",e.call(r,"id")];return n.source?(E.ok(!n.body),i.push("from",e.call(r,"source"))):i.push(e.call(r,"body")),A(" ").join(i);case"ImportSpecifier":var i=[];return n.imported?(i.push(e.call(r,"imported")),n.local&&n.local.name!==n.imported.name&&i.push(" as ",e.call(r,"local"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportSpecifier":var i=[];return n.local?(i.push(e.call(r,"local")),n.exported&&n.exported.name!==n.local.name&&i.push(" as ",e.call(r,"exported"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportBatchSpecifier":return A("*");case"ImportNamespaceSpecifier":var i=["* as "];return n.local?i.push(e.call(r,"local")):n.id&&i.push(e.call(r,"id")),D(i);case"ImportDefaultSpecifier":return n.local?e.call(r,"local"):e.call(r,"id");case"ExportDeclaration":var i=["export"];if(n["default"])i.push(" default");else if(n.specifiers&&n.specifiers.length>0)return 1===n.specifiers.length&&"ExportBatchSpecifier"===n.specifiers[0].type?i.push(" *"):i.push(" { ",A(", ").join(e.map(r,"specifiers"))," }"),n.source&&i.push(" from ",e.call(r,"source")),i.push(";"),D(i);if(n.declaration){var s=e.call(r,"declaration");i.push(" ",s),";"!==m(s)&&i.push(";")}return D(i);case"ExportDefaultDeclaration":return D(["export default ",e.call(r,"declaration")]);case"ExportNamedDeclaration":var i=["export "];return n.declaration&&i.push(e.call(r,"declaration")),n.specifiers&&n.specifiers.length>0&&i.push(n.declaration?", {":"{",A(", ").join(e.map(r,"specifiers")),"}"),n.source&&i.push(" from ",e.call(r,"source")),D(i);case"ExportAllDeclaration":var i=["export *"];return n.exported&&i.push(" as ",e.call(r,"exported")),D([" from ",e.call(r,"source")]);case"ExportNamespaceSpecifier":return D(["* as ",e.call(r,"exported")]);case"ExportDefaultSpecifier":return e.call(r,"exported");case"ImportDeclaration":var i=["import "];if(n.importKind&&"value"!==n.importKind&&i.push(n.importKind+" "),n.specifiers&&n.specifiers.length>0){var o=!1;e.each(function(e){var t=e.getName();t>0&&i.push(", ");var n=e.getValue();_.ImportDefaultSpecifier.check(n)||_.ImportNamespaceSpecifier.check(n)?E.strictEqual(o,!1):(_.ImportSpecifier.assert(n),o||(o=!0,i.push("{"))),i.push(r(e))},"specifiers"),o&&i.push("}"),i.push(" from ")}return i.push(e.call(r,"source"),";"),D(i);case"BlockStatement":var l=e.call(function(e){return u(e,t,r)},"body");return l.isEmpty()?A("{}"):D(["{\n",l.indent(t.tabWidth),"\n}"]);case"ReturnStatement":var i=["return"];if(n.argument){var g=e.call(r,"argument");g.length>1&&(_.XJSElement&&_.XJSElement.check(n.argument)||_.JSXElement&&_.JSXElement.check(n.argument))?i.push(" (\n",g.indent(t.tabWidth),"\n)"):i.push(" ",g)}return i.push(";"),D(i);case"CallExpression":return D([e.call(r,"callee"),f(e,t,r)]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":var b=!1,x="ObjectTypeAnnotation"===n.type,S=x?";":",",C=[];x&&C.push("indexers","callProperties"),C.push("properties");var w=0;C.forEach(function(e){w+=n[e].length});var I=x&&1===w||0===w,i=[I?"{":"{\n"],F=0;return C.forEach(function(n){e.each(function(e){var n=r(e);I||(n=n.indent(t.tabWidth));var a=!x&&n.length>1;a&&b&&i.push("\n"),i.push(n),w-1>F?(i.push(S+(a?"\n\n":"\n")),b=!a):1!==w&&x?i.push(S):t.trailingComma&&i.push(S),F++},n)}),i.push(I?"}":"\n}"),D(i);case"PropertyPattern":return D([e.call(r,"key"),": ",e.call(r,"pattern")]);case"Property":if(n.method||"get"===n.kind||"set"===n.kind)return c(e,t,r);var i=[];n.decorators&&e.each(function(e){i.push(r(e),"\n")},"decorators");var k=e.call(r,"key");return n.computed?i.push("[",k,"]"):i.push(k),n.shorthand||i.push(": ",e.call(r,"value")),D(i);case"Decorator":return D(["@",e.call(r,"expression")]);case"ArrayExpression":case"ArrayPattern":var P=n.elements,w=P.length,B=e.map(r,"elements"),T=A(", ").join(B),I=T.getLineLength(1)<=t.wrapColumn,i=[I?"[":"[\n"];return e.each(function(e){var r=e.getName(),n=e.getValue();if(n){var a=B[r];I?r>0&&i.push(" "):a=a.indent(t.tabWidth),i.push(a),(w-1>r||!I&&t.trailingComma)&&i.push(","),I||i.push("\n")}else i.push(",")},"elements"),i.push("]"),D(i);case"SequenceExpression":return A(", ").join(e.map(r,"expressions"));case"ThisExpression":return A("this");case"Super":return A("super");case"Literal":return"string"!=typeof n.value?A(n.value,t):A(v(n.value,t),t);case"ModuleSpecifier":if(n.local)throw new Error("The ESTree ModuleSpecifier type should be abstract");return A(v(n.value,t),t);case"UnaryExpression":var i=[n.operator];return/[a-z]$/.test(n.operator)&&i.push(" "),i.push(e.call(r,"argument")),D(i);case"UpdateExpression":var i=[e.call(r,"argument"),n.operator];return n.prefix&&i.reverse(),D(i);case"ConditionalExpression":return D(["(",e.call(r,"test")," ? ",e.call(r,"consequent")," : ",e.call(r,"alternate"),")"]);case"NewExpression":var i=["new ",e.call(r,"callee")],M=n.arguments;return M&&i.push(f(e,t,r)),D(i);case"VariableDeclaration":var i=[n.kind," "],O=0,B=e.map(function(e){var t=r(e);return O=Math.max(t.length,O),t},"declarations");1===O?i.push(A(", ").join(B)):B.length>1?i.push(A(",\n").join(B).indentTail(n.kind.length+1)):i.push(B[0]);var j=e.getParentNode();return _.ForStatement.check(j)||_.ForInStatement.check(j)||_.ForOfStatement&&_.ForOfStatement.check(j)||i.push(";"),D(i);case"VariableDeclarator":return n.init?A(" = ").join([e.call(r,"id"),e.call(r,"init")]):e.call(r,"id");case"WithStatement":return D(["with (",e.call(r,"object"),") ",e.call(r,"body")]);case"IfStatement":var L=h(e.call(r,"consequent"),t),i=["if (",e.call(r,"test"),")",L];return n.alternate&&i.push(y(L)?" else":"\nelse",h(e.call(r,"alternate"),t)),D(i);case"ForStatement":var N=e.call(r,"init"),R=N.length>1?";\n":"; ",V="for (",U=A(R).join([N,e.call(r,"test"),e.call(r,"update")]).indentTail(V.length),q=D([V,U,")"]),G=h(e.call(r,"body"),t),i=[q];return q.length>1&&(i.push("\n"),G=G.trimLeft()),i.push(G),D(i);case"WhileStatement":return D(["while (",e.call(r,"test"),")",h(e.call(r,"body"),t)]);case"ForInStatement":return D([n.each?"for each (":"for (",e.call(r,"left")," in ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"ForOfStatement":return D(["for (",e.call(r,"left")," of ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"DoWhileStatement":var H=D(["do",h(e.call(r,"body"),t)]),i=[H];return y(H)?i.push(" while"):i.push("\nwhile"),i.push(" (",e.call(r,"test"),");"),D(i);case"DoExpression":var W=e.call(function(e){return u(e,t,r)},"body");return D(["do {\n",W.indent(t.tabWidth),"\n}"]);case"BreakStatement":var i=["break"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"ContinueStatement":var i=["continue"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"LabeledStatement":return D([e.call(r,"label"),":\n",e.call(r,"body")]);case"TryStatement":var i=["try ",e.call(r,"block")];return n.handler?i.push(" ",e.call(r,"handler")):n.handlers&&e.each(function(e){i.push(" ",r(e))},"handlers"),n.finalizer&&i.push(" finally ",e.call(r,"finalizer")),D(i);case"CatchClause":var i=["catch (",e.call(r,"param")];return n.guard&&i.push(" if ",e.call(r,"guard")),i.push(") ",e.call(r,"body")),D(i);case"ThrowStatement":return D(["throw ",e.call(r,"argument"),";"]);case"SwitchStatement":return D(["switch (",e.call(r,"discriminant"),") {\n",A("\n").join(e.map(r,"cases")),"\n}"]);case"SwitchCase":var i=[];return n.test?i.push("case ",e.call(r,"test"),":"):i.push("default:"),n.consequent.length>0&&i.push("\n",e.call(function(e){return u(e,t,r)},"consequent").indent(t.tabWidth)),D(i);case"DebuggerStatement":return A("debugger;");case"XJSAttribute":case"JSXAttribute":var i=[e.call(r,"name")];return n.value&&i.push("=",e.call(r,"value")),D(i);case"XJSIdentifier":case"JSXIdentifier":return A(n.name,t);case"XJSNamespacedName":case"JSXNamespacedName":return A(":").join([e.call(r,"namespace"),e.call(r,"name")]);case"XJSMemberExpression":case"JSXMemberExpression":return A(".").join([e.call(r,"object"),e.call(r,"property")]);case"XJSSpreadAttribute":case"JSXSpreadAttribute":return D(["{...",e.call(r,"argument"),"}"]);case"XJSExpressionContainer":case"JSXExpressionContainer":return D(["{",e.call(r,"expression"),"}"]);case"XJSElement":case"JSXElement":var X=e.call(r,"openingElement");if(n.openingElement.selfClosing)return E.ok(!n.closingElement),X;var Y=D(e.map(function(e){var t=e.getValue();if(_.Literal.check(t)&&"string"==typeof t.value){if(/\S/.test(t.value))return t.value.replace(/^\s+|\s+$/g,"");if(/\n/.test(t.value))return"\n"}return r(e)},"children")).indentTail(t.tabWidth),J=e.call(r,"closingElement");return D([X,Y,J]);case"XJSOpeningElement":case"JSXOpeningElement":var i=["<",e.call(r,"name")],z=[];e.each(function(e){z.push(" ",r(e))},"attributes");var K=D(z),$=K.length>1||K.getLineLength(1)>t.wrapColumn;return $&&(z.forEach(function(e,t){" "===e&&(E.strictEqual(t%2,0),z[t]="\n")}),K=D(z).indentTail(t.tabWidth)),i.push(K,n.selfClosing?" />":">"),D(i);case"XJSClosingElement":case"JSXClosingElement":return D(["</",e.call(r,"name"),">"]);case"XJSText":case"JSXText":return A(n.value,t);case"XJSEmptyExpression":case"JSXEmptyExpression":return A("");case"TypeAnnotatedIdentifier":return D([e.call(r,"annotation")," ",e.call(r,"identifier")]);case"ClassBody":return 0===n.body.length?A("{}"):D(["{\n",e.call(function(e){return u(e,t,r)},"body").indent(t.tabWidth),"\n}"]);case"ClassPropertyDefinition":var i=["static ",e.call(r,"definition")];return _.MethodDefinition.check(n.definition)||i.push(";"),D(i);case"ClassProperty":var i=[];return n["static"]&&i.push("static "),i.push(e.call(r,"key")),n.typeAnnotation&&i.push(e.call(r,"typeAnnotation")),n.value&&i.push(" = ",e.call(r,"value")),i.push(";"),D(i);case"ClassDeclaration":case"ClassExpression":var i=["class"];return n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),n.superClass&&i.push(" extends ",e.call(r,"superClass"),e.call(r,"superTypeParameters")),n["implements"]&&i.push(" implements ",A(", ").join(e.map(r,"implements"))),i.push(" ",e.call(r,"body")),D(i);case"TemplateElement":return A(n.value.raw,t);case"TemplateLiteral":var Q=e.map(r,"expressions"),i=["`"];return e.each(function(e){var t=e.getName();i.push(r(e)),t<Q.length&&i.push("${",Q[t],"}")},"quasis"),i.push("`"),D(i);case"TaggedTemplateExpression":return D([e.call(r,"tag"),e.call(r,"quasi")]);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Comment":case"MemberTypeAnnotation":case"TupleTypeAnnotation":case"Type":throw new Error("unprintable type: "+JSON.stringify(n.type));case"CommentBlock":case"Block":return D(["/*",A(n.value,t),"*/"]);case"CommentLine":case"Line":return D(["//",A(n.value,t)]);case"TypeAnnotation":var i=[];return n.typeAnnotation?("FunctionTypeAnnotation"!==n.typeAnnotation.type&&i.push(": "),i.push(e.call(r,"typeAnnotation")),D(i)):A("");case"AnyTypeAnnotation":return A("any",t);case"MixedTypeAnnotation":return A("mixed",t);case"ArrayTypeAnnotation":return D([e.call(r,"elementType"),"[]"]);case"BooleanTypeAnnotation":return A("boolean",t);case"BooleanLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"boolean"),A(""+n.value,t);case"DeclareClass":return D([A("declare class ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareFunction":return D([A("declare function ",t),e.call(r,"id"),";"]);case"DeclareModule":return D([A("declare module ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareVariable":return D([A("declare var ",t),e.call(r,"id"),";"]);case"FunctionTypeAnnotation":var i=[],Z=e.getParentNode(0),ee=!(_.ObjectTypeCallProperty.check(Z)||_.DeclareFunction.check(e.getParentNode(2))),te=ee&&!_.FunctionTypeParam.check(Z);return te&&i.push(": "),i.push("(",A(", ").join(e.map(r,"params")),")"),n.returnType&&i.push(ee?" => ":": ",e.call(r,"returnType")),D(i);case"FunctionTypeParam":return D([e.call(r,"name"),": ",e.call(r,"typeAnnotation")]);case"GenericTypeAnnotation":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"InterfaceDeclaration":var i=[A("interface ",t),e.call(r,"id"),e.call(r,"typeParameters")," "];return n["extends"]&&i.push("extends ",A(", ").join(e.map(r,"extends"))),i.push(" ",e.call(r,"body")),D(i);case"ClassImplements":case"InterfaceExtends":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"IntersectionTypeAnnotation":return A(" & ").join(e.map(r,"types"));case"NullableTypeAnnotation":return D(["?",e.call(r,"typeAnnotation")]);case"NumberTypeAnnotation":return A("number",t);case"ObjectTypeCallProperty":return e.call(r,"value");case"ObjectTypeIndexer":return D(["[",e.call(r,"id"),": ",e.call(r,"key"),"]: ",e.call(r,"value")]);case"ObjectTypeProperty":return D([e.call(r,"key"),": ",e.call(r,"value")]);case"QualifiedTypeIdentifier":return D([e.call(r,"qualification"),".",e.call(r,"id")]);case"StringLiteralTypeAnnotation":return A(v(n.value,t),t);case"NumberLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"number"),A(""+n.value,t);case"StringTypeAnnotation":return A("string",t);case"TypeAlias":return D(["type ",e.call(r,"id")," = ",e.call(r,"right"),";"]);case"TypeCastExpression":return D(["(",e.call(r,"expression"),e.call(r,"typeAnnotation"),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":return D(["<",A(", ").join(e.map(r,"params")),">"]);case"TypeofTypeAnnotation":return D([A("typeof ",t),e.call(r,"argument")]);case"UnionTypeAnnotation":return A(" | ").join(e.map(r,"types"));case"VoidTypeAnnotation":return A("void",t);case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"XMLDefaultDeclaration":case"XMLAnyName":case"XMLQualifiedIdentifier":case"XMLFunctionQualifiedIdentifier":case"XMLAttributeSelector":case"XMLFilterExpression":case"XML":case"XMLElement":case"XMLList":case"XMLEscape":case"XMLText":case"XMLStartTag":case"XMLEndTag":case"XMLPointTag":case"XMLName":case"XMLAttribute":case"XMLCdata":case"XMLComment":case"XMLProcessingInstruction":default:throw new Error("unknown type: "+JSON.stringify(n.type))}return p}function u(e,t,r){var n=_.ClassBody&&_.ClassBody.check(e.getParentNode()),i=[],a=!1,s=!1;e.each(function(e){var t=(e.getName(),e.getValue());t&&"EmptyStatement"!==t.type&&(_.Comment.check(t)?a=!0:n||(_.Statement.assert(t),s=!0),i.push({node:t,printed:r(e)}))}),a&&E.strictEqual(s,!1,"Comments may appear as statements in otherwise empty statement lists, but may not coexist with non-Comment nodes.");var o=null,u=i.length,p=[];return i.forEach(function(e,r){var n,i,a=e.printed,s=e.node,c=a.length>1,f=r>0,d=u-1>r,h=s&&s.loc&&s.loc.lines,m=h&&t.reuseWhitespace&&B.getTrueLoc(s,h);if(f)if(m){var y=h.skipSpaces(m.start,!0),g=y?y.line:1,v=m.start.line-g;n=Array(v+1).join("\n")}else n=c?"\n\n":"\n";else n="";if(d)if(m){var b=h.skipSpaces(m.end),E=b?b.line:h.length,x=E-m.end.line;i=Array(x+1).join("\n")}else i=c?"\n\n":"\n";else i="";p.push(l(o,n),a),d?o=i:i&&p.push(i)}),D(p)}function l(e,t){if(!e&&!t)return A("");if(!e)return A(t);if(!t)return A(e);var r=A(e),n=A(t);return n.length>r.length?n:r}function c(e,t,r){var n=e.getNode(),i=n.kind,a=[];_.FunctionExpression.assert(n.value),n.decorators&&e.each(function(e){a.push(r(e),"\n")},"decorators"),n.value.async&&a.push("async "),i&&"init"!==i&&"method"!==i&&"constructor"!==i?(E.ok("get"===i||"set"===i),a.push(i," ")):n.value.generator&&a.push("*");var s=e.call(r,"key");return n.computed&&(s=D(["[",s,"]"])),a.push(s,e.call(r,"value","typeParameters"),"(",e.call(function(e){return d(e,t,r)},"value"),")",e.call(r,"value","returnType")," ",e.call(r,"value","body")),D(a)}function f(e,t,r){var n=e.map(r,"arguments"),i=A(", ").join(n);return i.getLineLength(1)>t.wrapColumn?(i=A(",\n").join(n),D(["(\n",i.indent(t.tabWidth),t.trailingComma?",\n)":"\n)"])):D(["(",i,")"])}function d(e,t,r){var n=e.getValue();_.Function.assert(n);var i=e.map(r,"params");n.defaults&&e.each(function(e){var t=e.getName(),n=i[t];n&&e.getValue()&&(i[t]=D([n,"=",r(e)]))},"defaults"),n.rest&&i.push(D(["...",e.call(r,"rest")]));var a=A(", ").join(i);return a.length>1||a.getLineLength(1)>t.wrapColumn?(a=A(",\n").join(i),t.trailingComma&&!n.rest&&(a=D([a,",\n"])),D(["\n",a.indent(t.tabWidth)])):a}function h(e,t){return D(e.length>1?[" ",e]:["\n",b(e).indent(t.tabWidth)])}function m(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function y(e){return"}"===m(e)}function g(e){return e.replace(/['"]/g,function(e){return'"'===e?"'":'"'})}function v(e,t){switch(F.assert(e),t.quote){case"auto":var r=JSON.stringify(e),n=g(JSON.stringify(g(e)));return r.length>n.length?n:r;case"single":return g(JSON.stringify(g(e)));case"double":default:return JSON.stringify(e)}}function b(e){var t=m(e);return!t||"\n};".indexOf(t)<0?D([e,";"]):e}var E=e(2),x=(e(599),e(550).printComments),S=e(552),A=S.fromString,D=S.concat,C=e(554).normalize,w=e(556).getReprinter,I=e(558),_=I.namedTypes,F=I.builtInTypes.string,k=I.builtInTypes.object,P=e(551),B=e(559),T=n.prototype,M=!1;T.toString=function(){return M||(console.warn("Deprecation warning: recast.print now returns an object with a .code property. You appear to be treating the object as a string, which might still work but is strongly discouraged."),M=!0),this.code};var O=new n("");r.Printer=i},{2:2,550:550,551:551,552:552,554:554,556:556,558:558,559:559,599:599}],558:[function(e,t,r){t.exports=e(576)},{576:576}],559:[function(e,t,r){function n(){ for(var e={},t=arguments.length,r=0;t>r;++r)for(var n=Object.keys(arguments[r]),i=n.length,a=0;i>a;++a)e[n[a]]=!0;return e}function i(e,t){return e.line-t.line||e.column-t.column}function a(e){return{line:e.line,column:e.column}}var s=(e(2),e(558)),o=(s.getFieldValue,s.namedTypes),u=e(599),p=u.SourceMapConsumer,l=u.SourceMapGenerator,c=Object.prototype.hasOwnProperty;r.getUnionOfKeys=n,r.comparePos=i,r.copyPos=a,r.composeSourceMaps=function(e,t){if(!e)return t||null;if(!t)return e;var r=new p(e),n=new p(t),i=new l({file:t.file,sourceRoot:t.sourceRoot}),s={};return n.eachMapping(function(e){var t=r.originalPositionFor({line:e.originalLine,column:e.originalColumn}),n=t.source;if(null!==n){i.addMapping({source:n,original:a(t),generated:{line:e.generatedLine,column:e.generatedColumn},name:e.name});var o=r.sourceContentFor(n);o&&!c.call(s,n)&&(s[n]=o,i.setSourceContent(n,o))}}),i.toJSON()},r.getTrueLoc=function(e,t){if(!e.loc)return null;var r=e.loc.start,n=e.loc.end;return e.comments&&e.comments.forEach(function(e){e.loc&&(i(e.loc.start,r)<0&&(r=e.loc.start),i(n,e.loc.end)<0&&(n=e.loc.end))}),{start:t.skipSpaces(r,!1,!1),end:t.skipSpaces(n,!0,!1)}},r.fixFaultyLocations=function(e){(o.MethodDefinition&&o.MethodDefinition.check(e)||o.Property.check(e)&&(e.method||e.shorthand))&&(e.value.loc=null,o.FunctionExpression.check(e.value)&&(e.value.id=null));var t=e.loc;t&&(t.start.line<1&&(t.start.line=1),t.end.line<1&&(t.end.line=1))}},{2:2,558:558,599:599}],560:[function(e,t,r){(function(t){function n(e,t){return new c(t).print(e)}function i(e,t){return new c(t).printGenerically(e)}function a(e,r){return s(t.argv[2],e,r)}function s(t,r,n){e(1).readFile(t,"utf-8",function(e,t){return e?void console.error(e):void u(t,r,n)})}function o(e){t.stdout.write(e)}function u(e,t,r){var i=r&&r.writeback||o;t(l(e,r),function(e){i(n(e,r).code)})}var p=e(558),l=e(555).parse,c=e(557).Printer;Object.defineProperties(r,{parse:{enumerable:!0,value:l},visit:{enumerable:!0,value:p.visit},print:{enumerable:!0,value:n},prettyPrint:{enumerable:!1,value:i},types:{enumerable:!1,value:p},run:{enumerable:!1,value:a}})}).call(this,e(10))},{1:1,10:10,555:555,557:557,558:558}],561:[function(e,t,r){e(565);var n=e(575),i=e(574).defaults,a=n.Type.def,s=n.Type.or;a("Noop").bases("Node").build(),a("DoExpression").bases("Expression").build("body").field("body",[a("Statement")]),a("Super").bases("Expression").build(),a("BindExpression").bases("Expression").build("object","callee").field("object",s(a("Expression"),null)).field("callee",a("Expression")),a("Decorator").bases("Node").build("expression").field("expression",a("Expression")),a("Property").field("decorators",s([a("Decorator")],null),i["null"]),a("MethodDefinition").field("decorators",s([a("Decorator")],null),i["null"]),a("MetaProperty").bases("Expression").build("meta","property").field("meta",a("Identifier")).field("property",a("Identifier")),a("ParenthesizedExpression").bases("Expression").build("expression").field("expression",a("Expression")),a("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",a("Identifier")),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),a("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(a("Declaration"),a("Expression"))),a("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(a("Declaration"),null)).field("specifiers",[a("ExportSpecifier")],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",a("Identifier")),a("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(a("Identifier"),null)).field("source",a("Literal")),a("CommentBlock").bases("Comment").build("value","leading","trailing"),a("CommentLine").bases("Comment").build("value","leading","trailing")},{565:565,574:574,575:575}],562:[function(e,t,r){var n=e(575),i=n.Type,a=i.def,s=i.or,o=e(574),u=o.defaults,p=o.geq;a("Printable").field("loc",s(a("SourceLocation"),null),u["null"],!0),a("Node").bases("Printable").field("type",String).field("comments",s([a("Comment")],null),u["null"],!0),a("SourceLocation").build("start","end","source").field("start",a("Position")).field("end",a("Position")).field("source",s(String,null),u["null"]),a("Position").build("line","column").field("line",p(1)).field("column",p(0)),a("File").bases("Node").build("program").field("program",a("Program")),a("Program").bases("Node").build("body").field("body",[a("Statement")]),a("Function").bases("Node").field("id",s(a("Identifier"),null),u["null"]).field("params",[a("Pattern")]).field("body",a("BlockStatement")),a("Statement").bases("Node"),a("EmptyStatement").bases("Statement").build(),a("BlockStatement").bases("Statement").build("body").field("body",[a("Statement")]),a("ExpressionStatement").bases("Statement").build("expression").field("expression",a("Expression")),a("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Statement")).field("alternate",s(a("Statement"),null),u["null"]),a("LabeledStatement").bases("Statement").build("label","body").field("label",a("Identifier")).field("body",a("Statement")),a("BreakStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("ContinueStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("WithStatement").bases("Statement").build("object","body").field("object",a("Expression")).field("body",a("Statement")),a("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",a("Expression")).field("cases",[a("SwitchCase")]).field("lexical",Boolean,u["false"]),a("ReturnStatement").bases("Statement").build("argument").field("argument",s(a("Expression"),null)),a("ThrowStatement").bases("Statement").build("argument").field("argument",a("Expression")),a("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",a("BlockStatement")).field("handler",s(a("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[a("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[a("CatchClause")],u.emptyArray).field("finalizer",s(a("BlockStatement"),null),u["null"]),a("CatchClause").bases("Node").build("param","guard","body").field("param",a("Pattern")).field("guard",s(a("Expression"),null),u["null"]).field("body",a("BlockStatement")),a("WhileStatement").bases("Statement").build("test","body").field("test",a("Expression")).field("body",a("Statement")),a("DoWhileStatement").bases("Statement").build("body","test").field("body",a("Statement")).field("test",a("Expression")),a("ForStatement").bases("Statement").build("init","test","update","body").field("init",s(a("VariableDeclaration"),a("Expression"),null)).field("test",s(a("Expression"),null)).field("update",s(a("Expression"),null)).field("body",a("Statement")),a("ForInStatement").bases("Statement").build("left","right","body").field("left",s(a("VariableDeclaration"),a("Expression"))).field("right",a("Expression")).field("body",a("Statement")),a("DebuggerStatement").bases("Statement").build(),a("Declaration").bases("Statement"),a("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",a("Identifier")),a("FunctionExpression").bases("Function","Expression").build("id","params","body"),a("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",s("var","let","const")).field("declarations",[a("VariableDeclarator")]),a("VariableDeclarator").bases("Node").build("id","init").field("id",a("Pattern")).field("init",s(a("Expression"),null)),a("Expression").bases("Node","Pattern"),a("ThisExpression").bases("Expression").build(),a("ArrayExpression").bases("Expression").build("elements").field("elements",[s(a("Expression"),null)]),a("ObjectExpression").bases("Expression").build("properties").field("properties",[a("Property")]),a("Property").bases("Node").build("kind","key","value").field("kind",s("init","get","set")).field("key",s(a("Literal"),a("Identifier"))).field("value",a("Expression")),a("SequenceExpression").bases("Expression").build("expressions").field("expressions",[a("Expression")]);var l=s("-","+","!","~","typeof","void","delete");a("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",l).field("argument",a("Expression")).field("prefix",Boolean,u["true"]);var c=s("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");a("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",a("Expression")).field("right",a("Expression"));var f=s("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");a("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",f).field("left",a("Pattern")).field("right",a("Expression"));var d=s("++","--");a("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",d).field("argument",a("Expression")).field("prefix",Boolean);var h=s("||","&&");a("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",a("Expression")).field("right",a("Expression")),a("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Expression")).field("alternate",a("Expression")),a("NewExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("CallExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("MemberExpression").bases("Expression").build("object","property","computed").field("object",a("Expression")).field("property",s(a("Identifier"),a("Expression"))).field("computed",Boolean,u["false"]),a("Pattern").bases("Node"),a("SwitchCase").bases("Node").build("test","consequent").field("test",s(a("Expression"),null)).field("consequent",[a("Statement")]),a("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),a("Literal").bases("Node","Expression").build("value").field("value",s(String,Boolean,null,Number,RegExp)).field("regex",s({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),a("Comment").bases("Printable").field("value",String).field("leading",Boolean,u["true"]).field("trailing",Boolean,u["false"])},{574:574,575:575}],563:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or;i("XMLDefaultDeclaration").bases("Declaration").field("namespace",i("Expression")),i("XMLAnyName").bases("Expression"),i("XMLQualifiedIdentifier").bases("Expression").field("left",a(i("Identifier"),i("XMLAnyName"))).field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLAttributeSelector").bases("Expression").field("attribute",i("Expression")),i("XMLFilterExpression").bases("Expression").field("left",i("Expression")).field("right",i("Expression")),i("XMLElement").bases("XML","Expression").field("contents",[i("XML")]),i("XMLList").bases("XML","Expression").field("contents",[i("XML")]),i("XML").bases("Node"),i("XMLEscape").bases("XML").field("expression",i("Expression")),i("XMLText").bases("XML").field("text",String),i("XMLStartTag").bases("XML").field("contents",[i("XML")]),i("XMLEndTag").bases("XML").field("contents",[i("XML")]),i("XMLPointTag").bases("XML").field("contents",[i("XML")]),i("XMLName").bases("XML").field("contents",a(String,[i("XML")])),i("XMLAttribute").bases("XML").field("value",String),i("XMLCdata").bases("XML").field("contents",String),i("XMLComment").bases("XML").field("contents",String),i("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",a(String,null))},{562:562,575:575}],564:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574).defaults;i("Function").field("generator",Boolean,s["false"]).field("expression",Boolean,s["false"]).field("defaults",[a(i("Expression"),null)],s.emptyArray).field("rest",a(i("Identifier"),null),s["null"]),i("RestElement").bases("Pattern").build("argument").field("argument",i("Pattern")),i("SpreadElementPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("FunctionDeclaration").build("id","params","body","generator","expression"),i("FunctionExpression").build("id","params","body","generator","expression"),i("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s["null"]).field("body",a(i("BlockStatement"),i("Expression"))).field("generator",!1,s["false"]),i("YieldExpression").bases("Expression").build("argument","delegate").field("argument",a(i("Expression"),null)).field("delegate",Boolean,s["false"]),i("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionBlock").bases("Node").build("left","right","each").field("left",i("Pattern")).field("right",i("Expression")).field("each",Boolean),i("Property").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",a(i("Expression"),i("Pattern"))).field("method",Boolean,s["false"]).field("shorthand",Boolean,s["false"]).field("computed",Boolean,s["false"]),i("PropertyPattern").bases("Pattern").build("key","pattern").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("pattern",i("Pattern")).field("computed",Boolean,s["false"]),i("ObjectPattern").bases("Pattern").build("properties").field("properties",[a(i("PropertyPattern"),i("Property"))]),i("ArrayPattern").bases("Pattern").build("elements").field("elements",[a(i("Pattern"),null)]),i("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",a("constructor","method","get","set")).field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",i("Function")).field("computed",Boolean,s["false"]).field("static",Boolean,s["false"]),i("SpreadElement").bases("Node").build("argument").field("argument",i("Expression")),i("ArrayExpression").field("elements",[a(i("Expression"),i("SpreadElement"),i("RestElement"),null)]),i("NewExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("CallExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("AssignmentPattern").bases("Pattern").build("left","right").field("left",i("Pattern")).field("right",i("Expression"));var o=a(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"));i("ClassProperty").bases("Declaration").build("key").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("computed",Boolean,s["false"]),i("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",o),i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",a(i("Identifier"),null)).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]),i("ClassExpression").bases("Expression").build("id","body","superClass").field("id",a(i("Identifier"),null),s["null"]).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]).field("implements",[i("ClassImplements")],s.emptyArray),i("ClassImplements").bases("Node").build("id").field("id",i("Identifier")).field("superClass",a(i("Expression"),null),s["null"]),i("Specifier").bases("Node"),i("ModuleSpecifier").bases("Specifier").field("local",a(i("Identifier"),null),s["null"]).field("id",a(i("Identifier"),null),s["null"]).field("name",a(i("Identifier"),null),s["null"]),i("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",i("Expression")).field("quasi",i("TemplateLiteral")),i("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[i("TemplateElement")]).field("expressions",[i("Expression")]),i("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)},{562:562,574:574,575:575}],565:[function(e,t,r){e(564);var n=e(575),i=n.Type.def,a=n.Type.or,s=(n.builtInTypes,e(574).defaults);i("Function").field("async",Boolean,s["false"]),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ObjectExpression").field("properties",[a(i("Property"),i("SpreadProperty"))]),i("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("ObjectPattern").field("properties",[a(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"))]),i("AwaitExpression").bases("Expression").build("argument","all").field("argument",a(i("Expression"),null)).field("all",Boolean,s["false"])},{564:564,574:574,575:575}],566:[function(e,t,r){e(565);var n=e(575),i=e(574).defaults,a=n.Type.def,s=n.Type.or;a("VariableDeclaration").field("declarations",[s(a("VariableDeclarator"),a("Identifier"))]),a("Property").field("value",s(a("Expression"),a("Pattern"))),a("ArrayPattern").field("elements",[s(a("Pattern"),a("SpreadElement"),null)]),a("ObjectPattern").field("properties",[s(a("Property"),a("PropertyPattern"),a("SpreadPropertyPattern"),a("SpreadProperty"))]),a("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ExportBatchSpecifier").bases("Specifier").build(),a("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),a("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(a("Declaration"),a("Expression"),null)).field("specifiers",[s(a("ExportSpecifier"),a("ExportBatchSpecifier"))],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[s(a("ImportSpecifier"),a("ImportNamespaceSpecifier"),a("ImportDefaultSpecifier"))],i.emptyArray).field("source",a("Literal")),a("Block").bases("Comment").build("value","leading","trailing"),a("Line").bases("Comment").build("value","leading","trailing")},{565:565,574:574,575:575}],567:[function(e,t,r){e(565);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574).defaults;i("JSXAttribute").bases("Node").build("name","value").field("name",a(i("JSXIdentifier"),i("JSXNamespacedName"))).field("value",a(i("Literal"),i("JSXExpressionContainer"),null),s["null"]),i("JSXIdentifier").bases("Identifier").build("name").field("name",String),i("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",i("JSXIdentifier")).field("name",i("JSXIdentifier")),i("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",a(i("JSXIdentifier"),i("JSXMemberExpression"))).field("property",i("JSXIdentifier")).field("computed",Boolean,s["false"]);var o=a(i("JSXIdentifier"),i("JSXNamespacedName"),i("JSXMemberExpression"));i("JSXSpreadAttribute").bases("Node").build("argument").field("argument",i("Expression"));var u=[a(i("JSXAttribute"),i("JSXSpreadAttribute"))];i("JSXExpressionContainer").bases("Expression").build("expression").field("expression",i("Expression")),i("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",i("JSXOpeningElement")).field("closingElement",a(i("JSXClosingElement"),null),s["null"]).field("children",[a(i("JSXElement"),i("JSXExpressionContainer"),i("JSXText"),i("Literal"))],s.emptyArray).field("name",o,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",u,function(){return this.openingElement.attributes},!0),i("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",o).field("attributes",u,s.emptyArray).field("selfClosing",Boolean,s["false"]),i("JSXClosingElement").bases("Node").build("name").field("name",o),i("JSXText").bases("Literal").build("value").field("value",String),i("JSXEmptyExpression").bases("Expression").build(),i("Type").bases("Node"),i("AnyTypeAnnotation").bases("Type").build(),i("MixedTypeAnnotation").bases("Type").build(),i("VoidTypeAnnotation").bases("Type").build(),i("NumberTypeAnnotation").bases("Type").build(),i("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),i("StringTypeAnnotation").bases("Type").build(),i("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),i("BooleanTypeAnnotation").bases("Type").build(),i("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),i("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",i("Type")),i("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",i("Type")),i("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[i("FunctionTypeParam")]).field("returnType",i("Type")).field("rest",a(i("FunctionTypeParam"),null)).field("typeParameters",a(i("TypeParameterDeclaration"),null)),i("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",i("Identifier")).field("typeAnnotation",i("Type")).field("optional",Boolean),i("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",i("Type")),i("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[i("ObjectTypeProperty")]).field("indexers",[i("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[i("ObjectTypeCallProperty")],s.emptyArray),i("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",a(i("Literal"),i("Identifier"))).field("value",i("Type")).field("optional",Boolean),i("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",i("Identifier")).field("key",i("Type")).field("value",i("Type")),i("ObjectTypeCallProperty").bases("Node").build("value").field("value",i("FunctionTypeAnnotation")).field("static",Boolean,!1),i("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("id",i("Identifier")),i("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("MemberTypeAnnotation").bases("Type").build("object","property").field("object",i("Identifier")).field("property",a(i("MemberTypeAnnotation"),i("GenericTypeAnnotation"))),i("UnionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",i("Type")),i("Identifier").field("typeAnnotation",a(i("TypeAnnotation"),null),s["null"]),i("TypeParameterDeclaration").bases("Node").build("params").field("params",[i("Identifier")]),i("TypeParameterInstantiation").bases("Node").build("params").field("params",[i("Type")]),i("Function").field("returnType",a(i("TypeAnnotation"),null),s["null"]).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]),i("ClassProperty").build("key","value","typeAnnotation","static").field("value",a(i("Expression"),null)).field("typeAnnotation",a(i("TypeAnnotation"),null)).field("static",Boolean,s["false"]),i("ClassImplements").field("typeParameters",a(i("TypeParameterInstantiation"),null),s["null"]),i("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]).field("body",i("ObjectTypeAnnotation")).field("extends",[i("InterfaceExtends")]),i("InterfaceExtends").bases("Node").build("id").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null)).field("right",i("Type")),i("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",i("Expression")).field("typeAnnotation",i("TypeAnnotation")),i("TupleTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("DeclareVariable").bases("Statement").build("id").field("id",i("Identifier")),i("DeclareFunction").bases("Statement").build("id").field("id",i("Identifier")),i("DeclareClass").bases("InterfaceDeclaration").build("id"),i("DeclareModule").bases("Statement").build("id","body").field("id",a(i("Identifier"),i("Literal"))).field("body",i("BlockStatement"))},{565:565,574:574,575:575}],568:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574),o=s.geq,u=s.defaults;i("Function").field("body",a(i("BlockStatement"),i("Expression"))),i("ForInStatement").build("left","right","body","each").field("each",Boolean,u["false"]),i("ForOfStatement").bases("Statement").build("left","right","body").field("left",a(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("LetStatement").bases("Statement").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Statement")),i("LetExpression").bases("Expression").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Expression")),i("GraphExpression").bases("Expression").build("index","expression").field("index",o(0)).field("expression",i("Literal")),i("GraphIndexExpression").bases("Expression").build("index").field("index",o(0))},{562:562,574:574,575:575}],569:[function(e,t,r){function n(e,t,r){return c.check(r)?r.length=0:r=null,a(e,t,r)}function i(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function a(e,t,r){return e===t?!0:c.check(e)?s(e,t,r):f.check(e)?o(e,t,r):d.check(e)?d.check(t)&&+e===+t:h.check(e)?h.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t}function s(e,t,r){c.assert(e);var n=e.length;if(!c.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var i=0;n>i;++i){if(r&&r.push(i),i in e!=i in t)return!1;if(!a(e[i],t[i],r))return!1;if(r){var s=r.pop();if(s!==i)throw new Error(""+s)}}return!0}function o(e,t,r){if(f.assert(e),!f.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var n=p(e),i=n.length,s=p(t),o=s.length;if(i===o){for(var u=0;i>u;++u){var c=n[u],d=l(e,c),h=l(t,c);if(r&&r.push(c),!a(d,h,r))return!1;if(r){var y=r.pop();if(y!==c)throw new Error(""+y)}}return!0}if(!r)return!1;var g=Object.create(null);for(u=0;i>u;++u)g[n[u]]=!0;for(u=0;o>u;++u){if(c=s[u],!m.call(g,c))return r.push(c),!1;delete g[c]}for(c in g){r.push(c);break}return!1}var u=e(576),p=u.getFieldNames,l=u.getFieldValue,c=u.builtInTypes.array,f=u.builtInTypes.object,d=u.builtInTypes.Date,h=u.builtInTypes.RegExp,m=Object.prototype.hasOwnProperty;n.assert=function(e,t){var r=[];if(!n(e,t,r)){if(0!==r.length)throw new Error("Nodes differ in the following path: "+r.map(i).join(""));if(e!==t)throw new Error("Nodes must be equal")}},t.exports=n},{576:576}],570:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("NodePath constructor cannot be invoked without 'new'");h.call(this,e,t,r)}function i(e){return l.BinaryExpression.check(e)||l.LogicalExpression.check(e)}function a(e){return l.CallExpression.check(e)?!0:d.check(e)?e.some(a):l.Node.check(e)?p.someField(e,function(e,t){return a(t)}):!1}function s(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,l.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(l.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw new Error("Nodes must be equal");return!0}if(l.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(l.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw new Error("Nodes must be equal")}else if(l.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw new Error("Nodes must be equal")}else if(l.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw new Error("Nodes must be equal")}else if(i(r)&&"left"===e.name){if(r.left!==t)throw new Error("Nodes must be equal")}else{if(!l.UnaryExpression.check(r)||r.prefix||"argument"!==e.name)return!1;if(r.argument!==t)throw new Error("Nodes must be equal")}}return!0}function o(e){if(l.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(l.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else l.IfStatement.check(e.node)&&u(e);return e}function u(e){var t=e.get("test").value,r=e.get("alternate").value,n=e.get("consequent").value;if(n||r){if(!n&&r){var i=c.unaryExpression("!",t,!0);l.UnaryExpression.check(t)&&"!"===t.operator&&(i=t.argument),e.get("test").replace(i),e.get("consequent").replace(r),e.get("alternate").replace()}}else{var a=c.expressionStatement(t);e.replace(a)}}var p=e(575),l=p.namedTypes,c=p.builders,f=p.builtInTypes.number,d=p.builtInTypes.array,h=e(572),m=e(573),y=n.prototype=Object.create(h.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(y,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),y.replace=function(){return delete this.node,delete this.parent,delete this.scope,h.prototype.replace.apply(this,arguments)},y.prune=function(){var e=this.parent;return this.replace(),o(e)},y._computeNode=function(){var e=this.value;if(l.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},y._computeParent=function(){var e=this.value,t=this.parentPath;if(!l.Node.check(e)){for(;t&&!l.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!l.Node.check(t.value);)t=t.parentPath;return t||null},y._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return l.Node.check(e)&&m.isEstablishedBy(e)&&(r=new m(this,r)),r||null},y.getValueProperty=function(e){return p.getFieldValue(this.value,e)},y.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var r=this.value;if(!l.Expression.check(r))return!1;if("Identifier"===r.type)return!1;for(;!l.Node.check(t.value);)if(t=t.parentPath,!t)return!1;var n=t.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===n.type&&"object"===this.name&&n.object===r; case"BinaryExpression":case"LogicalExpression":switch(n.type){case"CallExpression":return"callee"===this.name&&n.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":var i=n.operator,t=g[i],s=r.operator,o=g[s];if(t>o)return!0;if(t===o&&"right"===this.name){if(n.right!==r)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(n.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(n.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===n.type&&f.check(r.value)&&"object"===this.name&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&n.callee===r;case"ConditionalExpression":return"test"===this.name&&n.test===r;case"MemberExpression":return"object"===this.name&&n.object===r;default:return!1}default:if("NewExpression"===n.type&&"callee"===this.name&&n.callee===r)return a(r)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var g={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){g[e]=t})}),y.canBeFirstInStatement=function(){var e=this.node;return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},y.firstInStatement=function(){return s(this)},t.exports=n},{572:572,573:573,575:575}],571:[function(e,t,r){function n(){if(!(this instanceof n))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=i(this),this._shouldVisitComments=h.call(this._methodNameTable,"Block")||h.call(this._methodNameTable,"Line"),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function i(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=p.computeSupertypeLookupTable(t),i=Object.create(null),t=Object.keys(n),a=t.length,s=0;a>s;++s){var o=t[s];r="visit"+n[o],d.check(e[r])&&(i[o]=r)}return i}function a(e,t){for(var r in t)h.call(t,r)&&(e[r]=t[r]);return e}function s(e,t){if(!(e instanceof l))throw new Error("");if(!(t instanceof n))throw new Error("");var r=e.value;if(c.check(r))e.each(t.visitWithoutReset,t);else if(f.check(r)){var i=p.getFieldNames(r);t._shouldVisitComments&&r.comments&&i.indexOf("comments")<0&&i.push("comments");for(var a=i.length,s=[],o=0;a>o;++o){var u=i[o];h.call(r,u)||(r[u]=p.getFieldValue(r,u)),s.push(e.get(u))}for(var o=0;a>o;++o)t.visitWithoutReset(s[o])}else;return e.value}function o(e){function t(r){if(!(this instanceof t))throw new Error("");if(!(this instanceof n))throw new Error("");if(!(r instanceof l))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=r,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof n))throw new Error("");var r=t.prototype=Object.create(e);return r.constructor=t,a(r,y),t}var u,p=e(575),l=e(570),c=(p.namedTypes.Printable,p.builtInTypes.array),f=p.builtInTypes.object,d=p.builtInTypes["function"],h=Object.prototype.hasOwnProperty;n.fromMethodsObject=function(e){function t(){if(!(this instanceof t))throw new Error("Visitor constructor cannot be invoked without 'new'");n.call(this)}if(e instanceof n)return e;if(!f.check(e))return new n;var r=t.prototype=Object.create(m);return r.constructor=t,a(r,e),a(t,n),d.assert(t.fromMethodsObject),d.assert(t.visit),new t},n.visit=function(e,t){return n.fromMethodsObject(t).visit(e)};var m=n.prototype;m.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,t=new Array(e),r=0;e>r;++r)t[r]=arguments[r];t[0]instanceof l||(t[0]=new l({root:t[0]}).get("root")),this.reset.apply(this,t);try{var n=this.visitWithoutReset(t[0]),i=!0}finally{if(this._visiting=!1,!i&&this._abortRequested)return t[0].value}return n},m.AbortRequest=function(){},m.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},m.reset=function(e){},m.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof l))throw new Error("");var t=e.value,r=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!r)return s(e,this);var n=this.acquireContext(e);try{return n.invokeVisitorMethod(r)}finally{this.releaseContext(n)}},m.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},m.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},m.reportChanged=function(){this._changeReported=!0},m.wasChangeReported=function(){return this._changeReported};var y=Object.create(null);y.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},y.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(t===!1?this.needToCallTraverse=!1:t!==u&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),this.needToCallTraverse!==!1)throw new Error("Must either call this.traverse or return false in "+e);var r=this.currentPath;return r&&r.value},y.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,s(e,n.fromMethodsObject(t||this.visitor))},y.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,n.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},y.reportChanged=function(){this.visitor.reportChanged()},y.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},t.exports=n},{570:570,575:575}],572:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("Path constructor cannot be invoked without 'new'");if(t){if(!(t instanceof n))throw new Error("")}else t=null,r=null;this.value=e,this.parentPath=t,this.name=r,this.__childCache=null}function i(e){return e.__childCache||(e.__childCache=Object.create(null))}function a(e,t){var r=i(e),n=e.getValueProperty(t),a=r[t];return l.call(r,t)&&a.value===n||(a=r[t]=new e.constructor(n,e,t)),a}function s(){}function o(e,t,r,n){if(f.assert(e.value),0===t)return s;var a=e.value.length;if(1>a)return s;var o=arguments.length;2===o?(r=0,n=a):3===o?(r=Math.max(r,0),n=a):(r=Math.max(r,0),n=Math.min(n,a)),d.assert(r),d.assert(n);for(var u=Object.create(null),p=i(e),c=r;n>c;++c)if(l.call(e.value,c)){var h=e.get(c);if(h.name!==c)throw new Error("");var m=c+t;h.name=m,u[m]=h,delete p[c]}return delete p.length,function(){for(var t in u){var r=u[t];if(r.name!==+t)throw new Error("");p[t]=r,e.value[t]=r.value}}}function u(e){if(!(e instanceof n))throw new Error("");var t=e.parentPath;if(!t)return e;var r=t.value,a=i(t);if(r[e.name]===e.value)a[e.name]=e;else if(f.check(r)){var s=r.indexOf(e.value);s>=0&&(a[e.name=s]=e)}else r[e.name]=e.value,a[e.name]=e;if(r[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}var p=Object.prototype,l=p.hasOwnProperty,c=e(575),f=c.builtInTypes.array,d=c.builtInTypes.number,h=Array.prototype,m=(h.slice,h.map,n.prototype);m.getValueProperty=function(e){return this.value[e]},m.get=function(e){for(var t=this,r=arguments,n=r.length,i=0;n>i;++i)t=a(t,r[i]);return t},m.each=function(e,t){for(var r=[],n=this.value.length,i=0,i=0;n>i;++i)l.call(this.value,i)&&(r[i]=this.get(i));for(t=t||this,i=0;n>i;++i)l.call(r,i)&&e.call(t,r[i])},m.map=function(e,t){var r=[];return this.each(function(t){r.push(e.call(this,t))},t),r},m.filter=function(e,t){var r=[];return this.each(function(t){e.call(this,t)&&r.push(t)},t),r},m.shift=function(){var e=o(this,-1),t=this.value.shift();return e(),t},m.unshift=function(e){var t=o(this,arguments.length),r=this.value.unshift.apply(this.value,arguments);return t(),r},m.push=function(e){return f.assert(this.value),delete i(this).length,this.value.push.apply(this.value,arguments)},m.pop=function(){f.assert(this.value);var e=i(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},m.insertAt=function(e,t){var r=arguments.length,n=o(this,r-1,e);if(n===s)return this;e=Math.max(e,0);for(var i=1;r>i;++i)this.value[e+i-1]=arguments[i];return n(),this},m.insertBefore=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.insertAfter=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name+1],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.replace=function(e){var t=[],r=this.parentPath.value,n=i(this.parentPath),a=arguments.length;if(u(this),f.check(r)){for(var s=r.length,p=o(this.parentPath,a-1,this.name+1),l=[this.name,1],c=0;a>c;++c)l.push(arguments[c]);var d=r.splice.apply(r,l);if(d[0]!==this.value)throw new Error("");if(r.length!==s-1+a)throw new Error("");if(p(),0===a)delete this.value,delete n[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),c=0;a>c;++c)t.push(this.parentPath.get(this.name+c));if(t[0]!==this)throw new Error("")}}else if(1===a)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==a)throw new Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},t.exports=n},{575:575}],573:[function(e,t,r){function n(t,r){if(!(this instanceof n))throw new Error("Scope constructor cannot be invoked without 'new'");if(!(t instanceof e(570)))throw new Error("");g.assert(t.value);var i;if(r){if(!(r instanceof n))throw new Error("");i=r.depth+1}else r=null,i=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!r,enumerable:!0},depth:{value:i},parent:{value:r},bindings:{value:{}}})}function i(e,t){var r=e.value;g.assert(r),l.CatchClause.check(r)?o(e.get("param"),t):a(e,t)}function a(e,t){var r=e.value;e.parent&&l.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&o(e.parent.get("id"),t),r&&(d.check(r)?e.each(function(e){s(e,t)}):l.Function.check(r)?(e.get("params").each(function(e){o(e,t)}),s(e.get("body"),t)):l.VariableDeclarator.check(r)?(o(e.get("id"),t),s(e.get("init"),t)):"ImportSpecifier"===r.type||"ImportNamespaceSpecifier"===r.type||"ImportDefaultSpecifier"===r.type?o(e.get(r.local?"local":r.name?"name":"id"),t):c.check(r)&&!f.check(r)&&u.eachField(r,function(r,n){var i=e.get(r);if(i.value!==n)throw new Error("");s(i,t)}))}function s(e,t){var r=e.value;if(!r||f.check(r));else if(l.FunctionDeclaration.check(r))o(e.get("id"),t);else if(l.ClassDeclaration&&l.ClassDeclaration.check(r))o(e.get("id"),t);else if(g.check(r)){if(l.CatchClause.check(r)){var n=r.param.name,i=h.call(t,n);a(e.get("body"),t),i||delete t[n]}}else a(e,t)}function o(e,t){var r=e.value;l.Pattern.assert(r),l.Identifier.check(r)?h.call(t,r.name)?t[r.name].push(e):t[r.name]=[e]:l.ObjectPattern&&l.ObjectPattern.check(r)?e.get("properties").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.Property.check(r)?o(e.get("value"),t):l.SpreadProperty&&l.SpreadProperty.check(r)&&o(e.get("argument"),t)}):l.ArrayPattern&&l.ArrayPattern.check(r)?e.get("elements").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.SpreadElement&&l.SpreadElement.check(r)&&o(e.get("argument"),t)}):l.PropertyPattern&&l.PropertyPattern.check(r)?o(e.get("pattern"),t):(l.SpreadElementPattern&&l.SpreadElementPattern.check(r)||l.SpreadPropertyPattern&&l.SpreadPropertyPattern.check(r))&&o(e.get("argument"),t)}var u=e(575),p=u.Type,l=u.namedTypes,c=l.Node,f=l.Expression,d=u.builtInTypes.array,h=Object.prototype.hasOwnProperty,m=u.builders,y=[l.Program,l.Function,l.CatchClause],g=p.or.apply(p,y);n.isEstablishedBy=function(e){return g.check(e)};var v=n.prototype;v.didScan=!1,v.declares=function(e){return this.scan(),h.call(this.bindings,e)},v.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var t=0;this.declares(e+t);)++t;var r=e+t;return this.bindings[r]=u.builders.identifier(r)},v.injectTemporary=function(e,t){e||(e=this.declareTemporary());var r=this.path.get("body");return l.BlockStatement.check(r.value)&&(r=r.get("body")),r.unshift(m.variableDeclaration("var",[m.variableDeclarator(e,t||null)])),e},v.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];i(this.path,this.bindings),this.didScan=!0}},v.getBindings=function(){return this.scan(),this.bindings},v.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},v.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},t.exports=n},{570:570,575:575}],574:[function(e,t,r){var n=e(575),i=n.Type,a=n.builtInTypes,s=a.number;r.geq=function(e){return new i(function(t){return s.check(t)&&t>=e},s+" >= "+e)},r.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var o=i.or(a.string,a.number,a["boolean"],a["null"],a.undefined);r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString())},{575:575}],575:[function(e,t,r){function n(e,t){var r=this;if(!(r instanceof n))throw new Error("Type constructor cannot be invoked without 'new'");if(b.call(e)!==E)throw new Error(e+" is not a function");var i=b.call(t);if(i!==E&&i!==x)throw new Error(t+" is neither a function nor a string");Object.defineProperties(r,{name:{value:t},check:{value:function(t,n){var i=e.call(r,t,n);return!i&&n&&b.call(n)===E&&n(r,t),i}}})}function i(e){return k.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":F.check(e)?"["+e.map(i).join(", ")+"]":JSON.stringify(e)}function a(e,t){var r=b.call(e),i=new n(function(e){return b.call(e)===r},t);return w[t]=i,e&&"function"==typeof e.constructor&&(D.push(e.constructor),C.push(i)),i}function s(e,t){if(e instanceof n)return e;if(e instanceof u)return e.type;if(F.check(e))return n.fromArray(e);if(k.check(e))return n.fromObject(e);if(_.check(e)){var r=D.indexOf(e);return r>=0?C[r]:new n(e,t)}return new n(function(t){return t===e},B.check(t)?function(){return e+""}:t)}function o(e,t,r,n){var i=this;if(!(i instanceof o))throw new Error("Field constructor cannot be invoked without 'new'");I.assert(e),t=s(t);var a={name:{value:e},type:{value:t},hidden:{value:!!n}};_.check(r)&&(a.defaultFn={value:r}),Object.defineProperties(i,a)}function u(e){var t=this;if(!(t instanceof u))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(t,{typeName:{value:e},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new n(function(e,r){return t.check(e,r)},e)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function l(e){return e=p(e),e.replace(/(Expression)?$/,"Statement")}function c(e){var t=u.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function f(e,t){var r=u.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e[t]}function d(e){var t=l(e);if(!j[t]){var r=j[p(e)];r&&(j[t]=function(){return j.expressionStatement(r.apply(j,arguments))})}}function h(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n<t.length;++n){e=t[n];var i=M[e];if(i.finalized!==!0)throw new Error("");S.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,i.baseNames)}for(var a=0,s=a,o=t.length;o>s;++s)S.call(t,s)&&(t[a++]=t[s]);t.length=a}function m(e,t){return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}var y=Array.prototype,g=y.slice,v=(y.map,y.forEach,Object.prototype),b=v.toString,E=b.call(function(){}),x=b.call(""),S=v.hasOwnProperty,A=n.prototype;r.Type=n,A.assert=function(e,t){if(!this.check(e,t)){var r=i(e);throw new Error(r+" does not match type "+this)}return!0},A.toString=function(){var e=this.name;return I.check(e)?e:_.check(e)?e.call(this)+"":e+" type"};var D=[],C=[],w={};r.builtInTypes=w;var I=a("truthy","string"),_=a(function(){},"function"),F=a([],"array"),k=a({},"object"),P=(a(/./,"RegExp"),a(new Date,"Date"),a(3,"number")),B=(a(!0,"boolean"),a(null,"null"),a(void 0,"undefined"));n.or=function(){for(var e=[],t=arguments.length,r=0;t>r;++r)e.push(s(arguments[r]));return new n(function(r,n){for(var i=0;t>i;++i)if(e[i].check(r,n))return!0;return!1},function(){return e.join(" | ")})},n.fromArray=function(e){if(!F.check(e))throw new Error("");if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return s(e[0]).arrayOf()},A.arrayOf=function(){var e=this;return new n(function(t,r){return F.check(t)&&t.every(function(t){return e.check(t,r)})},function(){return"["+e+"]"})},n.fromObject=function(e){var t=Object.keys(e).map(function(t){return new o(t,e[t])});return new n(function(e,r){return k.check(e)&&t.every(function(t){return t.type.check(e[t.name],r)})},function(){return"{ "+t.join(", ")+" }"})};var T=o.prototype;T.toString=function(){return JSON.stringify(this.name)+": "+this.type},T.getValue=function(e){var t=e[this.name];return B.check(t)?(this.defaultFn&&(t=this.defaultFn.call(e)),t):t},n.def=function(e){return I.assert(e),S.call(M,e)?M[e]:M[e]=new u(e)};var M=Object.create(null);u.fromValue=function(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&S.call(M,t)){var r=M[t];if(r.finalized)return r}}return null};var O=u.prototype;O.isSupertypeOf=function(e){if(e instanceof u){if(this.finalized!==!0||e.finalized!==!0)throw new Error("");return S.call(e.allSupertypes,this.typeName)}throw new Error(e+" is not a Def")},r.getSupertypeNames=function(e){if(!S.call(M,e))throw new Error("");var t=M[e];if(t.finalized!==!0)throw new Error("");return t.supertypeList.slice(1)},r.computeSupertypeLookupTable=function(e){for(var t={},r=Object.keys(M),n=r.length,i=0;n>i;++i){var a=r[i],s=M[a];if(s.finalized!==!0)throw new Error(""+a);for(var o=0;o<s.supertypeList.length;++o){var u=s.supertypeList[o];if(S.call(e,u)){t[a]=u;break}}}return t},O.checkAllFields=function(e,t){function r(r){var i=n[r],a=i.type,s=i.getValue(e);return a.check(s,t)}var n=this.allFields;if(this.finalized!==!0)throw new Error(""+this.typeName);return k.check(e)&&Object.keys(n).every(r)},O.check=function(e,t){if(this.finalized!==!0)throw new Error("prematurely checking unfinalized type "+this.typeName);if(!k.check(e))return!1;var r=u.fromValue(e);return r?t&&r===this?this.checkAllFields(e,t):this.isSupertypeOf(r)?t?r.checkAllFields(e,t)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,t):!1},O.bases=function(){var e=g.call(arguments),t=this.baseNames;if(this.finalized){if(e.length!==t.length)throw new Error("");for(var r=0;r<e.length;r++)if(e[r]!==t[r])throw new Error("");return this}return e.forEach(function(e){I.assert(e),t.indexOf(e)<0&&t.push(e)}),this},Object.defineProperty(O,"buildable",{value:!1});var j={};r.builders=j;var L={};r.defineMethod=function(e,t){var r=L[e];return B.check(t)?delete L[e]:(_.assert(t),Object.defineProperty(L,e,{enumerable:!0,configurable:!0,value:t})),r};var N=I.arrayOf();O.build=function(){var e=this,t=g.call(arguments);return N.assert(t),Object.defineProperty(e,"buildParams",{value:t,writable:!1,enumerable:!1,configurable:!0}),e.buildable?e:(e.field("type",String,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(j,p(e.typeName),{enumerable:!0,value:function(){function t(t,s){if(!S.call(a,t)){var o=e.allFields;if(!S.call(o,t))throw new Error(""+t);var u,p=o[t],l=p.type;if(P.check(s)&&n>s)u=r[s];else{if(!p.defaultFn){var c="no value or default function given for field "+JSON.stringify(t)+" of "+e.typeName+"("+e.buildParams.map(function(e){return o[e]}).join(", ")+")";throw new Error(c)}u=p.defaultFn.call(a)}if(!l.check(u))throw new Error(i(u)+" does not match field "+p+" of type "+e.typeName);a[t]=u}}var r=arguments,n=r.length,a=Object.create(L);if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);if(e.buildParams.forEach(function(e,r){t(e,r)}),Object.keys(e.allFields).forEach(function(e){t(e)}),a.type!==e.typeName)throw new Error("");return a}}),e)},r.getBuilderName=p,r.getStatementBuilderName=l,O.field=function(e,t,r,n){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new o(e,t,r,n),this)};var R={};r.namedTypes=R,r.getFieldNames=c,r.getFieldValue=f,r.eachField=function(e,t,r){c(e).forEach(function(r){t.call(this,r,f(e,r))},r)},r.someField=function(e,t,r){return c(e).some(function(r){return t.call(this,r,f(e,r))},r)},Object.defineProperty(O,"finalized",{value:!1}),O.finalize=function(){var e=this;if(!e.finalized){var t=e.allFields,r=e.allSupertypes;e.baseNames.forEach(function(n){var i=M[n];if(!(i instanceof u)){var a="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(a)}i.finalize(),m(t,i.allFields),m(r,i.allSupertypes)}),m(t,e.ownFields),r[e.typeName]=e,e.fieldNames.length=0;for(var n in t)S.call(t,n)&&!t[n].hidden&&e.fieldNames.push(n);Object.defineProperty(R,e.typeName,{enumerable:!0,value:e.type}),Object.defineProperty(e,"finalized",{value:!0}),h(e.typeName,e.supertypeList),e.buildable&&e.supertypeList.lastIndexOf("Expression")>=0&&d(e.typeName)}},r.finalize=function(){Object.keys(M).forEach(function(e){M[e].finalize()})}},{}],576:[function(e,t,r){var n=e(575);e(562),e(564),e(565),e(568),e(563),e(567),e(566),e(561),n.finalize(),r.Type=n.Type,r.builtInTypes=n.builtInTypes,r.namedTypes=n.namedTypes,r.builders=n.builders,r.defineMethod=n.defineMethod,r.getFieldNames=n.getFieldNames,r.getFieldValue=n.getFieldValue,r.eachField=n.eachField,r.someField=n.someField,r.getSupertypeNames=n.getSupertypeNames,r.astNodesAreEquivalent=e(569),r.finalize=n.finalize,r.NodePath=e(570),r.PathVisitor=e(571),r.visit=r.PathVisitor.visit},{561:561,562:562,563:563,564:564,565:565,566:566,567:567,568:568,569:569,570:570,571:571,575:575}],577:[function(e,t,r){(function(e,r){!function(r){"use strict";function n(e,t,r,n){var i=Object.create((t||a).prototype),s=new h(n||[]);return i._invoke=c(e,r,s),i}function i(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}function a(){}function s(){}function o(){}function u(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function p(e){this.arg=e}function l(t){function r(e,r){var n=t[e](r),i=n.value;return i instanceof p?Promise.resolve(i.arg).then(a,s):Promise.resolve(i).then(function(e){return n.value=e,n})}function n(e,t){function n(){return r(e,t)}return i=i?i.then(n,n):new Promise(function(e){e(n())})}"object"==typeof e&&e.domain&&(r=e.domain.bind(r));var i,a=r.bind(t,"next"),s=r.bind(t,"throw");r.bind(t,"return");this._invoke=n}function c(e,t,r){var n=S;return function(a,s){if(n===D)throw new Error("Generator is already running");if(n===C){if("throw"===a)throw s;return y()}for(;;){var o=r.delegate;if(o){if("return"===a||"throw"===a&&o.iterator[a]===g){r.delegate=null;var u=o.iterator["return"];if(u){var p=i(u,o.iterator,s);if("throw"===p.type){a="throw",s=p.arg;continue}}if("return"===a)continue}var p=i(o.iterator[a],o.iterator,s);if("throw"===p.type){r.delegate=null,a="throw",s=p.arg;continue}a="next",s=g;var l=p.arg;if(!l.done)return n=A,l;r[o.resultName]=l.value,r.next=o.nextLoc,r.delegate=null}if("next"===a)n===A?r.sent=s:r.sent=g;else if("throw"===a){if(n===S)throw n=C,s;r.dispatchException(s)&&(a="next",s=g)}else"return"===a&&r.abrupt("return",s);n=D;var p=i(e,t,r);if("normal"===p.type){n=r.done?C:A;var l={value:p.arg,done:r.done};if(p.arg!==w)return l;r.delegate&&"next"===a&&(s=g)}else"throw"===p.type&&(n=C,a="throw",s=p.arg)}}}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function i(){for(;++r<e.length;)if(v.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=g,i.done=!0,i};return n.next=n}}return{next:y}}function y(){return{value:g,done:!0}}var g,v=Object.prototype.hasOwnProperty,b="function"==typeof Symbol&&Symbol.iterator||"@@iterator",E="object"==typeof t,x=r.regeneratorRuntime;if(x)return void(E&&(t.exports=x));x=r.regeneratorRuntime=E?t.exports:{},x.wrap=n;var S="suspendedStart",A="suspendedYield",D="executing",C="completed",w={},I=o.prototype=a.prototype;s.prototype=I.constructor=o,o.constructor=s,s.displayName="GeneratorFunction",x.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===s||"GeneratorFunction"===(t.displayName||t.name):!1},x.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,o):e.__proto__=o,e.prototype=Object.create(I),e},x.awrap=function(e){return new p(e)},u(l.prototype),x.async=function(e,t,r,i){var a=new l(n(e,t,r,i));return x.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},u(I),I[b]=function(){return this},I.toString=function(){return"[object Generator]"},x.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},x.values=m,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=g,this.done=!1,this.delegate=null,this.tryEntries.forEach(d),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,n){return a.type="throw",a.arg=e,r.next=t,!!n}if(this.done)throw e;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var s=v.call(i,"catchLoc"),o=v.call(i,"finallyLoc");if(s&&o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?this.next=i.finallyLoc:this.complete(a),w},complete:function(e,t){if("throw"===e.type)throw e.arg;"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t)},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),d(r),w}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;d(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:m(e),resultName:t,nextLoc:r},w}}}("object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10}],578:[function(e,t,r){var n=e(580);r.REGULAR={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,65535),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},r.UNICODE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},r.UNICODE_IGNORE_CASE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:n(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:n(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{580:580}],579:[function(e,t,r){t.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567, 66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,68736:68800,68737:68801,68738:68802,68739:68803,68740:68804,68741:68805,68742:68806,68743:68807,68744:68808,68745:68809,68746:68810,68747:68811,68748:68812,68749:68813,68750:68814,68751:68815,68752:68816,68753:68817,68754:68818,68755:68819,68756:68820,68757:68821,68758:68822,68759:68823,68760:68824,68761:68825,68762:68826,68763:68827,68764:68828,68765:68829,68766:68830,68767:68831,68768:68832,68769:68833,68770:68834,68771:68835,68772:68836,68773:68837,68774:68838,68775:68839,68776:68840,68777:68841,68778:68842,68779:68843,68780:68844,68781:68845,68782:68846,68783:68847,68784:68848,68785:68849,68786:68850,68800:68736,68801:68737,68802:68738,68803:68739,68804:68740,68805:68741,68806:68742,68807:68743,68808:68744,68809:68745,68810:68746,68811:68747,68812:68748,68813:68749,68814:68750,68815:68751,68816:68752,68817:68753,68818:68754,68819:68755,68820:68756,68821:68757,68822:68758,68823:68759,68824:68760,68825:68761,68826:68762,68827:68763,68828:68764,68829:68765,68830:68766,68831:68767,68832:68768,68833:68769,68834:68770,68835:68771,68836:68772,68837:68773,68838:68774,68839:68775,68840:68776,68841:68777,68842:68778,68843:68779,68844:68780,68845:68781,68846:68782,68847:68783,68848:68784,68849:68785,68850:68786,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],580:[function(t,r,n){(function(t){!function(i){var a="object"==typeof n&&n,s="object"==typeof r&&r&&r.exports==a&&r,o="object"==typeof t&&t;(o.global===o||o.window===o)&&(i=o);var u={rangeOrder:"A range’s `stop` value must be greater than or equal to the `start` value.",codePointRange:"Invalid code point value. Code points range from U+000000 to U+10FFFF."},p=55296,l=56319,c=56320,f=57343,d=/\\x00([^0123456789]|$)/g,h={},m=h.hasOwnProperty,y=function(e,t){var r;for(r in t)m.call(t,r)&&(e[r]=t[r]);return e},g=function(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r)},v=h.toString,b=function(e){return"[object Array]"==v.call(e)},E=function(e){return"number"==typeof e||"[object Number]"==v.call(e)},x="0000",S=function(e,t){var r=String(e);return r.length<t?(x+r).slice(-t):r},A=function(e){return Number(e).toString(16).toUpperCase()},D=[].slice,C=function(e){for(var t,r=-1,n=e.length,i=n-1,a=[],s=!0,o=0;++r<n;)if(t=e[r],s)a.push(t),o=t,s=!1;else if(t==o+1){if(r!=i){o=t;continue}s=!0,a.push(t+1)}else a.push(o+1,t),o=t;return s||a.push(t+1),a},w=function(e,t){for(var r,n,i=0,a=e.length;a>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return t==r?n==r+1?(e.splice(i,2),e):(e[i]=t+1,e):t==n-1?(e[i+1]=t,e):(e.splice(i,2,r,t,t+1,n),e);i+=2}return e},I=function(e,t,r){if(t>r)throw Error(u.rangeOrder);for(var n,i,a=0;a<e.length;){if(n=e[a],i=e[a+1]-1,n>r)return e;if(n>=t&&r>=i)e.splice(a,2);else{if(t>=n&&i>r)return t==n?(e[a]=r+1,e[a+1]=i+1,e):(e.splice(a,2,n,t,r+1,i+1),e);if(t>=n&&i>=t)e[a+1]=t;else if(r>=n&&i>=r)return e[a]=r+1,e;a+=2}}return e},_=function(e,t){var r,n,i=0,a=null,s=e.length;if(0>t||t>1114111)throw RangeError(u.codePointRange);for(;s>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return e;if(t==r-1)return e[i]=t,e;if(r>t)return e.splice(null!=a?a+2:0,0,t,t+1),e;if(t==n)return t+1==e[i+2]?(e.splice(i,4,r,e[i+3]),e):(e[i+1]=t+1,e);a=i,i+=2}return e.push(t,t+1),e},F=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?_(a,r):P(a,r,n),i+=2;return a},k=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?w(a,r):I(a,r,n),i+=2;return a},P=function(e,t,r){if(t>r)throw Error(u.rangeOrder);if(0>t||t>1114111||0>r||r>1114111)throw RangeError(u.codePointRange);for(var n,i,a=0,s=!1,o=e.length;o>a;){if(n=e[a],i=e[a+1],s){if(n==r+1)return e.splice(a-1,2),e;if(n>r)return e;n>=t&&r>=n&&(i>t&&r>=i-1?(e.splice(a,2),a-=2):(e.splice(a-1,2),a-=2))}else{if(n==r+1)return e[a]=t,e;if(n>r)return e.splice(a,0,t,r+1),e;if(t>=n&&i>t&&i>=r+1)return e;t>=n&&i>t||i==t?(e[a+1]=r+1,s=!0):n>=t&&r+1>=i&&(e[a]=t,e[a+1]=r+1,s=!0)}a+=2}return s||e.push(t,r+1),e},B=function(e,t){var r=0,n=e.length,i=e[r],a=e[n-1];if(n>=2&&(i>t||t>a))return!1;for(;n>r;){if(i=e[r],a=e[r+1],t>=i&&a>t)return!0;r+=2}return!1},T=function(e,t){for(var r,n=0,i=t.length,a=[];i>n;)r=t[n],B(e,r)&&a.push(r),++n;return C(a)},M=function(e){return!e.length},O=function(e){return 2==e.length&&e[0]+1==e[1]},j=function(e){for(var t,r,n=0,i=[],a=e.length;a>n;){for(t=e[n],r=e[n+1];r>t;)i.push(t),++t;n+=2}return i},L=Math.floor,N=function(e){return parseInt(L((e-65536)/1024)+p,10)},R=function(e){return parseInt((e-65536)%1024+c,10)},V=String.fromCharCode,U=function(e){var t;return t=9==e?"\\t":10==e?"\\n":12==e?"\\f":13==e?"\\r":92==e?"\\\\":36==e||e>=40&&43>=e||45==e||46==e||63==e||e>=91&&94>=e||e>=123&&125>=e?"\\"+V(e):e>=32&&126>=e?V(e):255>=e?"\\x"+S(A(e),2):"\\u"+S(A(e),4)},q=function(e){var t,r=e.length,n=e.charCodeAt(0);return n>=p&&l>=n&&r>1?(t=e.charCodeAt(1),1024*(n-p)+t-c+65536):n},G=function(e){var t,r,n="",i=0,a=e.length;if(O(e))return U(e[0]);for(;a>i;)t=e[i],r=e[i+1]-1,n+=t==r?U(t):t+1==r?U(t)+U(r):U(t)+"-"+U(r),i+=2;return"["+n+"]"},H=function(e){for(var t,r,n=[],i=[],a=[],s=[],o=0,u=e.length;u>o;)t=e[o],r=e[o+1]-1,p>t?(p>r&&a.push(t,r+1),r>=p&&l>=r&&(a.push(t,p),n.push(p,r+1)),r>=c&&f>=r&&(a.push(t,p),n.push(p,l+1),i.push(c,r+1)),r>f&&(a.push(t,p),n.push(p,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=p&&l>=t?(r>=p&&l>=r&&n.push(t,r+1),r>=c&&f>=r&&(n.push(t,l+1),i.push(c,r+1)),r>f&&(n.push(t,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=c&&f>=t?(r>=c&&f>=r&&i.push(t,r+1),r>f&&(i.push(t,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>f&&65535>=t?65535>=r?a.push(t,r+1):(a.push(t,65536),s.push(65536,r+1)):s.push(t,r+1),o+=2;return{loneHighSurrogates:n,loneLowSurrogates:i,bmp:a,astral:s}},W=function(e){for(var t,r,n,i,a,s,o=[],u=[],p=!1,l=-1,c=e.length;++l<c;)if(t=e[l],r=e[l+1]){for(n=t[0],i=t[1],a=r[0],s=r[1],u=i;a&&n[0]==a[0]&&n[1]==a[1];)u=O(s)?_(u,s[0]):P(u,s[0],s[1]-1),++l,t=e[l],n=t[0],i=t[1],r=e[l+1],a=r&&r[0],s=r&&r[1],p=!0;o.push([n,p?u:i]),p=!1}else o.push(t);return X(o)},X=function(e){if(1==e.length)return e;for(var t=-1,r=-1;++t<e.length;){var n=e[t],i=n[1],a=i[0],s=i[1];for(r=t;++r<e.length;){var o=e[r],u=o[1],p=u[0],l=u[1];a==p&&s==l&&(O(o[0])?n[0]=_(n[0],o[0][0]):n[0]=P(n[0],o[0][0],o[0][1]-1),e.splice(r,1),--r)}}return e},Y=function(e){if(!e.length)return[];for(var t,r,n,i,a,s,o=0,u=0,p=0,l=[],d=e.length;d>o;){t=e[o],r=e[o+1]-1,n=N(t),i=R(t),a=N(r),s=R(r);var h=i==c,m=s==f,y=!1;n==a||h&&m?(l.push([[n,a+1],[i,s+1]]),y=!0):l.push([[n,n+1],[i,f+1]]),!y&&a>n+1&&(m?(l.push([[n+1,a+1],[c,s+1]]),y=!0):l.push([[n+1,a],[c,f+1]])),y||l.push([[a,a+1],[c,s+1]]),u=n,p=a,o+=2}return W(l)},J=function(e){var t=[];return g(e,function(e){var r=e[0],n=e[1];t.push(G(r)+G(n))}),t.join("|")},z=function(e,t){var r=[],n=H(e),i=n.loneHighSurrogates,a=n.loneLowSurrogates,s=n.bmp,o=n.astral,u=(!M(n.astral),!M(i)),p=!M(a),l=Y(o);return t&&(s=F(s,i),u=!1,s=F(s,a),p=!1),M(s)||r.push(G(s)),l.length&&r.push(J(l)),u&&r.push(G(i)+"(?![\\uDC00-\\uDFFF])"),p&&r.push("(?:[^\\uD800-\\uDBFF]|^)"+G(a)),r.join("|")},K=function(e){return arguments.length>1&&(e=D.call(arguments)),this instanceof K?(this.data=[],e?this.add(e):this):(new K).add(e)};K.version="1.2.0";var $=K.prototype;y($,{add:function(e){var t=this;return null==e?t:e instanceof K?(t.data=F(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.add(e)}),t):(t.data=_(t.data,E(e)?e:q(e)),t))},remove:function(e){var t=this;return null==e?t:e instanceof K?(t.data=k(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.remove(e)}),t):(t.data=w(t.data,E(e)?e:q(e)),t))},addRange:function(e,t){var r=this;return r.data=P(r.data,E(e)?e:q(e),E(t)?t:q(t)),r},removeRange:function(e,t){var r=this,n=E(e)?e:q(e),i=E(t)?t:q(t);return r.data=I(r.data,n,i),r},intersection:function(e){var t=this,r=e instanceof K?j(e.data):e;return t.data=T(t.data,r),t},contains:function(e){return B(this.data,E(e)?e:q(e))},clone:function(){var e=new K;return e.data=this.data.slice(0),e},toString:function(e){var t=z(this.data,e?e.bmpOnly:!1);return t.replace(d,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return j(this.data)}}),$.toArray=$.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return K}):a&&!a.nodeType?s?s.exports=K:a.regenerate=K:i.regenerate=K}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],581:[function(t,r,n){(function(t){(function(){"use strict";function i(){var e,t,r=16384,n=[],i=-1,a=arguments.length;if(!a)return"";for(var s="";++i<a;){var o=Number(arguments[i]);if(!isFinite(o)||0>o||o>1114111||I(o)!=o)throw RangeError("Invalid code point: "+o);65535>=o?n.push(o):(o-=65536,e=(o>>10)+55296,t=o%1024+56320,n.push(e,t)),(i+1==a||n.length>r)&&(s+=w.apply(null,n),n.length=0)}return s}function a(e,t){if(-1==t.indexOf("|")){if(e==t)return;throw Error("Invalid node type: "+e)}if(t=a.hasOwnProperty(t)?a[t]:a[t]=RegExp("^(?:"+t+")$"),!t.test(e))throw Error("Invalid node type: "+e)}function s(e){var t=e.type;if(s.hasOwnProperty(t)&&"function"==typeof s[t])return s[t](e);throw Error("Invalid node type: "+t)}function o(e){a(e.type,"alternative");var t=e.body,r=t?t.length:0;if(1==r)return b(t[0]);for(var n=-1,i="";++n<r;)i+=b(t[n]);return i}function u(e){switch(a(e.type,"anchor"),e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function p(e){return a(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),s(e)}function l(e){a(e.type,"characterClass");var t=e.body,r=t?t.length:0,n=-1,i="[";for(e.negative&&(i+="^");++n<r;)i+=d(t[n]);return i+="]"}function c(e){return a(e.type,"characterClassEscape"),"\\"+e.value}function f(e){a(e.type,"characterClassRange");var t=e.min,r=e.max;if("characterClassRange"==t.type||"characterClassRange"==r.type)throw Error("Invalid character class range");return d(t)+"-"+d(r)}function d(e){return a(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),s(e)}function h(e){a(e.type,"disjunction");var t=e.body,r=t?t.length:0;if(0==r)throw Error("No body");if(1==r)return s(t[0]);for(var n=-1,i="";++n<r;)0!=n&&(i+="|"),i+=s(t[n]);return i}function m(e){return a(e.type,"dot"),"."}function y(e){a(e.type,"group");var t="(";switch(e.behavior){case"normal":break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var r=e.body,n=r?r.length:0;if(1==n)t+=s(r[0]);else for(var i=-1;++i<n;)t+=s(r[i]);return t+=")"}function g(e){a(e.type,"quantifier");var t="",r=e.min,n=e.max;switch(n){case void 0:case null:switch(r){case 0:t="*";break;case 1:t="+";break;default:t="{"+r+",}"}break;default:t=r==n?"{"+r+"}":0==r&&1==n?"?":"{"+r+","+n+"}"}return e.greedy||(t+="?"),p(e.body[0])+t}function v(e){return a(e.type,"reference"),"\\"+e.matchIndex}function b(e){return a(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),s(e)}function E(e){a(e.type,"value");var t=e.kind,r=e.codePoint;switch(t){case"controlLetter":return"\\c"+i(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+i(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+r)}case"symbol":return i(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var x={"function":!0,object:!0},S=x[typeof window]&&window||this,A=x[typeof n]&&n,D=x[typeof r]&&r&&!r.nodeType&&r,C=A&&D&&"object"==typeof t&&t;!C||C.global!==C&&C.window!==C&&C.self!==C||(S=C);var w=String.fromCharCode,I=Math.floor;s.alternative=o,s.anchor=u,s.characterClass=l,s.characterClassEscape=c,s.characterClassRange=f,s.disjunction=h,s.dot=m,s.group=y,s.quantifier=g,s.reference=v,s.value=E,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:s}}):A&&D?A.generate=s:S.regjsgen={generate:s}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],582:[function(e,t,r){!function(){function e(e,t){function r(t){return t.raw=e.substring(t.range[0],t.range[1]),t}function n(e,t){return e.range[0]=t,r(e)}function i(e,t){return r({type:"anchor",kind:e,range:[$-t,$]})}function a(e,t,n,i){return r({type:"value",kind:e,codePoint:t,range:[n,i]})}function s(e,t,r,n){return n=n||0,a(e,t,$-(r.length+n),$)}function o(e){var t=e[0],r=t.charCodeAt(0);if(K){var n;if(1===t.length&&r>=55296&&56319>=r&&(n=x().charCodeAt(0),n>=56320&&57343>=n))return $++,a("symbol",1024*(r-55296)+n-56320+65536,$-2,$)}return a("symbol",r,$-1,$)}function u(e,t,n){return r({type:"disjunction",body:e,range:[t,n]})}function p(){return r({type:"dot",range:[$-1,$]})}function l(e){return r({type:"characterClassEscape",value:e,range:[$-2,$]})}function c(e){return r({type:"reference",matchIndex:parseInt(e,10),range:[$-1-e.length,$]})}function f(e,t,n,i){return r({type:"group",behavior:e,body:t,range:[n,i]})}function d(e,t,n,i){return null==i&&(n=$-1,i=$),r({type:"quantifier",min:e,max:t,greedy:!0,body:null,range:[n,i]})}function h(e,t,n){return r({type:"alternative",body:e,range:[t,n]})}function m(e,t,n,i){return r({type:"characterClass",body:e,negative:t,range:[n,i]})}function y(e,t,n,i){return e.codePoint>t.codePoint&&X("invalid range in character class",e.raw+"-"+t.raw,n,i),r({type:"characterClassRange",min:e,max:t,range:[n,i]})}function g(e){return"alternative"===e.type?e.body:[e]}function v(t){t=t||1;var r=e.substring($,$+t);return $+=t||1,r}function b(e){E(e)||X("character",e)}function E(t){return e.indexOf(t,$)===$?v(t.length):void 0}function x(){return e[$]}function S(t){return e.indexOf(t,$)===$}function A(t){return e[$+1]===t}function D(t){var r=e.substring($),n=r.match(t);return n&&(n.range=[],n.range[0]=$,v(n[0].length),n.range[1]=$),n}function C(){var e=[],t=$;for(e.push(w());E("|");)e.push(w());return 1===e.length?e[0]:u(e,t,$)}function w(){for(var e,t=[],r=$;e=I();)t.push(e);return 1===t.length?t[0]:h(t,r,$)}function I(){if($>=e.length||S("|")||S(")"))return null;var t=F();if(t)return t;var r=P();r||X("Expected atom");var i=k()||!1;return i?(i.body=g(r),n(i,r.range[0]),i):r}function _(e,t,r,n){var i=null,a=$;if(E(e))i=t;else{if(!E(r))return!1;i=n}var s=C();s||X("Expected disjunction"),b(")");var o=f(i,g(s),a,$);return"normal"==i&&z&&J++,o}function F(){return E("^")?i("start",1):E("$")?i("end",1):E("\\b")?i("boundary",2):E("\\B")?i("not-boundary",2):_("(?=","lookahead","(?!","negativeLookahead")}function k(){var e,t,r,n,i=$;return E("*")?t=d(0):E("+")?t=d(1):E("?")?t=d(0,1):(e=D(/^\{([0-9]+)\}/))?(r=parseInt(e[1],10),t=d(r,r,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),\}/))?(r=parseInt(e[1],10),t=d(r,void 0,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),([0-9]+)\}/))&&(r=parseInt(e[1],10),n=parseInt(e[2],10),r>n&&X("numbers out of order in {} quantifier","",i,$),t=d(r,n,e.range[0],e.range[1])),t&&E("?")&&(t.greedy=!1,t.range[1]+=1),t}function P(){var e;return(e=D(/^[^^$\\.*+?(){[|]/))?o(e):E(".")?p():E("\\")?(e=M(),e||X("atomEscape"),e):(e=R())?e:_("(?:","ignore","(","normal")}function B(e){if(K){var t,n;if("unicodeEscape"==e.kind&&(t=e.codePoint)>=55296&&56319>=t&&S("\\")&&A("u")){var i=$;$++;var a=T();"unicodeEscape"==a.kind&&(n=a.codePoint)>=56320&&57343>=n?(e.range[1]=a.range[1],e.codePoint=1024*(t-55296)+n-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",r(e)):$=i}}return e}function T(){return M(!0)}function M(e){var t,r=$;if(t=O())return t;if(e){if(E("b"))return s("singleEscape",8,"\\b");E("B")&&X("\\B not possible inside of CharacterClass","",r)}return t=j()}function O(){var e,t;if(e=D(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);return J>=r?c(e[0]):(Y.push(r),v(-e[0].length),(e=D(/^[0-7]{1,3}/))?s("octal",parseInt(e[0],8),e[0],1):(e=o(D(/^[89]/)),n(e,e.range[0]-1)))}return(e=D(/^[0-7]{1,3}/))?(t=e[0],/^0{1,3}$/.test(t)?s("null",0,"0",t.length+1):s("octal",parseInt(t,8),t,1)):(e=D(/^[dDsSwW]/))?l(e[0]):!1}function j(){var e;if(e=D(/^[fnrtv]/)){var t=0;switch(e[0]){case"t":t=9;break;case"n":t=10;break;case"v":t=11;break;case"f":t=12;break;case"r":t=13}return s("singleEscape",t,"\\"+e[0])}return(e=D(/^c([a-zA-Z])/))?s("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=D(/^x([0-9a-fA-F]{2})/))?s("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=D(/^u([0-9a-fA-F]{4})/))?B(s("unicodeEscape",parseInt(e[1],16),e[1],2)):K&&(e=D(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):N()}function L(e){var t=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&t.test(String.fromCharCode(e))}function N(){var e,t="‌",r="‍";return L(x())?E(t)?s("identifier",8204,t):E(r)?s("identifier",8205,r):null:(e=v(),s("identifier",e.charCodeAt(0),e,1))}function R(){var e,t=$;return(e=D(/^\[\^/))?(e=V(),b("]"),m(e,!0,t,$)):E("[")?(e=V(),b("]"),m(e,!1,t,$)):null}function V(){var e;return S("]")?[]:(e=q(),e||X("nonEmptyClassRanges"),e)}function U(e){var t,r,n;if(S("-")&&!A("]")){b("-"),n=H(),n||X("classAtom"),r=$;var i=V();return i||X("classRanges"),t=e.range[0],"empty"===i.type?[y(e,n,t,r)]:[y(e,n,t,r)].concat(i)}return n=G(),n||X("nonEmptyClassRangesNoDash"),[e].concat(n)}function q(){var e=H();return e||X("classAtom"),S("]")?[e]:U(e)}function G(){var e=H();return e||X("classAtom"),S("]")?e:U(e)}function H(){return E("-")?o("-"):W()}function W(){var e;return(e=D(/^[^\\\]-]/))?o(e[0]):E("\\")?(e=T(),e||X("classEscape"),B(e)):void 0}function X(t,r,n,i){n=null==n?$:n,i=null==i?n:i;var a=Math.max(0,n-10),s=Math.min(i+10,e.length),o=" "+e.substring(a,s),u=" "+new Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+o+"\n"+u)}var Y=[],J=0,z=!0,K=-1!==(t||"").indexOf("u"),$=0;e=String(e),""===e&&(e="(?:)");var Q=C();Q.range[1]!==e.length&&X("Could not parse entire input - got stuck","",Q.range[1]);for(var Z=0;Z<Y.length;Z++)if(Y[Z]<=J)return $=0,z=!1,C();return Q}var r={parse:e};"undefined"!=typeof t&&t.exports?t.exports=r:window.regjsparser=r}()},{}],583:[function(e,t,r){function n(e){return A?S?m.UNICODE_IGNORE_CASE[e]:m.UNICODE[e]:m.REGULAR[e]}function i(e,t){return g.call(e,t)}function a(e,t){for(var r in t)e[r]=t[r]}function s(e,t){if(t){var r=f(t,"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=o(r,t)}a(e,r)}}function o(e,t){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+t+")"}}function u(e){return i(h,e)?h[e]:!1}function p(e){var t=d();e.body.forEach(function(e){switch(e.type){case"value":if(t.add(e.codePoint),S&&A){var r=u(e.codePoint);r&&t.add(r)}break;case"characterClassRange":var i=e.min.codePoint,a=e.max.codePoint;t.addRange(i,a),S&&A&&t.iuAddRange(i,a);break;case"characterClassEscape":t.add(n(e.value));break;default:throw Error("Unknown term type: "+e.type)}});return e.negative&&(t=(A?v:b).clone().remove(t)),s(e,t.toString()),e}function l(e){switch(e.type){case"dot":s(e,(A?E:x).toString());break;case"characterClass":e=p(e);break;case"characterClassEscape":s(e,n(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(l);break;case"value":var t=e.codePoint,r=d(t);if(S&&A){var i=u(t);i&&r.add(i)}s(e,r.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var c=e(581).generate,f=e(582).parse,d=e(580),h=e(579),m=e(578),y={},g=y.hasOwnProperty,v=d().addRange(0,1114111),b=d().addRange(0,65535),E=v.clone().remove(10,13,8232,8233),x=E.clone().intersection(b);d.prototype.iuAddRange=function(e,t){var r=this;do{var n=u(e);n&&r.add(n)}while(++e<=t);return r};var S=!1,A=!1;t.exports=function(e,t){var r=f(e,t);return S=t?t.indexOf("i")>-1:!1,A=t?t.indexOf("u")>-1:!1,a(r,l(r)),c(r)}},{578:578,579:579,580:580,581:581,582:582}],584:[function(e,t,r){"use strict";var n=e(585);t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>t||!n(t))throw new TypeError("Expected a finite positive number");var r="";do 1&t&&(r+=e),e+=e;while(t>>=1);return r}},{585:585}],585:[function(e,t,r){arguments[4][399][0].apply(r,arguments)},{399:399,586:586}],586:[function(e,t,r){arguments[4][400][0].apply(r,arguments)},{400:400}],587:[function(e,t,r){"use strict";t.exports=/^#!.*/},{}],588:[function(e,t,r){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),r=/[^\x00-\x80]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},{}],589:[function(e,t,r){function n(){this._array=[],this._set={}}var i=e(598);n.fromArray=function(e,t){for(var r=new n,i=0,a=e.length;a>i;i++)r.add(e[i],t);return r},n.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},n.prototype.add=function(e,t){var r=i.toSetString(e),n=this._set.hasOwnProperty(r),a=this._array.length;(!n||t)&&this._array.push(e),n||(this._set[r]=a)},n.prototype.has=function(e){var t=i.toSetString(e);return this._set.hasOwnProperty(t)},n.prototype.indexOf=function(e){var t=i.toSetString(e);if(this._set.hasOwnProperty(t))return this._set[t];throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},n.prototype.toArray=function(){return this._array.slice()},r.ArraySet=n},{598:598}],590:[function(e,t,r){function n(e){return 0>e?(-e<<1)+1:(e<<1)+0}function i(e){var t=1===(1&e),r=e>>1;return t?-r:r}var a=e(591),s=5,o=1<<s,u=o-1,p=o;r.encode=function(e){var t,r="",i=n(e);do t=i&u,i>>>=s,i>0&&(t|=p),r+=a.encode(t);while(i>0);return r},r.decode=function(e,t,r){var n,o,l=e.length,c=0,f=0;do{if(t>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(o=a.decode(e.charCodeAt(t++)),-1===o)throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(o&p),o&=u,c+=o<<f,f+=s}while(n);r.value=i(c),r.rest=t}},{591:591}],591:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(e>=0&&e<n.length)return n[e];throw new TypeError("Must be between 0 and 63: "+e)},r.decode=function(e){var t=65,r=90,n=97,i=122,a=48,s=57,o=43,u=47,p=26,l=52;return e>=t&&r>=e?e-t:e>=n&&i>=e?e-n+p:e>=a&&s>=e?e-a+l:e==o?62:e==u?63:-1}},{}],592:[function(e,t,r){function n(e,t,i,a,s,o){var u=Math.floor((t-e)/2)+e,p=s(i,a[u],!0);return 0===p?u:p>0?t-u>1?n(u,t,i,a,s,o):o==r.LEAST_UPPER_BOUND?t<a.length?t:-1:u:u-e>1?n(e,u,i,a,s,o):o==r.LEAST_UPPER_BOUND?u:0>e?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,a){if(0===t.length)return-1;var s=n(-1,t.length,e,t,i,a||r.GREATEST_LOWER_BOUND);if(0>s)return-1;for(;s-1>=0&&0===i(t[s],t[s-1],!0);)--s;return s}},{}],593:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,s=t.generatedColumn;return n>r||n==r&&s>=i||a.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var a=e(598);i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(a.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=i},{598:598}],594:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t){return Math.round(e+Math.random()*(t-e))}function a(e,t,r,s){if(s>r){var o=i(r,s),u=r-1;n(e,o,s);for(var p=e[s],l=r;s>l;l++)t(e[l],p)<=0&&(u+=1,n(e,u,l));n(e,u+1,l);var c=u+1;a(e,t,r,c-1),a(e,t,c+1,s)}}r.quickSort=function(e,t){a(e,t,0,e.length-1)}},{}],595:[function(e,t,r){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new s(t):new i(t)}function i(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),n=o.getArg(t,"sources"),i=o.getArg(t,"names",[]),a=o.getArg(t,"sourceRoot",null),s=o.getArg(t,"sourcesContent",null),u=o.getArg(t,"mappings"),l=o.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(o.normalize).map(function(e){return a&&o.isAbsolute(a)&&o.isAbsolute(e)?o.relative(a,e):e}),this._names=p.fromArray(i,!0),this._sources=p.fromArray(n,!0),this.sourceRoot=a,this.sourcesContent=s,this._mappings=u,this.file=l}function a(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),i=o.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new p,this._names=new p;var a={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=o.getArg(e,"offset"),r=o.getArg(t,"line"),i=o.getArg(t,"column");if(r<a.line||r===a.line&&i<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=t,{generatedOffset:{generatedLine:r+1,generatedColumn:i+1},consumer:new n(o.getArg(e,"map"))}})}var o=e(598),u=e(592),p=e(589).ArraySet,l=e(590),c=e(594).quickSort;n.fromSourceMap=function(e){return i.fromSourceMap(e)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),n.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},n.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(e,t,r){var i,a=t||null,s=r||n.GENERATED_ORDER;switch(s){case n.GENERATED_ORDER:i=this._generatedMappings;break;case n.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;i.map(function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=u&&(t=o.join(u,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,a)},n.prototype.allGeneratedPositionsFor=function(e){var t=o.getArg(e,"line"),r={source:o.getArg(e,"source"),originalLine:t,originalColumn:o.getArg(e,"column",0)};if(null!=this.sourceRoot&&(r.source=o.relative(this.sourceRoot,r.source)),!this._sources.has(r.source))return[];r.source=this._sources.indexOf(r.source);var n=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var a=this._originalMappings[i];if(void 0===e.column)for(var s=a.originalLine;a&&a.originalLine===s;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i];else for(var p=a.originalColumn;a&&a.originalLine===t&&a.originalColumn==p;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,i.prototype=Object.create(n.prototype),i.prototype.consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=p.fromArray(e._names.toArray(),!0),n=t._sources=p.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var s=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],f=0,d=s.length;d>f;f++){var h=s[f],m=new a;m.generatedLine=h.generatedLine,m.generatedColumn=h.generatedColumn,h.source&&(m.source=n.indexOf(h.source),m.originalLine=h.originalLine,m.originalColumn=h.originalColumn,h.name&&(m.name=r.indexOf(h.name)),l.push(m)),u.push(m)}return c(t.__originalMappings,o.compareByOriginalPositions),t},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?o.join(this.sourceRoot,e):e},this)}}),i.prototype._parseMappings=function(e,t){for(var r,n,i,s,u,p=1,f=0,d=0,h=0,m=0,y=0,g=e.length,v=0,b={},E={},x=[],S=[];g>v;)if(";"===e.charAt(v))p++,v++,f=0;else if(","===e.charAt(v))v++;else{for(r=new a,r.generatedLine=p,s=v;g>s&&!this._charIsMappingSeparator(e,s);s++);if(n=e.slice(v,s),i=b[n])v+=n.length;else{for(i=[];s>v;)l.decode(e,v,E),u=E.value,v=E.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");b[n]=i}r.generatedColumn=f+i[0],f=r.generatedColumn,i.length>1&&(r.source=m+i[1],m+=i[1],r.originalLine=d+i[2],d=r.originalLine,r.originalLine+=1,r.originalColumn=h+i[3],h=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),S.push(r),"number"==typeof r.originalLine&&x.push(r); }c(S,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,c(x,o.compareByOriginalPositions),this.__originalMappings=x},i.prototype._findMapping=function(e,t,r,n,i,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,a)},i.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",o.compareByGeneratedPositionsDeflated,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var a=o.getArg(i,"source",null);null!==a&&(a=this._sources.at(a),null!=this.sourceRoot&&(a=o.join(this.sourceRoot,a)));var s=o.getArg(i,"name",null);return null!==s&&(s=this._names.at(s)),{source:a,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}):!1},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var r={source:t,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===r.source)return{line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,s.prototype=Object.create(n.prototype),s.prototype.constructor=n,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),s.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=u.search(t,this._sections,function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r?r:e.generatedColumn-t.generatedOffset.generatedColumn}),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},s.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r],i=n.consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer.sources.indexOf(o.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n){var i={line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}},s.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],i=n.consumer._generatedMappings,a=0;a<i.length;a++){var s=i[a],u=n.consumer._sources.at(s.source);null!==n.consumer.sourceRoot&&(u=o.join(n.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var p=n.consumer._names.at(s.name);this._names.add(p),p=this._names.indexOf(p);var l={source:u,generatedLine:s.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(n.generatedOffset.generatedLine===s.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:p};this.__generatedMappings.push(l),"number"==typeof l.originalLine&&this.__originalMappings.push(l)}c(this.__generatedMappings,o.compareByGeneratedPositionsDeflated),c(this.__originalMappings,o.compareByOriginalPositions)},r.IndexedSourceMapConsumer=s},{589:589,590:590,592:592,594:594,598:598}],596:[function(e,t,r){function n(e){e||(e={}),this._file=a.getArg(e,"file",null),this._sourceRoot=a.getArg(e,"sourceRoot",null),this._skipValidation=a.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new o,this._sourcesContents=null}var i=e(590),a=e(598),s=e(589).ArraySet,o=e(593).MappingList;n.prototype._version=3,n.fromSourceMap=function(e){var t=e.sourceRoot,r=new n({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=a.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)}),e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&r.setSourceContent(t,n)}),r},n.prototype.addMapping=function(e){var t=a.getArg(e,"generated"),r=a.getArg(e,"original",null),n=a.getArg(e,"source",null),i=a.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,i),null==n||this._sources.has(n)||this._sources.add(n),null==i||this._names.has(i)||this._names.add(i),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:i})},n.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=a.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[a.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[a.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var i=this._sourceRoot;null!=i&&(n=a.relative(i,n));var o=new s,u=new s;this._mappings.unsortedForEach(function(t){if(t.source===n&&null!=t.originalLine){var s=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=s.source&&(t.source=s.source,null!=r&&(t.source=a.join(r,t.source)),null!=i&&(t.source=a.relative(i,t.source)),t.originalLine=s.line,t.originalColumn=s.column,null!=s.name&&(t.name=s.name))}var p=t.source;null==p||o.has(p)||o.add(p);var l=t.name;null==l||u.has(l)||u.add(l)},this),this._sources=o,this._names=u,e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=a.join(r,t)),null!=i&&(t=a.relative(i,t)),this.setSourceContent(t,n))},this)},n.prototype._validateMapping=function(e,t,r,n){if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n=0,s=1,o=0,u=0,p=0,l=0,c="",f=this._mappings.toArray(),d=0,h=f.length;h>d;d++){if(e=f[d],e.generatedLine!==s)for(n=0;e.generatedLine!==s;)c+=";",s++;else if(d>0){if(!a.compareByGeneratedPositionsInflated(e,f[d-1]))continue;c+=","}c+=i.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(r=this._sources.indexOf(e.source),c+=i.encode(r-l),l=r,c+=i.encode(e.originalLine-1-u),u=e.originalLine-1,c+=i.encode(e.originalColumn-o),o=e.originalColumn,null!=e.name&&(t=this._names.indexOf(e.name),c+=i.encode(t-p),p=t))}return c},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=a.relative(t,e));var r=a.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{589:589,590:590,593:593,598:598}],597:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[u]=!0,null!=n&&this.add(n)}var i=e(596).SourceMapGenerator,a=e(598),s=/(\r?\n)/,o=10,u="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=r?a.join(r,e.source):e.source;o.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new n,u=e.split(s),p=function(){var e=u.shift(),t=u.shift()||"";return e+t},l=1,c=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(l<e.generatedLine)){var t=u[0],r=t.substr(0,e.generatedColumn-c);return u[0]=t.substr(e.generatedColumn-c),c=e.generatedColumn,i(f,r),void(f=e)}i(f,p()),l++,c=0}for(;l<e.generatedLine;)o.add(p()),l++;if(c<e.generatedColumn){var t=u[0];o.add(t.substr(0,e.generatedColumn)),u[0]=t.substr(e.generatedColumn),c=e.generatedColumn}f=e},this),u.length>0&&(f&&i(f,p()),o.add(u.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=a.join(r,e)),o.setSourceContent(e,n))}),o},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;n>r;r++)t=this.children[r],t[u]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;n-1>r;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[u]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[a.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;r>t;t++)this.children[t][u]&&this.children[t].walkSourceContents(e);for(var n=Object.keys(this.sourceContents),t=0,r=n.length;r>t;t++)e(a.fromSetString(n[t]),this.sourceContents[n[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new i(e),n=!1,a=null,s=null,u=null,p=null;return this.walk(function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?((a!==i.source||s!==i.line||u!==i.column||p!==i.name)&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),a=i.source,s=i.line,u=i.column,p=i.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),a=null,n=!1);for(var l=0,c=e.length;c>l;l++)e.charCodeAt(l)===o?(t.line++,t.column=0,l+1===c?(a=null,n=!1):n&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:t.code,map:r}},r.SourceNode=n},{596:596,598:598}],598:[function(e,t,r){function n(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}function i(e){var t=e.match(m);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function a(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(e){var t=e,n=i(e);if(n){if(!n.path)return e;t=n.path}for(var s,o=r.isAbsolute(t),u=t.split(/\/+/),p=0,l=u.length-1;l>=0;l--)s=u[l],"."===s?u.splice(l,1):".."===s?p++:p>0&&(""===s?(u.splice(l+1,p),p=0):(u.splice(l,2),p--));return t=u.join("/"),""===t&&(t=o?"/":"."),n?(n.path=t,a(n)):t}function o(e,t){""===e&&(e="."),""===t&&(t=".");var r=i(t),n=i(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),a(r);if(r||t.match(y))return t;if(n&&!n.host&&!n.path)return n.host=t,a(n);var o="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=o,a(n)):o}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(0>n)return t;if(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}function p(e){return"$"+e}function l(e){return e.substr(1)}function c(e,t,r){var n=e.source-t.source;return 0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n||r?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=e.generatedLine-t.generatedLine,0!==n?n:e.name-t.name))))}function f(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n||r?n:(n=e.source-t.source,0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:e.name-t.name))))}function d(e,t){return e===t?0:e>t?1:-1}function h(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=d(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:d(e.name,t.name)))))}r.getArg=n;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,y=/^data:.+\,.+$/;r.urlParse=i,r.urlGenerate=a,r.normalize=s,r.join=o,r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},r.relative=u,r.toSetString=p,r.fromSetString=l,r.compareByOriginalPositions=c,r.compareByGeneratedPositionsDeflated=f,r.compareByGeneratedPositionsInflated=h},{}],599:[function(e,t,r){r.SourceMapGenerator=e(596).SourceMapGenerator,r.SourceMapConsumer=e(595).SourceMapConsumer,r.SourceNode=e(597).SourceNode},{595:595,596:596,597:597}],600:[function(e,t,r){"use strict";t.exports=function n(e){function t(){}t.prototype=e,new t}},{}],601:[function(e,t,r){"use strict";t.exports=function(e){for(var t=e.length;/[\s\uFEFF\u00A0]/.test(e[t-1]);)t--;return e.slice(0,t)}},{}],602:[function(e,t,r){(function(r){var n,i=e(1),a=t.exports=function(t,r){try{return(r||e).resolve(t)}catch(n){return null}};a.relative=function(e){if("object"==typeof i)return null;n||(n=new i,n.paths=i._nodeModulePaths(r.cwd()));try{return i._resolveFilename(e,n)}catch(t){return null}}}).call(this,e(10))},{1:1,10:10}],603:[function(e,t,r){t.exports={name:"babel-core",version:"5.8.33",description:"A compiler for writing next generation JavaScript",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",license:"MIT",repository:"babel/babel",browser:{"./lib/api/register/node.js":"./lib/api/register/browser.js"},keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var"],scripts:{bench:"make bench",test:"make test"},dependencies:{"babel-plugin-constant-folding":"^1.0.1","babel-plugin-dead-code-elimination":"^1.0.2","babel-plugin-eval":"^1.0.1","babel-plugin-inline-environment-variables":"^1.0.1","babel-plugin-jscript":"^1.0.4","babel-plugin-member-expression-literals":"^1.0.1","babel-plugin-property-literals":"^1.0.1","babel-plugin-proto-to-assign":"^1.0.3","babel-plugin-react-constant-elements":"^1.0.3","babel-plugin-react-display-name":"^1.0.3","babel-plugin-remove-console":"^1.0.1","babel-plugin-remove-debugger":"^1.0.1","babel-plugin-runtime":"^1.0.7","babel-plugin-undeclared-variables-check":"^1.0.2","babel-plugin-undefined-to-void":"^1.1.6",babylon:"^5.8.29",bluebird:"^2.9.33",chalk:"^1.0.0","convert-source-map":"^1.1.0","core-js":"^1.0.0",debug:"^2.1.1","detect-indent":"^3.0.0",esutils:"^2.0.0","fs-readdir-recursive":"^0.1.0",globals:"^6.4.0","home-or-tmp":"^1.0.0","is-integer":"^1.0.4","js-tokens":"1.0.1",json5:"^0.4.0","line-numbers":"0.2.0",lodash:"^3.10.0",minimatch:"^2.0.3","output-file-sync":"^1.1.0","path-exists":"^1.0.0","path-is-absolute":"^1.0.0","private":"^0.1.6",regenerator:"0.8.40",regexpu:"^1.3.0",repeating:"^1.1.2",resolve:"^1.1.6","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.5.0","source-map-support":"^0.2.10","to-fast-properties":"^1.0.0","trim-right":"^1.0.0","try-resolve":"^1.0.0"}}},{}],604:[function(e,t,r){t.exports={"abstract-expression-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-delete":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceDelete"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceSet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"VALUE"}]}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},parenthesizedExpression:!0},arguments:[]}}]},"array-from":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"VALUE"}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-decorator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"CLASS_REF"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"DECORATOR"},arguments:[{type:"Identifier",name:"CLASS_REF"}]},operator:"||",right:{type:"Identifier",name:"CLASS_REF"}}}}]},"class-derived-default-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Super"},arguments:[{type:"SpreadElement",argument:{type:"Identifier",name:"arguments"}}]}}]},parenthesizedExpression:!0}}]},"default-parameter-assign":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE_NAME"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE_NAME"},right:{type:"Identifier",name:"DEFAULT_VALUE"}}},alternate:null}]},"default-parameter":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1},operator:"<=",right:{type:"Identifier",name:"ARGUMENT_KEY"}},operator:"||",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"Identifier",name:"DEFAULT_VALUE"},alternate:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0}}}],kind:"let"}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-from-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"ID"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"get"},value:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"INIT"}}]}},kind:"init"}]}]}}]},"exports-module-declaration-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},"exports-module-declaration":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Literal",value:"__esModule"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},"for-of-array":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"ARR"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BODY"}}}]},"for-of-loose":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"Identifier",name:"OBJECT"}},{type:"VariableDeclarator",id:{type:"Identifier",name:"IS_ARRAY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"LOOP_OBJECT"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"INDEX"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"ConditionalExpression",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"Identifier",name:"LOOP_OBJECT"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}}}],kind:"var"},test:null,update:null,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ID"},init:null}],kind:"var"},{type:"IfStatement",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"INDEX"},operator:">=",right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"length"},computed:!1}},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"INDEX"}},computed:!0}}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"INDEX"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]}}},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"value"},computed:!1}}}]}}]}}]},"for-of":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_COMPLETION"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"ITERATOR_COMPLETION"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{ type:"Literal",value:"return"},computed:!0},arguments:[]}}]},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"Identifier",name:"ITERATOR_ERROR_KEY"}}]},alternate:null}]}}]}}]},"helper-async-to-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"fn"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"gen"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"fn"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"Promise"},arguments:[{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"resolve"},{type:"Identifier",name:"reject"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callNext"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"next"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callThrow"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"throw"}]}}],kind:"var"},{type:"FunctionDeclaration",id:{type:"Identifier",name:"step"},generator:!1,expression:!1,params:[{type:"Identifier",name:"key"},{type:"Identifier",name:"arg"}],body:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"info"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Identifier",name:"key"},computed:!0},arguments:[{type:"Identifier",name:"arg"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"value"},computed:!1}}],kind:"var"}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"error"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"reject"},arguments:[{type:"Identifier",name:"error"}]}},{type:"ReturnStatement",argument:null}]}},guardedHandlers:[],finalizer:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"resolve"},arguments:[{type:"Identifier",name:"value"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Promise"},property:{type:"Identifier",name:"resolve"},computed:!1},arguments:[{type:"Identifier",name:"value"}]},property:{type:"Identifier",name:"then"},computed:!1},arguments:[{type:"Identifier",name:"callNext"},{type:"Identifier",name:"callThrow"}]}}]}}]}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"callNext"},arguments:[]}}]}}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-bind":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"bind"},computed:!1}}]},"helper-class-call-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"instance"},{type:"Identifier",name:"Constructor"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"BinaryExpression",left:{type:"Identifier",name:"instance"},operator:"instanceof",right:{type:"Identifier",name:"Constructor"},parenthesizedExpression:!0}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot call a class as a function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-create-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"descriptors"},{type:"Identifier",name:"initializers"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"initializers"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"descriptor"}}},{type:"ContinueStatement",label:null}]},alternate:null}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"protoInitializers"},{type:"Identifier",name:"staticInitializers"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"protoInitializers"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"staticInitializers"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-object":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}}]},alternate:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]}}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-default-props":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"defaultProps"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"defaultProps"},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"propName"},init:null}],kind:"var"},right:{type:"Identifier",name:"defaultProps"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"defaultProps"},property:{type:"Identifier",name:"propName"},computed:!0}}}]},alternate:null}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"props"}}]},parenthesizedExpression:!0}}]},"helper-defaults":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"keys"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyNames"},computed:!1},arguments:[{type:"Identifier",name:"defaults"}]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"defaults"},{type:"Identifier",name:"key"}]}}],kind:"var"},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"Identifier",name:"value"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"value"},property:{type:"Identifier",name:"configurable"},computed:!1}},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-define-decorated-property-descriptor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"key"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_descriptor"}},consequent:{type:"ReturnStatement",argument:null,leadingComments:null,trailingComments:null},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor",leadingComments:null},init:{type:"ObjectExpression",properties:[]},leadingComments:null}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_key"},init:null}],kind:"var"},right:{type:"Identifier",name:"_descriptor"},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"_key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"_descriptor"},property:{type:"Identifier",name:"_key"},computed:!0}},trailingComments:null}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"value"},computed:!1,leadingComments:null},right:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]},alternate:{type:"Identifier",name:"undefined"}},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]},parenthesizedExpression:!0}}]},"helper-define-property":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"key",leadingComments:null},operator:"in",right:{type:"Identifier",name:"obj"},leadingComments:null},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"value"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"value" }}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-extends":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"assign"},computed:!1},operator:"||",right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:1}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"source"},init:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"source"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"source"},{type:"Identifier",name:"key"}]},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"source"},property:{type:"Identifier",name:"key"},computed:!0}}}]},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]}}}}]},"helper-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"object"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"object"},right:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1}}},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"get"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}]}}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"getter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"get"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"getter"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:null},{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"getter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-has-own":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1}}]},"helper-inherits":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}},operator:"!==",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"BinaryExpression",left:{type:"Identifier",name:"superClass"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"Literal",value:"Super expression must either be null or a function, not "},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}}}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"prototype"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:!1},arguments:[{type:"LogicalExpression",left:{type:"Identifier",name:"superClass"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"superClass"},property:{type:"Identifier",name:"prototype"},computed:!1}},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"subClass"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!1},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"}]},kind:"init"}]}]}}},{type:"IfStatement",test:{type:"Identifier",name:"superClass"},consequent:{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}]},alternate:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"__proto__"},computed:!1},right:{type:"Identifier",name:"superClass"}}}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-instanceof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"left"},{type:"Identifier",name:"right"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Identifier",name:"right"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"left"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"BinaryExpression",left:{type:"Identifier",name:"left"},operator:"instanceof",right:{type:"Identifier",name:"right"}}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-export-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"CallExpression",callee:{type:"Identifier",name:"defaults"},arguments:[{type:"ObjectExpression",properties:[]},{type:"Identifier",name:"obj"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]},parenthesizedExpression:!0}}]},"helper-interop-require-default":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"Identifier",name:"obj"},alternate:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Literal",value:"default"},value:{type:"Identifier",name:"obj"},kind:"init"}]}}}]},parenthesizedExpression:!0}}]},"helper-interop-require-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"}]},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0}}},alternate:null}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"obj"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-require":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Literal",value:"default"},computed:!0},alternate:{type:"Identifier",name:"obj"}}}]},parenthesizedExpression:!0}}]},"helper-new-arrow-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"innerThis"},{type:"Identifier",name:"boundThis"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"innerThis"},operator:"!==",right:{type:"Identifier",name:"boundThis"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot instantiate an arrow function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-destructuring-empty":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot destructure undefined"}]}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-without-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"keys"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"indexOf"},computed:!1},arguments:[{type:"Identifier",name:"i"}]},operator:">=",right:{type:"Literal",value:0}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"i"}]}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:!0}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-self-global":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"self"},alternate:{type:"Identifier",name:"global"}}}]},"helper-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"set"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"set"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}]}}]},alternate:null}]},alternate:{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"writable"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"Identifier",name:"value"}}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"setter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"set"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"setter"},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"setter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"value"}}]},parenthesizedExpression:!0}}]},"helper-slice":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"slice"},computed:!1}}]},"helper-sliced-to-array-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_iterator"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_step"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_step"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_iterator"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1}},update:null,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_step"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-sliced-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"sliceIterator",leadingComments:null},generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr",leadingComments:null},init:{type:"ArrayExpression",elements:[]},leadingComments:null}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_n"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_d"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_e"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_i"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_s"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_s"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_s"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_d"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_e"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_n"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0},arguments:[]}},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"_d"},consequent:{type:"ThrowStatement",argument:{type:"Identifier",name:"_e"}},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"sliceIterator"},arguments:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-tagged-template-literal-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"strings"},property:{type:"Identifier",name:"raw"},computed:!1},right:{type:"Identifier",name:"raw"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"strings"}}]},parenthesizedExpression:!0}}]},"helper-tagged-template-literal":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement", argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:!1},arguments:[{type:"Identifier",name:"strings"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"raw"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"Identifier",name:"raw"}]},kind:"init"}]},kind:"init"}]}]}]}}]},parenthesizedExpression:!0}}]},"helper-temporal-assert-defined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"val"},{type:"Identifier",name:"name"},{type:"Identifier",name:"undef"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"val"},operator:"===",right:{type:"Identifier",name:"undef"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"ReferenceError"},arguments:[{type:"BinaryExpression",left:{type:"Identifier",name:"name"},operator:"+",right:{type:"Literal",value:" is not defined - temporal dead zone"}}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Literal",value:!0}}]},parenthesizedExpression:!0}}]},"helper-temporal-undefined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ObjectExpression",properties:[],parenthesizedExpression:!0}}]},"helper-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"Identifier",name:"arr"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}}]},parenthesizedExpression:!0}}]},"helper-to-consumable-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"arr2"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}]}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"arr2"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"i"},computed:!0}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"arr2"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}]}}]},parenthesizedExpression:!0}}]},"helper-typeof-react-element":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"Symbol"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0}},operator:"&&",right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0},arguments:[{type:"Literal",value:"react.element"}]}},operator:"||",right:{type:"Literal",value:60103}}}]},"helper-typeof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"constructor"},computed:!1},operator:"===",right:{type:"Identifier",name:"Symbol"}}},consequent:{type:"Literal",value:"symbol"},alternate:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"obj"}}}}]},parenthesizedExpression:!0}}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:!1}},alternate:null}]},"named-function":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"GET_OUTER_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION"}}]},parenthesizedExpression:!0},arguments:[]}}]},"property-method-assignment-wrapper-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!0,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"YieldExpression",delegate:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"property-method-assignment-wrapper":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:!1}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:!1}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},rest:{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LEN"},init:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1}},{type:"VariableDeclarator",id:{type:"Identifier",name:"ARRAY"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"Identifier",name:"ARRAY_LEN"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Identifier",name:"START"}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"Identifier",name:"LEN"}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"ARRAY_KEY"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"KEY"},computed:!0}}}]}}]},"self-contained-helpers-head":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"HELPER"}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},system:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"System"},property:{type:"Identifier",name:"register"},computed:!1},arguments:[{type:"Identifier",name:"MODULE_NAME"},{type:"Identifier",name:"MODULE_DEPENDENCIES"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"EXPORT_IDENTIFIER"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"setters"},value:{type:"Identifier",name:"SETTERS"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"execute"},value:{type:"Identifier",name:"EXECUTE"},kind:"init"}]}}]}}]}}]},"tail-call-body":{type:"Program",body:[{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"AGAIN_ID"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"LabeledStatement",body:{type:"WhileStatement",test:{type:"Identifier",name:"AGAIN_ID"},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BLOCK"}}},label:{type:"Identifier",name:"FUNCTION_ID"}}]}]},"test-exports":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"test-module":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"module"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"umd-commonjs-strict":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"root"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}}]}}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"UMD_ROOT"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FACTORY_PARAMETERS"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"Identifier",name:"FACTORY_BODY"}}]}}]}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"global"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"Identifier",name:"COMMON_TEST"},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"mod"},init:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"exports"},value:{type:"ObjectExpression",properties:[]},kind:"init"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1},{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"global"},property:{type:"Identifier",name:"GLOBAL_ARG"},computed:!1},right:{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1}}}]}}}]},parenthesizedExpression:!0}}]}}},{}],605:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){return new s["default"](t,e).parse()}r.__esModule=!0,r.parse=i;var a=e(609),s=n(a);e(614),e(613),e(611),e(608),e(612),e(610),e(607);var o=e(621);e(619),e(618);var u=e(615),p=n(u),l=e(616),c=n(l);a.plugins.flow=p["default"],a.plugins.jsx=c["default"],r.tokTypes=o.types},{607:607,608:608,609:609,610:610,611:611,612:612,613:613,614:614,615:615,616:616,618:618,619:619,621:621}],606:[function(e,t,r){"use strict";function n(e){var t={};for(var r in i)t[r]=e&&r in e?e[r]:i[r];return t}r.__esModule=!0,r.getOptions=n;var i={sourceType:"script",allowReserved:!0,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,plugins:{},features:{},strictMode:null};r.defaultOptions=i},{}],607:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return e[e.length-1]}var a=e(609),s=n(a),o=s["default"].prototype;o.addComment=function(e){this.state.trailingComments.push(e),this.state.leadingComments.push(e)},o.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t,r,n,a=this.state.commentStack;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(r=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var s=i(a);a.length>0&&s.trailingComments&&s.trailingComments[0].start>=e.end&&(r=s.trailingComments,s.trailingComments=null)}for(;a.length>0&&i(a).start>=e.start;)t=a.pop();if(t){if(t.leadingComments)if(t!==e&&i(t.leadingComments).end<=e.start)e.leadingComments=t.leadingComments,t.leadingComments=null;else for(n=t.leadingComments.length-2;n>=0;--n)if(t.leadingComments[n].end<=e.start){e.leadingComments=t.leadingComments.splice(0,n+1);break}}else if(this.state.leadingComments.length>0)if(i(this.state.leadingComments).end<=e.start)e.leadingComments=this.state.leadingComments,this.state.leadingComments=[];else{for(n=0;n<this.state.leadingComments.length&&!(this.state.leadingComments[n].end>e.start);n++);e.leadingComments=this.state.leadingComments.slice(0,n),0===e.leadingComments.length&&(e.leadingComments=null),r=this.state.leadingComments.slice(n),0===r.length&&(r=null)}r&&(r.length&&r[0].start>=e.start&&i(r).end<=e.end?e.innerComments=r:e.trailingComments=r),a.push(e)}}},{609:609}],608:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(622),u=s["default"].prototype;u.checkPropClash=function(e,t){if(!(e.computed||e.method||e.shorthand)){var r=e.key,n=void 0;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;"__proto__"===n&&"init"===i&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},u.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseMaybeAssign(e,t);if(this.match(i.types.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[a];this.eat(i.types.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return a},u.parseMaybeAssign=function(e,t,r){if(this.match(i.types._yield)&&this.state.inGenerator)return this.parseYield();var n=void 0;t?n=!1:(t={start:0},n=!0);var a=this.state.start,s=this.state.startLoc;(this.match(i.types.parenL)||this.match(i.types.name))&&(this.state.potentialArrowAt=this.state.start);var o=this.parseMaybeConditional(e,t);if(r&&(o=r.call(this,o,a,s)),this.state.type.isAssign){var u=this.startNodeAt(a,s);if(u.operator=this.state.value,u.left=this.match(i.types.eq)?this.toAssignable(o):o,t.start=0,this.checkLVal(o),o.parenthesizedExpression){var p=void 0;"ObjectPattern"===o.type?p="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===o.type&&(p="`([a]) = 0` use `([a] = 0)`"),p&&this.raise(o.start,"You're trying to assign to a parenthesized expression, eg. instead of "+p)}return this.next(),u.right=this.parseMaybeAssign(e),this.finishNode(u,"AssignmentExpression")}return n&&t.start&&this.unexpected(t.start),o},u.parseMaybeConditional=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseExprOps(e,t);if(t&&t.start)return a;if(this.eat(i.types.question)){var s=this.startNodeAt(r,n);return s.test=a,s.consequent=this.parseMaybeAssign(),this.expect(i.types.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return a},u.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},u.parseExprOp=function(e,t,r,n,a){var s=this.state.type.binop;if(!(null==s||a&&this.match(i.types._in))&&s>n){var o=this.startNodeAt(t,r);o.left=e,o.operator=this.state.value;var u=this.state.type;this.next();var p=this.state.start,l=this.state.startLoc;return o.right=this.parseExprOp(this.parseMaybeUnary(),p,l,u.rightAssociative?s-1:s,a),this.finishNode(o,u===i.types.logicalOR||u===i.types.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(o,t,r,n,a)}return e},u.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(i.types.incDec);return t.operator=this.state.value,t.prefix=!0,this.next(),t.argument=this.parseMaybeUnary(),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument):this.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var n=this.state.start,a=this.state.startLoc,s=this.parseExprSubscripts(e);if(e&&e.start)return s;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var t=this.startNodeAt(n,a);t.operator=this.state.value,t.prefix=!1,t.argument=s,this.checkLVal(s),this.next(),s=this.finishNode(t,"UpdateExpression")}return s},u.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.parseExprAtom(e);return e&&e.start?n:this.parseSubscripts(n,t,r)},u.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(i.types.doubleColon)){var a=this.startNodeAt(t,r);return a.object=e,a.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(a,"BindExpression"),t,r,n)}if(this.eat(i.types.dot)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseIdent(!0),a.computed=!1,e=this.finishNode(a,"MemberExpression")}else if(this.eat(i.types.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(i.types.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(i.types.parenL)){var s="Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var a=this.startNodeAt(t,r);a.callee=e,a.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),e=this.finishNode(a,"CallExpression"),s&&(this.match(i.types.colon)||this.match(i.types.arrow))?e=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),a):this.toReferencedList(a.arguments)}else{if(!this.match(i.types.backQuote))return e;var a=this.startNodeAt(t,r);a.tag=e,a.quasi=this.parseTemplate(),e=this.finishNode(a,"TaggedTemplateExpression")}}},u.parseAsyncArrowFromCallExpression=function(e,t){return this.options.features["es7.asyncFunctions"]||this.unexpected(),this.expect(i.types.arrow),this.parseArrowExpression(e,t.arguments,!0)},u.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},u.parseExprAtom=function(e){var t=void 0,r=this.state.potentialArrowAt===this.state.start;switch(this.state.type){case i.types._super:this.state.inFunction||this.raise(this.state.start,"'super' outside of function or class");case i.types._this:var n=this.match(i.types._this)?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,n);case i.types._yield:this.state.inGenerator&&this.unexpected();case i.types._do:if(this.options.features["es7.doExpressions"]){var a=this.startNode();this.next();var s=this.state.inFunction,o=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,a.body=this.parseBlock(),this.state.inFunction=s,this.state.labels=o,this.finishNode(a,"DoExpression")}case i.types.name:t=this.startNode();var u=this.parseIdent(!0);if(this.options.features["es7.asyncFunctions"])if("await"===u.name){if(this.inAsync)return this.parseAwait(t)}else{if("async"===u.name&&this.match(i.types._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(t,!1,!1,!0);if(r&&"async"===u.name&&this.match(i.types.name)){var p=[this.parseIdent()];return this.expect(i.types.arrow),this.parseArrowExpression(t,p,!0)}}return r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow)?this.parseArrowExpression(t,[u]):u;case i.types.regexp:var l=this.state.value;return t=this.parseLiteral(l.value),t.regex={pattern:l.pattern,flags:l.flags},t;case i.types.num:case i.types.string:return this.parseLiteral(this.state.value);case i.types._null:case i.types._true:case i.types._false:return t=this.startNode(),t.rawValue=t.value=this.match(i.types._null)?null:this.match(i.types._true),t.raw=this.state.type.keyword,this.next(),this.finishNode(t,"Literal");case i.types.parenL:return this.parseParenAndDistinguishExpression(null,null,r);case i.types.bracketL:return t=this.startNode(),this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for)?this.parseComprehension(t,!1):(t.elements=this.parseExprList(i.types.bracketR,!0,!0,e),this.toReferencedList(t.elements),this.finishNode(t,"ArrayExpression"));case i.types.braceL:return this.parseObj(!1,e);case i.types._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case i.types.at:this.parseDecorators();case i.types._class:return t=this.startNode(),this.takeDecorators(t),this.parseClass(t,!1);case i.types._new:return this.parseNew();case i.types.backQuote:return this.parseTemplate();case i.types.doubleColon:t=this.startNode(),this.next(),t.object=null;var c=t.callee=this.parseNoCallExpr();if("MemberExpression"===c.type)return this.finishNode(t,"BindExpression");this.raise(c.start,"Binding should be performed on object property.");default:this.unexpected()}},u.parseLiteral=function(e){var t=this.startNode();return t.rawValue=t.value=e,t.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(t,"Literal")},u.parseParenExpression=function(){this.expect(i.types.parenL);var e=this.parseExpression();return this.expect(i.types.parenR),e},u.parseParenAndDistinguishExpression=function(e,t,r,n){e=e||this.state.start,t=t||this.state.startLoc;var a=void 0;if(this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for))return this.parseComprehension(this.startNodeAt(e,t),!0);for(var s=this.state.start,o=this.state.startLoc,u=[],p=!0,l={start:0},c=void 0,f=void 0,d=void 0;!this.match(i.types.parenR);){if(p)p=!1;else if(this.expect(i.types.comma),this.match(i.types.parenR)&&this.options.features["es7.trailingFunctionCommas"]){d=this.state.start;break}if(this.match(i.types.ellipsis)){var h=this.state.start,m=this.state.startLoc;c=this.state.start,u.push(this.parseParenItem(this.parseRest(),m,h));break}this.match(i.types.parenL)&&!f&&(f=this.state.start),u.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var y=this.state.start,g=this.state.startLoc;if(this.expect(i.types.parenR),r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow))return f&&this.unexpected(f),this.parseArrowExpression(this.startNodeAt(e,t),u,n);if(!u.length){if(n)return;this.unexpected(this.state.lastTokStart)}return d&&this.unexpected(d),c&&this.unexpected(c),l.start&&this.unexpected(l.start),u.length>1?(a=this.startNodeAt(s,o),a.expressions=u,this.toReferencedList(a.expressions),this.finishNodeAt(a,"SequenceExpression",y,g)):a=u[0],a.parenthesizedExpression=!0,a},u.parseParenItem=function(e){return e},u.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);return this.eat(i.types.dot)?(e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raise(e.property.start,"The only valid meta property for new is new.target"),this.finishNode(e,"MetaProperty")):(e.callee=this.parseNoCallExpr(),this.eat(i.types.parenL)?(e.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression"))},u.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),e.tail=this.match(i.types.backQuote),this.finishNode(e,"TemplateElement")},u.parseTemplate=function(){var e=this.startNode();this.next(),e.expressions=[];var t=this.parseTemplateElement();for(e.quasis=[t];!t.tail;)this.expect(i.types.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(i.types.braceR),e.quasis.push(t=this.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},u.parseObj=function(e,t){var r=this.startNode(),n=!0,a=Object.create(null);r.properties=[];var s=[];for(this.next();!this.eat(i.types.braceR);){if(n)n=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;for(;this.match(i.types.at);)s.push(this.parseDecorator());var o=this.startNode(),u=!1,p=!1,l=void 0,c=void 0;if(s.length&&(o.decorators=s,s=[]),this.options.features["es7.objectRestSpread"]&&this.match(i.types.ellipsis))o=this.parseSpread(),o.type="SpreadProperty",r.properties.push(o);else{if(o.method=!1,o.shorthand=!1,(e||t)&&(l=this.state.start,c=this.state.startLoc),e||(u=this.eat(i.types.star)),!e&&this.options.features["es7.asyncFunctions"]&&this.isContextual("async")){u&&this.unexpected(); var f=this.parseIdent();this.match(i.types.colon)||this.match(i.types.parenL)||this.match(i.types.braceR)?o.key=f:(p=!0,this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,l,c,u,p,e,t),this.checkPropClash(o,a),r.properties.push(this.finishNode(o,"Property"))}}return s.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},u.parseObjPropValue=function(e,t,r,n,a,s,u){if(this.eat(i.types.colon))e.value=s?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,u),e.kind="init";else if(this.match(i.types.parenL))s&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,a);else if(e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.match(i.types.comma)||this.match(i.types.braceR))e.computed||"Identifier"!==e.key.type?this.unexpected():(e.kind="init",s?((this.isKeyword(e.key.name)||this.strict&&(o.reservedWords.strictBind(e.key.name)||o.reservedWords.strict(e.key.name))||!this.options.allowReserved&&this.isReservedWord(e.key.name))&&this.raise(e.key.start,"Binding "+e.key.name),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):this.match(i.types.eq)&&u?(u.start||(u.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0);else{(n||a||s)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var p="get"===e.kind?0:1;if(e.value.params.length!==p){var l=e.value.start;"get"===e.kind?this.raise(l,"getter should have no params"):this.raise(l,"setter should have exactly one param")}}},u.parsePropertyName=function(e){return this.eat(i.types.bracketL)?(e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(i.types.bracketR),e.key):(e.computed=!1,e.key=this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0))},u.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,this.options.features["es7.asyncFunctions"]&&(e.async=!!t)},u.parseMethod=function(e,t){var r=this.startNode();return this.initFunction(r,t),this.expect(i.types.parenL),r.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"]),r.generator=e,this.parseFunctionBody(r),this.finishNode(r,"FunctionExpression")},u.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},u.parseFunctionBody=function(e,t){var r=t&&!this.match(i.types.braceL),n=this.inAsync;if(this.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var a=this.state.inFunction,s=this.state.inGenerator,o=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=a,this.state.inGenerator=s,this.state.labels=o}if(this.inAsync=n,this.strict||!r&&e.body.body.length&&this.isUseStrict(e.body.body[0])){var u=Object.create(null),p=this.strict;this.strict=!0,e.id&&this.checkLVal(e.id,!0);for(var l=e.params,c=0;c<l.length;c++){var f=l[c];this.checkLVal(f,!0,u)}this.strict=p}},u.parseExprList=function(e,t,r,n){for(var a=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(i.types.comma),t&&this.eat(e))break;a.push(this.parseExprListItem(r,n))}return a},u.parseExprListItem=function(e,t){var r=void 0;return r=e&&this.match(i.types.comma)?null:this.match(i.types.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t)},u.parseIdent=function(e){var t=this.startNode();return this.match(i.types.name)?(!e&&(!this.options.allowReserved&&this.isReservedWord(this.state.value)||this.strict&&o.reservedWords.strict(this.state.value))&&this.raise(this.state.start,"The keyword '"+this.state.value+"' is reserved"),t.name=this.state.value):e&&this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"Identifier")},u.parseAwait=function(e){return(this.eat(i.types.semi)||this.canInsertSemicolon())&&this.unexpected(),e.all=this.eat(i.types.star),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},u.parseYield=function(){var e=this.startNode();return this.next(),this.match(i.types.semi)||this.canInsertSemicolon()||!this.match(i.types.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(i.types.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},u.parseComprehension=function(e,t){for(e.blocks=[];this.match(i.types._for);){var r=this.startNode();this.next(),this.expect(i.types.parenL),r.left=this.parseBindingAtom(),this.checkLVal(r.left,!0),this.expectContextual("of"),r.right=this.parseExpression(),this.expect(i.types.parenR),e.blocks.push(this.finishNode(r,"ComprehensionBlock"))}return e.filter=this.eat(i.types._if)?this.parseParenExpression():null,e.body=this.parseExpression(),this.expect(t?i.types.parenR:i.types.bracketR),e.generator=t,this.finishNode(e,"ComprehensionExpression")}},{609:609,621:621,622:622}],609:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var s=e(622),o=e(606),u=e(619),p=n(u),l={};r.plugins=l;var c=function(e){function t(r,n){i(this,t),e.call(this,n),this.options=o.getOptions(r),this.isKeyword=s.isKeyword,this.isReservedWord=s.reservedWords[6],this.input=n,this.loadPlugins(this.options.plugins),this.inModule="module"===this.options.sourceType,this.strict=this.options.strictMode===!1?!1:this.inModule,0===this.state.pos&&"#"===this.input[0]&&"!"===this.input[1]&&this.skipLineComment(2)}return a(t,e),t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadPlugins=function(e){for(var t in e){var n=r.plugins[t];if(!n)throw new Error("Plugin '"+t+"' not found");n(this,e[t])}},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(p["default"]);r["default"]=c},{606:606,619:619,622:622}],610:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(623),a=e(609),s=n(a),o=s["default"].prototype;o.raise=function(e,t){var r=i.getLineInfo(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n}},{609:609,623:623}],611:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(622),u=s["default"].prototype;u.toAssignable=function(e,t){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var r=e.properties,n=0;n<r.length;n++){var i=r[n];"SpreadProperty"!==i.type&&("init"!==i.kind&&this.raise(i.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(i.value,t))}break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}return e},u.toAssignableList=function(e,t){var r=e.length;if(r){var n=e[r-1];if(n&&"RestElement"===n.type)--r;else if(n&&"SpreadElement"===n.type){n.type="RestElement";var i=n.argument;this.toAssignable(i,t),"Identifier"!==i.type&&"MemberExpression"!==i.type&&"ArrayPattern"!==i.type&&this.unexpected(i.start),--r}}for(var a=0;r>a;a++){var s=e[a];s&&this.toAssignable(s,t)}return e},u.toReferencedList=function(e){return e},u.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(e),this.finishNode(t,"SpreadElement")},u.parseRest=function(){var e=this.startNode();return this.next(),e.argument=this.match(i.types.name)||this.match(i.types.bracketL)?this.parseBindingAtom():this.unexpected(),this.finishNode(e,"RestElement")},u.parseBindingAtom=function(){switch(this.state.type){case i.types.name:return this.parseIdent();case i.types.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(i.types.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case i.types.braceL:return this.parseObj(!0);default:this.unexpected()}},u.parseBindingList=function(e,t,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(i.types.comma),t&&this.match(i.types.comma))n.push(null);else{if(r&&this.eat(e))break;if(this.match(i.types.ellipsis)){n.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(e);break}var s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s),n.push(this.parseMaybeDefault(null,null,s))}return n},u.parseAssignableListItemTypes=function(e){return e},u.parseMaybeDefault=function(e,t,r){if(t=t||this.state.startLoc,e=e||this.state.start,r=r||this.parseBindingAtom(),!this.eat(i.types.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},u.checkLVal=function(e,t,r){switch(e.type){case"Identifier":this.strict&&(o.reservedWords.strictBind(e.name)||o.reservedWords.strict(e.name))&&this.raise(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(r[e.name]?this.raise(e.start,"Argument name clash in strict mode"):r[e.name]=!0);break;case"MemberExpression":t&&this.raise(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];"Property"===a.type&&(a=a.value),this.checkLVal(a,t,r)}break;case"ArrayPattern":for(var s=e.elements,u=0;u<s.length;u++){var p=s[u];p&&this.checkLVal(p,t,r)}break;case"AssignmentPattern":this.checkLVal(e.left,t,r);break;case"SpreadProperty":case"RestElement":this.checkLVal(e.argument,t,r);break;default:this.raise(e.start,(t?"Binding":"Assigning to")+" rvalue")}}},{609:609,621:621,622:622}],612:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}r.__esModule=!0;var s=e(609),o=n(s),u=e(623),p=o["default"].prototype,l=function(){function e(t,r,n){i(this,e),this.type="",this.start=r,this.end=0,this.loc=new u.SourceLocation(n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)t[r]=this[r];return t},e}();r.Node=l,p.startNode=function(){return new l(this,this.state.start,this.state.startLoc)},p.startNodeAt=function(e,t){return new l(this,e,t)},p.finishNode=function(e,t){return a.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},p.finishNodeAt=function(e,t,r,n){return a.call(this,e,t,r,n)}},{609:609,623:623}],613:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(624),u=s["default"].prototype;u.parseTopLevel=function(e,t){t.sourceType=this.options.sourceType,t.body=[];for(var r=!0;!this.match(i.types.eof);){var n=this.parseStatement(!0,!0);t.body.push(n),r&&(this.isUseStrict(n)&&this.setStrict(!0),r=!1)}return this.next(),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var p={kind:"loop"},l={kind:"switch"};u.parseStatement=function(e,t){this.match(i.types.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case i.types._break:case i.types._continue:return this.parseBreakContinueStatement(n,r.keyword);case i.types._debugger:return this.parseDebuggerStatement(n);case i.types._do:return this.parseDoStatement(n);case i.types._for:return this.parseForStatement(n);case i.types._function:return e||this.unexpected(),this.parseFunctionStatement(n);case i.types._class:return e||this.unexpected(),this.takeDecorators(n),this.parseClass(n,!0);case i.types._if:return this.parseIfStatement(n);case i.types._return:return this.parseReturnStatement(n);case i.types._switch:return this.parseSwitchStatement(n);case i.types._throw:return this.parseThrowStatement(n);case i.types._try:return this.parseTryStatement(n);case i.types._let:case i.types._const:e||this.unexpected();case i.types._var:return this.parseVarStatement(n,r);case i.types._while:return this.parseWhileStatement(n);case i.types._with:return this.parseWithStatement(n);case i.types.braceL:return this.parseBlock();case i.types.semi:return this.parseEmptyStatement(n);case i.types._export:case i.types._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===i.types._import?this.parseImport(n):this.parseExport(n);case i.types.name:if(this.options.features["es7.asyncFunctions"]&&"async"===this.state.value){var a=this.state.clone();if(this.next(),this.match(i.types._function)&&!this.canInsertSemicolon())return this.expect(i.types._function),this.parseFunction(n,!0,!1,!0);this.state=a}default:var s=this.state.value,o=this.parseExpression();return r===i.types.name&&"Identifier"===o.type&&this.eat(i.types.colon)?this.parseLabeledStatement(n,s,o):this.parseExpressionStatement(n,o)}},u.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},u.parseDecorators=function(e){for(;this.match(i.types.at);)this.state.decorators.push(this.parseDecorator());e&&this.match(i.types._export)||this.match(i.types._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},u.parseDecorator=function(){this.options.features["es7.decorators"]||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},u.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.label=null:this.match(i.types.name)?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var n=0;n<this.state.labels.length;++n){var a=this.state.labels[n];if(null==e.label||a.name===e.label.name){if(null!=a.kind&&(r||"loop"===a.kind))break;if(e.label&&r)break}}return n===this.state.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},u.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},u.parseDoStatement=function(e){return this.next(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.expect(i.types._while),e.test=this.parseParenExpression(),this.eat(i.types.semi),this.finishNode(e,"DoWhileStatement")},u.parseForStatement=function(e){if(this.next(),this.state.labels.push(p),this.expect(i.types.parenL),this.match(i.types.semi))return this.parseFor(e,null);if(this.match(i.types._var)||this.match(i.types._let)||this.match(i.types._const)){var t=this.startNode(),r=this.state.type;return this.next(),this.parseVar(t,!0,r),this.finishNode(t,"VariableDeclaration"),!this.match(i.types._in)&&!this.isContextual("of")||1!==t.declarations.length||r!==i.types._var&&t.declarations[0].init?this.parseFor(e,t):this.parseForIn(e,t)}var n={start:0},a=this.parseExpression(!0,n);return this.match(i.types._in)||this.isContextual("of")?(this.toAssignable(a),this.checkLVal(a),this.parseForIn(e,a)):(n.start&&this.unexpected(n.start),this.parseFor(e,a))},u.parseFunctionStatement=function(e){return this.next(),this.parseFunction(e,!0)},u.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!1),e.alternate=this.eat(i.types._else)?this.parseStatement(!1):null,this.finishNode(e,"IfStatement")},u.parseReturnStatement=function(e){return this.state.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},u.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(i.types.braceL),this.state.labels.push(l);for(var t,r;!this.match(i.types.braceR);)if(this.match(i.types._case)||this.match(i.types._default)){var n=this.match(i.types._case);t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raise(this.state.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(i.types.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(!0));return t&&this.finishNode(t,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(e,"SwitchStatement")},u.parseThrowStatement=function(e){return this.next(),o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var c=[];u.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(i.types._catch)){var t=this.startNode();this.next(),this.expect(i.types.parenL),t.param=this.parseBindingAtom(),this.checkLVal(t.param,!0),this.expect(i.types.parenR),t.body=this.parseBlock(),e.handler=this.finishNode(t,"CatchClause")}return e.guardedHandlers=c,e.finalizer=this.eat(i.types._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},u.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},u.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"WhileStatement")},u.parseWithStatement=function(e){return this.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},u.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},u.parseLabeledStatement=function(e,t,r){for(var n=this.state.labels,a=0;a<n.length;a++){var s=n[a];s.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(i.types._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var s=this.state.labels[u];if(s.statementStart!==e.start)break;s.statementStart=this.state.start,s.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},u.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},u.parseBlock=function(e){var t=this.startNode(),r=!0,n=void 0;for(t.body=[],this.expect(i.types.braceL);!this.eat(i.types.braceR);){var a=this.parseStatement(!0);t.body.push(a),r&&e&&this.isUseStrict(a)&&(n=this.strict,this.setStrict(this.strict=!0)),r=!1}return n===!1&&this.setStrict(!1),this.finishNode(t,"BlockStatement")},u.parseFor=function(e,t){return e.init=t,this.expect(i.types.semi),e.test=this.match(i.types.semi)?null:this.parseExpression(),this.expect(i.types.semi),e.update=this.match(i.types.parenR)?null:this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},u.parseForIn=function(e,t){var r=this.match(i.types._in)?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,r)},u.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(i.types.eq)?n.init=this.parseMaybeAssign(t):r!==i.types._const||this.match(i.types._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(i.types._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(i.types.comma))break}return e},u.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0)},u.parseFunction=function(e,t,r,n){return this.initFunction(e,n),e.generator=this.eat(i.types.star),(t||this.match(i.types.name))&&(e.id=this.parseIdent()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},u.parseFunctionParams=function(e){this.expect(i.types.parenL),e.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"])},u.parseClass=function(e,t){this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),n=!1;r.body=[],this.expect(i.types.braceL);for(var a=[];!this.eat(i.types.braceR);)if(!this.eat(i.types.semi))if(this.match(i.types.at))a.push(this.parseDecorator());else{var s=this.startNode();a.length&&(s.decorators=a,a=[]);var o=this.match(i.types.name)&&"static"===this.state.value,u=this.eat(i.types.star),p=!1;if(this.parsePropertyName(s),s["static"]=o&&!this.match(i.types.parenL),s["static"]&&(u&&this.unexpected(),u=this.eat(i.types.star),this.parsePropertyName(s)),u||"Identifier"!==s.key.type||s.computed||!this.isClassProperty()){!this.options.features["es7.asyncFunctions"]||this.match(i.types.parenL)||s.computed||"Identifier"!==s.key.type||"async"!==s.key.name||(p=!0,this.parsePropertyName(s));var l=!1;if(s.kind="method",!s.computed){var c=s.key;p||u||"Identifier"!==c.type||this.match(i.types.parenL)||"get"!==c.name&&"set"!==c.name||(l=!0,s.kind=c.name,c=this.parsePropertyName(s)),!s["static"]&&("Identifier"===c.type&&"constructor"===c.name||"Literal"===c.type&&"constructor"===c.value)&&(n&&this.raise(c.start,"Duplicate constructor in the same class"),l&&this.raise(c.start,"Constructor can't have get/set modifier"),u&&this.raise(c.start,"Constructor can't be a generator"),p&&this.raise(c.start,"Constructor can't be an async function"),s.kind="constructor",n=!0)}if("constructor"===s.kind&&s.decorators&&this.raise(s.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(r,s,u,p),l){var f="get"===s.kind?0:1;if(s.value.params.length!==f){var d=s.value.start;"get"===s.kind?this.raise(d,"getter should have no params"):this.raise(d,"setter should have exactly one param")}}}else r.body.push(this.parseClassProperty(s))}return a.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},u.isClassProperty=function(){return this.match(i.types.eq)||this.match(i.types.semi)||this.canInsertSemicolon()},u.parseClassProperty=function(e){return this.match(i.types.eq)?(this.options.features["es7.classProperties"]||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.finishNode(e,"ClassProperty")},u.parseClassMethod=function(e,t,r,n){t.value=this.parseMethod(r,n),e.body.push(this.finishNode(t,"MethodDefinition"))},u.parseClassId=function(e,t){e.id=this.match(i.types.name)?this.parseIdent():t?this.unexpected():null},u.parseClassSuper=function(e){e.superClass=this.eat(i.types._extends)?this.parseExprSubscripts():null},u.parseExport=function(e){if(this.next(),this.match(i.types.star)){var t=this.startNode();if(this.next(),!this.options.features["es7.exportExtensions"]||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdent(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.options.features["es7.exportExtensions"]&&this.isExportDefaultSpecifier()){var t=this.startNode();if(t.exported=this.parseIdent(!0),e.specifiers=[this.finishNode(t,"ExportDefaultSpecifier")],this.match(i.types.comma)&&this.lookahead().type===i.types.star){this.expect(i.types.comma);var r=this.startNode();this.expect(i.types.star),this.expectContextual("as"),r.exported=this.parseIdent(),e.specifiers.push(this.finishNode(r,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(i.types._default)){var n=this.match(i.types._function)||this.match(i.types._class),a=this.parseMaybeAssign(),s=!0;return n&&(s=!1,a.id&&(a.type="FunctionExpression"===a.type?"FunctionDeclaration":"ClassDeclaration")),e.declaration=a,s&&this.semicolon(),this.checkExport(e),this.finishNode(e,"ExportDefaultDeclaration")}this.state.type.keyword||this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e),this.finishNode(e,"ExportNamedDeclaration")},u.parseExportDeclaration=function(){return this.parseStatement(!0)},u.isExportDefaultSpecifier=function(){if(this.match(i.types.name))return"type"!==this.state.value&&"async"!==this.state.value;if(!this.match(i.types._default))return!1;var e=this.lookahead();return e.type===i.types.comma||e.type===i.types.name&&"from"===e.value},u.parseExportSpecifiersMaybe=function(e){this.eat(i.types.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},u.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},u.shouldParseExportDeclaration=function(){return this.options.features["es7.asyncFunctions"]&&this.isContextual("async")},u.checkExport=function(e){if(this.state.decorators.length){var t=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&t||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},u.parseExportSpecifiers=function(){var e=[],t=!0;for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var r=this.startNode();r.local=this.parseIdent(this.match(i.types._default)),r.exported=this.eatContextual("as")?this.parseIdent(!0):r.local.__clone(),e.push(this.finishNode(r,"ExportSpecifier"))}return e},u.parseImport=function(e){return this.next(),this.match(i.types.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},u.parseImportSpecifiers=function(e){var t=!0;if(this.match(i.types.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(),r,n)),!this.eat(i.types.comma))return}if(this.match(i.types.star)){var a=this.startNode();return this.next(),this.expectContextual("as"),a.local=this.parseIdent(),this.checkLVal(a.local,!0),void e.specifiers.push(this.finishNode(a,"ImportNamespaceSpecifier"))}for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var a=this.startNode();a.imported=this.parseIdent(!0),a.local=this.eatContextual("as")?this.parseIdent():a.imported.__clone(),this.checkLVal(a.local,!0),e.specifiers.push(this.finishNode(a,"ImportSpecifier"))}},u.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0),this.finishNode(n,"ImportDefaultSpecifier")}},{609:609,621:621,624:624}],614:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(624),u=s["default"].prototype;u.isUseStrict=function(e){return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.raw.slice(1,-1)},u.isRelational=function(e){return this.match(i.types.relational)&&this.state.value===e},u.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected()},u.isContextual=function(e){return this.match(i.types.name)&&this.state.value===e},u.eatContextual=function(e){return this.state.value===e&&this.eat(i.types.name)},u.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},u.canInsertSemicolon=function(){return this.match(i.types.eof)||this.match(i.types.braceR)||o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))},u.semicolon=function(){this.eat(i.types.semi)||this.canInsertSemicolon()||this.unexpected()},u.expect=function(e){return this.eat(e)||this.unexpected()},u.unexpected=function(e){this.raise(null!=e?e:this.state.start,"Unexpected token")}},{609:609,621:621,624:624}],615:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(621),a=e(609),s=n(a),o=s["default"].prototype;o.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||i.types.colon);var r=this.flowParseType();return this.state.inType=t,r},o.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},o.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdent(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(i.types.parenL);var a=this.flowParseFunctionTypeParams();return r.params=a.params,r.rest=a.rest,this.expect(i.types.parenR),r.returnType=this.flowParseTypeInitialiser(),n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},o.flowParseDeclare=function(e){return this.match(i.types._class)?this.flowParseDeclareClass(e):this.match(i.types._function)?this.flowParseDeclareFunction(e):this.match(i.types._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.flowParseDeclareModule(e):void this.unexpected()},o.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},o.flowParseDeclareModule=function(e){this.next(),this.match(i.types.string)?e.id=this.parseExprAtom():e.id=this.parseIdent();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(i.types.braceL);!this.match(i.types.braceR);){var n=this.startNode();this.next(),r.push(this.flowParseDeclare(n))}return this.expect(i.types.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},o.flowParseInterfaceish=function(e,t){if(e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e["extends"]=[],this.eat(i.types._extends))do e["extends"].push(this.flowParseInterfaceExtends());while(this.eat(i.types.comma));e.body=this.flowParseObjectType(t)},o.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null, this.finishNode(e,"InterfaceExtends")},o.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},o.flowParseTypeAlias=function(e){return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(i.types.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},o.flowParseTypeParameterDeclaration=function(){var e=this.startNode();for(e.params=[],this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseTypeAnnotatableIdentifier()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.finishNode(e,"TypeParameterDeclaration")},o.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},o.flowParseObjectPropertyKey=function(){return this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0)},o.flowParseObjectTypeIndexer=function(e,t){return e["static"]=t,this.expect(i.types.bracketL),e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser(),this.expect(i.types.bracketR),e.value=this.flowParseTypeInitialiser(),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},o.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(i.types.parenL);this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(i.types.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},o.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i["static"]=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},o.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e["static"]=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},o.flowParseObjectType=function(e){var t,r,n,a=this.startNode();for(a.callProperties=[],a.properties=[],a.indexers=[],this.expect(i.types.braceL);!this.match(i.types.braceR);){var s=!1,o=this.state.start,u=this.state.startLoc;t=this.startNode(),e&&this.isContextual("static")&&(this.next(),n=!0),this.match(i.types.bracketL)?a.indexers.push(this.flowParseObjectTypeIndexer(t,n)):this.match(i.types.parenL)||this.isRelational("<")?a.callProperties.push(this.flowParseObjectTypeCallProperty(t,e)):(r=n&&this.match(i.types.colon)?this.parseIdent():this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(i.types.parenL)?a.properties.push(this.flowParseObjectTypeMethod(o,u,n,r)):(this.eat(i.types.question)&&(s=!0),t.key=r,t.value=this.flowParseTypeInitialiser(),t.optional=s,t["static"]=n,this.flowObjectTypeSemicolon(),a.properties.push(this.finishNode(t,"ObjectTypeProperty"))))}return this.expect(i.types.braceR),this.finishNode(a,"ObjectTypeAnnotation")},o.flowObjectTypeSemicolon=function(){this.eat(i.types.semi)||this.eat(i.types.comma)||this.match(i.types.braceR)||this.unexpected()},o.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);for(n.typeParameters=null,n.id=r;this.eat(i.types.dot);){var a=this.startNodeAt(e,t);a.qualification=n.id,a.id=this.parseIdent(),n.id=this.finishNode(a,"QualifiedTypeIdentifier")}return this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},o.flowParseTypeofType=function(){var e=this.startNode();return this.expect(i.types._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},o.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(i.types.bracketL);this.state.pos<this.input.length&&!this.match(i.types.bracketR)&&(e.types.push(this.flowParseType()),!this.match(i.types.bracketR));)this.expect(i.types.comma);return this.expect(i.types.bracketR),this.finishNode(e,"TupleTypeAnnotation")},o.flowParseFunctionTypeParam=function(){var e=!1,t=this.startNode();return t.name=this.parseIdent(),this.eat(i.types.question)&&(e=!0),t.optional=e,t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeParam")},o.flowParseFunctionTypeParams=function(){for(var e={params:[],rest:null};this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),e},o.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},o.flowParsePrimaryType=function(){var e,t,r=this.state.start,n=this.state.startLoc,a=this.startNode(),s=!1;switch(this.state.type){case i.types.name:return this.flowIdentToTypeAnnotation(r,n,a,this.parseIdent());case i.types.braceL:return this.flowParseObjectType();case i.types.bracketL:return this.flowParseTupleType();case i.types.relational:if("<"===this.state.value)return a.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(i.types.parenL),e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),this.finishNode(a,"FunctionTypeAnnotation");case i.types.parenL:if(this.next(),!this.match(i.types.parenR)&&!this.match(i.types.ellipsis))if(this.match(i.types.name)){var o=this.lookahead().type;s=o!==i.types.question&&o!==i.types.colon}else s=!0;return s?(t=this.flowParseType(),this.expect(i.types.parenR),this.eat(i.types.arrow)&&this.raise(a,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),t):(e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),a.typeParameters=null,this.finishNode(a,"FunctionTypeAnnotation"));case i.types.string:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"StringLiteralTypeAnnotation");case i.types._true:case i.types._false:return a.value=this.match(i.types._true),this.next(),this.finishNode(a,"BooleanLiteralTypeAnnotation");case i.types.num:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"NumberLiteralTypeAnnotation");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},o.flowParsePostfixType=function(){var e=this.startNode(),t=e.elementType=this.flowParsePrimaryType();return this.match(i.types.bracketL)?(this.expect(i.types.bracketL),this.expect(i.types.bracketR),this.finishNode(e,"ArrayTypeAnnotation")):t},o.flowParsePrefixType=function(){var e=this.startNode();return this.eat(i.types.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},o.flowParseIntersectionType=function(){var e=this.startNode(),t=this.flowParsePrefixType();for(e.types=[t];this.eat(i.types.bitwiseAND);)e.types.push(this.flowParsePrefixType());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},o.flowParseUnionType=function(){var e=this.startNode(),t=this.flowParseIntersectionType();for(e.types=[t];this.eat(i.types.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},o.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},o.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},o.flowParseTypeAnnotatableIdentifier=function(e,t){var r=this.parseIdent(),n=!1;return t&&this.eat(i.types.question)&&(this.expect(i.types.question),n=!0),(e||this.match(i.types.colon))&&(r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,r.type)),n&&(r.optional=!0,this.finishNode(r,r.type)),r},r["default"]=function(e){function t(e){return e.expression.typeAnnotation=e.typeAnnotation,e.expression}e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(i.types.colon)&&!r&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.strict&&this.match(i.types.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(i.types._class)||this.match(i.types.name)||this.match(i.types._function)||this.match(i.types._var))return this.flowParseDeclare(t)}else if(this.match(i.types.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||e.call(this)}}),e.extend("parseParenItem",function(){return function(e,t,r,n){if(this.match(i.types.colon)){var a=this.startNodeAt(t,r);if(a.expression=e,a.typeAnnotation=this.flowParseTypeAnnotation(),n&&!this.match(i.types.arrow)&&this.unexpected(),this.eat(i.types.arrow)){var s=this.parseArrowExpression(this.startNodeAt(t,r),[e]);return s.returnType=a.typeAnnotation,s}return this.finishNode(a,"TypeCastExpression")}return e}}),e.extend("parseExport",function(e){return function(t){return t=e.call(this,t),"ExportNamedDeclaration"===t.type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(i.types.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t,r){e.call(this,t,r),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return this.state.inType&&"void"===t?!1:e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(i.types.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){return this.state.inType?void 0:e.call(this)}}),e.extend("toAssignableList",function(e){return function(r,n){for(var i=0;i<r.length;i++){var a=r[i];a&&"TypeCastExpression"===a.type&&(r[i]=t(a))}return e.call(this,r,n)}}),e.extend("toReferencedList",function(){return function(e){for(var t=0;t<e.length;t++){var r=e[t];r&&r._exprListItem&&"TypeCastExpression"===r.type&&this.raise(r.start,"Unexpected type cast")}return e}}),e.extend("parseExprListItem",function(e){return function(t,r){var n=this.startNode(),a=e.call(this,t,r);return this.match(i.types.colon)?(n._exprListItem=!0,n.expression=a,n.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(n,"TypeCastExpression")):a}}),e.extend("parseClassProperty",function(e){return function(t){return this.match(i.types.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.call(this,t)}}),e.extend("isClassProperty",function(e){return function(){return this.match(i.types.colon)||e.call(this)}}),e.extend("parseClassMethod",function(){return function(e,t,r,n){var i;this.isRelational("<")&&(i=this.flowParseTypeParameterDeclaration()),t.value=this.parseMethod(r,n),t.value.typeParameters=i,e.body.push(this.finishNode(t,"MethodDefinition"))}}),e.extend("parseClassSuper",function(e){return function(t,r){if(e.call(this,t,r),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var n=t["implements"]=[];do{var a=this.startNode();a.id=this.parseIdent(),this.isRelational("<")?a.typeParameters=this.flowParseTypeParameterInstantiation():a.typeParameters=null,n.push(this.finishNode(a,"ClassImplements"))}while(this.eat(i.types.comma))}}}),e.extend("parseObjPropValue",function(e){return function(t){var r;this.isRelational("<")&&(r=this.flowParseTypeParameterDeclaration(),this.match(i.types.parenL)||this.unexpected()),e.apply(this,arguments),r&&(t.value.typeParameters=r)}}),e.extend("parseAssignableListItemTypes",function(){return function(e){return this.eat(i.types.question)&&(e.optional=!0),this.match(i.types.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),this.finishNode(e,e.type),e}}),e.extend("parseImportSpecifiers",function(e){return function(t){t.importKind="value";var r=this.match(i.types._typeof)?"typeof":this.isContextual("type")?"type":null;if(r){var n=this.lookahead();(n.type===i.types.name&&"from"!==n.value||n.type===i.types.braceL||n.type===i.types.star)&&(this.next(),t.importKind=r)}e.call(this,t)}}),e.extend("parseFunctionParams",function(e){return function(t){this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),e.call(this,t)}}),e.extend("parseVarHead",function(e){return function(t){e.call(this,t),this.match(i.types.colon)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(t.id,t.id.type))}}),e.extend("parseAsyncArrowFromCallExpression",function(e){return function(t,r){return this.match(i.types.colon)&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseParenAndDistinguishExpression",function(e){return function(t,r,n,a){if(t=t||this.state.start,r=r||this.state.startLoc,this.lookahead().type===i.types.parenR){this.expect(i.types.parenL),this.expect(i.types.parenR);var s=this.startNodeAt(t,r);return this.match(i.types.colon)&&(s.returnType=this.flowParseTypeAnnotation()),this.expect(i.types.arrow),this.parseArrowExpression(s,[],a)}var s=e.call(this,t,r,n,a);if(!this.match(i.types.colon))return s;var o=this.state.clone();try{return this.parseParenItem(s,t,r,!0)}catch(u){if(u instanceof SyntaxError)return this.state=o,s;throw u}}})},t.exports=r["default"]},{609:609,621:621}],616:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?i(e.object)+"."+i(e.property):void 0}r.__esModule=!0;var a=e(617),s=n(a),o=e(621),u=e(618),p=e(609),l=n(p),c=e(622),f=e(624),d=/^[\da-fA-F]+$/,h=/^\d+$/;u.types.j_oTag=new u.TokContext("<tag",!1),u.types.j_cTag=new u.TokContext("</tag",!1),u.types.j_expr=new u.TokContext("<tag>...</tag>",!0,!0),o.types.jsxName=new o.TokenType("jsxName"),o.types.jsxText=new o.TokenType("jsxText",{beforeExpr:!0}),o.types.jsxTagStart=new o.TokenType("jsxTagStart"),o.types.jsxTagEnd=new o.TokenType("jsxTagEnd"),o.types.jsxTagStart.updateContext=function(){this.state.context.push(u.types.j_expr),this.state.context.push(u.types.j_oTag),this.state.exprAllowed=!1},o.types.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===u.types.j_oTag&&e===o.types.slash||t===u.types.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===u.types.j_expr):this.state.exprAllowed=!0};var m=l["default"].prototype;m.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(o.types.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:f.isNewLine(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},m.jsxReadNewLine=function(e){var t,r=this.input.charCodeAt(this.state.pos);return++this.state.pos,13===r&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,t=e?"\n":"\r\n"):t=String.fromCharCode(r),++this.state.curLine,this.state.lineStart=this.state.pos,t},m.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):f.isNewLine(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(o.types.string,t)},m.jsxReadEntity=function(){for(var e,t="",r=0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos<this.input.length&&r++<10;){if(n=this.input[this.state.pos++],";"===n){"#"===t[0]?"x"===t[1]?(t=t.substr(2),d.test(t)&&(e=String.fromCharCode(parseInt(t,16)))):(t=t.substr(1),h.test(t)&&(e=String.fromCharCode(parseInt(t,10)))):e=s["default"][t];break}t+=n}return e?e:(this.state.pos=i,"&")},m.jsxReadWord=function(){var e,t=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(c.isIdentifierChar(e)||45===e);return this.finishToken(o.types.jsxName,this.input.slice(t,this.state.pos))},m.jsxParseIdentifier=function(){var e=this.startNode();return this.match(o.types.jsxName)?e.name=this.state.value:this.state.type.keyword?e.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")},m.jsxParseNamespacedName=function(){var e=this.state.start,t=this.state.startLoc,r=this.jsxParseIdentifier();if(!this.eat(o.types.colon))return r;var n=this.startNodeAt(e,t);return n.namespace=r,n.name=this.jsxParseIdentifier(),this.finishNode(n,"JSXNamespacedName")},m.jsxParseElementName=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.jsxParseNamespacedName();this.eat(o.types.dot);){var n=this.startNodeAt(e,t);n.object=r,n.property=this.jsxParseIdentifier(),r=this.finishNode(n,"JSXMemberExpression")}return r},m.jsxParseAttributeValue=function(){var e;switch(this.state.type){case o.types.braceL:if(e=this.jsxParseExpressionContainer(),"JSXEmptyExpression"!==e.expression.type)return e;this.raise(e.start,"JSX attributes must only be assigned a non-empty expression");case o.types.jsxTagStart:case o.types.string:return e=this.parseExprAtom(),e.rawValue=null,e;default:this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}},m.jsxParseEmptyExpression=function(){var e=this.state.start;return this.state.start=this.state.lastTokEnd,this.state.lastTokEnd=e,e=this.state.startLoc,this.state.startLoc=this.state.lastTokEndLoc,this.state.lastTokEndLoc=e,this.finishNode(this.startNode(),"JSXEmptyExpression")},m.jsxParseExpressionContainer=function(){var e=this.startNode();return this.next(),this.match(o.types.braceR)?e.expression=this.jsxParseEmptyExpression():e.expression=this.parseExpression(),this.expect(o.types.braceR),this.finishNode(e,"JSXExpressionContainer")},m.jsxParseAttribute=function(){var e=this.startNode();return this.eat(o.types.braceL)?(this.expect(o.types.ellipsis),e.argument=this.parseMaybeAssign(),this.expect(o.types.braceR),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(o.types.eq)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))},m.jsxParseOpeningElementAt=function(e,t){var r=this.startNodeAt(e,t);for(r.attributes=[],r.name=this.jsxParseElementName();!this.match(o.types.slash)&&!this.match(o.types.jsxTagEnd);)r.attributes.push(this.jsxParseAttribute());return r.selfClosing=this.eat(o.types.slash),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXOpeningElement")},m.jsxParseClosingElementAt=function(e,t){var r=this.startNodeAt(e,t);return r.name=this.jsxParseElementName(),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXClosingElement")},m.jsxParseElementAt=function(e,t){var r=this.startNodeAt(e,t),n=[],a=this.jsxParseOpeningElementAt(e,t),s=null;if(!a.selfClosing){e:for(;;)switch(this.state.type){case o.types.jsxTagStart:if(e=this.state.start,t=this.state.startLoc,this.next(),this.eat(o.types.slash)){s=this.jsxParseClosingElementAt(e,t);break e}n.push(this.jsxParseElementAt(e,t));break;case o.types.jsxText:n.push(this.parseExprAtom());break;case o.types.braceL:n.push(this.jsxParseExpressionContainer());break;default:this.unexpected()}i(s.name)!==i(a.name)&&this.raise(s.start,"Expected corresponding JSX closing tag for <"+i(a.name)+">")}return r.openingElement=a,r.closingElement=s,r.children=n,this.match(o.types.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},m.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)},r["default"]=function(e){e.extend("parseExprAtom",function(e){return function(t){if(this.match(o.types.jsxText)){var r=this.parseLiteral(this.state.value);return r.rawValue=null,r}return this.match(o.types.jsxTagStart)?this.jsxParseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){var r=this.curContext();if(r===u.types.j_expr)return this.jsxReadToken();if(r===u.types.j_oTag||r===u.types.j_cTag){if(c.isIdentifierStart(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(o.types.jsxTagEnd);if((34===t||39===t)&&r===u.types.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.match(o.types.braceL)){var r=this.curContext();r===u.types.j_oTag?this.state.context.push(u.types.b_expr):r===u.types.j_expr?this.state.context.push(u.types.b_tmpl):e.call(this,t),this.state.exprAllowed=!0}else{if(!this.match(o.types.slash)||t!==o.types.jsxTagStart)return e.call(this,t);this.state.context.length-=2,this.state.context.push(u.types.j_cTag),this.state.exprAllowed=!1}}})},t.exports=r["default"]},{609:609,617:617,618:618,621:621,622:622,624:624}],617:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},t.exports=r["default"]},{}],618:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(621),a=function o(e,t,r,i){n(this,o),this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i};r.TokContext=a;var s={b_stat:new a("{",!1),b_expr:new a("{",!0),b_tmpl:new a("${",!0),p_stat:new a("(",!1),p_expr:new a("(",!0),q_tmpl:new a("`",!0,!0,function(e){return e.readTmplToken()}),f_expr:new a("function",!0)};r.types=s,i.types.parenR.updateContext=i.types.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);var e=this.state.context.pop();e===s.b_stat&&this.curContext()===s.f_expr?(this.state.context.pop(),this.state.exprAllowed=!1):e===s.b_tmpl?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr},i.types.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?s.b_stat:s.b_expr),this.state.exprAllowed=!0},i.types.dollarBraceL.updateContext=function(){this.state.context.push(s.b_tmpl),this.state.exprAllowed=!0},i.types.parenL.updateContext=function(e){var t=e===i.types._if||e===i.types._for||e===i.types._with||e===i.types._while;this.state.context.push(t?s.p_stat:s.p_expr),this.state.exprAllowed=!0},i.types.incDec.updateContext=function(){},i.types._function.updateContext=function(){this.curContext()!==s.b_stat&&this.state.context.push(s.f_expr),this.state.exprAllowed=!1},i.types.backQuote.updateContext=function(){this.curContext()===s.q_tmpl?this.state.context.pop():this.state.context.push(s.q_tmpl),this.state.exprAllowed=!1}},{621:621}],619:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r){try{return new RegExp(e,t)}catch(n){void 0!==r&&(n instanceof SyntaxError&&this.raise(r,"Error parsing regular expression: "+n.message),this.raise(n))}}function s(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}r.__esModule=!0;var o=e(622),u=e(621),p=e(618),l=e(623),c=e(624),f=e(620),d=n(f),h=function v(e){i(this,v),this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,this.loc=new l.SourceLocation(e.startLoc,e.endLoc)};r.Token=h;var m="object"==typeof Packages&&"[object JavaPackage]"===Object.prototype.toString.call(Packages),y=!!a("￿","u"),g=function(){function e(t){i(this,e),this.state=new d["default"],this.state.init(t)}return e.prototype.next=function(){this.state.tokens.push(new h(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return this.match(e)?(this.next(),!0):!1},e.prototype.match=function(e){return this.state.type===e},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(),this.next();var t=this.state.clone();return this.state=e,t},e.prototype.setStrict=function(e){if(this.strict=e,this.match(u.types.num)||this.match(u.types.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}},e.prototype.curContext=function(){return this.state.context[this.state.context.length-1]},e.prototype.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.input.length?this.finishToken(u.types.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return o.isIdentifierStart(e,!0)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);if(55295>=e||e>=57344)return e;var t=this.input.charCodeAt(this.state.pos+1);return(e<<10)+t-56613888},e.prototype.pushComment=function(e,t,r,n,i,a){var s={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new l.SourceLocation(i,a),range:[r,n]};this.state.tokens.push(s),this.state.comments.push(s),this.addComment(s)},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,c.lineBreakG.lastIndex=t;for(var n=void 0;(n=c.lineBreakG.exec(this.input))&&n.index<this.state.pos;)++this.state.curLine,this.state.lineStart=n.index+n[0].length;this.pushComment(!0,this.input.slice(t+2,r),t,this.state.pos,e,this.state.curPosition())},e.prototype.skipLineComment=function(e){for(var t=this.state.pos,r=this.state.curPosition(),n=this.input.charCodeAt(this.state.pos+=e);this.state.pos<this.input.length&&10!==n&&13!==n&&8232!==n&&8233!==n;)++this.state.pos,n=this.input.charCodeAt(this.state.pos);this.pushComment(!1,this.input.slice(t+e,this.state.pos),t,this.state.pos,r,this.state.curPosition())},e.prototype.skipSpace=function(){e:for(;this.state.pos<this.input.length;){var e=this.input.charCodeAt(this.state.pos);switch(e){case 32:case 160:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&14>e||e>=5760&&c.nonASCIIwhitespace.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&57>=e)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3, this.finishToken(u.types.ellipsis)):(++this.state.pos,this.finishToken(u.types.dot))},e.prototype.readToken_slash=function(){if(this.state.exprAllowed)return++this.state.pos,this.readRegexp();var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?u.types.star:u.types.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&this.options.features["es7.exponentiationOperator"]&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=u.types.exponent),61===n&&(r++,t=u.types.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?u.types.logicalOR:u.types.logicalAND,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(124===e?u.types.bitwiseOR:u.types.bitwiseAND,1)},e.prototype.readToken_caret=function(){var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.types.incDec,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(u.types.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(u.types.assign,r+1):this.finishOp(u.types.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=61===this.input.charCodeAt(this.state.pos+2)?3:2),this.finishOp(u.types.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(u.types.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(u.types.arrow)):this.finishOp(61===e?u.types.eq:u.types.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(u.types.parenL);case 41:return++this.state.pos,this.finishToken(u.types.parenR);case 59:return++this.state.pos,this.finishToken(u.types.semi);case 44:return++this.state.pos,this.finishToken(u.types.comma);case 91:return++this.state.pos,this.finishToken(u.types.bracketL);case 93:return++this.state.pos,this.finishToken(u.types.bracketR);case 123:return++this.state.pos,this.finishToken(u.types.braceL);case 125:return++this.state.pos,this.finishToken(u.types.braceR);case 58:return this.options.features["es7.functionBind"]&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(u.types.doubleColon,2):(++this.state.pos,this.finishToken(u.types.colon));case 63:return++this.state.pos,this.finishToken(u.types.question);case 64:return++this.state.pos,this.finishToken(u.types.at);case 96:return++this.state.pos,this.finishToken(u.types.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(u.types.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+s(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this,t=void 0,r=void 0,n=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.state.pos);if(c.lineBreak.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if("["===i)r=!0;else if("]"===i&&r)r=!1;else if("/"===i&&!r)break;t="\\"===i}++this.state.pos}var s=this.input.slice(n,this.state.pos);++this.state.pos;var o=this.readWord1(),p=s;if(o){var l=/^[gmsiyu]*$/;l.test(o)||this.raise(n,"Invalid regular expression flag"),o.indexOf("u")>=0&&!y&&(p=p.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,r,i){return r=Number("0x"+r),r>1114111&&e.raise(n+i+3,"Code point out of bounds"),"x"}),p=p.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}var f=null;return m||(a.call(this,p,void 0,n),f=a.call(this,s,o)),this.finishToken(u.types.regexp,{pattern:s,flags:o,value:f})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,a=null==t?1/0:t;a>i;++i){var s=this.input.charCodeAt(this.state.pos),o=void 0;if(o=s>=97?s-97+10:s>=65?s-65+10:s>=48&&57>=s?s-48:1/0,o>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(u.types.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=!1,n=48===this.input.charCodeAt(this.state.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.state.pos);46===i&&(++this.state.pos,this.readInt(10),r=!0,i=this.input.charCodeAt(this.state.pos)),(69===i||101===i)&&(i=this.input.charCodeAt(++this.state.pos),(43===i||45===i)&&++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),s=void 0;return r?s=parseFloat(a):n&&1!==a.length?/[89]/.test(a)||this.strict?this.raise(t,"Invalid number"):s=parseInt(a,8):s=parseInt(a,10),this.finishToken(u.types.num,s)},e.prototype.readCodePoint=function(){var e=this.input.charCodeAt(this.state.pos),t=void 0;if(123===e){var r=++this.state.pos;t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos),++this.state.pos,t>1114111&&this.raise(r,"Code point out of bounds")}else t=this.readHexChar(4);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(c.isNewLine(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(u.types.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var r=this.input.charCodeAt(this.state.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(u.types.template)?36===r?(this.state.pos+=2,this.finishToken(u.types.dollarBraceL)):(++this.state.pos,this.finishToken(u.types.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(u.types.template,e));if(92===r)e+=this.input.slice(t,this.state.pos),e+=this.readEscapedChar(!0),t=this.state.pos;else if(c.isNewLine(r)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,r){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return s(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return" ";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(t>=48&&55>=t){var r=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=parseInt(r,8)),n>0&&(this.strict||e)&&this.raise(this.state.pos-2,"Octal literal in strict mode"),this.state.pos+=r.length-1,String.fromCharCode(n)}return String.fromCharCode(t)}},e.prototype.readHexChar=function(e){var t=this.state.pos,r=this.readInt(16,e);return null===r&&this.raise(t,"Bad character escape sequence"),r},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(o.isIdentifierChar(n,!0))this.state.pos+=65535>=n?1:2;else{if(92!==n)break;this.state.containsEsc=!0,e+=this.input.slice(r,this.state.pos);var i=this.state.pos;117!==this.input.charCodeAt(++this.state.pos)&&this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.state.pos;var a=this.readCodePoint();(t?o.isIdentifierStart:o.isIdentifierChar)(a,!0)||this.raise(i,"Invalid Unicode escape"),e+=s(a),r=this.state.pos}t=!1}return e+this.input.slice(r,this.state.pos)},e.prototype.readWord=function(){var e=this.readWord1(),t=u.types.name;return!this.state.containsEsc&&this.isKeyword(e)&&(t=u.keywords[e]),this.finishToken(t,e)},e.prototype.braceIsBlock=function(e){if(e===u.types.colon){var t=this.curContext();if(t===p.types.b_stat||t===p.types.b_expr)return!t.isExpr}return e===u.types._return?c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start)):e===u.types._else||e===u.types.semi||e===u.types.eof||e===u.types.parenR?!0:e===u.types.braceL?this.curContext()===p.types.b_stat:!this.state.exprAllowed},e.prototype.updateContext=function(e){var t=void 0,r=this.state.type;r.keyword&&e===u.types.dot?this.state.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.state.exprAllowed=r.beforeExpr},e}();r["default"]=g},{618:618,620:620,621:621,622:622,623:623,624:624}],620:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(623),a=e(618),s=e(621),o=function(){function e(){n(this,e)}return e.prototype.init=function(e){return this.input=e,this.potentialArrowAt=-1,this.inFunction=this.inGenerator=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=1,this.type=s.types.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[a.types.b_stat],this.exprAllowed=!0,this.containsEsc=!1,this},e.prototype.curPosition=function(){return new i.Position(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(){var t=new e;for(var r in this){var n=this[r];Array.isArray(n)&&(n=n.slice()),t[r]=n}return t},e}();r["default"]=o,t.exports=r["default"]},{618:618,621:621,623:623}],621:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return new s(e,{beforeExpr:!0,binop:t})}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.keyword=e,l[e]=p["_"+e]=new s(e,t)}r.__esModule=!0;var s=function c(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];n(this,c),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};r.TokenType=s;var o={beforeExpr:!0},u={startsExpr:!0},p={num:new s("num",u),regexp:new s("regexp",u),string:new s("string",u),name:new s("name",u),eof:new s("eof"),bracketL:new s("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new s("]"),braceL:new s("{",{beforeExpr:!0,startsExpr:!0}),braceR:new s("}"),parenL:new s("(",{beforeExpr:!0,startsExpr:!0}),parenR:new s(")"),comma:new s(",",o),semi:new s(";",o),colon:new s(":",o),doubleColon:new s("::",o),dot:new s("."),question:new s("?",o),arrow:new s("=>",o),template:new s("template"),ellipsis:new s("...",o),backQuote:new s("`",u),dollarBraceL:new s("${",{beforeExpr:!0,startsExpr:!0}),at:new s("@"),eq:new s("=",{beforeExpr:!0,isAssign:!0}),assign:new s("_=",{beforeExpr:!0,isAssign:!0}),incDec:new s("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new s("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=",6),relational:i("</>",7),bitShift:i("<</>>",8),plusMin:new s("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),exponent:new s("**",{beforeExpr:!0,binop:11,rightAssociative:!0})};r.types=p;var l={};r.keywords=l,a("break"),a("case",o),a("catch"),a("continue"),a("debugger"),a("default",o),a("do",{isLoop:!0}),a("else",o),a("finally"),a("for",{isLoop:!0}),a("function",u),a("if"),a("return",o),a("switch"),a("throw",o),a("try"),a("var"),a("let"),a("const"),a("while",{isLoop:!0}),a("with"),a("new",{beforeExpr:!0,startsExpr:!0}),a("this",u),a("super",u),a("class"),a("extends",o),a("export"),a("import"),a("yield",{beforeExpr:!0,startsExpr:!0}),a("null",u),a("true",u),a("false",u),a("in",{beforeExpr:!0,binop:7}),a("instanceof",{beforeExpr:!0,binop:7}),a("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{}],622:[function(e,t,r){"use strict";function n(e){return e=e.split(" "),function(t){return e.indexOf(t)>=0}}function i(e,t){for(var r=65536,n=0;n<t.length;n+=2){if(r+=t[n],r>e)return!1;if(r+=t[n+1],r>=e)return!0}}function a(e){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&c.test(String.fromCharCode(e)):i(e,d)}function s(e){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&f.test(String.fromCharCode(e)):i(e,d)||i(e,h)}r.__esModule=!0,r.isIdentifierStart=a,r.isIdentifierChar=s;var o={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")};r.reservedWords=o;var u=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");r.isKeyword=u;var p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",l="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",c=new RegExp("["+p+"]"),f=new RegExp("["+p+l+"]");p=l=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541],h=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]},{}],623:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=1,n=0;;){a.lineBreakG.lastIndex=n;var i=a.lineBreakG.exec(e);if(!(i&&i.index<t))return new s(r,t-n);++r,n=i.index+i[0].length}}r.__esModule=!0,r.getLineInfo=i;var a=e(624),s=function u(e,t){n(this,u),this.line=e,this.column=t};r.Position=s;var o=function p(e,t){n(this,p),this.start=e,this.end=t};r.SourceLocation=o},{624:624}],624:[function(e,t,r){"use strict";function n(e){return 10===e||13===e||8232===e||8233===e}r.__esModule=!0,r.isNewLine=n;var i=/\r\n?|\n|\u2028|\u2029/;r.lineBreak=i;var a=new RegExp(i.source,"g");r.lineBreakG=a;var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;r.nonASCIIwhitespace=s},{}]},{},[14])(14)});
examples/immutable-track/app.js
peterox/react-redux-form
import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware, compose } from 'redux'; import { fromJS } from 'immutable'; import { Field, Control, Form, Fieldset, track, combineForms, } from 'react-redux-form/immutable'; const initialUserState = fromJS({ firstName: '', lastName: '', groups: [ { id: 5, name: 'Group A', }, { id: 6, name: 'Group B', }, ], }); const store = createStore( combineForms({ user: initialUserState, }), ); class UserForm extends Component { constructor(props) { super(props); this.state = { groupIndex: 0, groupId: 5, }; } render() { return ( <Form model="user" onSubmit={v => console.log(v.toJS())}> <div className="field"> <label>First name:</label> <Control.text model=".firstName" /> </div> <div className="field"> <label>Last name:</label> <Control.text model=".lastName" /> </div> <div className="field"> <label>Group index</label> <input type="number" value={this.state.groupIndex} onChange={event => this.setState({ groupIndex: event.target.value })} /> </div> <div className="field"> <label>Select Group by ID: </label> <input type="number" value={this.state.groupId} onChange={event => this.setState({ groupId: parseInt(event.target.value, 10) })} /> </div> <Fieldset model={track(`.groups[]`, { id: this.state.groupId })}> <div className="field"> <label>Group: </label> <div> ID: <Control.text model=".id" /> <br /> Name: <Control.text model=".name" /> </div> </div> </Fieldset> <button type="submit"> Submit (check console) </button> </Form> ); } } class App extends React.Component { render() { return ( <Provider store={store}> <UserForm /> </Provider> ); } } ReactDOM.render(<App />, document.getElementById('app'));
node_modules/material-ui/svg-icons/communication/mail-outline.js
lzm854676408/big-demo
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDefault(_SvgIcon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var CommunicationMailOutline = function CommunicationMailOutline(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z' }) ); }; CommunicationMailOutline = (0, _pure2.default)(CommunicationMailOutline); CommunicationMailOutline.displayName = 'CommunicationMailOutline'; CommunicationMailOutline.muiName = 'SvgIcon'; exports.default = CommunicationMailOutline;
program/js/editor.js
jparyani/roundcubemail
/** * Roundcube editor js library * * This file is part of the Roundcube Webmail client * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) 2006-2014, The Roundcube Dev Team * * The JavaScript code in this page is free software: you can * redistribute it and/or modify it under the terms of the GNU * General Public License (GNU GPL) as published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. The code is distributed WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. * * As additional permission under GNU GPL version 3 section 7, you * may distribute non-source (e.g., minimized or compacted) forms of * that code without the copy of the GNU GPL normally required by * section 4, provided you include this license notice and a URL * through which recipients can access the Corresponding Source. * * @licend The above is the entire license notice * for the JavaScript code in this file. * * @author Eric Stadtherr <estadtherr@gmail.com> * @author Aleksander Machniak <alec@alec.pl> */ /** * Roundcube Text Editor Widget class * @constructor */ function rcube_text_editor(config, id) { var ref = this, abs_url = location.href.replace(/[?#].*$/, '').replace(/\/$/, ''), conf = { selector: '#' + ($('#' + id).is('.mce_editor') ? id : 'fake-editor-id'), cache_suffix: 's=4010900', theme: 'modern', language: config.lang, content_css: rcmail.assets_path('program/js/tinymce/roundcube/content.css'), menubar: false, statusbar: false, toolbar_items_size: 'small', extended_valid_elements: 'font[face|size|color|style],span[id|class|align|style]', relative_urls: false, remove_script_host: false, convert_urls: false, // #1486944 image_description: false, paste_webkit_style: "color font-size font-family", paste_data_images: true, browser_spellcheck: true }; // register spellchecker for plain text editor this.spellcheck_observer = function() {}; if (config.spellchecker) { this.spellchecker = config.spellchecker; if (config.spellcheck_observer) { this.spellchecker.spelling_state_observer = this.spellcheck_observer = config.spellcheck_observer; } } // secure spellchecker requests with Roundcube token // Note: must be registered only once (#1490311) if (!tinymce.registered_request_token) { tinymce.registered_request_token = true; tinymce.util.XHR.on('beforeSend', function(e) { e.xhr.setRequestHeader('X-Roundcube-Request', rcmail.env.request_token); }); } // minimal editor if (config.mode == 'identity') { $.extend(conf, { plugins: 'autolink charmap code colorpicker hr image link paste tabfocus textcolor', toolbar: 'bold italic underline alignleft aligncenter alignright alignjustify' + ' | outdent indent charmap hr link unlink image code forecolor' + ' | fontselect fontsizeselect', file_browser_callback: function(name, url, type, win) { ref.file_browser_callback(name, url, type); }, file_browser_callback_types: 'image' }); } // full-featured editor else { $.extend(conf, { plugins: 'autolink charmap code colorpicker directionality emoticons link image media nonbreaking' + ' paste table tabfocus textcolor searchreplace' + (config.spellcheck ? ' spellchecker' : ''), toolbar: 'bold italic underline | alignleft aligncenter alignright alignjustify' + ' | bullist numlist outdent indent ltr rtl blockquote | forecolor backcolor | fontselect fontsizeselect' + ' | link unlink table | emoticons charmap image media | code searchreplace undo redo', spellchecker_rpc_url: abs_url + '/?_task=utils&_action=spell_html&_remote=1', spellchecker_language: rcmail.env.spell_lang, accessibility_focus: false, file_browser_callback: function(name, url, type, win) { ref.file_browser_callback(name, url, type); }, // @todo: support more than image (types: file, image, media) file_browser_callback_types: 'image media' }); } // support external configuration settings e.g. from skin if (window.rcmail_editor_settings) $.extend(conf, window.rcmail_editor_settings); conf.setup = function(ed) { ed.on('init', function(ed) { ref.init_callback(ed); }); // add handler for spellcheck button state update ed.on('SpellcheckStart SpellcheckEnd', function(args) { ref.spellcheck_active = args.type == 'spellcheckstart'; ref.spellcheck_observer(); }); ed.on('keypress', function() { rcmail.compose_type_activity++; }); }; // textarea identifier this.id = id; // reference to active editor (if in HTML mode) this.editor = null; tinymce.init(conf); // react to real individual tinyMCE editor init this.init_callback = function(event) { this.editor = event.target; if (rcmail.env.action != 'compose') { return; } var area = $('#' + this.id), height = $('div.mce-toolbar-grp:first', area.parent()).height(); // the editor might be still not fully loaded, making the editing area // inaccessible, wait and try again (#1490310) if (height > 200 || height > area.height()) { return setTimeout(function () { ref.init_callback(event); }, 300); } var css = {}, elem = rcube_find_object('_from'), fe = rcmail.env.compose_focus_elem; if (rcmail.env.default_font) css['font-family'] = rcmail.env.default_font; if (rcmail.env.default_font_size) css['font-size'] = rcmail.env.default_font_size; if (css['font-family'] || css['font-size']) $(this.editor.getBody()).css(css); if (elem && elem.type == 'select-one') { // insert signature (only for the first time) if (!rcmail.env.identities_initialized) rcmail.change_identity(elem); // Focus previously focused element if (fe && fe.id != this.id) { window.focus(); // for WebKit (#1486674) fe.focus(); rcmail.env.compose_focus_elem = null; } } // set tabIndex and set focus to element that was focused before ref.tabindex(fe && fe.id == ref.id); // Trigger resize (needed for proper editor resizing in some browsers) $(window).resize(); }; // set tabIndex on tinymce editor this.tabindex = function(focus) { if (rcmail.env.task == 'mail' && this.editor) { var textarea = this.editor.getElement(), body = this.editor.getBody(), node = this.editor.getContentAreaContainer().childNodes[0]; if (textarea && node) node.tabIndex = textarea.tabIndex; // find :prev and :next elements to get focus when tabbing away if (textarea.tabIndex > 0) { var x = null, tabfocus_elements = [':prev',':next'], el = tinymce.DOM.select('*[tabindex='+textarea.tabIndex+']:not(iframe)'); tinymce.each(el, function(e, i) { if (e.id == ref.id) { x = i; return false; } }); if (x !== null) { if (el[x-1] && el[x-1].id) { tabfocus_elements[0] = el[x-1].id; } if (el[x+1] && el[x+1].id) { tabfocus_elements[1] = el[x+1].id; } this.editor.settings.tabfocus_elements = tabfocus_elements.join(','); } } // ContentEditable reset fixes invisible cursor issue in Firefox < 25 if (bw.mz && bw.vendver < 25) $(body).prop('contenteditable', false).prop('contenteditable', true); if (focus) body.focus(); } }; // switch html/plain mode this.toggle = function(ishtml, noconvert) { var curr, content, result, // these non-printable chars are not removed on text2html and html2text // we can use them as temp signature replacement sig_mark = "\u0002\u0003", input = $('#' + this.id), signature = rcmail.env.identity ? rcmail.env.signatures[rcmail.env.identity] : null, is_sig = signature && signature.text && signature.text.length > 1; // apply spellcheck changes if spell checker is active this.spellcheck_stop(); if (ishtml) { content = input.val(); // replace current text signature with temp mark if (is_sig) { content = content.replace(/\r\n/, "\n"); content = content.replace(signature.text.replace(/\r\n/, "\n"), sig_mark); } var init_editor = function(data) { // replace signature mark with html version of the signature if (is_sig) data = data.replace(sig_mark, '<div id="_rc_sig">' + signature.html + '</div>'); input.val(data); tinymce.execCommand('mceAddEditor', false, ref.id); if (ref.editor) { var body = $(ref.editor.getBody()); // #1486593 ref.tabindex(true); // put cursor on start of the compose body ref.editor.selection.setCursorLocation(body.children().first().get(0)); } }; // convert to html if (!noconvert) { result = rcmail.plain2html(content, init_editor); } else { init_editor(content); result = true; } } else if (this.editor) { if (is_sig) { // get current version of signature, we'll need it in // case of html2text conversion abort if (curr = this.editor.dom.get('_rc_sig')) curr = curr.innerHTML; // replace current signature with some non-printable characters // we use non-printable characters, because this replacement // is visible to the user // doing this after getContent() would be hard this.editor.dom.setHTML('_rc_sig', sig_mark); } // get html content content = this.editor.getContent(); var init_plaintext = function(data) { tinymce.execCommand('mceRemoveEditor', false, ref.id); ref.editor = null; // replace signture mark with text version of the signature if (is_sig) data = data.replace(sig_mark, "\n" + signature.text); input.val(data).focus(); rcmail.set_caret_pos(input.get(0), 0); }; // convert html to text if (!noconvert) { result = rcmail.html2plain(content, init_plaintext); } else { init_plaintext(input.val()); result = true; } // bring back current signature if (!result && curr) this.editor.dom.setHTML('_rc_sig', curr); } return result; }; // start spellchecker this.spellcheck_start = function() { if (this.editor) { tinymce.execCommand('mceSpellCheck', true); this.spellcheck_observer(); } else if (this.spellchecker && this.spellchecker.spellCheck) { this.spellchecker.spellCheck(); } }; // stop spellchecker this.spellcheck_stop = function() { var ed = this.editor; if (ed) { if (ed.plugins && ed.plugins.spellchecker && this.spellcheck_active) { ed.execCommand('mceSpellCheck', false); this.spellcheck_observer(); } } else if (ed = this.spellchecker) { if (ed.state && ed.state != 'ready' && ed.state != 'no_error_found') $(ed.spell_span).trigger('click'); } }; // spellchecker state this.spellcheck_state = function() { var ed; if (this.editor) return this.spellcheck_active; else if ((ed = this.spellchecker) && ed.state) return ed.state != 'ready' && ed.state != 'no_error_found'; }; // resume spellchecking, highlight provided mispellings without a new ajax request this.spellcheck_resume = function(data) { var ed = this.editor; if (ed) { ed.plugins.spellchecker.markErrors(data); } else if (ed = this.spellchecker) { ed.prepare(false, true); ed.processData(data); } }; // get selected (spellcheker) language this.get_language = function() { if (this.editor) { return this.editor.settings.spellchecker_language || rcmail.env.spell_lang; } else if (this.spellchecker) { return GOOGIE_CUR_LANG; } }; // set language for spellchecking this.set_language = function(lang) { var ed = this.editor; if (ed) { ed.settings.spellchecker_language = lang; } if (ed = this.spellchecker) { ed.setCurrentLanguage(lang); } }; // replace selection with text snippet this.replace = function(text) { var ed = this.editor; // insert into tinymce editor if (ed) { ed.getWin().focus(); // correct focus in IE & Chrome ed.selection.setContent(rcmail.quote_html(text).replace(/\r?\n/g, '<br/>'), { format:'text' }); } // replace selection in compose textarea else if (ed = rcube_find_object(this.id)) { var selection = $(ed).is(':focus') ? rcmail.get_input_selection(ed) : { start:0, end:0 }, inp_value = ed.value; pre = inp_value.substring(0, selection.start), end = inp_value.substring(selection.end, inp_value.length); // insert response text ed.value = pre + text + end; // set caret after inserted text rcmail.set_caret_pos(ed, selection.start + text.length); ed.focus(); } }; // get selected text (if no selection returns all text) from the editor this.get_content = function(args) { var sigstart, ed = this.editor, text = '', strip = false, defaults = {refresh: true, selection: false, nosig: false, format: 'html'}; args = $.extend(defaults, args); // apply spellcheck changes if spell checker is active if (args.refresh) { this.spellcheck_stop(); } // get selected text from tinymce editor if (ed) { ed.getWin().focus(); // correct focus in IE & Chrome if (args.selection) text = ed.selection.getContent({format: args.format}); if (!text) { text = ed.getContent({format: args.format}); // @todo: strip signature in html mode strip = args.format == 'text'; } } // get selected text from compose textarea else if (ed = rcube_find_object(this.id)) { if (args.selection && $(ed).is(':focus')) { text = rcmail.get_input_selection(ed).text; } if (!text) { text = ed.value; strip = true; } } // strip off signature // @todo: make this optional if (strip && args.nosig) { sigstart = text.indexOf('-- \n'); if (sigstart > 0) { text = text.substring(0, sigstart); } } return text; }; // change user signature text this.change_signature = function(id, show_sig) { var position_element, cursor_pos, p = -1, input_message = $('#' + this.id), message = input_message.val(), sig = rcmail.env.identity; if (!this.editor) { // plain text mode // remove the 'old' signature if (show_sig && sig && rcmail.env.signatures && rcmail.env.signatures[sig]) { sig = rcmail.env.signatures[sig].text; sig = sig.replace(/\r\n/g, '\n'); p = rcmail.env.top_posting ? message.indexOf(sig) : message.lastIndexOf(sig); if (p >= 0) message = message.substring(0, p) + message.substring(p+sig.length, message.length); } // add the new signature string if (show_sig && rcmail.env.signatures && rcmail.env.signatures[id]) { sig = rcmail.env.signatures[id].text; sig = sig.replace(/\r\n/g, '\n'); // in place of removed signature if (p >= 0) { message = message.substring(0, p) + sig + message.substring(p, message.length); cursor_pos = p - 1; } // empty message else if (!message) { message = '\n\n' + sig; cursor_pos = 0; } else if (rcmail.env.top_posting && !rcmail.env.sig_below) { // at cursor position if (pos = rcmail.get_caret_pos(input_message.get(0))) { message = message.substring(0, pos) + '\n' + sig + '\n\n' + message.substring(pos, message.length); cursor_pos = pos; } // on top else { message = '\n\n' + sig + '\n\n' + message.replace(/^[\r\n]+/, ''); cursor_pos = 0; } } else { message = message.replace(/[\r\n]+$/, ''); cursor_pos = !rcmail.env.top_posting && message.length ? message.length + 1 : 0; message += '\n\n' + sig; } } else { cursor_pos = rcmail.env.top_posting ? 0 : message.length; } input_message.val(message); // move cursor before the signature rcmail.set_caret_pos(input_message.get(0), cursor_pos); } else if (show_sig && rcmail.env.signatures) { // html var sigElem = this.editor.dom.get('_rc_sig'); // Append the signature as a div within the body if (!sigElem) { var body = this.editor.getBody(), doc = this.editor.getDoc(); sigElem = doc.createElement('div'); sigElem.setAttribute('id', '_rc_sig'); if (rcmail.env.top_posting && !rcmail.env.sig_below) { this.editor.getWin().focus(); // correct focus in IE & Chrome var node = this.editor.selection.getNode(); // insert at start or at cursor position if found body.insertBefore(sigElem, node.nodeName == 'BODY' ? body.firstChild : node.nextSibling); body.insertBefore(doc.createElement('p'), sigElem); } else { body.appendChild(sigElem); position_element = rcmail.env.top_posting ? body.firstChild : $(sigElem).prev(); } } if (rcmail.env.signatures[id]) { sigElem.innerHTML = rcmail.env.signatures[id].html; } } else if (!rcmail.env.top_posting) { position_element = $(this.editor.getBody()).children().last(); } // put cursor before signature and scroll the window if (this.editor && position_element && position_element.length) { this.editor.selection.setCursorLocation(position_element.get(0)); this.editor.getWin().scroll(0, position_element.offset().top); } }; // trigger content save this.save = function() { if (this.editor) { this.editor.save(); } }; // focus the editing area this.focus = function() { (this.editor || rcube_find_object(this.id)).focus(); }; // image selector this.file_browser_callback = function(field_name, url, type) { var i, elem, cancel, dialog, fn, list = []; // open image selector dialog dialog = this.editor.windowManager.open({ title: rcmail.gettext('select' + type), width: 500, height: 300, html: '<div id="image-selector-list"><ul></ul></div>' + '<div id="image-selector-form"><div id="image-upload-button" class="mce-widget mce-btn" role="button" tabindex="0"></div></div>', buttons: [{text: 'Cancel', onclick: function() { ref.file_browser_close(); }}] }); rcmail.env.file_browser_field = field_name; rcmail.env.file_browser_type = type; // fill images list with available images for (i in rcmail.env.attachments) { if (elem = ref.file_browser_entry(i, rcmail.env.attachments[i])) { list.push(elem); } } if (list.length) { $('#image-selector-list > ul').append(list).find('li:first').focus(); } // add hint about max file size (in dialog footer) $('div.mce-abs-end', dialog.getEl()).append($('<div class="hint">') .text($('div.hint', rcmail.gui_objects.uploadform).text())); // init upload button elem = $('#image-upload-button').append($('<span>').text(rcmail.gettext('add' + type))); cancel = elem.parents('.mce-panel').find('button:last').parent(); // we need custom Tab key handlers, until we find out why // tabindex do not work here as expected elem.keydown(function(e) { if (e.which == 9) { // on Tab + Shift focus first file if (rcube_event.get_modifier(e) == SHIFT_KEY) $('#image-selector-list li:last').focus(); // on Tab focus Cancel button else cancel.focus(); return false; } }); cancel.keydown(function(e) { if (e.which == 9) { // on Tab + Shift focus upload button if (rcube_event.get_modifier(e) == SHIFT_KEY) elem.focus(); else $('#image-selector-list li:first').focus(); return false; } }); // enable (smart) upload button this.hack_file_input(elem, rcmail.gui_objects.uploadform); // enable drag-n-drop area if ((window.XMLHttpRequest && XMLHttpRequest.prototype && XMLHttpRequest.prototype.sendAsBinary) || window.FormData) { if (!rcmail.env.filedrop) { rcmail.env.filedrop = {}; } if (rcmail.gui_objects.filedrop) { rcmail.env.old_file_drop = rcmail.gui_objects.filedrop; } rcmail.gui_objects.filedrop = $('#image-selector-form'); rcmail.gui_objects.filedrop.addClass('droptarget') .bind('dragover dragleave', function(e) { e.preventDefault(); e.stopPropagation(); $(this)[(e.type == 'dragover' ? 'addClass' : 'removeClass')]('hover'); }) .get(0).addEventListener('drop', function(e) { return rcmail.file_dropped(e); }, false); } // register handler for successful file upload if (!rcmail.env.file_dialog_event) { rcmail.env.file_dialog_event = true; rcmail.addEventListener('fileuploaded', function(attr) { var elem; if (elem = ref.file_browser_entry(attr.name, attr.attachment)) { $('#image-selector-list > ul').prepend(elem); elem.focus(); } }); } // @todo: upload progress indicator }; // close file browser window this.file_browser_close = function(url) { var input = $('#' + rcmail.env.file_browser_field); if (url) input.val(url); this.editor.windowManager.close(); input.focus(); if (rcmail.env.old_file_drop) rcmail.gui_objects.filedrop = rcmail.env.old_file_drop; }; // creates file browser entry this.file_browser_entry = function(file_id, file) { if (!file.complete || !file.mimetype) { return; } if (rcmail.file_upload_id) { rcmail.set_busy(false, null, rcmail.file_upload_id); } var rx, img_src; switch (rcmail.env.file_browser_type) { case 'image': rx = /^image\//i; break; case 'media': rx = /^video\//i; img_src = 'program/js/tinymce/roundcube/video.png'; break; default: return; } if (rx.test(file.mimetype)) { var path = rcmail.env.comm_path + '&_from=' + rcmail.env.action, action = rcmail.env.compose_id ? '&_id=' + rcmail.env.compose_id + '&_action=display-attachment' : '&_action=upload-display', href = path + action + '&_file=' + file_id, img = $('<img>').attr({title: file.name, src: img_src ? img_src : href + '&_thumbnail=1'}); return $('<li>').attr({tabindex: 0}) .data('url', href) .append($('<span class="img">').append(img)) .append($('<span class="name">').text(file.name)) .click(function() { ref.file_browser_close($(this).data('url')); }) .keydown(function(e) { if (e.which == 13) { ref.file_browser_close($(this).data('url')); } // we need custom Tab key handlers, until we find out why // tabindex do not work here as expected else if (e.which == 9) { if (rcube_event.get_modifier(e) == SHIFT_KEY) { if (!$(this).prev().focus().length) $('#image-upload-button').parents('.mce-panel').find('button:last').parent().focus(); } else { if (!$(this).next().focus().length) $('#image-upload-button').focus(); } return false; } }); } }; // create smart files upload button this.hack_file_input = function(elem, clone_form) { var link = $(elem), file = $('<input>').attr('name', '_file[]'), form = $('<form>').attr({method: 'post', enctype: 'multipart/form-data'}), offset = link.offset(); // clone existing upload form if (clone_form) { file.attr('name', $('input[type="file"]', clone_form).attr('name')); form.attr('action', $(clone_form).attr('action')) .append($('<input>').attr({type: 'hidden', name: '_token', value: rcmail.env.request_token})); } function move_file_input(e) { file.css({top: (e.pageY - offset.top - 10) + 'px', left: (e.pageX - offset.left - 10) + 'px'}); } file.attr({type: 'file', multiple: 'multiple', size: 5, title: '', tabindex: -1}) .change(function() { rcmail.upload_file(form, 'upload'); }) .click(function() { setTimeout(function() { link.mouseleave(); }, 20); }) // opacity:0 does the trick, display/visibility doesn't work .css({opacity: 0, cursor: 'pointer', position: 'relative', outline: 'none'}) .appendTo(form); // In FF and IE we need to move the browser file-input's button under the cursor // Thanks to the size attribute above we know the length of the input field if (navigator.userAgent.match(/Firefox|MSIE/)) file.css({marginLeft: '-80px'}); // Note: now, I observe problem with cursor style on FF < 4 only link.css({overflow: 'hidden', cursor: 'pointer'}) .mouseenter(function() { this.__active = true; }) // place button under the cursor .mousemove(function(e) { if (this.__active) move_file_input(e); // move the input away if button is disabled else $(this).mouseleave(); }) .mouseleave(function() { file.css({top: '-10000px', left: '-10000px'}); this.__active = false; }) .click(function(e) { // forward click if mouse-enter event was missed if (!this.__active) { this.__active = true; move_file_input(e); file.trigger(e); } }) .keydown(function(e) { if (e.which == 13) file.trigger('click'); }) .mouseleave() .append(form); }; }
SSBW/Tareas/Tarea9/restaurantes2/node_modules/react-bootstrap/es/MediaHeading.js
jmanday/Master
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { componentClass: elementType }; var defaultProps = { componentClass: 'h4' }; var MediaHeading = function (_React$Component) { _inherits(MediaHeading, _React$Component); function MediaHeading() { _classCallCheck(this, MediaHeading); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } MediaHeading.prototype.render = function render() { var _props = this.props, Component = _props.componentClass, className = _props.className, props = _objectWithoutProperties(_props, ['componentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) })); }; return MediaHeading; }(React.Component); MediaHeading.propTypes = propTypes; MediaHeading.defaultProps = defaultProps; export default bsClass('media-heading', MediaHeading);
ajax/libs/yui/3.10.3/event-custom-base/event-custom-base-debug.js
jamesarosen/cdnjs
YUI.add('event-custom-base', function (Y, NAME) { /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom */ Y.Env.evt = { handles: {}, plugins: {} }; /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ /** * Allows for the insertion of methods that are executed before or after * a specified method * @class Do * @static */ var DO_BEFORE = 0, DO_AFTER = 1, DO = { /** * Cache of objects touched by the utility * @property objs * @static * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object * replaces the role of this property, but is considered to be private, and * is only mentioned to provide a migration path. * * If you have a use case which warrants migration to the _yuiaop property, * please file a ticket to let us know what it's used for and we can see if * we need to expose hooks for that functionality more formally. */ objs: null, /** * <p>Execute the supplied method before the specified function. Wrapping * function may optionally return an instance of the following classes to * further alter runtime behavior:</p> * <dl> * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> * <dd>Immediatly stop execution and return * <code>returnValue</code>. No other wrapping functions will be * executed.</dd> * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt> * <dd>Replace the arguments that the original function will be * called with.</dd> * <dt></code>Y.Do.Prevent(message)</code></dt> * <dd>Don't execute the wrapped function. Other before phase * wrappers will be executed.</dd> * </dl> * * @method before * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @param arg* {mixed} 0..n additional arguments to supply to the subscriber * when the event fires. * @return {string} handle for the subscription * @static */ before: function(fn, obj, sFn, c) { // Y.log('Do before: ' + sFn, 'info', 'event'); var f = fn, a; if (c) { a = [fn, c].concat(Y.Array(arguments, 4, true)); f = Y.rbind.apply(Y, a); } return this._inject(DO_BEFORE, f, obj, sFn); }, /** * <p>Execute the supplied method after the specified function. Wrapping * function may optionally return an instance of the following classes to * further alter runtime behavior:</p> * <dl> * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> * <dd>Immediatly stop execution and return * <code>returnValue</code>. No other wrapping functions will be * executed.</dd> * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt> * <dd>Return <code>returnValue</code> instead of the wrapped * method's original return value. This can be further altered by * other after phase wrappers.</dd> * </dl> * * <p>The static properties <code>Y.Do.originalRetVal</code> and * <code>Y.Do.currentRetVal</code> will be populated for reference.</p> * * @method after * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @param arg* {mixed} 0..n additional arguments to supply to the subscriber * @return {string} handle for the subscription * @static */ after: function(fn, obj, sFn, c) { var f = fn, a; if (c) { a = [fn, c].concat(Y.Array(arguments, 4, true)); f = Y.rbind.apply(Y, a); } return this._inject(DO_AFTER, f, obj, sFn); }, /** * Execute the supplied method before or after the specified function. * Used by <code>before</code> and <code>after</code>. * * @method _inject * @param when {string} before or after * @param fn {Function} the function to execute * @param obj the object hosting the method to displace * @param sFn {string} the name of the method to displace * @param c The execution context for fn * @return {string} handle for the subscription * @private * @static */ _inject: function(when, fn, obj, sFn) { // object id var id = Y.stamp(obj), o, sid; if (!obj._yuiaop) { // create a map entry for the obj if it doesn't exist, to hold overridden methods obj._yuiaop = {}; } o = obj._yuiaop; if (!o[sFn]) { // create a map entry for the method if it doesn't exist o[sFn] = new Y.Do.Method(obj, sFn); // re-route the method to our wrapper obj[sFn] = function() { return o[sFn].exec.apply(o[sFn], arguments); }; } // subscriber id sid = id + Y.stamp(fn) + sFn; // register the callback o[sFn].register(sid, fn, when); return new Y.EventHandle(o[sFn], sid); }, /** * Detach a before or after subscription. * * @method detach * @param handle {string} the subscription handle * @static */ detach: function(handle) { if (handle.detach) { handle.detach(); } } }; Y.Do = DO; ////////////////////////////////////////////////////////////////////////// /** * Contains the return value from the wrapped method, accessible * by 'after' event listeners. * * @property originalRetVal * @static * @since 3.2.0 */ /** * Contains the current state of the return value, consumable by * 'after' event listeners, and updated if an after subscriber * changes the return value generated by the wrapped function. * * @property currentRetVal * @static * @since 3.2.0 */ ////////////////////////////////////////////////////////////////////////// /** * Wrapper for a displaced method with aop enabled * @class Do.Method * @constructor * @param obj The object to operate on * @param sFn The name of the method to displace */ DO.Method = function(obj, sFn) { this.obj = obj; this.methodName = sFn; this.method = obj[sFn]; this.before = {}; this.after = {}; }; /** * Register a aop subscriber * @method register * @param sid {string} the subscriber id * @param fn {Function} the function to execute * @param when {string} when to execute the function */ DO.Method.prototype.register = function (sid, fn, when) { if (when) { this.after[sid] = fn; } else { this.before[sid] = fn; } }; /** * Unregister a aop subscriber * @method delete * @param sid {string} the subscriber id * @param fn {Function} the function to execute * @param when {string} when to execute the function */ DO.Method.prototype._delete = function (sid) { // Y.log('Y.Do._delete: ' + sid, 'info', 'Event'); delete this.before[sid]; delete this.after[sid]; }; /** * <p>Execute the wrapped method. All arguments are passed into the wrapping * functions. If any of the before wrappers return an instance of * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped * function nor any after phase subscribers will be executed.</p> * * <p>The return value will be the return value of the wrapped function or one * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or * <code>Y.Do.AlterReturn</code>. * * @method exec * @param arg* {any} Arguments are passed to the wrapping and wrapped functions * @return {any} Return value of wrapped function unless overwritten (see above) */ DO.Method.prototype.exec = function () { var args = Y.Array(arguments, 0, true), i, ret, newRet, bf = this.before, af = this.after, prevented = false; // execute before for (i in bf) { if (bf.hasOwnProperty(i)) { ret = bf[i].apply(this.obj, args); if (ret) { switch (ret.constructor) { case DO.Halt: return ret.retVal; case DO.AlterArgs: args = ret.newArgs; break; case DO.Prevent: prevented = true; break; default: } } } } // execute method if (!prevented) { ret = this.method.apply(this.obj, args); } DO.originalRetVal = ret; DO.currentRetVal = ret; // execute after methods. for (i in af) { if (af.hasOwnProperty(i)) { newRet = af[i].apply(this.obj, args); // Stop processing if a Halt object is returned if (newRet && newRet.constructor === DO.Halt) { return newRet.retVal; // Check for a new return value } else if (newRet && newRet.constructor === DO.AlterReturn) { ret = newRet.newRetVal; // Update the static retval state DO.currentRetVal = ret; } } } return ret; }; ////////////////////////////////////////////////////////////////////////// /** * Return an AlterArgs object when you want to change the arguments that * were passed into the function. Useful for Do.before subscribers. An * example would be a service that scrubs out illegal characters prior to * executing the core business logic. * @class Do.AlterArgs * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param newArgs {Array} Call parameters to be used for the original method * instead of the arguments originally passed in. */ DO.AlterArgs = function(msg, newArgs) { this.msg = msg; this.newArgs = newArgs; }; /** * Return an AlterReturn object when you want to change the result returned * from the core method to the caller. Useful for Do.after subscribers. * @class Do.AlterReturn * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param newRetVal {any} Return value passed to code that invoked the wrapped * function. */ DO.AlterReturn = function(msg, newRetVal) { this.msg = msg; this.newRetVal = newRetVal; }; /** * Return a Halt object when you want to terminate the execution * of all subsequent subscribers as well as the wrapped method * if it has not exectued yet. Useful for Do.before subscribers. * @class Do.Halt * @constructor * @param msg {String} (optional) Explanation of why the termination was done * @param retVal {any} Return value passed to code that invoked the wrapped * function. */ DO.Halt = function(msg, retVal) { this.msg = msg; this.retVal = retVal; }; /** * Return a Prevent object when you want to prevent the wrapped function * from executing, but want the remaining listeners to execute. Useful * for Do.before subscribers. * @class Do.Prevent * @constructor * @param msg {String} (optional) Explanation of why the termination was done */ DO.Prevent = function(msg) { this.msg = msg; }; /** * Return an Error object when you want to terminate the execution * of all subsequent method calls. * @class Do.Error * @constructor * @param msg {String} (optional) Explanation of the altered return value * @param retVal {any} Return value passed to code that invoked the wrapped * function. * @deprecated use Y.Do.Halt or Y.Do.Prevent */ DO.Error = DO.Halt; ////////////////////////////////////////////////////////////////////////// /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ // var onsubscribeType = "_event:onsub", var YArray = Y.Array, AFTER = 'after', CONFIGS = [ 'broadcast', 'monitored', 'bubbles', 'context', 'contextFn', 'currentTarget', 'defaultFn', 'defaultTargetOnly', 'details', 'emitFacade', 'fireOnce', 'async', 'host', 'preventable', 'preventedFn', 'queuable', 'silent', 'stoppedFn', 'target', 'type' ], CONFIGS_HASH = YArray.hash(CONFIGS), nativeSlice = Array.prototype.slice, YUI3_SIGNATURE = 9, YUI_LOG = 'yui:log', mixConfigs = function(r, s, ov) { var p; for (p in s) { if (CONFIGS_HASH[p] && (ov || !(p in r))) { r[p] = s[p]; } } return r; }; /** * The CustomEvent class lets you define events for your application * that can be subscribed to by one or more independent component. * * @param {String} type The type of event, which is passed to the callback * when the event fires. * @param {object} defaults configuration object. * @class CustomEvent * @constructor */ /** * The type of event, returned to subscribers when the event fires * @property type * @type string */ /** * By default all custom events are logged in the debug build, set silent * to true to disable debug outpu for this event. * @property silent * @type boolean */ Y.CustomEvent = function(type, defaults) { this._kds = Y.CustomEvent.keepDeprecatedSubs; this.id = Y.guid(); this.type = type; this.silent = this.logSystem = (type === YUI_LOG); if (this._kds) { /** * The subscribers to this event * @property subscribers * @type Subscriber {} * @deprecated */ /** * 'After' subscribers * @property afters * @type Subscriber {} * @deprecated */ this.subscribers = {}; this.afters = {}; } if (defaults) { mixConfigs(this, defaults, true); } }; /** * Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a> * and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance. * * These properties were changed to private properties (`_subscribers` and `_afters`), and * converted from objects to arrays for performance reasons. * * Setting this property to true will populate the deprecated `subscribers` and `afters` * properties for people who may be using them (which is expected to be rare). There will * be a performance hit, compared to the new array based implementation. * * If you are using these deprecated properties for a use case which the public API * does not support, please file an enhancement request, and we can provide an alternate * public implementation which doesn't have the performance cost required to maintiain the * properties as objects. * * @property keepDeprecatedSubs * @static * @for CustomEvent * @type boolean * @default false * @deprecated */ Y.CustomEvent.keepDeprecatedSubs = false; Y.CustomEvent.mixConfigs = mixConfigs; Y.CustomEvent.prototype = { constructor: Y.CustomEvent, /** * Monitor when an event is attached or detached. * * @property monitored * @type boolean */ /** * If 0, this event does not broadcast. If 1, the YUI instance is notified * every time this event fires. If 2, the YUI instance and the YUI global * (if event is enabled on the global) are notified every time this event * fires. * @property broadcast * @type int */ /** * Specifies whether this event should be queued when the host is actively * processing an event. This will effect exectution order of the callbacks * for the various events. * @property queuable * @type boolean * @default false */ /** * This event has fired if true * * @property fired * @type boolean * @default false; */ /** * An array containing the arguments the custom event * was last fired with. * @property firedWith * @type Array */ /** * This event should only fire one time if true, and if * it has fired, any new subscribers should be notified * immediately. * * @property fireOnce * @type boolean * @default false; */ /** * fireOnce listeners will fire syncronously unless async * is set to true * @property async * @type boolean * @default false */ /** * Flag for stopPropagation that is modified during fire() * 1 means to stop propagation to bubble targets. 2 means * to also stop additional subscribers on this target. * @property stopped * @type int */ /** * Flag for preventDefault that is modified during fire(). * if it is not 0, the default behavior for this event * @property prevented * @type int */ /** * Specifies the host for this custom event. This is used * to enable event bubbling * @property host * @type EventTarget */ /** * The default function to execute after event listeners * have fire, but only if the default action was not * prevented. * @property defaultFn * @type Function */ /** * The function to execute if a subscriber calls * stopPropagation or stopImmediatePropagation * @property stoppedFn * @type Function */ /** * The function to execute if a subscriber calls * preventDefault * @property preventedFn * @type Function */ /** * The subscribers to this event * @property _subscribers * @type Subscriber [] * @private */ /** * 'After' subscribers * @property _afters * @type Subscriber [] * @private */ /** * If set to true, the custom event will deliver an EventFacade object * that is similar to a DOM event object. * @property emitFacade * @type boolean * @default false */ /** * Supports multiple options for listener signatures in order to * port YUI 2 apps. * @property signature * @type int * @default 9 */ signature : YUI3_SIGNATURE, /** * The context the the event will fire from by default. Defaults to the YUI * instance. * @property context * @type object */ context : Y, /** * Specifies whether or not this event's default function * can be cancelled by a subscriber by executing preventDefault() * on the event facade * @property preventable * @type boolean * @default true */ preventable : true, /** * Specifies whether or not a subscriber can stop the event propagation * via stopPropagation(), stopImmediatePropagation(), or halt() * * Events can only bubble if emitFacade is true. * * @property bubbles * @type boolean * @default true */ bubbles : true, /** * Returns the number of subscribers for this event as the sum of the on() * subscribers and after() subscribers. * * @method hasSubs * @return Number */ hasSubs: function(when) { var s = 0, a = 0, subs = this._subscribers, afters = this._afters, sib = this.sibling; if (subs) { s = subs.length; } if (afters) { a = afters.length; } if (sib) { subs = sib._subscribers; afters = sib._afters; if (subs) { s += subs.length; } if (afters) { a += afters.length; } } if (when) { return (when === 'after') ? a : s; } return (s + a); }, /** * Monitor the event state for the subscribed event. The first parameter * is what should be monitored, the rest are the normal parameters when * subscribing to an event. * @method monitor * @param what {string} what to monitor ('detach', 'attach', 'publish'). * @return {EventHandle} return value from the monitor event subscription. */ monitor: function(what) { this.monitored = true; var type = this.id + '|' + this.type + '_' + what, args = nativeSlice.call(arguments, 0); args[0] = type; return this.host.on.apply(this.host, args); }, /** * Get all of the subscribers to this event and any sibling event * @method getSubs * @return {Array} first item is the on subscribers, second the after. */ getSubs: function() { var sibling = this.sibling, subs = this._subscribers, afters = this._afters, siblingSubs, siblingAfters; if (sibling) { siblingSubs = sibling._subscribers; siblingAfters = sibling._afters; } if (siblingSubs) { if (subs) { subs = subs.concat(siblingSubs); } else { subs = siblingSubs.concat(); } } else { if (subs) { subs = subs.concat(); } else { subs = []; } } if (siblingAfters) { if (afters) { afters = afters.concat(siblingAfters); } else { afters = siblingAfters.concat(); } } else { if (afters) { afters = afters.concat(); } else { afters = []; } } return [subs, afters]; }, /** * Apply configuration properties. Only applies the CONFIG whitelist * @method applyConfig * @param o hash of properties to apply. * @param force {boolean} if true, properties that exist on the event * will be overwritten. */ applyConfig: function(o, force) { mixConfigs(this, o, force); }, /** * Create the Subscription for subscribing function, context, and bound * arguments. If this is a fireOnce event, the subscriber is immediately * notified. * * @method _on * @param fn {Function} Subscription callback * @param [context] {Object} Override `this` in the callback * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire() * @param [when] {String} "after" to slot into after subscribers * @return {EventHandle} * @protected */ _on: function(fn, context, args, when) { if (!fn) { this.log('Invalid callback for CE: ' + this.type); } var s = new Y.Subscriber(fn, context, args, when); if (this.fireOnce && this.fired) { if (this.async) { setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0); } else { this._notify(s, this.firedWith); } } if (when === AFTER) { if (!this._afters) { this._afters = []; this._hasAfters = true; } this._afters.push(s); } else { if (!this._subscribers) { this._subscribers = []; this._hasSubs = true; } this._subscribers.push(s); } if (this._kds) { if (when === AFTER) { this.afters[s.id] = s; } else { this.subscribers[s.id] = s; } } return new Y.EventHandle(this, s); }, /** * Listen for this event * @method subscribe * @param {Function} fn The function to execute. * @return {EventHandle} Unsubscribe handle. * @deprecated use on. */ subscribe: function(fn, context) { Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated'); var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; return this._on(fn, context, a, true); }, /** * Listen for this event * @method on * @param {Function} fn The function to execute. * @param {object} context optional execution context. * @param {mixed} arg* 0..n additional arguments to supply to the subscriber * when the event fires. * @return {EventHandle} An object with a detach method to detch the handler(s). */ on: function(fn, context) { var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; if (this.monitored && this.host) { this.host._monitor('attach', this, { args: arguments }); } return this._on(fn, context, a, true); }, /** * Listen for this event after the normal subscribers have been notified and * the default behavior has been applied. If a normal subscriber prevents the * default behavior, it also prevents after listeners from firing. * @method after * @param {Function} fn The function to execute. * @param {object} context optional execution context. * @param {mixed} arg* 0..n additional arguments to supply to the subscriber * when the event fires. * @return {EventHandle} handle Unsubscribe handle. */ after: function(fn, context) { var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; return this._on(fn, context, a, AFTER); }, /** * Detach listeners. * @method detach * @param {Function} fn The subscribed function to remove, if not supplied * all will be removed. * @param {Object} context The context object passed to subscribe. * @return {int} returns the number of subscribers unsubscribed. */ detach: function(fn, context) { // unsubscribe handle if (fn && fn.detach) { return fn.detach(); } var i, s, found = 0, subs = this._subscribers, afters = this._afters; if (subs) { for (i = subs.length; i >= 0; i--) { s = subs[i]; if (s && (!fn || fn === s.fn)) { this._delete(s, subs, i); found++; } } } if (afters) { for (i = afters.length; i >= 0; i--) { s = afters[i]; if (s && (!fn || fn === s.fn)) { this._delete(s, afters, i); found++; } } } return found; }, /** * Detach listeners. * @method unsubscribe * @param {Function} fn The subscribed function to remove, if not supplied * all will be removed. * @param {Object} context The context object passed to subscribe. * @return {int|undefined} returns the number of subscribers unsubscribed. * @deprecated use detach. */ unsubscribe: function() { return this.detach.apply(this, arguments); }, /** * Notify a single subscriber * @method _notify * @param {Subscriber} s the subscriber. * @param {Array} args the arguments array to apply to the listener. * @protected */ _notify: function(s, args, ef) { this.log(this.type + '->' + 'sub: ' + s.id); var ret; ret = s.notify(args, this); if (false === ret || this.stopped > 1) { this.log(this.type + ' cancelled by subscriber'); return false; } return true; }, /** * Logger abstraction to centralize the application of the silent flag * @method log * @param {string} msg message to log. * @param {string} cat log category. */ log: function(msg, cat) { if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); } }, /** * Notifies the subscribers. The callback functions will be executed * from the context specified when the event was created, and with the * following parameters: * <ul> * <li>The type of event</li> * <li>All of the arguments fire() was executed with as an array</li> * <li>The custom object (if any) that was passed into the subscribe() * method</li> * </ul> * @method fire * @param {Object*} arguments an arbitrary set of parameters to pass to * the handler. * @return {boolean} false if one of the subscribers returned false, * true otherwise. * */ fire: function() { // push is the fastest way to go from arguments to arrays // for most browsers currently // http://jsperf.com/push-vs-concat-vs-slice/2 var args = []; args.push.apply(args, arguments); return this._fire(args); }, /** * Private internal implementation for `fire`, which is can be used directly by * `EventTarget` and other event module classes which have already converted from * an `arguments` list to an array, to avoid the repeated overhead. * * @method _fire * @private * @param {Array} args The array of arguments passed to be passed to handlers. * @return {boolean} false if one of the subscribers returned false, true otherwise. */ _fire: function(args) { if (this.fireOnce && this.fired) { this.log('fireOnce event: ' + this.type + ' already fired'); return true; } else { // this doesn't happen if the event isn't published // this.host._monitor('fire', this.type, args); this.fired = true; if (this.fireOnce) { this.firedWith = args; } if (this.emitFacade) { return this.fireComplex(args); } else { return this.fireSimple(args); } } }, /** * Set up for notifying subscribers of non-emitFacade events. * * @method fireSimple * @param args {Array} Arguments passed to fire() * @return Boolean false if a subscriber returned false * @protected */ fireSimple: function(args) { this.stopped = 0; this.prevented = 0; if (this.hasSubs()) { var subs = this.getSubs(); this._procSubs(subs[0], args); this._procSubs(subs[1], args); } if (this.broadcast) { this._broadcast(args); } return this.stopped ? false : true; }, // Requires the event-custom-complex module for full funcitonality. fireComplex: function(args) { this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type); args[0] = args[0] || {}; return this.fireSimple(args); }, /** * Notifies a list of subscribers. * * @method _procSubs * @param subs {Array} List of subscribers * @param args {Array} Arguments passed to fire() * @param ef {} * @return Boolean false if a subscriber returns false or stops the event * propagation via e.stopPropagation(), * e.stopImmediatePropagation(), or e.halt() * @private */ _procSubs: function(subs, args, ef) { var s, i, l; for (i = 0, l = subs.length; i < l; i++) { s = subs[i]; if (s && s.fn) { if (false === this._notify(s, args, ef)) { this.stopped = 2; } if (this.stopped === 2) { return false; } } } return true; }, /** * Notifies the YUI instance if the event is configured with broadcast = 1, * and both the YUI instance and Y.Global if configured with broadcast = 2. * * @method _broadcast * @param args {Array} Arguments sent to fire() * @private */ _broadcast: function(args) { if (!this.stopped && this.broadcast) { var a = args.concat(); a.unshift(this.type); if (this.host !== Y) { Y.fire.apply(Y, a); } if (this.broadcast === 2) { Y.Global.fire.apply(Y.Global, a); } } }, /** * Removes all listeners * @method unsubscribeAll * @return {int} The number of listeners unsubscribed. * @deprecated use detachAll. */ unsubscribeAll: function() { return this.detachAll.apply(this, arguments); }, /** * Removes all listeners * @method detachAll * @return {int} The number of listeners unsubscribed. */ detachAll: function() { return this.detach(); }, /** * Deletes the subscriber from the internal store of on() and after() * subscribers. * * @method _delete * @param s subscriber object. * @param subs (optional) on or after subscriber array * @param index (optional) The index found. * @private */ _delete: function(s, subs, i) { var when = s._when; if (!subs) { subs = (when === AFTER) ? this._afters : this._subscribers; } if (subs) { i = YArray.indexOf(subs, s, 0); if (s && subs[i] === s) { subs.splice(i, 1); if (subs.length === 0) { if (when === AFTER) { this._hasAfters = false; } else { this._hasSubs = false; } } } } if (this._kds) { if (when === AFTER) { delete this.afters[s.id]; } else { delete this.subscribers[s.id]; } } if (this.monitored && this.host) { this.host._monitor('detach', this, { ce: this, sub: s }); } if (s) { s.deleted = true; } } }; /** * Stores the subscriber information to be used when the event fires. * @param {Function} fn The wrapped function to execute. * @param {Object} context The value of the keyword 'this' in the listener. * @param {Array} args* 0..n additional arguments to supply the listener. * * @class Subscriber * @constructor */ Y.Subscriber = function(fn, context, args, when) { /** * The callback that will be execute when the event fires * This is wrapped by Y.rbind if obj was supplied. * @property fn * @type Function */ this.fn = fn; /** * Optional 'this' keyword for the listener * @property context * @type Object */ this.context = context; /** * Unique subscriber id * @property id * @type String */ this.id = Y.guid(); /** * Additional arguments to propagate to the subscriber * @property args * @type Array */ this.args = args; this._when = when; /** * Custom events for a given fire transaction. * @property events * @type {EventTarget} */ // this.events = null; /** * This listener only reacts to the event once * @property once */ // this.once = false; }; Y.Subscriber.prototype = { constructor: Y.Subscriber, _notify: function(c, args, ce) { if (this.deleted && !this.postponed) { if (this.postponed) { delete this.fn; delete this.context; } else { delete this.postponed; return null; } } var a = this.args, ret; switch (ce.signature) { case 0: ret = this.fn.call(c, ce.type, args, c); break; case 1: ret = this.fn.call(c, args[0] || null, c); break; default: if (a || args) { args = args || []; a = (a) ? args.concat(a) : args; ret = this.fn.apply(c, a); } else { ret = this.fn.call(c); } } if (this.once) { ce._delete(this); } return ret; }, /** * Executes the subscriber. * @method notify * @param args {Array} Arguments array for the subscriber. * @param ce {CustomEvent} The custom event that sent the notification. */ notify: function(args, ce) { var c = this.context, ret = true; if (!c) { c = (ce.contextFn) ? ce.contextFn() : ce.context; } // only catch errors if we will not re-throw them. if (Y.config && Y.config.throwFail) { ret = this._notify(c, args, ce); } else { try { ret = this._notify(c, args, ce); } catch (e) { Y.error(this + ' failed: ' + e.message, e); } } return ret; }, /** * Returns true if the fn and obj match this objects properties. * Used by the unsubscribe method to match the right subscriber. * * @method contains * @param {Function} fn the function to execute. * @param {Object} context optional 'this' keyword for the listener. * @return {boolean} true if the supplied arguments match this * subscriber's signature. */ contains: function(fn, context) { if (context) { return ((this.fn === fn) && this.context === context); } else { return (this.fn === fn); } }, valueOf : function() { return this.id; } }; /** * Return value from all subscribe operations * @class EventHandle * @constructor * @param {CustomEvent} evt the custom event. * @param {Subscriber} sub the subscriber. */ Y.EventHandle = function(evt, sub) { /** * The custom event * * @property evt * @type CustomEvent */ this.evt = evt; /** * The subscriber object * * @property sub * @type Subscriber */ this.sub = sub; }; Y.EventHandle.prototype = { batch: function(f, c) { f.call(c || this, this); if (Y.Lang.isArray(this.evt)) { Y.Array.each(this.evt, function(h) { h.batch.call(c || h, f); }); } }, /** * Detaches this subscriber * @method detach * @return {int} the number of detached listeners */ detach: function() { var evt = this.evt, detached = 0, i; if (evt) { // Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event'); if (Y.Lang.isArray(evt)) { for (i = 0; i < evt.length; i++) { detached += evt[i].detach(); } } else { evt._delete(this.sub); detached = 1; } } return detached; }, /** * Monitor the event state for the subscribed event. The first parameter * is what should be monitored, the rest are the normal parameters when * subscribing to an event. * @method monitor * @param what {string} what to monitor ('attach', 'detach', 'publish'). * @return {EventHandle} return value from the monitor event subscription. */ monitor: function(what) { return this.evt.monitor.apply(this.evt, arguments); } }; /** * Custom event engine, DOM event listener abstraction layer, synthetic DOM * events. * @module event-custom * @submodule event-custom-base */ /** * EventTarget provides the implementation for any object to * publish, subscribe and fire to custom events, and also * alows other EventTargets to target the object with events * sourced from the other object. * EventTarget is designed to be used with Y.augment to wrap * EventCustom in an interface that allows events to be listened to * and fired by name. This makes it possible for implementing code to * subscribe to an event that either has not been created yet, or will * not be created at all. * @class EventTarget * @param opts a configuration object * @config emitFacade {boolean} if true, all events will emit event * facade payloads by default (default false) * @config prefix {String} the prefix to apply to non-prefixed event names */ var L = Y.Lang, PREFIX_DELIMITER = ':', CATEGORY_DELIMITER = '|', AFTER_PREFIX = '~AFTER~', WILD_TYPE_RE = /(.*?)(:)(.*?)/, _wildType = Y.cached(function(type) { return type.replace(WILD_TYPE_RE, "*$2$3"); }), /** * If the instance has a prefix attribute and the * event type is not prefixed, the instance prefix is * applied to the supplied type. * @method _getType * @private */ _getType = function(type, pre) { if (!pre || type.indexOf(PREFIX_DELIMITER) > -1) { return type; } return pre + PREFIX_DELIMITER + type; }, /** * Returns an array with the detach key (if provided), * and the prefixed event name from _getType * Y.on('detachcategory| menu:click', fn) * @method _parseType * @private */ _parseType = Y.cached(function(type, pre) { var t = type, detachcategory, after, i; if (!L.isString(t)) { return t; } i = t.indexOf(AFTER_PREFIX); if (i > -1) { after = true; t = t.substr(AFTER_PREFIX.length); } i = t.indexOf(CATEGORY_DELIMITER); if (i > -1) { detachcategory = t.substr(0, (i)); t = t.substr(i+1); if (t === '*') { t = null; } } // detach category, full type with instance prefix, is this an after listener, short type return [detachcategory, (pre) ? _getType(t, pre) : t, after, t]; }), ET = function(opts) { var etState = this._yuievt, etConfig; if (!etState) { etState = this._yuievt = { events: {}, // PERF: Not much point instantiating lazily. We're bound to have events targets: null, // PERF: Instantiate lazily, if user actually adds target, config: { host: this, context: this }, chain: Y.config.chain }; } etConfig = etState.config; if (opts) { mixConfigs(etConfig, opts, true); if (opts.chain !== undefined) { etState.chain = opts.chain; } if (opts.prefix) { etConfig.prefix = opts.prefix; } } }; ET.prototype = { constructor: ET, /** * Listen to a custom event hosted by this object one time. * This is the equivalent to <code>on</code> except the * listener is immediatelly detached when it is executed. * @method once * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching the * subscription */ once: function() { var handle = this.on.apply(this, arguments); handle.batch(function(hand) { if (hand.sub) { hand.sub.once = true; } }); return handle; }, /** * Listen to a custom event hosted by this object one time. * This is the equivalent to <code>after</code> except the * listener is immediatelly detached when it is executed. * @method onceAfter * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching that * subscription */ onceAfter: function() { var handle = this.after.apply(this, arguments); handle.batch(function(hand) { if (hand.sub) { hand.sub.once = true; } }); return handle; }, /** * Takes the type parameter passed to 'on' and parses out the * various pieces that could be included in the type. If the * event type is passed without a prefix, it will be expanded * to include the prefix one is supplied or the event target * is configured with a default prefix. * @method parseType * @param {String} type the type * @param {String} [pre=this._yuievt.config.prefix] the prefix * @since 3.3.0 * @return {Array} an array containing: * * the detach category, if supplied, * * the prefixed event type, * * whether or not this is an after listener, * * the supplied event type */ parseType: function(type, pre) { return _parseType(type, pre || this._yuievt.config.prefix); }, /** * Subscribe a callback function to a custom event fired by this object or * from an object that bubbles its events to this object. * * Callback functions for events published with `emitFacade = true` will * receive an `EventFacade` as the first argument (typically named "e"). * These callbacks can then call `e.preventDefault()` to disable the * behavior published to that event's `defaultFn`. See the `EventFacade` * API for all available properties and methods. Subscribers to * non-`emitFacade` events will receive the arguments passed to `fire()` * after the event name. * * To subscribe to multiple events at once, pass an object as the first * argument, where the key:value pairs correspond to the eventName:callback, * or pass an array of event names as the first argument to subscribe to * all listed events with the same callback. * * Returning `false` from a callback is supported as an alternative to * calling `e.preventDefault(); e.stopPropagation();`. However, it is * recommended to use the event methods whenever possible. * * @method on * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching that * subscription */ on: function(type, fn, context) { var yuievt = this._yuievt, parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce, detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype, Node = Y.Node, n, domevent, isArr; // full name, args, detachcategory, after this._monitor('attach', parts[1], { args: arguments, category: parts[0], after: parts[2] }); if (L.isObject(type)) { if (L.isFunction(type)) { return Y.Do.before.apply(Y.Do, arguments); } f = fn; c = context; args = nativeSlice.call(arguments, 0); ret = []; if (L.isArray(type)) { isArr = true; } after = type._after; delete type._after; Y.each(type, function(v, k) { if (L.isObject(v)) { f = v.fn || ((L.isFunction(v)) ? v : f); c = v.context || c; } var nv = (after) ? AFTER_PREFIX : ''; args[0] = nv + ((isArr) ? v : k); args[1] = f; args[2] = c; ret.push(this.on.apply(this, args)); }, this); return (yuievt.chain) ? this : new Y.EventHandle(ret); } detachcategory = parts[0]; after = parts[2]; shorttype = parts[3]; // extra redirection so we catch adaptor events too. take a look at this. if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) { args = nativeSlice.call(arguments, 0); args.splice(2, 0, Node.getDOMNode(this)); // Y.log("Node detected, redirecting with these args: " + args); return Y.on.apply(Y, args); } type = parts[1]; if (Y.instanceOf(this, YUI)) { adapt = Y.Env.evt.plugins[type]; args = nativeSlice.call(arguments, 0); args[0] = shorttype; if (Node) { n = args[2]; if (Y.instanceOf(n, Y.NodeList)) { n = Y.NodeList.getDOMNodes(n); } else if (Y.instanceOf(n, Node)) { n = Node.getDOMNode(n); } domevent = (shorttype in Node.DOM_EVENTS); // Captures both DOM events and event plugins. if (domevent) { args[2] = n; } } // check for the existance of an event adaptor if (adapt) { Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event'); handle = adapt.on.apply(Y, args); } else if ((!type) || domevent) { handle = Y.Event._attach(args); } } if (!handle) { ce = yuievt.events[type] || this.publish(type); handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true); // TODO: More robust regex, accounting for category if (type.indexOf("*:") !== -1) { this._hasSiblings = true; } } if (detachcategory) { store[detachcategory] = store[detachcategory] || {}; store[detachcategory][type] = store[detachcategory][type] || []; store[detachcategory][type].push(handle); } return (yuievt.chain) ? this : handle; }, /** * subscribe to an event * @method subscribe * @deprecated use on */ subscribe: function() { Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated'); return this.on.apply(this, arguments); }, /** * Detach one or more listeners the from the specified event * @method detach * @param type {string|Object} Either the handle to the subscriber or the * type of event. If the type * is not specified, it will attempt to remove * the listener from all hosted events. * @param fn {Function} The subscribed function to unsubscribe, if not * supplied, all subscribers will be removed. * @param context {Object} The custom object passed to subscribe. This is * optional, but if supplied will be used to * disambiguate multiple listeners that are the same * (e.g., you subscribe many object using a function * that lives on the prototype) * @return {EventTarget} the host */ detach: function(type, fn, context) { var evts = this._yuievt.events, i, Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node)); // detachAll disabled on the Y instance. if (!type && (this !== Y)) { for (i in evts) { if (evts.hasOwnProperty(i)) { evts[i].detach(fn, context); } } if (isNode) { Y.Event.purgeElement(Node.getDOMNode(this)); } return this; } var parts = _parseType(type, this._yuievt.config.prefix), detachcategory = L.isArray(parts) ? parts[0] : null, shorttype = (parts) ? parts[3] : null, adapt, store = Y.Env.evt.handles, detachhost, cat, args, ce, keyDetacher = function(lcat, ltype, host) { var handles = lcat[ltype], ce, i; if (handles) { for (i = handles.length - 1; i >= 0; --i) { ce = handles[i].evt; if (ce.host === host || ce.el === host) { handles[i].detach(); } } } }; if (detachcategory) { cat = store[detachcategory]; type = parts[1]; detachhost = (isNode) ? Y.Node.getDOMNode(this) : this; if (cat) { if (type) { keyDetacher(cat, type, detachhost); } else { for (i in cat) { if (cat.hasOwnProperty(i)) { keyDetacher(cat, i, detachhost); } } } return this; } // If this is an event handle, use it to detach } else if (L.isObject(type) && type.detach) { type.detach(); return this; // extra redirection so we catch adaptor events too. take a look at this. } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) { args = nativeSlice.call(arguments, 0); args[2] = Node.getDOMNode(this); Y.detach.apply(Y, args); return this; } adapt = Y.Env.evt.plugins[shorttype]; // The YUI instance handles DOM events and adaptors if (Y.instanceOf(this, YUI)) { args = nativeSlice.call(arguments, 0); // use the adaptor specific detach code if if (adapt && adapt.detach) { adapt.detach.apply(Y, args); return this; // DOM event fork } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) { args[0] = type; Y.Event.detach.apply(Y.Event, args); return this; } } // ce = evts[type]; ce = evts[parts[1]]; if (ce) { ce.detach(fn, context); } return this; }, /** * detach a listener * @method unsubscribe * @deprecated use detach */ unsubscribe: function() { Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated'); return this.detach.apply(this, arguments); }, /** * Removes all listeners from the specified event. If the event type * is not specified, all listeners from all hosted custom events will * be removed. * @method detachAll * @param type {String} The type, or name of the event */ detachAll: function(type) { return this.detach(type); }, /** * Removes all listeners from the specified event. If the event type * is not specified, all listeners from all hosted custom events will * be removed. * @method unsubscribeAll * @param type {String} The type, or name of the event * @deprecated use detachAll */ unsubscribeAll: function() { Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated'); return this.detachAll.apply(this, arguments); }, /** * Creates a new custom event of the specified type. If a custom event * by that name already exists, it will not be re-created. In either * case the custom event is returned. * * @method publish * * @param type {String} the type, or name of the event * @param opts {object} optional config params. Valid properties are: * * <ul> * <li> * 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false) * </li> * <li> * 'bubbles': whether or not this event bubbles (true) * Events can only bubble if emitFacade is true. * </li> * <li> * 'context': the default execution context for the listeners (this) * </li> * <li> * 'defaultFn': the default function to execute when this event fires if preventDefault was not called * </li> * <li> * 'emitFacade': whether or not this event emits a facade (false) * </li> * <li> * 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click' * </li> * <li> * 'fireOnce': if an event is configured to fire once, new subscribers after * the fire will be notified immediately. * </li> * <li> * 'async': fireOnce event listeners will fire synchronously if the event has already * fired unless async is true. * </li> * <li> * 'preventable': whether or not preventDefault() has an effect (true) * </li> * <li> * 'preventedFn': a function that is executed when preventDefault is called * </li> * <li> * 'queuable': whether or not this event can be queued during bubbling (false) * </li> * <li> * 'silent': if silent is true, debug messages are not provided for this event. * </li> * <li> * 'stoppedFn': a function that is executed when stopPropagation is called * </li> * * <li> * 'monitored': specifies whether or not this event should send notifications about * when the event has been attached, detached, or published. * </li> * <li> * 'type': the event type (valid option if not provided as the first parameter to publish) * </li> * </ul> * * @return {CustomEvent} the custom event * */ publish: function(type, opts) { var ret, etState = this._yuievt, etConfig = etState.config, pre = etConfig.prefix; if (typeof type === "string") { if (pre) { type = _getType(type, pre); } ret = this._publish(type, etConfig, opts); } else { ret = {}; Y.each(type, function(v, k) { if (pre) { k = _getType(k, pre); } ret[k] = this._publish(k, etConfig, v || opts); }, this); } return ret; }, /** * Returns the fully qualified type, given a short type string. * That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix. * * NOTE: This method, unlike _getType, does no checking of the value passed in, and * is designed to be used with the low level _publish() method, for critical path * implementations which need to fast-track publish for performance reasons. * * @method _getFullType * @private * @param {String} type The short type to prefix * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in */ _getFullType : function(type) { var pre = this._yuievt.config.prefix; if (pre) { return pre + PREFIX_DELIMITER + type; } else { return type; } }, /** * The low level event publish implementation. It expects all the massaging to have been done * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast * path publish, which can be used by critical code paths to improve performance. * * @method _publish * @private * @param {String} fullType The prefixed type of the event to publish. * @param {Object} etOpts The EventTarget specific configuration to mix into the published event. * @param {Object} ceOpts The publish specific configuration to mix into the published event. * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will * be the default `CustomEvent` instance, and can be configured independently. */ _publish : function(fullType, etOpts, ceOpts) { var ce, etState = this._yuievt, etConfig = etState.config, host = etConfig.host, context = etConfig.context, events = etState.events; ce = events[fullType]; // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight. if ((etConfig.monitored && !ce) || (ce && ce.monitored)) { this._monitor('publish', fullType, { args: arguments }); } if (!ce) { // Publish event ce = events[fullType] = new Y.CustomEvent(fullType, etOpts); if (!etOpts) { ce.host = host; ce.context = context; } } if (ceOpts) { mixConfigs(ce, ceOpts, true); } return ce; }, /** * This is the entry point for the event monitoring system. * You can monitor 'attach', 'detach', 'fire', and 'publish'. * When configured, these events generate an event. click -> * click_attach, click_detach, click_publish -- these can * be subscribed to like other events to monitor the event * system. Inividual published events can have monitoring * turned on or off (publish can't be turned off before it * it published) by setting the events 'monitor' config. * * @method _monitor * @param what {String} 'attach', 'detach', 'fire', or 'publish' * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object. * @param o {Object} Information about the event interaction, such as * fire() args, subscription category, publish config * @private */ _monitor: function(what, eventType, o) { var monitorevt, ce, type; if (eventType) { if (typeof eventType === "string") { type = eventType; ce = this.getEvent(eventType, true); } else { ce = eventType; type = eventType.type; } if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { monitorevt = type + '_' + what; o.monitored = what; this.fire.call(this, monitorevt, o); } } }, /** * Fire a custom event by name. The callback functions will be executed * from the context specified when the event was created, and with the * following parameters. * * If the custom event object hasn't been created, then the event hasn't * been published and it has no subscribers. For performance sake, we * immediate exit in this case. This means the event won't bubble, so * if the intention is that a bubble target be notified, the event must * be published on this object first. * * The first argument is the event type, and any additional arguments are * passed to the listeners as parameters. If the first of these is an * object literal, and the event is configured to emit an event facade, * that object is mixed into the event facade and the facade is provided * in place of the original object. * * @method fire * @param type {String|Object} The type of the event, or an object that contains * a 'type' property. * @param arguments {Object*} an arbitrary set of parameters to pass to * the handler. If the first of these is an object literal and the event is * configured to emit an event facade, the event facade will replace that * parameter after the properties the object literal contains are copied to * the event facade. * @return {EventTarget} the event host */ fire: function(type) { var typeIncluded = (typeof type === "string"), argCount = arguments.length, t = type, yuievt = this._yuievt, etConfig = yuievt.config, pre = etConfig.prefix, ret, ce, ce2, args; if (typeIncluded && argCount <= 3) { // PERF: Try to avoid slice/iteration for the common signatures // Most common if (argCount === 2) { args = [arguments[1]]; // fire("foo", {}) } else if (argCount === 3) { args = [arguments[1], arguments[2]]; // fire("foo", {}, opts) } else { args = []; // fire("foo") } } else { args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0)); } if (!typeIncluded) { t = (type && type.type); } if (pre) { t = _getType(t, pre); } ce = yuievt.events[t]; if (this._hasSiblings) { ce2 = this.getSibling(t, ce); if (ce2 && !ce) { ce = this.publish(t); } } // PERF: trying to avoid function call, since this is a critical path if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { this._monitor('fire', (ce || t), { args: args }); } // this event has not been published or subscribed to if (!ce) { if (yuievt.hasTargets) { return this.bubble({ type: t }, args, this); } // otherwise there is nothing to be done ret = true; } else { if (ce2) { ce.sibling = ce2; } ret = ce._fire(args); } return (yuievt.chain) ? this : ret; }, getSibling: function(type, ce) { var ce2; // delegate to *:type events if there are subscribers if (type.indexOf(PREFIX_DELIMITER) > -1) { type = _wildType(type); ce2 = this.getEvent(type, true); if (ce2) { ce2.applyConfig(ce); ce2.bubbles = false; ce2.broadcast = 0; } } return ce2; }, /** * Returns the custom event of the provided type has been created, a * falsy value otherwise * @method getEvent * @param type {String} the type, or name of the event * @param prefixed {String} if true, the type is prefixed already * @return {CustomEvent} the custom event or null */ getEvent: function(type, prefixed) { var pre, e; if (!prefixed) { pre = this._yuievt.config.prefix; type = (pre) ? _getType(type, pre) : type; } e = this._yuievt.events; return e[type] || null; }, /** * Subscribe to a custom event hosted by this object. The * supplied callback will execute after any listeners add * via the subscribe method, and after the default function, * if configured for the event, has executed. * * @method after * @param {String} type The name of the event * @param {Function} fn The callback to execute in response to the event * @param {Object} [context] Override `this` object in callback * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber * @return {EventHandle} A subscription handle capable of detaching the * subscription */ after: function(type, fn) { var a = nativeSlice.call(arguments, 0); switch (L.type(type)) { case 'function': return Y.Do.after.apply(Y.Do, arguments); case 'array': // YArray.each(a[0], function(v) { // v = AFTER_PREFIX + v; // }); // break; case 'object': a[0]._after = true; break; default: a[0] = AFTER_PREFIX + type; } return this.on.apply(this, a); }, /** * Executes the callback before a DOM event, custom event * or method. If the first argument is a function, it * is assumed the target is a method. For DOM and custom * events, this is an alias for Y.on. * * For DOM and custom events: * type, callback, context, 0-n arguments * * For methods: * callback, object (method host), methodName, context, 0-n arguments * * @method before * @return detach handle */ before: function() { return this.on.apply(this, arguments); } }; Y.EventTarget = ET; // make Y an event target Y.mix(Y, ET.prototype); ET.call(Y, { bubbles: false }); YUI.Env.globalEvents = YUI.Env.globalEvents || new ET(); /** * Hosts YUI page level events. This is where events bubble to * when the broadcast config is set to 2. This property is * only available if the custom event module is loaded. * @property Global * @type EventTarget * @for YUI */ Y.Global = YUI.Env.globalEvents; // @TODO implement a global namespace function on Y.Global? /** `Y.on()` can do many things: <ul> <li>Subscribe to custom events `publish`ed and `fire`d from Y</li> <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and `fire`d from any object in the YUI instance sandbox</li> <li>Subscribe to DOM events</li> <li>Subscribe to the execution of a method on any object, effectively treating that method as an event</li> </ul> For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument. Y.on('io:complete', function () { Y.MyApp.updateStatus('Transaction complete'); }); To subscribe to DOM events, pass the name of a DOM event as the first argument and a CSS selector string as the third argument after the callback function. Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`, array, or simply omitted (the default is the `window` object). Y.on('click', function (e) { e.preventDefault(); // proceed with ajax form submission var url = this.get('action'); ... }, '#my-form'); The `this` object in DOM event callbacks will be the `Node` targeted by the CSS selector or other identifier. `on()` subscribers for DOM events or custom events `publish`ed with a `defaultFn` can prevent the default behavior with `e.preventDefault()` from the event object passed as the first parameter to the subscription callback. To subscribe to the execution of an object method, pass arguments corresponding to the call signature for <a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>. NOTE: The formal parameter list below is for events, not for function injection. See `Y.Do.before` for that signature. @method on @param {String} type DOM or custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @see Do.before @for YUI **/ /** Listen for an event one time. Equivalent to `on()`, except that the listener is immediately detached when executed. See the <a href="#methods_on">`on()` method</a> for additional subscription options. @see on @method once @param {String} type DOM or custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ /** Listen for an event one time. Equivalent to `once()`, except, like `after()`, the subscription callback executes after all `on()` subscribers and the event's `defaultFn` (if configured) have executed. Like `after()` if any `on()` phase subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()` subscribers will execute. The listener is immediately detached when executed. See the <a href="#methods_on">`on()` method</a> for additional subscription options. @see once @method onceAfter @param {String} type The custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [arg*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ /** Like `on()`, this method creates a subscription to a custom event or to the execution of a method on an object. For events, `after()` subscribers are executed after the event's `defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber. See the <a href="#methods_on">`on()` method</a> for additional subscription options. NOTE: The subscription signature shown is for events, not for function injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a> for that signature. @see on @see Do.after @method after @param {String} type The custom event name @param {Function} fn The callback to execute in response to the event @param {Object} [context] Override `this` object in callback @param {Any} [args*] 0..n additional arguments to supply to the subscriber @return {EventHandle} A subscription handle capable of detaching the subscription @for YUI **/ }, '@VERSION@', {"requires": ["oop"]});
src/components/Settings/Speech/Speech.container.js
shayc/cboard
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import debounce from 'lodash/debounce'; import { injectIntl } from 'react-intl'; import { speak, cancelSpeech, changeVoice, changePitch, changeRate } from '../../../providers/SpeechProvider/SpeechProvider.actions'; import Speech from './Speech.component'; import messages from './Speech.messages'; import API from '../../../api'; export class SpeechContainer extends Component { static propTypes = { /** * Active language */ lang: PropTypes.string, speech: PropTypes.object, voices: PropTypes.array, cancelSpeech: PropTypes.func, changeVoice: PropTypes.func, changePitch: PropTypes.func, changeRate: PropTypes.func, history: PropTypes.object.isRequired }; state = { selectedVoiceIndex: 0, voiceOpen: false, anchorEl: null }; speakSample = debounce(() => { const { cancelSpeech, intl, speak } = this.props; const text = intl.formatMessage(messages.sampleSentence); cancelSpeech(); speak(text); }, 500); handleClickListItem = event => { this.setState({ voiceOpen: true, anchorEl: event.currentTarget }); }; handleMenuItemClick = async ({ voiceURI, lang }, index) => { const { changeVoice } = this.props; changeVoice(voiceURI, lang); this.speakSample(); await this.updateSettings('voiceURI', voiceURI); this.setState({ voiceOpen: false, selectedVoiceIndex: index }); }; updateSettings(property, value) { if (this.updateSettingsTimeout) { clearTimeout(this.updateSettingsTimeout); } this.updateSettingsTimeout = setTimeout(async () => { const { speech: { options: { voiceURI, pitch, rate } } } = this.props; const speech = { voiceURI, pitch, rate, [property]: value }; try { await API.updateSettings({ speech }); } catch (e) {} }, 500); } handleChangePitch = async (event, value) => { const { changePitch } = this.props; await this.updateSettings('pitch', value); changePitch(value); this.speakSample(); }; handleChangeRate = async (event, value) => { const { changeRate } = this.props; await this.updateSettings('rate', value); changeRate(value); this.speakSample(); }; handleVoiceClose = () => { this.setState({ voiceOpen: false }); }; render() { const { history, intl, lang, speech: { voices, options: { voiceURI, pitch, rate } } } = this.props; const langVoices = voices.filter( voice => voice.lang.slice(0, 2) === lang.slice(0, 2) ); const voiceArray = voices.filter(v => voiceURI === v.voiceURI); const voice = voiceArray[0]; return ( <Speech {...this.state} handleChangePitch={this.handleChangePitch} handleChangeRate={this.handleChangeRate} handleClickListItem={this.handleClickListItem} handleMenuItemClick={this.handleMenuItemClick} handleVoiceClose={this.handleVoiceClose} intl={intl} langVoices={langVoices} onClose={history.goBack} pitch={pitch} rate={rate} voice={voice} /> ); } } const mapStateToProps = state => ({ lang: state.language.lang, voices: state.speech.voices, speech: state.speech }); const mapDispatchToProps = { cancelSpeech, changeVoice, changePitch, changeRate, speak }; const EnhancedSpeechContainer = injectIntl(SpeechContainer); export default connect( mapStateToProps, mapDispatchToProps )(EnhancedSpeechContainer);
examples/js/sort/reusable-custom-sort-table.js
opensourcegeek/react-bootstrap-table
'use strict'; import React from 'react'; import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; var products = []; function addProducts(quantity) { var startId = products.length; for (var i = 0; i < quantity; i++) { var id = startId + i; products.push({ id: id, name: "Item name " + id, price: 100 + i }); } } addProducts(5); function numberSortFunc(a, b, order, sortField){ //order is desc or asc if(order == 'desc'){ return a[sortField] - b[sortField]; } else{ return b[sortField] - a[sortField]; } } export default class CustomSortTable extends React.Component{ render(){ return ( <BootstrapTable data={products}> <TableHeaderColumn dataField="id" isKey={true} dataSort={true} sortFunc={numberSortFunc}>Product ID</TableHeaderColumn> <TableHeaderColumn dataField="name">Product Name</TableHeaderColumn> <TableHeaderColumn dataField="price" dataSort={true} sortFunc={numberSortFunc}>Product Price</TableHeaderColumn> </BootstrapTable> ); } };
client/screens/components/table/Components/FilterableTable.js
francixcoag/trace_packages
import React from 'react'; import Table from './Table.js'; import Header from './Header.js'; import Pager from 'react-pager'; import FilterAndSort from '../Helpers/FilterAndSort.js'; import axios from 'axios'; import isElementInViewport from '../Helpers/isElementInViewport.js'; import moment from '../../../../utils/moment.min.js'; class FilterableTable extends React.Component { constructor(props) { super(props); this.state = { loading: false, importCSV: false, entries: this.props.data || [], sort: this.props.initialSort, sortDir: (typeof this.props.initialSortDir === "boolean") ? this.props.initialSortDir : true, filter: '', startDate: moment().subtract(29, 'days').format('DD/MM/YYYY'), endDate: moment().format('DD/MM/YYYY'), exactFilters: [], serverError: false, totalPages: 1, visiblePages: 5, page: 0, pageSize: +localStorage.getItem(this.props.namespace + '.PageSize') || 10 } this.loadData = this.loadData.bind(this); this.setData = this.setData.bind(this); this.updateFilter = this.updateFilter.bind(this); this.updateDate = this.updateDate.bind(this); this.addExactFilter = this.addExactFilter.bind(this); this.updatePageSize = this.updatePageSize.bind(this); this.updatePage = this.updatePage.bind(this); this.filterInputChanged = this.filterInputChanged.bind(this); this.filterDateChanged = this.filterDateChanged.bind(this); this.updateSort = this.updateSort.bind(this); this.scrollIntoView = this.scrollIntoView.bind(this); this.removeExactFilter = this.removeExactFilter.bind(this); axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; } static get defaultProps() { // Set defaults if values weren't passed in return { noRecordsMessage: "There are no records to display", noFilteredRecordsMessage: "There are no records to display", stickySorting: false, namespace: "react-filterable-table", tableClassName: "table table-condensed table-hover filterable-table text-left" } } componentDidMount() { this.loadData(); // focus the search input when '/' is pressed window.onkeydown = function(e) { // Don't focus if the active element is one of these let ignoredTags = ["INPUT", "SELECT"]; // 191 is '/' if (e.which === 191 && ignoredTags.indexOf(document.activeElement.tagName) < 0) { e.preventDefault(); document.querySelector("input.filter-input").focus(); } } } componentWillReceiveProps(nextProps) { // If the `data` prop changes, make sure we run our onDataReceived callback (if supplied) // and set our states if (nextProps.hasOwnProperty('data')) { this.setData(nextProps.data); } if (nextProps.hasOwnProperty('initialSort')) { this.setState({ sort: nextProps.initialSort }); } if (nextProps.hasOwnProperty('initialSortDir')) { this.setState({ sortDir: nextProps.initialSortDir }); } } loadData(e) { if (e) { e.preventDefault() } // Make sure either data was set or an endpoint was passed in if (!Array.isArray(this.props.data) && !this.props.dataEndpoint) { throw "No data was passed in and no data endpoint was set."; } // Set state to 'loading' to show the "Loading..." message this.setState({ loading: true }); if (Array.isArray(this.props.data)) { //this.setData(this.props.data); var newData = this.props.data; this.setData(newData); } else { // Load data from endpoint axios.get(this.props.dataEndpoint) .then(response => response.data.records) .then(entries => { console.log(entries); this.translatePackageState(entries); this.translateAccount(entries); this.fixCodProcess(entries); this.setData(entries); }) .catch(error => { this.setState({ serverError: true, loading: false }); console.log(error); }); } }; fixCodProcess(entries){ //cod_process entries.forEach(function(element) { element['cod_process'] = Math.round(element['cod_process']); }); }; translateAccount(entries){ //accountID entries.forEach(function(element){ if(element['account_id'] == 31752){ element['account_id'] = "Cilnet"; }else if(element['account_id'] == 31868){ element['account_id'] = "Horas de Luxo"; } }); } translatePackageState(entries){ //cod_main_state entries.forEach(function(element) { if(element['cod_main_state'] == 1){ element['cod_main_state'] = "Incidência"; }else if(element['cod_main_state'] == 2){ element['cod_main_state'] = "Em Distribuição"; }else if(element['cod_main_state'] == 3){ element['cod_main_state'] = "Balcão"; }else if(element['cod_main_state'] == 4){ element['cod_main_state'] = "Em Devolução"; }else if(element['cod_main_state'] == 5){ element['cod_main_state'] = "Entregue"; }else if(element['cod_main_state'] == 6){ element['cod_main_state'] = "Devolvido"; } }); } setData(entries) { if (this.props.onDataReceived) { // Run callback if supplied this.props.onDataReceived(entries); } this.setState({ entries, loading: false, serverError: false, page: 0 }); } updateFilter(filter) { // Set the state filter to what was passed in. this.setState({ filter, page: 0 }); this.scrollIntoView(); } updateDate(startDate, endDate) { this.setState({ startDate, endDate, page: 0 }); this.scrollIntoView(); } addExactFilter(value, fieldname, name = fieldname) { // Exact filters are an array; grab the existing ones and push this one on it. // Don't add it if value is null/undefined if (!value) { return; } let { exactFilters } = this.state; // Build our object to push onto the array let thisFilter = { value: value.toString(), fieldname, name } // Don't add it if it's already in there let filterExists = exactFilters.some(f => { // If field and value ar the same, we already have this filter. return f.fieldname === thisFilter.fieldname && f.value === thisFilter.value; }); if (filterExists) { return; } exactFilters.push(thisFilter); // Update state this.setState({ exactFilters, page: 0 }); } removeExactFilter(filter) { let { exactFilters } = this.state; let index = exactFilters.indexOf(filter); if (index > -1) { exactFilters.splice(index, 1); } this.setState({ exactFilters, page: 0 }); this.scrollIntoView(); } updatePage(page) { console.log('page changed'); this.setState({ page }); this.scrollIntoView(); console.log("before action"); this.props.saveTableState(page); console.log("after log"); console.log(page); } updatePageSize(event) { let pageSize = +event.target.value; this.setState({ page: 0, pageSize }); localStorage.setItem(this.props.namespace + '.PageSize', pageSize); } filterInputChanged(event) { this.updateFilter(event.target.value); this.setState({ page: 0 }); } filterDateChanged(event) { this.updateDate(event.target.value); this.setState({ page: 0 }); console.log('event target Date ' + event.target ); } updateSort(sort) { let sortDir = this.state.sortDir; if (sort === this.state.sort) { // If sorting again on the same field, switch the sort direction sortDir = !sortDir; } else { // Default to asc when sorting on new field sortDir = true; } this.setState({ sort, sortDir, page: 0 }); } scrollIntoView() { // Make sure things are in view let table = this.refs.Table.refs.table; if (table && !isElementInViewport(table)) { table.scrollIntoView(); } } render() { if(this.state.serverError) console.log(this.state.serverError) let loading = !this.state.loading ? '' : <div className="well text-center"> A carregar... </div>; let csvData = [ ['firstname', 'lastname', 'email'] , ['Ahmed', 'Tomi' , 'ah@smthing.co.com'] , ['Raed', 'Labes' , 'rl@smthing.co.com'] , ['Yezzi','Min l3b', 'ymin@cocococo.com'] ]; let importCSV = !this.state.importCSV ? '': <div> <CSVLink data={csvData} >Importar CSV</CSVLink> </div> let serverErrorMessage = !this.state.serverError ? '' : <div className="alert alert-danger text-center"> Aconteceu algo inesperado! Contacte os nossos serviços administrativos. </div>; let noRecordsMessage = (!this.state.serverError && !this.state.loading && this.state.entries.length === 0) ? <div> {this.props.noRecordsMessage} </div> : ''; let filteredEntries = FilterAndSort(this.state.entries, { filter: this.state.filter, exactFilters: this.state.exactFilters, sort: this.state.sort, sortDir: this.state.sortDir, stickySorting: this.props.stickySorting, fields: this.props.fields, startDate: this.state.startDate, endDate: this.state.endDate }); let table = this.state.loading || this.state.entries.length === 0 ? '' : <Table records={filteredEntries} fields={this.props.fields} filter={this.state.filter} filterExact={this.state.filterExact} addExactFilter={this.addExactFilter} updateSort={this.updateSort} sort={this.state.sort} sortDir={this.state.sortDir} page={this.state.page} pageSize={this.state.pageSize} pagersVisible={this.props.pagersVisible} noFilteredRecordsMessage={this.props.noFilteredRecordsMessage} className={this.props.tableClassName} trClassName={this.props.trClassName} style={this.props.style} ref="Table" />; let totalPages = (filteredEntries && filteredEntries.length > 0) ? Math.ceil(filteredEntries.length / this.state.pageSize) : 0; let topPager = this.state.loading || this.state.entries.length === 0 || this.props.pagersVisible === false || this.props.topPagerVisible === false ? '' : <Pager total={totalPages} current={this.state.page} visiblePages={this.state.visiblePages} onPageChanged={this.updatePage} className="pagination-sm pull-right" />; let bottomPager = this.state.loading || this.state.entries.length === 0 || this.props.pagersVisible === false || this.props.bottomPagerVisible === false ? '' : <Pager total={totalPages} current={this.state.page} visiblePages={this.state.visiblePages} onPageChanged={this.updatePage} titles={{ first: 'Início', prev: '\u00AB', prevSet: '...', nextSet: '...', next: '\u00BB', last: 'Fim' }} />; return ( <div className={"filterable-table-container" + (this.props.className ? ' ' + this.props.className : '')}> <Header loading={this.state.loading} updateFilter={this.updateFilter} updateSort={this.updateSort} updateDate={this.updateDate} filter={this.state.filter} exactFilters={this.state.exactFilters} removeExactFilter={this.removeExactFilter} pageSize={this.state.pageSize} updatePageSize={this.updatePageSize} pager={topPager} recordCount={filteredEntries.length} recordCountName={this.props.recordCountName} recordCountNamePlural={this.props.recordCountNamePlural} upperHeaderChildren={this.props.upperHeaderChildren} lowerHeaderChildren={this.props.lowerHeaderChildren} visible={this.props.headerVisible} pagersVisible={this.props.pagersVisible} dateRangeVisible={this.props.dateRangeVisible} > </Header> <div className="table-container"> {loading} {serverErrorMessage} {noRecordsMessage} {table} {bottomPager} </div> </div> ); } } module.exports = FilterableTable;
src/svg-icons/av/forward-30.js
jacklam718/react-svg-iconx
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let AvForward30 = (props) => ( <SvgIcon {...props}> <path d="M9.6 13.5h.4c.2 0 .4-.1.5-.2s.2-.2.2-.4v-.2s-.1-.1-.1-.2-.1-.1-.2-.1h-.5s-.1.1-.2.1-.1.1-.1.2v.2h-1c0-.2 0-.3.1-.5s.2-.3.3-.4.3-.2.4-.2.4-.1.5-.1c.2 0 .4 0 .6.1s.3.1.5.2.2.2.3.4.1.3.1.5v.3s-.1.2-.1.3-.1.2-.2.2-.2.1-.3.2c.2.1.4.2.5.4s.2.4.2.6c0 .2 0 .4-.1.5s-.2.3-.3.4-.3.2-.5.2-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.4-.1-.6h.8v.2s.1.1.1.2.1.1.2.1h.5s.1-.1.2-.1.1-.1.1-.2v-.5s-.1-.1-.1-.2-.1-.1-.2-.1h-.6v-.7zm5.7.7c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1.3.2.5.3.2.3.3.6.1.5.1.8v.7zm-.9-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5zM4 13c0 4.4 3.6 8 8 8s8-3.6 8-8h-2c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6v4l5-5-5-5v4c-4.4 0-8 3.6-8 8z"/> </SvgIcon> ); AvForward30 = pure(AvForward30); AvForward30.displayName = 'AvForward30'; AvForward30.muiName = 'SvgIcon'; export default AvForward30;
lib/components/Main.js
hilvitzs/weatherly
import React, { Component } from 'react'; import Weatherly from './Weatherly'; // import key from './key.js' export default class Main extends Component { render() { return ( <section> <h1 className='appTitle'>Weatherly</h1> <div> <Weatherly/> </div> </section> ); } }
docs/src/app/components/pages/components/DropDownMenu/ExampleSimple.js
ngbrown/material-ui
import React from 'react'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; const styles = { customWidth: { width: 200, }, }; export default class DropDownMenuSimpleExample extends React.Component { constructor(props) { super(props); this.state = {value: 1}; } handleChange = (event, index, value) => this.setState({value}); render() { return ( <div> <DropDownMenu value={this.state.value} onChange={this.handleChange}> <MenuItem value={1} primaryText="Never" /> <MenuItem value={2} primaryText="Every Night" /> <MenuItem value={3} primaryText="Weeknights" /> <MenuItem value={4} primaryText="Weekends" /> <MenuItem value={5} primaryText="Weekly" /> </DropDownMenu> <br /> <DropDownMenu value={this.state.value} onChange={this.handleChange} style={styles.customWidth} autoWidth={false} > <MenuItem value={1} primaryText="Custom width" /> <MenuItem value={2} primaryText="Every Night" /> <MenuItem value={3} primaryText="Weeknights" /> <MenuItem value={4} primaryText="Weekends" /> <MenuItem value={5} primaryText="Weekly" /> </DropDownMenu> </div> ); } }
examples/passing-props-to-children/app.js
runlevelsix/react-router
import React from 'react'; import { Router, Route, Link, History } from 'react-router'; var App = React.createClass({ mixins: [ History ], getInitialState() { return { tacos: [ { name: 'duck confit' }, { name: 'carne asada' }, { name: 'shrimp' } ] }; }, addTaco() { var name = prompt('taco name?'); this.setState({ tacos: this.state.tacos.concat({name: name}) }); }, handleRemoveTaco(removedTaco) { var tacos = this.state.tacos.filter(function (taco) { return taco.name != removedTaco; }); this.setState({tacos: tacos}); this.history.pushState(null, '/'); }, render() { var links = this.state.tacos.map(function (taco, i) { return ( <li key={i}> <Link to={`/taco/${taco.name}`}>{taco.name}</Link> </li> ); }); return ( <div className="App"> <button onClick={this.addTaco}>Add Taco</button> <ul className="Master"> {links} </ul> <div className="Detail"> {this.props.children && React.cloneElement(this.props.children, { onRemoveTaco: this.handleRemoveTaco })} </div> </div> ); } }); var Taco = React.createClass({ remove() { this.props.onRemoveTaco(this.props.params.name); }, render() { return ( <div className="Taco"> <h1>{this.props.params.name}</h1> <button onClick={this.remove}>remove</button> </div> ); } }); React.render(( <Router> <Route path="/" component={App}> <Route path="taco/:name" component={Taco} /> </Route> </Router> ), document.getElementById('example'));
test/ReactPlayer/instanceMethods.js
CookPete/react-player
import React from 'react' import test from 'ava' import sinon from 'sinon' import { configure, shallow } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' import ReactPlayer from '../../src/index' configure({ adapter: new Adapter() }) const COMMON_METHODS = ['getDuration', 'getCurrentTime', 'getSecondsLoaded', 'getInternalPlayer'] for (const method of COMMON_METHODS) { test(`${method}()`, t => { const instance = shallow(<ReactPlayer />).instance() instance.references.player({ [method]: () => 123 }) t.true(instance[method]() === 123) }) test(`${method}() - null`, t => { const instance = shallow(<ReactPlayer />).instance() t.true(instance[method]() === null) }) } test('getInternalPlayer() - default', t => { const instance = shallow(<ReactPlayer />).instance() const getInternalPlayer = sinon.fake.returns('abc') instance.references.player({ getInternalPlayer }) t.true(instance.getInternalPlayer() === 'abc') t.true(getInternalPlayer.calledOnceWith('player')) }) test('seekTo()', t => { const instance = shallow(<ReactPlayer />).instance() instance.references.player({ seekTo: sinon.fake() }) instance.seekTo(5) t.true(instance.player.seekTo.calledOnce) t.true(instance.player.seekTo.calledWith(5)) }) test('seekTo() - null', t => { const instance = shallow(<ReactPlayer />).instance() t.true(instance.seekTo() === null) }) test('onReady()', t => { const onReady = sinon.fake() const instance = shallow(<ReactPlayer onReady={onReady} />).instance() instance.handleReady() t.true(onReady.calledWith(instance)) }) test('refs', t => { const instance = shallow(<ReactPlayer />).instance() instance.references.player('abc') instance.references.wrapper('def') t.true(instance.player === 'abc') t.true(instance.wrapper === 'def') })
app/components/GateAnimation/index.js
yasserhennawi/yasserhennawi
import React from 'react'; import PropTypes from 'prop-types'; import styled from 'utils/styled-components'; import { StaggeredMotion } from 'react-motion'; import { connect } from 'react-redux'; import colors from 'theme/color'; import { routeIsReady as routeIsReadyAction } from '../../containers/App/actions'; import selector from './selectors'; import getStaggeredMotionStyle from './helpers'; const Wrapper = styled.div` display: flex; position: absolute; flex-direction: column; width: 100%; box-sizing: border-box; min-height: 100vh; overflow: hidden; `; const Box = styled.div` height: 100%; width: ${(props) => props.width}%; position: absolute; background-color: ${(props) => props.bgColor}; z-index: 2; &:nth-child(2) { align-self: flex-end; } `; const ContentWrapper = styled.div` box-sizing: border-box; min-height: 100vh; justify-content: center; align-items: center; font-size: 40px; width: 100%; overflow-x: hidden; `; // eslint-disable-line react/prefer-stateless-function const GateAnimation = ({ children, gateStatus, isRouteReady, routeToLoad, routeIsReady, }) => ( <StaggeredMotion defaultStyles={[{ width: 50 }, { width: 50 }, { width: 0 }]} styles={getStaggeredMotionStyle(gateStatus)} > {(styles) => { if ( !gateStatus && styles[0].width === 50 && !isRouteReady && routeToLoad ) { setTimeout(() => { routeIsReady(); }, 1); } return ( <Wrapper> <Box bgColor={colors.black1} width={styles[0].width} /> <Box bgColor={colors.black1} width={styles[1].width} /> <ContentWrapper>{children}</ContentWrapper> </Wrapper> ); }} </StaggeredMotion> ); GateAnimation.propTypes = { children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.node), PropTypes.node, ]).isRequired, gateStatus: PropTypes.bool, isRouteReady: PropTypes.bool, routeToLoad: PropTypes.string, routeIsReady: PropTypes.func, }; const mapStateToProps = selector(); const mapDispatchToProps = { routeIsReady: routeIsReadyAction, }; export default connect(mapStateToProps, mapDispatchToProps)(GateAnimation);
ajax/libs/kule.lazy/4.0.18b/js/kule.urbrowser.min.js
cdnjs/cdnjs
"use strict";!function(){var e=document.documentElement,t=navigator.userAgent?navigator.userAgent.toLowerCase():null,a={},o={xs:0,sm:576,md:768,lg:992,xl:1200},s={app:"1password|arora|alienblue|amaya|baidu(boxapp)?((\\.|\\w)+)?|beetalk|checkme|collectd|electron|eve-igb|(fb[a|s]v)|flipboard|frontpage(\\sexpress)?|google(.maps|\\searth(\\spro)?|weblight)|gsa|instagram|itunes|kakaotalk|line(at|\\s)?(\\/)?\\d|linkedin|mail|micromessenger|msoffice|panascoutpro|pinterest|qq(\\W)|safepay|secondlife|snapchat|spotify|spray-can|tableaumobile|thunderbird|topbuzz|twitter|twstockapp|viber|weatherreport|weibo|winamp|yahoo(\\.|\\w){0,}|yrcweblinkpreview|zhihu|(microsoft|office)?\\s(access|excel|lync|office|onenote|outlook(\\s(calendar|mail))?(-express)?|powerpoint|project|publisher|visio|word)",browser:"(126|1337|aloha|atomic|aw|dorado\\swap-|inettv|lb|miui|mqq|naenara|nintendo|obigo(internet)|one|oppo|ovi|qt(car)?|qq|samsung|slim|sogoumobile|uc(\\s)?|up\\.|webos|ya|yolo)browser|acheetahi|adobeair|amaya|aol|awesomium|avant(go)?|band|bluechrome|blazer|bonecho|brave|camino|chimera|chromeplus|chromium|coda|coder\\snut|cometbird|comodo((_|\\s)dragon)*|coolnovo|dillo|dolfin|dooble|dragon|ekiohflow|elinks|epiphany|fennec|firebird|firefox|\\sfocus|flashfire|flock|\\sflow\\/|fxios|galeon|icab|ice(ape|dragon|weasel)|iemobile|\\siron|javafx|k-meleon|kazehakase|konqueror|lunascape|lynx|maxthon|mercury|midori|minefield|mms|mosaic|msie|mx(browser|ios)|netsurf|novarra-vision|obigo|omniweb|origin|palemoon|phoenix|playstation(\\s)?(portable|vita)?(\\s\\d+)?|puffin|quark|qupzilla|raptr|reactornetty|rekonq|rockmelt|ruxitsynthetic|seamonkey|shiretoko|silk|skyfire|sleipnir|songbird|stagefright|super(hk)?|tableau((\\s|_)?public)?|teashark|tesla(_|[a-zA-Z])*|tencenttraveler|tenfourfox|vienna|vivaldi|waterfox|webpositive|wyzo",browserAlias:"(fb[a|s]v)|fxios|edg|mx(browser|ios)|acheetahi|(mqq|lb|sogoumobile|oppo|miui|samsung|ya|yolo|aloha)browser",webkit:"edga|edge|edgios|edg|chrome|crios|version|safari",engine:"webkit|trident|gecko|presto|netfront|goanna",webview:"apache|cordova|nodejs|phonegap|react|webview",platform:"android|bada|beos|dalvik|darwin|haiku|hpwos|ip(hone|(a|o)d)|irix(64)?|kaios|kindle|klifd|nintendo(\\s)?(3ds|wii(u)?)?|playstation|rim\\stablet\\sos|tizen|windows|(free|open|net)bsd",bot:"(\\w)-google|google((bot(-(image|mobile|news|video))?)|imageproxy|-(\\w)|\\s(favicon))|(200please|abacho|addsugar|ado|aihit|anyapex|archive\\.org_|bebop|become|beslist|bitly|blitz|bradstreet|brightlocal|career|catch|centric|check|cliqz|cocolyze|crawler|diff|disco(rd)?|domain\\sre-animator\\s|dot|echo|finditanswers|flinkhub|gethpinfo\\.com|grapes|hlsh|idealo|index|info|isec(\\w|\\d|_)*|jooble|jyxo|kantarsifomediaaudit|letsearch|link(edin|is)|lxr|makemoneyteamwork|maui|meanpath|netpeak(checker)?|o|odkl|onb|quicksprout|redirect|sc|schema|snap|survey|techiejobs|telegram|tiger|tweetmeme|twitter|tzt-securityscan|web)(spider)?(-|_)?bot|(commoncontent|grapeshot)(\\s)?crawl(er)?|(360|jike|soso)spider|(b|l|i|t|z|o|-){15}|(i)?earthworm|80legs|accoona-(ai|biz)-agent|admantx(-(\\w)*)?|ahrefs(bot|siteaudit)?|alexa(\\ssite\\saudit|\\w*)?(\\s(site|audit))?|amazon(\\w)+|android(\\w)+|apple(core(\\w)*|bot)+|arachmo|baidu(mobaider|spider-\\w*)|bing(bot|preview)*|boitho\\.com-dc|broadsign\\sxpress|castbox|catchpoint|charlotte|chrome-lighthouse|(squid)?clamav(_|\\w)*|collectd|convera|cosmos|covario(\\s)?(-|\\w)*|curl|dataparksearch|dejaclick|dmbrowser|dragonfly|duckduck(go)?(-|\\w)+|earthcom\\.info|embeddedwb|envolk|evaliant|exabot(-|\\w)*|exb\\slanguage|facebookexternalhit|fast(\\s(enterprise|metaweb)|-web)|fdse|findlinks|genieo|go-http-client|gomezagent|gtmetrix|headlesschrome|htt(pclient|punit|rack)|ia_archiver|jakarta|jeeves|jikespider|linkcheck|lua|megaindex|mewe|mj12bot|msnbot(-media)?|netseer|nutch|okhttp|panscient|phantomjs|pinterest(bot)?|postman|proximic|ptst|searchhelper|semrushbot(-sa)?|sitemonitor(\\.py)?|slackbot(-|\\w)*|slurp|(new|-)*sogou(-|\\s|\\w)*spider|squider|ssl\\slabs|swami|teomabar|unwindfetchor|voilabot\\s?(beta)?|w3c(-|\\w)*|webindexer|wget|widget|y(!(\\w|-)*|search)|(yahoo(!)?(:|-|\\w)*(\\s((\\w|\\s)*crawler|mindset|pipes|slurp))+|slurp)|yandex(\\w)*|yodao(\\w|-)*|zgrab|zoominfo",botAlias:"accoona|admantx|ahrefs|alexa|amazon|android|apple|baidu|bing|boitho|duckduck|facebook|google|headless|msn|semrush|slack|sogou|w3c|yahoo",android:"acer|asus|huawei|htc|lg|miui|oppo|samsung|sharp|sony|xiaomi",tv:"crkey|netcast|smarttv|webtv",mobile:"ip(hone|(a|o)d)|android|blackberry|mobile|tablet|touch|phone|kindle",linux:"centos|debian|deepin|ezgo|hiweed|mint|redhat|startos|ubuntu|unicos",opera:"op(r|era|ios|t)"},i={discobot:"discovery","exabot-images":"exalead","exabot-thumbnails":"exalead",ia_archiver:"alexaBot",mj12bot:"majestic-12",searchhelper:"safariBot",slurp:"yahooBot",swami:"yahooBot","y!":"yahooBot"},r=function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},n=function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},c={},l=e.className,b=a.isBuiltInApp=RegExp(s.app+"|"+s.webview).test(t),m=a.isBot=/robot|spider|analyzer|crawler|\+?http(s)?:\/\/(\w|\.)*/.test(t)||RegExp(s.bot).test(t);a.isInApp=!!RegExp(s.app).test(t)&&a.getOSName,a.isWebView=!!RegExp(s.webview).test(t)&&(-1!=t.indexOf("ios")?"ios":-1!=t.indexOf("android")?"android":"unknown");var d,p,w,h,u,g,k,f,v=function(){var e,t=o,s=r();switch(!0){case s<t.sm:e="xs";break;case s>=t.sm&&s<t.md:e="sm";break;case s>=t.md&&s<t.lg:e="md";break;case s>=t.lg&&s<t.xl:e="lg";break;default:e="xl"}a.getBreakpointRange=e},x=function(e){var t={crkey:"chromecast"};return t[e]?t[e]:e},y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;"undefined"!=typeof JSON&&"undefined"!=typeof localStorage&&(e?(localStorage.removeItem("urbrowser"),e=JSON.stringify(e),localStorage.setItem("urbrowser",e)):localStorage.removeItem("urbrowser"))};!function(){var e=b?t.match(new RegExp(s.app,"i")):t.match(new RegExp(s.browser+"|"+s.app+"|"+s.webview,"i")),o=null;switch(m&&(s.bot+="|butterfly"),!0){case RegExp(s.bot).test(t):o=t.match(RegExp(s.bot))[0],m=!0;break;case e instanceof Array:switch(e=e[0],!0){case/line(at)?/.test(e):o=e.match(/line(at)?/)[0];break;case RegExp(e).test(s.bot):o=t.match(RegExp(s.bot))?t.match(RegExp(s.bot))[0]:e,m=!0;break;default:o=e.replace(/(microsoft|office)\s/,"")}break;case RegExp(s.opera).test(t):o=t.match(RegExp(s.opera,"i"))?t.match(RegExp(s.opera,"i"))[0]:"version";break;case/trident|(windows)+.*[\s|;]rv(:)?/.test(t):o=/(\s|;)rv:/.test(t)?"rv:":"rv";break;case/blackberry\d*/.test(t):o="blackberry8520";break;case RegExp(s.webkit).test(t):for(var i=s.webkit.split("|"),r=0,n=i.length;r<n;r++)if(t.match(i[r])){o=i[r];break}break;default:var c=t.match(s.engine);o=c?c[0]:null}a.getNameByAgent=o}(),function(){var e=a.getNameByAgent,o=t.replace(/<.*>/,""),s={int:"",full:""};function i(e){if(e){var t=e.length;t="rv:"===e?t-1:t;var a=o.substr(o.search(e)+t,20),i=(a=+a.charAt(0)?a:a.substr(1)).match(/(\d(\.)?)*/g)[0];s.int=parseInt(i,10),s.full=i}return s}if(e&&!((s=i(e)).int>=0)){var r={"80legs":"008",google:"googlebot",jakarta:"client",lua:"http","msnbot-media":"msnbot-media\\s",qq:"mqqbrowser","ssl labs":"of",topbuzz:"newsrepublic","valve steam":"gameoverlay",weibo:"_weibo_","y!":"y!j-asr",yahoo:"yjtop",zhihu:"futureve"}[e]||(m?"crawler":"chrome");s=i(r)}a.getBrowserVersionByName=s}(),function(){var e=a.getNameByAgent,o=e?e.match(RegExp(s.browserAlias,"i")):null,r=t.match(RegExp(s.engine));r=r?r[0]:"webkit";var n=e||null,c="",l=a.getBrowserVersionByName;if(l=l?l.int?l.int:l.full:null,o){switch(n=o[0],!0){case/fb[a|s]v/.test(n):n="facebook";break;case/edg/.test(n):n="edge";break;case/mx(browser|ios)/.test(n):n="maxthon";break;case/acheetahi/.test(n):n="armorfly";break;case/fxios/.test(n):n="firefox";break;case/browser/.test(n):n={lb:"leibao",sogoumobile:"sogou",ya:"yandex",mqq:"qq"}[n=n.replace(/browser/,"")]||n}l="twitter"===n?null:l}else switch(!0){case RegExp(s.bot).test(t):r="bot";var b=t.match(RegExp(s.bot));if(b=b?b[0]:null){var d=b.match(s.botAlias);n=d?d[0]+"Bot":i[b]||b}else n=i[b]||b;m=!0;break;case/firefox/.test(e):r=/gecko/.test(t)?"gecko":"webkit";break;case RegExp(s.opera+"|coast|mms").test(e):n="opera",r=/applewebkit/.test(t)?"webkit":"presto",c="coast"===e?"coast":"mms"===e?"opera-neon":"";break;case/version|chrome|crios|safari/.test(e):switch(!0){case/c(hrome|rios)/.test(e):n="chrome";break;case"version"===e&&RegExp(s.mobile).test(t):n="builtin";break;default:n="safari"}break;case/msie|rv|iemobile/.test(e):r="ie",n=null;break;case/baidu|yahoo/.test(e):n=e.match(/baidu|yahoo/)[0];break;default:var p=!!e&&e.match(RegExp(s.webview,"i"));r="webkit",p?(-1!==t.indexOf("-android")?n=p[0]+"-adr "+p[0]:-1!==t.indexOf("-ios")&&(n=p[0]+"-ios "+p[0]),l=null):/iemobile|msie/.test(t)?r="ie":/applewebkit/.test(t)&&(/c(hrome|rios)/.test(t)?c="chrome":/version/.test(t)?c+=RegExp(s.mobile).test(t)?" builtin":" safari":c+="safari")}c=/chrome/.test(t)&&!/chrome/.test(c)&&c.length?"chrome":c,c=/^edge$/.test(n)?"":c;var w=n?n.split(" "):null,h=(w?w[0]:r)+l,u=(n||"")+(h?" "+h:"")+(c?" "+c:"")+(r?" "+r:"");u=u.replace(/^\s+|\s+$/g,""),a.getBrowserWithCoreName={origin:n||r,name:h,core:r,addon:c,full:u},a.getBrowserWithCoreName}(),function(){var e=t.match(RegExp(s.platform,"i")),o=null;switch(!0){case e instanceof Array:e=e[0],o=m&&(o=t.match(RegExp(s.bot)))?o[0]:e;break;case RegExp(s.bot).test(t):o=t.match(RegExp(s.bot))[0];break;case/arm/.test(t):o=/windows\s(phone|nt)|iemobile/.test(t)?"wp":/android/.test(t)?"android":"arm";break;case/linux/.test(t):switch(!0){case/cros/.test(t):o="chromeos";break;case/(?=.*windows)(?=.*mxbrowser)|android/.test(t):o="android";break;case/pike/.test(t):o="iphone";break;case/ip(hone|ad|od)/.test(t):o=t.match(/ip(hone|ad|od)/)[0];break;default:o="linux"}break;case/iphone|pike/.test(t):o="iphone";break;case/mac(intel|intosh|ppc68k){0,}/.test(t):o="mac";break;case/x11|hp-ux/.test(t):o=/cros/.test(t)?"chromeos":"unix";break;case/sunos/.test(t):o="solaris";break;case/playstation|psp/.test(t):o="playstation";break;case/(palm|web)os/.test(t):o="palm";break;case/s60|symbian|\\bseries\\b/.test(t):o="symbian";break;case/windows\s(ce|mobile|phone|(nt\s6\.[23];\sarm))|(zune|xbl)wp|iemobile/.test(t):o="wp";break;case/windows\snt\s\d+\.\d+/.test(t):o="windows";break;case/android/.test(t):o="android";break;case/u;\sblackberry|bb|blackberry(\d*)?/.test(t):o="blackberry"}a.getPlatform=o}(),function(){var e;if(m)e=a.getBrowserWithCoreName.origin;else{var o=a.getPlatform;switch(!0){case/ip(hone|ad|od)/.test(o):e="ios";break;case"windows"===o&&/windows\snt/.test(t):e=/tablet/.test(t)?"wt":"windows";break;case"klifd"===o:e="firefoxos";break;case"hpwos"===o:e="hpwebos";break;case/irix/.test(o):e="irix";break;case RegExp(s.android).test(t):e="android";break;case"linux"===o:var r=t.match(RegExp(s.linux));e=r?r[0]:o;break;case RegExp(s.bot).test(o):e=i[o]||(o.match(RegExp(s.botAlias))?o.match(RegExp(s.botAlias))[0]+"Bot":o.match(RegExp(s.bot))[0]);break;default:e=o||"Unknown"}}a.getOSName=e}(),function(){var e;if(m)e=a.getBrowserVersionByName?a.getBrowserVersionByName.full:"";else{var o,s=a.getPlatform,i=a.getOSName;switch(i=i?i.toLowerCase():i,!0){case"wp"===i:o=/windows\s(ce.*(ppc|smartphone|mobile|[0-9]{3}x[0-9]{3})|mobile)|wce;/.test(t)?"windows mobile":"windows phone";break;case"iphone"===s||/iphone/.test(t):o=/ipad/.test(t)?"cpu os":"iphone os";break;case"ipad"===s||/ipad/.test(t):o="cpu os";break;case"ipod"===s||/ipod/.test(t):o="ipod os";break;case"mac"===i:o="mac os x";break;case"chromeos"===i:o="cros i686";break;case/windows|wt/.test(i):o=/windows\snt\s?/.test(t)?"windows nt":"windows";break;case/blackberry/.test(i):o=/u;\sblackberry/.test(t)?"u; blackberry":/bb/.test(t)?"bb":i;break;default:o=s}var r=function(e){if(e){var a=/(\d+(_|\.)?)*/g,o=t.match(e)?t.match(e)[0].length:e.length,s=t.substr(t.search(e)+o,10);return s=(s=(s=(s=+s.charAt(0)?s:s.substr(1)).replace(/(\)|\(|;)/g,"")).match(a)?s.match(a)[0]:"").replace(/_+/g,".")}return null};if(!(e=r(o)))e=r({android:"zhihu"===a.getBrowserWithCoreName.origin?/\sandroid\s/:/system\/android/,"iphone os":"ios","mac os x":"mac os","y!":"y!j-asr"}[o]);e=e||""}a.getOSVersion=e}(),d=a.getBrowserWithCoreName,p=d.origin,a.getBrowserName={name:p,origin:l,classes:d.full},w=(w=a.getBrowserVersionByName)&&+w.full?w.full:"unknown",a.getBrowserFullVersion=w,h=a.getPlatform,u=a.getOSName,g=h,g=m?"bot":t.match(RegExp(s.tv))?"tv":t.match(RegExp(s.mobile))||u.match(RegExp(s.mobile))?"mobile":RegExp(s.mobile).test(h)?"mobile":"desktop",a.getDeviceType=g||null,function(){var e=a.getPlatform,o=a.getDeviceType,i=e;if(m)i="bot";else if("mobile"===o)switch(e){case"bb":i="blackberry";break;default:i=t.match(RegExp(s.android))?t.match(RegExp(s.android))[0]:e}else"tv"===o&&(i=t.match(RegExp(s.tv))?t.match(RegExp(s.tv))[0]:e,i=x(i));a.getDevice=i||null}(),k=r()>=n()?"landscape":"portrait",(f="orientation"in window?window.orientation:window.screen.orientation?window.screen.orientation.angle:null)&&(k=Math.abs(f)/90%2?"portrait":"landscape"),a.orientation=k,v();var E={project:{name:"urBrowser",version:"4.3.8",author:"Kei Cheng",github:"https://github.com/kuletw/urbrowser",website:"https://urbrowser.kule.tw",facebook:"https://www.facebook.com/kule.tw",license:"MIT License"},init:function(){return(c="undefined"==typeof JSON?a:JSON.parse(JSON.stringify(a))).project=this.project.name,c.version=this.project.version,c.author=this.project.author,c.classes=[],c.classes.push(a.getDevice),c.classes.push(a.getBrowserName.classes),a.isInApp&&c.classes.push("inApp"),a.isWebView&&c.classes.push("isWebview"),c.classes=c.classes.join(" "),c},build:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t=t||this.init(),e.id=t.getOSName,e.className=(l?l+" ":"")+t.classes+" "+t.getDeviceType,e.setAttribute("data-browser-name",t.getBrowserName.name),e.setAttribute("data-browser-version",t.getBrowserVersionByName.full),e.setAttribute("data-browser-core",t.getBrowserWithCoreName.core),e.setAttribute("data-os-name",t.getOSName),e.setAttribute("data-os-version",t.getOSVersion),e.setAttribute("data-device-name",t.getDevice),e.setAttribute("data-device-type",t.getDeviceType),e.setAttribute("data-breakpoint",t.getBreakpointRange),e.setAttribute("data-inapp",t.isInApp),e.setAttribute("data-iswebview",t.isWebView),e.setAttribute("data-ub-version",t.version),y(t)},resizing:function(){var t=this.init();v(),e.setAttribute("data-breakpoint",t.getBreakpointRange),y(t)},run:function(){var e;this.build(),void 0!==window.addEventListener&&window.addEventListener("resize",(function(){clearTimeout(e),e=setTimeout((function(){E.resizing(),clearTimeout(e)}),150)}),!1)}};E.run()}(window);
packages/cockpit/ui/src/components/TextEditorToolbar.js
iurimatias/embark-framework
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import {Button, Nav, NavLink} from 'reactstrap'; import classnames from 'classnames'; import FontAwesomeIcon from 'react-fontawesome'; import AddFileModal from '../components/AddFileModal'; import AddFolderModal from '../components/AddFolderModal'; const StatusText = ({message, icon, spin = false}) => ( <span className="ml-2"><FontAwesomeIcon className="mr-1" name={icon} spin={spin}/>{message}</span> ); StatusText.propTypes = { message: PropTypes.string, icon: PropTypes.string, spin: PropTypes.bool }; export const TextEditorToolbarTabs = { Interact: { label: 'Interact', icon: 'bolt' }, Details: { label: 'Details', icon: 'info-circle' }, Debugger: { label: 'Debugger', icon: 'bug' }, Log: { label: 'Log', icon: 'list-alt' }, Browser: { label: 'Browser', icon: 'eye' } }; class TextEditorToolbar extends Component { constructor(props) { super(props); this.state = { successMessage: '' }; this.addFileModal = React.createRef(); this.addFolderModal = React.createRef(); } componentDidUpdate(prevProps) { if (this.props.editorOperationStatus.success !== prevProps.editorOperationStatus.success) { this.setState({successMessage: this.props.editorOperationStatus.success}); setTimeout(() => { this.setState({successMessage: ''}); }, 3000); } } isActiveTab(tab) { return this.props.activeTab === tab; } isBrowserTab(tab) { return tab === TextEditorToolbarTabs.Browser; } isDebuggerTab(tab) { return tab === TextEditorToolbarTabs.Debugger; } renderTab(tab) { return ( <NavLink key={tab.label} className={classnames('btn', { active: this.isActiveTab(tab)})} onClick={() => this.props.toggleAsideTab(tab)}> <FontAwesomeIcon className="mr-2" name={tab.icon} /> {tab.label} </NavLink> ); } render() { return ( <ol className="breadcrumb mb-0"> <li className="breadcrumb-item"> <Button color="success" size="sm" className="mr-1" onClick={() => this.addFileModal.current.toggle()}> <FontAwesomeIcon className="mr-2" name="plus"/> Add File </Button> <AddFileModal theme={this.props.theme} node={{path: this.props.rootDirname}} saveFile={this.props.saveFile} ref={this.addFileModal} /> <Button color="success" size="sm" className="mr-1" onClick={() => this.addFolderModal.current.toggle()}> <FontAwesomeIcon className="mr-2" name="folder-open"/> Add Folder </Button> <AddFolderModal theme={this.props.theme} node={{path: this.props.rootDirname}} saveFolder={this.props.saveFolder} ref={this.addFolderModal} /> <Button color="success" size="sm" className="mr-1" onClick={this.props.save}> <FontAwesomeIcon className="mr-2" name="save"/> Save </Button> <Button color="danger" size="sm" onClick={this.props.remove}> <FontAwesomeIcon className="mr-2" name="trash"/> Delete </Button> {this.state.successMessage && <StatusText message={this.state.successMessage} icon="check"/>} {this.props.editorOperationStatus.loading && <StatusText message="Processing..." icon="spinner" spin={true}/>} {this.props.editorOperationStatus.error && <StatusText message={this.props.editorOperationStatus.error} icon="exclamation-triangle"/>} </li> <li className="breadcrumb-menu"> <Nav className="btn-group"> {this.props.isContract && Object.values(TextEditorToolbarTabs).map(tab => !this.isBrowserTab(tab) && !this.isDebuggerTab(tab) && this.renderTab(tab))} {this.renderTab(TextEditorToolbarTabs.Debugger)} {this.renderTab(TextEditorToolbarTabs.Browser)} </Nav> </li> </ol> ); } } TextEditorToolbar.propTypes = { isContract: PropTypes.bool, theme: PropTypes.string, save: PropTypes.func, saveFile: PropTypes.func, rootDirname: PropTypes.string, saveFolder: PropTypes.func, remove: PropTypes.func, toggleShowHiddenFiles: PropTypes.func, toggleAsideTab: PropTypes.func, activeTab: PropTypes.object, editorOperationStatus: PropTypes.object }; export default TextEditorToolbar;
packages/material-ui-icons/src/LocalHospital.js
dsslimshaddy/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from 'material-ui/SvgIcon'; let LocalHospital = props => <SvgIcon {...props}> <path d="M19 3H5c-1.1 0-1.99.9-1.99 2L3 19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 11h-4v4h-4v-4H6v-4h4V6h4v4h4v4z" /> </SvgIcon>; LocalHospital = pure(LocalHospital); LocalHospital.muiName = 'SvgIcon'; export default LocalHospital;
app/containers/NotFoundPage/index.js
kossel/react-boilerplate
/** * NotFoundPage * * This is the page we show when the user visits a url that doesn't have a route */ import React from 'react'; import { FormattedMessage } from 'react-intl'; import H1 from 'components/H1'; import messages from './messages'; export default function NotFound() { return ( <article> <H1> <FormattedMessage {...messages.header} /> </H1> </article> ); }
ajax/libs/yui/3.10.1/datatable-core/datatable-core-debug.js
rileyjshaw/cdnjs
YUI.add('datatable-core', function (Y, NAME) { /** The core implementation of the `DataTable` and `DataTable.Base` Widgets. @module datatable @submodule datatable-core @since 3.5.0 **/ var INVALID = Y.Attribute.INVALID_VALUE, Lang = Y.Lang, isFunction = Lang.isFunction, isObject = Lang.isObject, isArray = Lang.isArray, isString = Lang.isString, isNumber = Lang.isNumber, toArray = Y.Array, keys = Y.Object.keys, Table; /** _API docs for this extension are included in the DataTable class._ Class extension providing the core API and structure for the DataTable Widget. Use this class extension with Widget or another Base-based superclass to create the basic DataTable model API and composing class structure. @class DataTable.Core @for DataTable @since 3.5.0 **/ Table = Y.namespace('DataTable').Core = function () {}; Table.ATTRS = { /** Columns to include in the rendered table. If omitted, the attributes on the configured `recordType` or the first item in the `data` collection will be used as a source. This attribute takes an array of strings or objects (mixing the two is fine). Each string or object is considered a column to be rendered. Strings are converted to objects, so `columns: ['first', 'last']` becomes `columns: [{ key: 'first' }, { key: 'last' }]`. DataTable.Core only concerns itself with a few properties of columns. These properties are: * `key` - Used to identify the record field/attribute containing content for this column. Also used to create a default Model if no `recordType` or `data` are provided during construction. If `name` is not specified, this is assigned to the `_id` property (with added incrementer if the key is used by multiple columns). * `children` - Traversed to initialize nested column objects * `name` - Used in place of, or in addition to, the `key`. Useful for columns that aren't bound to a field/attribute in the record data. This is assigned to the `_id` property. * `id` - For backward compatibility. Implementers can specify the id of the header cell. This should be avoided, if possible, to avoid the potential for creating DOM elements with duplicate IDs. * `field` - For backward compatibility. Implementers should use `name`. * `_id` - Assigned unique-within-this-instance id for a column. By order of preference, assumes the value of `name`, `key`, `id`, or `_yuid`. This is used by the rendering views as well as feature module as a means to identify a specific column without ambiguity (such as multiple columns using the same `key`. * `_yuid` - Guid stamp assigned to the column object. * `_parent` - Assigned to all child columns, referencing their parent column. @attribute columns @type {Object[]|String[]} @default (from `recordType` ATTRS or first item in the `data`) @since 3.5.0 **/ columns: { // TODO: change to setter to clone input array/objects validator: isArray, setter: '_setColumns', getter: '_getColumns' }, /** Model subclass to use as the `model` for the ModelList stored in the `data` attribute. If not provided, it will try really hard to figure out what to use. The following attempts will be made to set a default value: 1. If the `data` attribute is set with a ModelList instance and its `model` property is set, that will be used. 2. If the `data` attribute is set with a ModelList instance, and its `model` property is unset, but it is populated, the `ATTRS` of the `constructor of the first item will be used. 3. If the `data` attribute is set with a non-empty array, a Model subclass will be generated using the keys of the first item as its `ATTRS` (see the `_createRecordClass` method). 4. If the `columns` attribute is set, a Model subclass will be generated using the columns defined with a `key`. This is least desirable because columns can be duplicated or nested in a way that's not parsable. 5. If neither `data` nor `columns` is set or populated, a change event subscriber will listen for the first to be changed and try all over again. @attribute recordType @type {Function} @default (see description) @since 3.5.0 **/ recordType: { getter: '_getRecordType', setter: '_setRecordType' }, /** The collection of data records to display. This attribute is a pass through to a `data` property, which is a ModelList instance. If this attribute is passed a ModelList or subclass, it will be assigned to the property directly. If an array of objects is passed, a new ModelList will be created using the configured `recordType` as its `model` property and seeded with the array. Retrieving this attribute will return the ModelList stored in the `data` property. @attribute data @type {ModelList|Object[]} @default `new ModelList()` @since 3.5.0 **/ data: { valueFn: '_initData', setter : '_setData', lazyAdd: false }, /** Content for the `<table summary="ATTRIBUTE VALUE HERE">`. Values assigned to this attribute will be HTML escaped for security. @attribute summary @type {String} @default '' (empty string) @since 3.5.0 **/ //summary: {}, /** HTML content of an optional `<caption>` element to appear above the table. Leave this config unset or set to a falsy value to remove the caption. @attribute caption @type HTML @default '' (empty string) @since 3.5.0 **/ //caption: {}, /** Deprecated as of 3.5.0. Passes through to the `data` attribute. WARNING: `get('recordset')` will NOT return a Recordset instance as of 3.5.0. This is a break in backward compatibility. @attribute recordset @type {Object[]|Recordset} @deprecated Use the `data` attribute @since 3.5.0 **/ recordset: { setter: '_setRecordset', getter: '_getRecordset', lazyAdd: false }, /** Deprecated as of 3.5.0. Passes through to the `columns` attribute. WARNING: `get('columnset')` will NOT return a Columnset instance as of 3.5.0. This is a break in backward compatibility. @attribute columnset @type {Object[]} @deprecated Use the `columns` attribute @since 3.5.0 **/ columnset: { setter: '_setColumnset', getter: '_getColumnset', lazyAdd: false } }; Y.mix(Table.prototype, { // -- Instance properties ------------------------------------------------- /** The ModelList that manages the table's data. @property data @type {ModelList} @default undefined (initially unset) @since 3.5.0 **/ //data: null, // -- Public methods ------------------------------------------------------ /** Gets the column configuration object for the given key, name, or index. For nested columns, `name` can be an array of indexes, each identifying the index of that column in the respective parent's "children" array. If you pass a column object, it will be returned. For columns with keys, you can also fetch the column with `instance.get('columns.foo')`. @method getColumn @param {String|Number|Number[]} name Key, "name", index, or index array to identify the column @return {Object} the column configuration object @since 3.5.0 **/ getColumn: function (name) { var col, columns, i, len, cols; if (isObject(name) && !isArray(name)) { // TODO: support getting a column from a DOM node - this will cross // the line into the View logic, so it should be relayed // Assume an object passed in is already a column def col = name; } else { col = this.get('columns.' + name); } if (col) { return col; } columns = this.get('columns'); if (isNumber(name) || isArray(name)) { name = toArray(name); cols = columns; for (i = 0, len = name.length - 1; cols && i < len; ++i) { cols = cols[name[i]] && cols[name[i]].children; } return (cols && cols[name[i]]) || null; } return null; }, /** Returns the Model associated to the record `id`, `clientId`, or index (not row index). If none of those yield a Model from the `data` ModelList, the arguments will be passed to the `view` instance's `getRecord` method if it has one. If no Model can be found, `null` is returned. @method getRecord @param {Number|String|Node} seed Record `id`, `clientId`, index, Node, or identifier for a row or child element @return {Model} @since 3.5.0 **/ getRecord: function (seed) { var record = this.data.getById(seed) || this.data.getByClientId(seed); if (!record) { if (isNumber(seed)) { record = this.data.item(seed); } // TODO: this should be split out to base somehow if (!record && this.view && this.view.getRecord) { record = this.view.getRecord.apply(this.view, arguments); } } return record || null; }, // -- Protected and private properties and methods ------------------------ /** This tells `Y.Base` that it should create ad-hoc attributes for config properties passed to DataTable's constructor. This is useful for setting configurations on the DataTable that are intended for the rendering View(s). @property _allowAdHocAttrs @type Boolean @default true @protected @since 3.6.0 **/ _allowAdHocAttrs: true, /** A map of column key to column configuration objects parsed from the `columns` attribute. @property _columnMap @type {Object} @default undefined (initially unset) @protected @since 3.5.0 **/ //_columnMap: null, /** The Node instance of the table containing the data rows. This is set when the table is rendered. It may also be set by progressive enhancement, though this extension does not provide the logic to parse from source. @property _tableNode @type {Node} @default undefined (initially unset) @protected @since 3.5.0 **/ //_tableNode: null, /** Updates the `_columnMap` property in response to changes in the `columns` attribute. @method _afterColumnsChange @param {EventFacade} e The `columnsChange` event object @protected @since 3.5.0 **/ _afterColumnsChange: function (e) { this._setColumnMap(e.newVal); }, /** Updates the `modelList` attributes of the rendered views in response to the `data` attribute being assigned a new ModelList. @method _afterDataChange @param {EventFacade} e the `dataChange` event @protected @since 3.5.0 **/ _afterDataChange: function (e) { var modelList = e.newVal; this.data = e.newVal; if (!this.get('columns') && modelList.size()) { // TODO: this will cause a re-render twice because the Views are // subscribed to columnsChange this._initColumns(); } }, /** Assigns to the new recordType as the model for the data ModelList @method _afterRecordTypeChange @param {EventFacade} e recordTypeChange event @protected @since 3.6.0 **/ _afterRecordTypeChange: function (e) { var data = this.data.toJSON(); this.data.model = e.newVal; this.data.reset(data); if (!this.get('columns') && data) { if (data.length) { this._initColumns(); } else { this.set('columns', keys(e.newVal.ATTRS)); } } }, /** Creates a Model subclass from an array of attribute names or an object of attribute definitions. This is used to generate a class suitable to represent the data passed to the `data` attribute if no `recordType` is set. @method _createRecordClass @param {String[]|Object} attrs Names assigned to the Model subclass's `ATTRS` or its entire `ATTRS` definition object @return {Model} @protected @since 3.5.0 **/ _createRecordClass: function (attrs) { var ATTRS, i, len; if (isArray(attrs)) { ATTRS = {}; for (i = 0, len = attrs.length; i < len; ++i) { ATTRS[attrs[i]] = {}; } } else if (isObject(attrs)) { ATTRS = attrs; } return Y.Base.create('record', Y.Model, [], null, { ATTRS: ATTRS }); }, /** Tears down the instance. @method destructor @protected @since 3.6.0 **/ destructor: function () { new Y.EventHandle(Y.Object.values(this._eventHandles)).detach(); }, /** The getter for the `columns` attribute. Returns the array of column configuration objects if `instance.get('columns')` is called, or the specific column object if `instance.get('columns.columnKey')` is called. @method _getColumns @param {Object[]} columns The full array of column objects @param {String} name The attribute name requested (e.g. 'columns' or 'columns.foo'); @protected @since 3.5.0 **/ _getColumns: function (columns, name) { // Workaround for an attribute oddity (ticket #2529254) // getter is expected to return an object if get('columns.foo') is called. // Note 'columns.' is 8 characters return name.length > 8 ? this._columnMap : columns; }, /** Relays the `get()` request for the deprecated `columnset` attribute to the `columns` attribute. THIS BREAKS BACKWARD COMPATIBILITY. 3.4.1 and prior implementations will expect a Columnset instance returned from `get('columnset')`. @method _getColumnset @param {Object} ignored The current value stored in the `columnset` state @param {String} name The attribute name requested (e.g. 'columnset' or 'columnset.foo'); @deprecated This will be removed with the `columnset` attribute in a future version. @protected @since 3.5.0 **/ _getColumnset: function (_, name) { return this.get(name.replace(/^columnset/, 'columns')); }, /** Returns the Model class of the instance's `data` attribute ModelList. If not set, returns the explicitly configured value. @method _getRecordType @param {Model} val The currently configured value @return {Model} **/ _getRecordType: function (val) { // Prefer the value stored in the attribute because the attribute // change event defaultFn sets e.newVal = this.get('recordType') // before notifying the after() subs. But if this getter returns // this.data.model, then after() subs would get e.newVal === previous // model before _afterRecordTypeChange can set // this.data.model = e.newVal return val || (this.data && this.data.model); }, /** Initializes the `_columnMap` property from the configured `columns` attribute. If `columns` is not set, but there are records in the `data` ModelList, use `ATTRS` of that class. @method _initColumns @protected @since 3.5.0 **/ _initColumns: function () { var columns = this.get('columns') || [], item; // Default column definition from the configured recordType if (!columns.length && this.data.size()) { // TODO: merge superclass attributes up to Model? item = this.data.item(0); if (item.toJSON) { item = item.toJSON(); } this.set('columns', keys(item)); } this._setColumnMap(columns); }, /** Sets up the change event subscriptions to maintain internal state. @method _initCoreEvents @protected @since 3.6.0 **/ _initCoreEvents: function () { this._eventHandles.coreAttrChanges = this.after({ columnsChange : Y.bind('_afterColumnsChange', this), recordTypeChange: Y.bind('_afterRecordTypeChange', this), dataChange : Y.bind('_afterDataChange', this) }); }, /** Defaults the `data` attribute to an empty ModelList if not set during construction. Uses the configured `recordType` for the ModelList's `model` proeprty if set. @method _initData @protected @return {ModelList} @since 3.6.0 **/ _initData: function () { var recordType = this.get('recordType'), // TODO: LazyModelList if recordType doesn't have complex ATTRS modelList = new Y.ModelList(); if (recordType) { modelList.model = recordType; } return modelList; }, /** Initializes the instance's `data` property from the value of the `data` attribute. If the attribute value is a ModelList, it is assigned directly to `this.data`. If it is an array, a ModelList is created, its `model` property is set to the configured `recordType` class, and it is seeded with the array data. This ModelList is then assigned to `this.data`. @method _initDataProperty @param {Array|ModelList|ArrayList} data Collection of data to populate the DataTable @protected @since 3.6.0 **/ _initDataProperty: function (data) { var recordType; if (!this.data) { recordType = this.get('recordType'); if (data && data.each && data.toJSON) { this.data = data; if (recordType) { this.data.model = recordType; } } else { // TODO: customize the ModelList or read the ModelList class // from a configuration option? this.data = new Y.ModelList(); if (recordType) { this.data.model = recordType; } } // TODO: Replace this with an event relay for specific events. // Using bubbling causes subscription conflicts with the models' // aggregated change event and 'change' events from DOM elements // inside the table (via Widget UI event). this.data.addTarget(this); } }, /** Initializes the columns, `recordType` and data ModelList. @method initializer @param {Object} config Configuration object passed to constructor @protected @since 3.5.0 **/ initializer: function (config) { var data = config.data, columns = config.columns, recordType; // Referencing config.data to allow _setData to be more stringent // about its behavior this._initDataProperty(data); // Default columns from recordType ATTRS if recordType is supplied at // construction. If no recordType is supplied, but the data is // supplied as a non-empty array, use the keys of the first item // as the columns. if (!columns) { recordType = (config.recordType || config.data === this.data) && this.get('recordType'); if (recordType) { columns = keys(recordType.ATTRS); } else if (isArray(data) && data.length) { columns = keys(data[0]); } if (columns) { this.set('columns', columns); } } this._initColumns(); this._eventHandles = {}; this._initCoreEvents(); }, /** Iterates the array of column configurations to capture all columns with a `key` property. An map is built with column keys as the property name and the corresponding column object as the associated value. This map is then assigned to the instance's `_columnMap` property. @method _setColumnMap @param {Object[]|String[]} columns The array of column config objects @protected @since 3.6.0 **/ _setColumnMap: function (columns) { var map = {}; function process(cols) { var i, len, col, key; for (i = 0, len = cols.length; i < len; ++i) { col = cols[i]; key = col.key; // First in wins for multiple columns with the same key // because the first call to genId (in _setColumns) will // return the same key, which will then be overwritten by the // subsequent same-keyed column. So table.getColumn(key) would // return the last same-keyed column. if (key && !map[key]) { map[key] = col; } //TODO: named columns can conflict with keyed columns map[col._id] = col; if (col.children) { process(col.children); } } } process(columns); this._columnMap = map; }, /** Translates string columns into objects with that string as the value of its `key` property. All columns are assigned a `_yuid` stamp and `_id` property corresponding to the column's configured `name` or `key` property with any spaces replaced with dashes. If the same `name` or `key` appears in multiple columns, subsequent appearances will have their `_id` appended with an incrementing number (e.g. if column "foo" is included in the `columns` attribute twice, the first will get `_id` of "foo", and the second an `_id` of "foo1"). Columns that are children of other columns will have the `_parent` property added, assigned the column object to which they belong. @method _setColumns @param {null|Object[]|String[]} val Array of config objects or strings @return {null|Object[]} @protected **/ _setColumns: function (val) { var keys = {}, known = [], knownCopies = [], arrayIndex = Y.Array.indexOf; function copyObj(o) { var copy = {}, key, val, i; known.push(o); knownCopies.push(copy); for (key in o) { if (o.hasOwnProperty(key)) { val = o[key]; if (isArray(val)) { copy[key] = val.slice(); } else if (isObject(val, true)) { i = arrayIndex(val, known); copy[key] = i === -1 ? copyObj(val) : knownCopies[i]; } else { copy[key] = o[key]; } } } return copy; } function genId(name) { // Sanitize the name for use in generated CSS classes. // TODO: is there more to do for other uses of _id? name = name.replace(/\s+/, '-'); if (keys[name]) { name += (keys[name]++); } else { keys[name] = 1; } return name; } function process(cols, parent) { var columns = [], i, len, col, yuid; for (i = 0, len = cols.length; i < len; ++i) { columns[i] = // chained assignment col = isString(cols[i]) ? { key: cols[i] } : copyObj(cols[i]); yuid = Y.stamp(col); // For backward compatibility if (!col.id) { // Implementers can shoot themselves in the foot by setting // this config property to a non-unique value col.id = yuid; } if (col.field) { // Field is now known as "name" to avoid confusion with data // fields or schema.resultFields col.name = col.field; } if (parent) { col._parent = parent; } else { delete col._parent; } // Unique id based on the column's configured name or key, // falling back to the yuid. Duplicates will have a counter // added to the end. col._id = genId(col.name || col.key || col.id); if (isArray(col.children)) { col.children = process(col.children, col); } } return columns; } return val && process(val); }, /** Relays attribute assignments of the deprecated `columnset` attribute to the `columns` attribute. If a Columnset is object is passed, its basic object structure is mined. @method _setColumnset @param {Array|Columnset} val The columnset value to relay @deprecated This will be removed with the deprecated `columnset` attribute in a later version. @protected @since 3.5.0 **/ _setColumnset: function (val) { this.set('columns', val); return isArray(val) ? val : INVALID; }, /** Accepts an object with `each` and `getAttrs` (preferably a ModelList or subclass) or an array of data objects. If an array is passes, it will create a ModelList to wrap the data. In doing so, it will set the created ModelList's `model` property to the class in the `recordType` attribute, which will be defaulted if not yet set. If the `data` property is already set with a ModelList, passing an array as the value will call the ModelList's `reset()` method with that array rather than replacing the stored ModelList wholesale. Any non-ModelList-ish and non-array value is invalid. @method _setData @protected @since 3.5.0 **/ _setData: function (val) { if (val === null) { val = []; } if (isArray(val)) { this._initDataProperty(); // silent to prevent subscribers to both reset and dataChange // from reacting to the change twice. // TODO: would it be better to return INVALID to silence the // dataChange event, or even allow both events? this.data.reset(val, { silent: true }); // Return the instance ModelList to avoid storing unprocessed // data in the state and their vivified Model representations in // the instance's data property. Decreases memory consumption. val = this.data; } else if (!val || !val.each || !val.toJSON) { // ModelList/ArrayList duck typing val = INVALID; } return val; }, /** Relays the value assigned to the deprecated `recordset` attribute to the `data` attribute. If a Recordset instance is passed, the raw object data will be culled from it. @method _setRecordset @param {Object[]|Recordset} val The recordset value to relay @deprecated This will be removed with the deprecated `recordset` attribute in a later version. @protected @since 3.5.0 **/ _setRecordset: function (val) { var data; if (val && Y.Recordset && val instanceof Y.Recordset) { data = []; val.each(function (record) { data.push(record.get('data')); }); val = data; } this.set('data', val); return val; }, /** Accepts a Base subclass (preferably a Model subclass). Alternately, it will generate a custom Model subclass from an array of attribute names or an object defining attributes and their respective configurations (it is assigned as the `ATTRS` of the new class). Any other value is invalid. @method _setRecordType @param {Function|String[]|Object} val The Model subclass, array of attribute names, or the `ATTRS` definition for a custom model subclass @return {Function} A Base/Model subclass @protected @since 3.5.0 **/ _setRecordType: function (val) { var modelClass; // Duck type based on known/likely consumed APIs if (isFunction(val) && val.prototype.toJSON && val.prototype.setAttrs) { modelClass = val; } else if (isObject(val)) { modelClass = this._createRecordClass(val); } return modelClass || INVALID; } }); }, '@VERSION@', {"requires": ["escape", "model-list", "node-event-delegate"]});
app/javascript/mastodon/features/ui/components/__tests__/column-test.js
ikuradon/mastodon
import { render, fireEvent, screen } from '@testing-library/react'; import React from 'react'; import Column from '../column'; describe('<Column />', () => { describe('<ColumnHeader /> click handler', () => { it('runs the scroll animation if the column contains scrollable content', () => { const scrollToMock = jest.fn(); const { container } = render( <Column heading='notifications'> <div className='scrollable' /> </Column>, ); container.querySelector('.scrollable').scrollTo = scrollToMock; fireEvent.click(screen.getByText('notifications')); expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 }); }); it('does not try to scroll if there is no scrollable content', () => { render(<Column heading='notifications' />); fireEvent.click(screen.getByText('notifications')); }); }); });
common/routes/Home/components/Home.js
jhabdas/12roads
import React from 'react' import { StyleSheet, css } from 'aphrodite' import data from '../data' // This is a static page. It uses an array to hold data about the resources // and maintain DRY const Home = (props) => ( <div> <h2 className={css(styles.header)}>About</h2> <p className={css(styles.lead)}> This is an example react application (master-detail feed) with isomorphic rendering, async react-router routes, async redux reducers, async data fetching, and code-splitting. </p> <h2 className={css(styles.header)}>Motivation</h2> <p className={css(styles.lead)}> The file size of isomorphic React apps can quickly get out of hand. Many isomorphic starter kits look awesome to begin with but yield a several megabyte javascript file for the client to download. This project aims to demonstrate some possible solutions. </p> <h2 className={css(styles.header)}>Under the Hood</h2> <ul className={css(styles.list)}> {data.map((item, i) => ( <li key={i}> <h3><a className={css(styles.link)} href={item.link} target='_blank'>{item.resource}</a></h3> <p className={css(styles.body)}>{item.description}</p> </li> ))} </ul> </div> ) const styles = StyleSheet.create({ header: { fontSize: 28, lineHeight: '1.2', margin: '0 0 1.5rem' }, lead: { fontSize: 18, lineHeight: '1.5', margin: '0 0 1.5rem', color: '#555' }, body: { fontSize: '1rem', lineHeight: '1.5', margin: '0 0 1.5rem', color: '#555' }, list: { fontSize: '1rem', listStyle: 'none', padding: 0 }, link: { display: 'block', fontSize: '1.25rem', margin: '0 0 .5rem', lineHeight: '1.5', fontWeight: 'bold', color: '#08c', opacity: 1, transition: '.2s opacity ease', textDecoration: 'none', ':hover': { opacity: 0.5, textDecoration: 'none' } } }) export default Home
ui/js/dfv/src/admin/edit-pod/save-status-message.js
pods-framework/pods
import React from 'react'; import { __ } from '@wordpress/i18n'; import { withSelect } from '@wordpress/data'; import { compose } from '@wordpress/compose'; import { SAVE_STATUSES } from 'dfv/src/store/constants'; export const SaveStatusMessage = ( { saveStatus, saveMessage } ) => { switch ( saveStatus ) { case SAVE_STATUSES.SAVING: return ( <div id="message" className="notice notice-warning"> <p><b>{ __( 'Saving Pod…', 'pods' ) }</b></p> </div> ); case SAVE_STATUSES.SAVE_SUCCESS: return ( <div id="message" className="updated fade"> <p> <strong>{ __( 'Success!', 'pods' ) }</strong> { '\u00A0' /* &nbsp; */ } { __( 'Pod saved successfully.', 'pods' ) } </p> </div> ); case SAVE_STATUSES.SAVE_ERROR: return ( <div id="message" className="notice error"> <p><b>{ !! saveMessage ? saveMessage : __( 'Save Error', 'pods' ) }</b></p> </div> ); default: return null; } }; export default compose( [ withSelect( ( select, ownProps ) => { const { storeKey } = ownProps; return { saveStatus: select( storeKey ).getSaveStatus(), saveMessage: select( storeKey ).getSaveMessage(), }; } ), ] )( SaveStatusMessage );
renderer/components/Login/LoginNotAllowed.js
LN-Zap/zap-desktop
import React from 'react' import PropTypes from 'prop-types' import { Flex, Box } from 'rebass/styled-components' import { FormattedMessage } from 'react-intl' import Delete from 'components/Icon/Delete' import { Heading, Text, Card, CenteredContent } from 'components/UI' import messages from './messages' const LoginNotAllowed = ({ platform = window.Zap.getPlatform() }) => { const descMsg = messages[`error_desc_${platform}`] || messages.error_desc_linux return ( <CenteredContent> <Card px={7} py={7} width={640}> <Flex alignItems="center" flexDirection="column" mb={4}> <Box color="superRed" mb={2}> <Delete height={72} width={72} /> </Box> <Heading.H1> <FormattedMessage {...messages.header} /> </Heading.H1> <Text color="gray" mt={3} textAlign="left"> <FormattedMessage {...descMsg} /> </Text> </Flex> </Card> </CenteredContent> ) } LoginNotAllowed.propTypes = { platform: PropTypes.string, } export default LoginNotAllowed
stories/Calendar.js
intljusticemission/react-big-calendar
import { storiesOf } from '@storybook/react' import { action } from '@storybook/addon-actions' import moment from 'moment' import React from 'react' import '../src/sass/styles.scss' import '../src/addons/dragAndDrop/styles.scss' import demoEvents from '../examples/events' import createEvents from './helpers/createEvents' import customComponents from './helpers/customComponents' import { events, Views, Calendar } from './helpers' storiesOf('Big Calendar', module) .add('demo', () => ( <Calendar popup popupOffset={{ x: -10, y: -20 }} events={demoEvents} onSelectEvent={action('event selected')} defaultDate={new Date(2015, 3, 1)} /> )) .add('default view', () => { return ( <Calendar defaultView={Views.WEEK} min={moment('12:00am', 'h:mma').toDate()} max={moment('11:59pm', 'h:mma').toDate()} events={events} onSelectEvent={action('event selected')} defaultDate={new Date()} /> ) }) .add('selectable', () => { return ( <Calendar selectable defaultView={Views.WEEK} min={moment('12:00am', 'h:mma').toDate()} max={moment('11:59pm', 'h:mma').toDate()} events={events} onSelectEvent={action('event selected')} onSelectSlot={action('slot selected')} defaultDate={new Date()} /> ) }) .add('add custom date header', () => { return ( <Calendar defaultView={Views.MONTH} events={events} components={{ month: { dateHeader: ({ label }) => ( <span>{label} - Custom date header</span> ), }, }} /> ) }) .add('complex day view layout', () => { return ( <Calendar defaultDate={new Date()} defaultView={Views.DAY} events={createEvents(1)} step={30} /> ) }) .add('multi-day', () => { return ( /* should display all three events */ <Calendar showMultiDayTimes defaultDate={new Date(2016, 11, 4)} max={moment() .endOf('day') .add(-1, 'hours') .toDate()} events={[ { title: 'start of the week', start: new Date(2016, 11, 4, 15), end: new Date(2016, 11, 5, 3), }, { title: 'single day longer than max', start: new Date(2016, 11, 4, 15), end: new Date(2016, 11, 4, 23, 30), }, { title: 'end of the week', start: new Date(2016, 11, 3), end: new Date(2016, 11, 3), }, { title: 'middle', start: new Date(2016, 11, 6), end: new Date(2016, 11, 6), }, ]} /> ) }) .add('agenda view - with length prop', () => { return ( /* should display as title toolbar (from now to now + 14 days) */ <Calendar defaultView={Views.AGENDA} events={events} length={14} /> ) }) .add('custom now is the first of the month', () => { const customNow = () => { let now = new Date() now.setDate(1) return now } return ( <Calendar defaultView={Views.WEEK} getNow={customNow} min={moment('12:00am', 'h:mma').toDate()} max={moment('11:59pm', 'h:mma').toDate()} events={events} onSelectEvent={action('event selected')} defaultDate={new Date()} /> ) }) .add('custom time gutter header', () => { const TimeGutter = () => <p>Custom gutter text</p> return ( <Calendar popup events={demoEvents} onSelectEvent={action('event selected')} defaultDate={new Date(2015, 3, 1)} defaultView="week" views={['week', 'day']} components={{ timeGutterHeader: TimeGutter, }} /> ) }) .add('add custom dateCellWrapper', () => { return ( <Calendar defaultView={Views.MONTH} events={events} components={{ dateCellWrapper: customComponents.dateCellWrapper, }} /> ) }) .add('add custom timeSlotWrapper', () => { return ( <Calendar defaultView={Views.DAY} events={events} components={{ timeSlotWrapper: customComponents.timeSlotWrapper, }} /> ) }) .add('add custom eventWrapper', () => { return ( <Calendar defaultView={Views.DAY} events={events} components={{ eventWrapper: customComponents.eventWrapper, }} /> ) }) .add('add custom no agenda events label', () => { return ( <Calendar defaultView={Views.AGENDA} events={events} messages={{ noEventsInRange: 'There are no special events in this range [test message]', }} /> ) }) .add('add custom timeSlotWrapper', () => { return ( <Calendar defaultView={Views.WEEK} events={events} components={{ timeSlotWrapper: customComponents.timeSlotWrapper, }} /> ) })
src/charts/base-chart.js
WaldoJeffers/react-dc
import React from 'react' export default class BaseChart extends React.Component{ render(){ return <div ref={chart => this.chart = chart}></div> } }
fields/types/textarray/TextArrayFilter.js
benkroeger/keystone
import React from 'react'; import { findDOMNode } from 'react-dom'; import { FormField, FormInput, FormSelect, } from '../../../admin/client/App/elemental'; const MODE_OPTIONS = [ { label: 'Contains', value: 'contains' }, { label: 'Exactly', value: 'exactly' }, { label: 'Begins with', value: 'beginsWith' }, { label: 'Ends with', value: 'endsWith' }, ]; const PRESENCE_OPTIONS = [ { label: 'At least one element', value: 'some' }, { label: 'No element', value: 'none' }, ]; function getDefaultValue () { return { mode: MODE_OPTIONS[0].value, presence: PRESENCE_OPTIONS[0].value, value: '', }; } var TextArrayFilter = React.createClass({ propTypes: { filter: React.PropTypes.shape({ mode: React.PropTypes.oneOf(MODE_OPTIONS.map(i => i.value)), presence: React.PropTypes.oneOf(PRESENCE_OPTIONS.map(i => i.value)), value: React.PropTypes.string, }), }, statics: { getDefaultValue: getDefaultValue, }, getDefaultProps () { return { filter: getDefaultValue(), }; }, updateFilter (value) { this.props.onChange({ ...this.props.filter, ...value }); }, selectMode (e) { const mode = e.target.value; this.updateFilter({ mode }); findDOMNode(this.refs.focusTarget).focus(); }, selectPresence (e) { const presence = e.target.value; this.updateFilter({ presence }); findDOMNode(this.refs.focusTarget).focus(); }, updateValue (e) { this.updateFilter({ value: e.target.value }); }, render () { const { filter } = this.props; const mode = MODE_OPTIONS.filter(i => i.value === filter.mode)[0]; const presence = PRESENCE_OPTIONS.filter(i => i.value === filter.presence)[0]; const beingVerb = mode.value === 'exactly' ? ' is ' : ' '; const placeholder = presence.label + beingVerb + mode.label.toLowerCase() + '...'; return ( <div> <FormField> <FormSelect onChange={this.selectPresence} options={PRESENCE_OPTIONS} value={presence.value} /> </FormField> <FormField> <FormSelect onChange={this.selectMode} options={MODE_OPTIONS} value={mode.value} /> </FormField> <FormInput autoFocus onChange={this.updateValue} placeholder={placeholder} ref="focusTarget" value={this.props.filter.value} /> </div> ); }, }); module.exports = TextArrayFilter;
CoreCRM/wwwroot/js/User.js
holmescn/CoreCRM
webpackJsonp([4],{ /***/ 0: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(580); /***/ }), /***/ 11: /***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var React = __webpack_require__(1); var factory = __webpack_require__(63); // Hack to grab NoopUpdateQueue from isomorphic React var ReactNoopUpdateQueue = new React.Component().updater; module.exports = factory( React.Component, React.isValidElement, ReactNoopUpdateQueue ); /***/ }), /***/ 17: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.noop = noop; exports.getKeyFromChildrenIndex = getKeyFromChildrenIndex; exports.loopMenuItem = loopMenuItem; exports.loopMenuItemRecusively = loopMenuItemRecusively; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function noop() {} function getKeyFromChildrenIndex(child, menuEventKey, index) { var prefix = menuEventKey || ''; return child.key || prefix + 'item_' + index; } function loopMenuItem(children, cb) { var index = -1; _react2["default"].Children.forEach(children, function (c) { index++; if (c && c.type && c.type.isMenuItemGroup) { _react2["default"].Children.forEach(c.props.children, function (c2) { index++; cb(c2, index); }); } else { cb(c, index); } }); } function loopMenuItemRecusively(children, keys, ret) { if (!children || ret.find) { return; } _react2["default"].Children.forEach(children, function (c) { if (ret.find) { return; } if (c) { var construt = c.type; if (!construt || !(construt.isSubMenu || construt.isMenuItem || construt.isMenuItemGroup)) { return; } if (keys.indexOf(c.key) !== -1) { ret.find = true; } else if (c.props.children) { loopMenuItemRecusively(c.props.children, keys, ret); } } }); } /***/ }), /***/ 18: /***/ (function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * @ignore * some key-codes definition and utils from closure-library * @author yiminghe@gmail.com */ var KeyCode = { /** * MAC_ENTER */ MAC_ENTER: 3, /** * BACKSPACE */ BACKSPACE: 8, /** * TAB */ TAB: 9, /** * NUMLOCK on FF/Safari Mac */ NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac /** * ENTER */ ENTER: 13, /** * SHIFT */ SHIFT: 16, /** * CTRL */ CTRL: 17, /** * ALT */ ALT: 18, /** * PAUSE */ PAUSE: 19, /** * CAPS_LOCK */ CAPS_LOCK: 20, /** * ESC */ ESC: 27, /** * SPACE */ SPACE: 32, /** * PAGE_UP */ PAGE_UP: 33, // also NUM_NORTH_EAST /** * PAGE_DOWN */ PAGE_DOWN: 34, // also NUM_SOUTH_EAST /** * END */ END: 35, // also NUM_SOUTH_WEST /** * HOME */ HOME: 36, // also NUM_NORTH_WEST /** * LEFT */ LEFT: 37, // also NUM_WEST /** * UP */ UP: 38, // also NUM_NORTH /** * RIGHT */ RIGHT: 39, // also NUM_EAST /** * DOWN */ DOWN: 40, // also NUM_SOUTH /** * PRINT_SCREEN */ PRINT_SCREEN: 44, /** * INSERT */ INSERT: 45, // also NUM_INSERT /** * DELETE */ DELETE: 46, // also NUM_DELETE /** * ZERO */ ZERO: 48, /** * ONE */ ONE: 49, /** * TWO */ TWO: 50, /** * THREE */ THREE: 51, /** * FOUR */ FOUR: 52, /** * FIVE */ FIVE: 53, /** * SIX */ SIX: 54, /** * SEVEN */ SEVEN: 55, /** * EIGHT */ EIGHT: 56, /** * NINE */ NINE: 57, /** * QUESTION_MARK */ QUESTION_MARK: 63, // needs localization /** * A */ A: 65, /** * B */ B: 66, /** * C */ C: 67, /** * D */ D: 68, /** * E */ E: 69, /** * F */ F: 70, /** * G */ G: 71, /** * H */ H: 72, /** * I */ I: 73, /** * J */ J: 74, /** * K */ K: 75, /** * L */ L: 76, /** * M */ M: 77, /** * N */ N: 78, /** * O */ O: 79, /** * P */ P: 80, /** * Q */ Q: 81, /** * R */ R: 82, /** * S */ S: 83, /** * T */ T: 84, /** * U */ U: 85, /** * V */ V: 86, /** * W */ W: 87, /** * X */ X: 88, /** * Y */ Y: 89, /** * Z */ Z: 90, /** * META */ META: 91, // WIN_KEY_LEFT /** * WIN_KEY_RIGHT */ WIN_KEY_RIGHT: 92, /** * CONTEXT_MENU */ CONTEXT_MENU: 93, /** * NUM_ZERO */ NUM_ZERO: 96, /** * NUM_ONE */ NUM_ONE: 97, /** * NUM_TWO */ NUM_TWO: 98, /** * NUM_THREE */ NUM_THREE: 99, /** * NUM_FOUR */ NUM_FOUR: 100, /** * NUM_FIVE */ NUM_FIVE: 101, /** * NUM_SIX */ NUM_SIX: 102, /** * NUM_SEVEN */ NUM_SEVEN: 103, /** * NUM_EIGHT */ NUM_EIGHT: 104, /** * NUM_NINE */ NUM_NINE: 105, /** * NUM_MULTIPLY */ NUM_MULTIPLY: 106, /** * NUM_PLUS */ NUM_PLUS: 107, /** * NUM_MINUS */ NUM_MINUS: 109, /** * NUM_PERIOD */ NUM_PERIOD: 110, /** * NUM_DIVISION */ NUM_DIVISION: 111, /** * F1 */ F1: 112, /** * F2 */ F2: 113, /** * F3 */ F3: 114, /** * F4 */ F4: 115, /** * F5 */ F5: 116, /** * F6 */ F6: 117, /** * F7 */ F7: 118, /** * F8 */ F8: 119, /** * F9 */ F9: 120, /** * F10 */ F10: 121, /** * F11 */ F11: 122, /** * F12 */ F12: 123, /** * NUMLOCK */ NUMLOCK: 144, /** * SEMICOLON */ SEMICOLON: 186, // needs localization /** * DASH */ DASH: 189, // needs localization /** * EQUALS */ EQUALS: 187, // needs localization /** * COMMA */ COMMA: 188, // needs localization /** * PERIOD */ PERIOD: 190, // needs localization /** * SLASH */ SLASH: 191, // needs localization /** * APOSTROPHE */ APOSTROPHE: 192, // needs localization /** * SINGLE_QUOTE */ SINGLE_QUOTE: 222, // needs localization /** * OPEN_SQUARE_BRACKET */ OPEN_SQUARE_BRACKET: 219, // needs localization /** * BACKSLASH */ BACKSLASH: 220, // needs localization /** * CLOSE_SQUARE_BRACKET */ CLOSE_SQUARE_BRACKET: 221, // needs localization /** * WIN_KEY */ WIN_KEY: 224, /** * MAC_FF_META */ MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 /** * WIN_IME */ WIN_IME: 229 }; /* whether text and modified key is entered at the same time. */ KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) { var keyCode = e.keyCode; if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { return false; } // The following keys are quite harmless, even in combination with // CTRL, ALT or SHIFT. switch (keyCode) { case KeyCode.ALT: case KeyCode.CAPS_LOCK: case KeyCode.CONTEXT_MENU: case KeyCode.CTRL: case KeyCode.DOWN: case KeyCode.END: case KeyCode.ESC: case KeyCode.HOME: case KeyCode.INSERT: case KeyCode.LEFT: case KeyCode.MAC_FF_META: case KeyCode.META: case KeyCode.NUMLOCK: case KeyCode.NUM_CENTER: case KeyCode.PAGE_DOWN: case KeyCode.PAGE_UP: case KeyCode.PAUSE: case KeyCode.PRINT_SCREEN: case KeyCode.RIGHT: case KeyCode.SHIFT: case KeyCode.UP: case KeyCode.WIN_KEY: case KeyCode.WIN_KEY_RIGHT: return false; default: return true; } }; /* whether character is entered. */ KeyCode.isCharacterKey = function isCharacterKey(keyCode) { if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { return true; } if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { return true; } if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { return true; } // Safari sends zero key code for non-latin characters. if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { return true; } switch (keyCode) { case KeyCode.SPACE: case KeyCode.QUESTION_MARK: case KeyCode.NUM_PLUS: case KeyCode.NUM_MINUS: case KeyCode.NUM_PERIOD: case KeyCode.NUM_DIVISION: case KeyCode.SEMICOLON: case KeyCode.DASH: case KeyCode.EQUALS: case KeyCode.COMMA: case KeyCode.PERIOD: case KeyCode.SLASH: case KeyCode.APOSTROPHE: case KeyCode.SINGLE_QUOTE: case KeyCode.OPEN_SQUARE_BRACKET: case KeyCode.BACKSLASH: case KeyCode.CLOSE_SQUARE_BRACKET: return true; default: return false; } }; exports["default"] = KeyCode; module.exports = exports['default']; /***/ }), /***/ 30: /***/ (function(module, exports) { module.exports = function(arr, obj){ if (arr.indexOf) return arr.indexOf(obj); for (var i = 0; i < arr.length; ++i) { if (arr[i] === obj) return i; } return -1; }; /***/ }), /***/ 31: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _Event = __webpack_require__(64); var _Event2 = _interopRequireDefault(_Event); var _componentClasses = __webpack_require__(60); var _componentClasses2 = _interopRequireDefault(_componentClasses); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0; var capitalPrefixes = ['Webkit', 'Moz', 'O', // ms is special .... ! 'ms']; var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; function getStyleProperty(node, name) { // old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle var style = window.getComputedStyle(node, null); var ret = ''; for (var i = 0; i < prefixes.length; i++) { ret = style.getPropertyValue(prefixes[i] + name); if (ret) { break; } } return ret; } function fixBrowserByTimeout(node) { if (isCssAnimationSupported) { var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); // sometimes, browser bug node.rcEndAnimTimeout = setTimeout(function () { node.rcEndAnimTimeout = null; if (node.rcEndListener) { node.rcEndListener(); } }, time * 1000 + 200); } } function clearBrowserBugTimeout(node) { if (node.rcEndAnimTimeout) { clearTimeout(node.rcEndAnimTimeout); node.rcEndAnimTimeout = null; } } var cssAnimation = function cssAnimation(node, transitionName, endCallback) { var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; var className = nameIsObj ? transitionName.name : transitionName; var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; var end = endCallback; var start = void 0; var active = void 0; var nodeClasses = (0, _componentClasses2["default"])(node); if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { end = endCallback.end; start = endCallback.start; active = endCallback.active; } if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function (e) { if (e && e.target !== node) { return; } if (node.rcAnimTimeout) { clearTimeout(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); nodeClasses.remove(className); nodeClasses.remove(activeClassName); _Event2["default"].removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; // Usually this optional end is used for informing an owner of // a leave animation and telling it to remove the child. if (end) { end(); } }; _Event2["default"].addEndEventListener(node, node.rcEndListener); if (start) { start(); } nodeClasses.add(className); node.rcAnimTimeout = setTimeout(function () { node.rcAnimTimeout = null; nodeClasses.add(activeClassName); if (active) { setTimeout(active, 0); } fixBrowserByTimeout(node); // 30ms for firefox }, 30); return { stop: function stop() { if (node.rcEndListener) { node.rcEndListener(); } } }; }; cssAnimation.style = function (node, style, callback) { if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function (e) { if (e && e.target !== node) { return; } if (node.rcAnimTimeout) { clearTimeout(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); _Event2["default"].removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; // Usually this optional callback is used for informing an owner of // a leave animation and telling it to remove the child. if (callback) { callback(); } }; _Event2["default"].addEndEventListener(node, node.rcEndListener); node.rcAnimTimeout = setTimeout(function () { for (var s in style) { if (style.hasOwnProperty(s)) { node.style[s] = style[s]; } } node.rcAnimTimeout = null; fixBrowserByTimeout(node); }, 0); }; cssAnimation.setTransition = function (node, p, value) { var property = p; var v = value; if (value === undefined) { v = property; property = ''; } property = property || ''; capitalPrefixes.forEach(function (prefix) { node.style[prefix + 'Transition' + property] = v; }); }; cssAnimation.isCssAnimationSupported = isCssAnimationSupported; exports["default"] = cssAnimation; module.exports = exports['default']; /***/ }), /***/ 32: /***/ (function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util = { isAppearSupported: function isAppearSupported(props) { return props.transitionName && props.transitionAppear || props.animation.appear; }, isEnterSupported: function isEnterSupported(props) { return props.transitionName && props.transitionEnter || props.animation.enter; }, isLeaveSupported: function isLeaveSupported(props) { return props.transitionName && props.transitionLeave || props.animation.leave; }, allowAppearCallback: function allowAppearCallback(props) { return props.transitionAppear || props.animation.appear; }, allowEnterCallback: function allowEnterCallback(props) { return props.transitionEnter || props.animation.enter; }, allowLeaveCallback: function allowLeaveCallback(props) { return props.transitionLeave || props.animation.leave; } }; exports["default"] = util; module.exports = exports['default']; /***/ }), /***/ 33: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(8); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(19); var _reactDom2 = _interopRequireDefault(_reactDom); var _KeyCode = __webpack_require__(18); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _createChainedFunction = __webpack_require__(83); var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction); var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _domScrollIntoView = __webpack_require__(95); var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView); var _util = __webpack_require__(17); var _DOMWrap = __webpack_require__(72); var _DOMWrap2 = _interopRequireDefault(_DOMWrap); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function allDisabled(arr) { if (!arr.length) { return true; } return arr.every(function (c) { return !!c.props.disabled; }); } function getActiveKey(props, originalActiveKey) { var activeKey = originalActiveKey; var children = props.children, eventKey = props.eventKey; if (activeKey) { var found = void 0; (0, _util.loopMenuItem)(children, function (c, i) { if (c && !c.props.disabled && activeKey === (0, _util.getKeyFromChildrenIndex)(c, eventKey, i)) { found = true; } }); if (found) { return activeKey; } } activeKey = null; if (props.defaultActiveFirst) { (0, _util.loopMenuItem)(children, function (c, i) { if (!activeKey && c && !c.props.disabled) { activeKey = (0, _util.getKeyFromChildrenIndex)(c, eventKey, i); } }); return activeKey; } return activeKey; } function saveRef(index, subIndex, c) { if (c) { if (subIndex !== undefined) { this.instanceArray[index] = this.instanceArray[index] || []; this.instanceArray[index][subIndex] = c; } else { this.instanceArray[index] = c; } } } var MenuMixin = { propTypes: { focusable: _propTypes2["default"].bool, multiple: _propTypes2["default"].bool, style: _propTypes2["default"].object, defaultActiveFirst: _propTypes2["default"].bool, visible: _propTypes2["default"].bool, activeKey: _propTypes2["default"].string, selectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultSelectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultOpenKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), children: _propTypes2["default"].any }, getDefaultProps: function getDefaultProps() { return { prefixCls: 'rc-menu', className: '', mode: 'vertical', level: 1, inlineIndent: 24, visible: true, focusable: true, style: {} }; }, getInitialState: function getInitialState() { var props = this.props; return { activeKey: getActiveKey(props, props.activeKey) }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var props = void 0; if ('activeKey' in nextProps) { props = { activeKey: getActiveKey(nextProps, nextProps.activeKey) }; } else { var originalActiveKey = this.state.activeKey; var activeKey = getActiveKey(nextProps, originalActiveKey); // fix: this.setState(), parent.render(), if (activeKey !== originalActiveKey) { props = { activeKey: activeKey }; } } if (props) { this.setState(props); } }, shouldComponentUpdate: function shouldComponentUpdate(nextProps) { return this.props.visible || nextProps.visible; }, componentWillMount: function componentWillMount() { this.instanceArray = []; }, // all keyboard events callbacks run from here at first onKeyDown: function onKeyDown(e) { var _this = this; var keyCode = e.keyCode; var handled = void 0; this.getFlatInstanceArray().forEach(function (obj) { if (obj && obj.props.active) { handled = obj.onKeyDown(e); } }); if (handled) { return 1; } var activeItem = null; if (keyCode === _KeyCode2["default"].UP || keyCode === _KeyCode2["default"].DOWN) { activeItem = this.step(keyCode === _KeyCode2["default"].UP ? -1 : 1); } if (activeItem) { e.preventDefault(); this.setState({ activeKey: activeItem.props.eventKey }, function () { (0, _domScrollIntoView2["default"])(_reactDom2["default"].findDOMNode(activeItem), _reactDom2["default"].findDOMNode(_this), { onlyScrollIfNeeded: true }); }); return 1; } else if (activeItem === undefined) { e.preventDefault(); this.setState({ activeKey: null }); return 1; } }, getOpenChangesOnItemHover: function getOpenChangesOnItemHover(e) { var mode = this.props.mode; var key = e.key, hover = e.hover, trigger = e.trigger; var activeKey = this.state.activeKey; if (!trigger || hover || this.props.closeSubMenuOnMouseLeave || !e.item.isSubMenu || mode === 'inline') { this.setState({ activeKey: hover ? key : null }); } else {} // keep active for sub menu for click active // empty // clear last open status if (hover && mode !== 'inline') { var activeItem = this.getFlatInstanceArray().filter(function (c) { return c && c.props.eventKey === activeKey; })[0]; if (activeItem && activeItem.isSubMenu && activeItem.props.eventKey !== key) { return { item: activeItem, originalEvent: e, key: activeItem.props.eventKey, open: false }; } } return []; }, getFlatInstanceArray: function getFlatInstanceArray() { var instanceArray = this.instanceArray; var hasInnerArray = instanceArray.some(function (a) { return Array.isArray(a); }); if (hasInnerArray) { instanceArray = []; this.instanceArray.forEach(function (a) { if (Array.isArray(a)) { instanceArray.push.apply(instanceArray, a); } else { instanceArray.push(a); } }); this.instanceArray = instanceArray; } return instanceArray; }, renderCommonMenuItem: function renderCommonMenuItem(child, i, subIndex, extraProps) { var state = this.state; var props = this.props; var key = (0, _util.getKeyFromChildrenIndex)(child, props.eventKey, i); var childProps = child.props; var isActive = key === state.activeKey; var newChildProps = (0, _extends3["default"])({ mode: props.mode, level: props.level, inlineIndent: props.inlineIndent, renderMenuItem: this.renderMenuItem, rootPrefixCls: props.prefixCls, index: i, parentMenu: this, ref: childProps.disabled ? undefined : (0, _createChainedFunction2["default"])(child.ref, saveRef.bind(this, i, subIndex)), eventKey: key, closeSubMenuOnMouseLeave: props.closeSubMenuOnMouseLeave, onItemHover: this.onItemHover, active: !childProps.disabled && isActive, multiple: props.multiple, onClick: this.onClick, openTransitionName: this.getOpenTransitionName(), openAnimation: props.openAnimation, onOpenChange: this.onOpenChange, onDeselect: this.onDeselect, onDestroy: this.onDestroy, onSelect: this.onSelect }, extraProps); if (props.mode === 'inline') { newChildProps.closeSubMenuOnMouseLeave = newChildProps.openSubMenuOnMouseEnter = false; } return _react2["default"].cloneElement(child, newChildProps); }, renderRoot: function renderRoot(props) { var _classes; this.instanceArray = []; var classes = (_classes = {}, (0, _defineProperty3["default"])(_classes, props.prefixCls, 1), (0, _defineProperty3["default"])(_classes, props.prefixCls + '-' + props.mode, 1), (0, _defineProperty3["default"])(_classes, props.className, !!props.className), _classes); var domProps = { className: (0, _classnames2["default"])(classes), role: 'menu', 'aria-activedescendant': '' }; if (props.id) { domProps.id = props.id; } if (props.focusable) { domProps.tabIndex = '0'; domProps.onKeyDown = this.onKeyDown; } return ( // ESLint is not smart enough to know that the type of `children` was checked. /* eslint-disable */ _react2["default"].createElement( _DOMWrap2["default"], (0, _extends3["default"])({ style: props.style, tag: 'ul', hiddenClassName: props.prefixCls + '-hidden', visible: props.visible }, domProps), _react2["default"].Children.map(props.children, this.renderMenuItem) ) /*eslint-enable */ ); }, step: function step(direction) { var children = this.getFlatInstanceArray(); var activeKey = this.state.activeKey; var len = children.length; if (!len) { return null; } if (direction < 0) { children = children.concat().reverse(); } // find current activeIndex var activeIndex = -1; children.every(function (c, ci) { if (c && c.props.eventKey === activeKey) { activeIndex = ci; return false; } return true; }); if (!this.props.defaultActiveFirst && activeIndex !== -1) { if (allDisabled(children.slice(activeIndex, len - 1))) { return undefined; } } var start = (activeIndex + 1) % len; var i = start; for (;;) { var child = children[i]; if (!child || child.props.disabled) { i = (i + 1 + len) % len; // complete a loop if (i === start) { return null; } } else { return child; } } } }; exports["default"] = MenuMixin; module.exports = exports['default']; /***/ }), /***/ 39: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(57); var _layout = __webpack_require__(55); var _layout2 = _interopRequireDefault(_layout); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _NavigationBar = __webpack_require__(85); var _NavigationBar2 = _interopRequireDefault(_NavigationBar); var _Layout = __webpack_require__(67); var _Layout2 = _interopRequireDefault(_Layout); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Header = _layout2.default.Header, Footer = _layout2.default.Footer, Content = _layout2.default.Content; var Layout = function Layout(props) { return _react2.default.createElement( _layout2.default, { className: _Layout2.default.layout }, _react2.default.createElement( Header, { className: _Layout2.default.header }, _react2.default.createElement( 'div', { className: _Layout2.default.logo }, 'CoreCRM' ), _react2.default.createElement(_NavigationBar2.default, null) ), _react2.default.createElement( Content, { className: _Layout2.default.content }, props.children ), _react2.default.createElement( Footer, { className: _Layout2.default.footer }, 'CoreCRM \u7248\u6743\u6240\u6709 \xA92017' ) ); }; Layout.propTypes = {}; exports.default = Layout; module.exports = exports['default']; /***/ }), /***/ 48: /***/ (function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * @ignore * base event object for custom and dom event. * @author yiminghe@gmail.com */ function returnFalse() { return false; } function returnTrue() { return true; } function EventBaseObject() { this.timeStamp = Date.now(); this.target = undefined; this.currentTarget = undefined; } EventBaseObject.prototype = { isEventObject: 1, constructor: EventBaseObject, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function preventDefault() { this.isDefaultPrevented = returnTrue; }, stopPropagation: function stopPropagation() { this.isPropagationStopped = returnTrue; }, stopImmediatePropagation: function stopImmediatePropagation() { this.isImmediatePropagationStopped = returnTrue; // fixed 1.2 // call stopPropagation implicitly this.stopPropagation(); }, halt: function halt(immediate) { if (immediate) { this.stopImmediatePropagation(); } else { this.stopPropagation(); } this.preventDefault(); } }; exports["default"] = EventBaseObject; module.exports = exports['default']; /***/ }), /***/ 49: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _EventBaseObject = __webpack_require__(48); var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); var _objectAssign = __webpack_require__(10); var _objectAssign2 = _interopRequireDefault(_objectAssign); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /** * @ignore * event object for dom * @author yiminghe@gmail.com */ var TRUE = true; var FALSE = false; var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; function isNullOrUndefined(w) { return w === null || w === undefined; } var eventNormalizers = [{ reg: /^key/, props: ['char', 'charCode', 'key', 'keyCode', 'which'], fix: function fix(event, nativeEvent) { if (isNullOrUndefined(event.which)) { event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; } // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) if (event.metaKey === undefined) { event.metaKey = event.ctrlKey; } } }, { reg: /^touch/, props: ['touches', 'changedTouches', 'targetTouches'] }, { reg: /^hashchange$/, props: ['newURL', 'oldURL'] }, { reg: /^gesturechange$/i, props: ['rotation', 'scale'] }, { reg: /^(mousewheel|DOMMouseScroll)$/, props: [], fix: function fix(event, nativeEvent) { var deltaX = void 0; var deltaY = void 0; var delta = void 0; var wheelDelta = nativeEvent.wheelDelta; var axis = nativeEvent.axis; var wheelDeltaY = nativeEvent.wheelDeltaY; var wheelDeltaX = nativeEvent.wheelDeltaX; var detail = nativeEvent.detail; // ie/webkit if (wheelDelta) { delta = wheelDelta / 120; } // gecko if (detail) { // press control e.detail == 1 else e.detail == 3 delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); } // Gecko if (axis !== undefined) { if (axis === event.HORIZONTAL_AXIS) { deltaY = 0; deltaX = 0 - delta; } else if (axis === event.VERTICAL_AXIS) { deltaX = 0; deltaY = delta; } } // Webkit if (wheelDeltaY !== undefined) { deltaY = wheelDeltaY / 120; } if (wheelDeltaX !== undefined) { deltaX = -1 * wheelDeltaX / 120; } // 默认 deltaY (ie) if (!deltaX && !deltaY) { deltaY = delta; } if (deltaX !== undefined) { /** * deltaX of mousewheel event * @property deltaX * @member Event.DomEvent.Object */ event.deltaX = deltaX; } if (deltaY !== undefined) { /** * deltaY of mousewheel event * @property deltaY * @member Event.DomEvent.Object */ event.deltaY = deltaY; } if (delta !== undefined) { /** * delta of mousewheel event * @property delta * @member Event.DomEvent.Object */ event.delta = delta; } } }, { reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], fix: function fix(event, nativeEvent) { var eventDoc = void 0; var doc = void 0; var body = void 0; var target = event.target; var button = nativeEvent.button; // Calculate pageX/Y if missing and clientX/Y available if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { eventDoc = target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } // which for click: 1 === left; 2 === middle; 3 === right // do not use button if (!event.which && button !== undefined) { if (button & 1) { event.which = 1; } else if (button & 2) { event.which = 3; } else if (button & 4) { event.which = 2; } else { event.which = 0; } } // add relatedTarget, if necessary if (!event.relatedTarget && event.fromElement) { event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; } return event; } }]; function retTrue() { return TRUE; } function retFalse() { return FALSE; } function DomEventObject(nativeEvent) { var type = nativeEvent.type; var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; _EventBaseObject2["default"].call(this); this.nativeEvent = nativeEvent; // in case dom event has been mark as default prevented by lower dom node var isDefaultPrevented = retFalse; if ('defaultPrevented' in nativeEvent) { isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; } else if ('getPreventDefault' in nativeEvent) { // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; } else if ('returnValue' in nativeEvent) { isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; } this.isDefaultPrevented = isDefaultPrevented; var fixFns = []; var fixFn = void 0; var l = void 0; var prop = void 0; var props = commonProps.concat(); eventNormalizers.forEach(function (normalizer) { if (type.match(normalizer.reg)) { props = props.concat(normalizer.props); if (normalizer.fix) { fixFns.push(normalizer.fix); } } }); l = props.length; // clone properties of the original event object while (l) { prop = props[--l]; this[prop] = nativeEvent[prop]; } // fix target property, if necessary if (!this.target && isNative) { this.target = nativeEvent.srcElement || document; // srcElement might not be defined either } // check if target is a text node (safari) if (this.target && this.target.nodeType === 3) { this.target = this.target.parentNode; } l = fixFns.length; while (l) { fixFn = fixFns[--l]; fixFn(this, nativeEvent); } this.timeStamp = nativeEvent.timeStamp || Date.now(); } var EventBaseObjectProto = _EventBaseObject2["default"].prototype; (0, _objectAssign2["default"])(DomEventObject.prototype, EventBaseObjectProto, { constructor: DomEventObject, preventDefault: function preventDefault() { var e = this.nativeEvent; // if preventDefault exists run it on the original event if (e.preventDefault) { e.preventDefault(); } else { // otherwise set the returnValue property of the original event to FALSE (IE) e.returnValue = FALSE; } EventBaseObjectProto.preventDefault.call(this); }, stopPropagation: function stopPropagation() { var e = this.nativeEvent; // if stopPropagation exists run it on the original event if (e.stopPropagation) { e.stopPropagation(); } else { // otherwise set the cancelBubble property of the original event to TRUE (IE) e.cancelBubble = TRUE; } EventBaseObjectProto.stopPropagation.call(this); } }); exports["default"] = DomEventObject; module.exports = exports['default']; /***/ }), /***/ 50: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = addEventListener; var _EventObject = __webpack_require__(49); var _EventObject2 = _interopRequireDefault(_EventObject); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function addEventListener(target, eventType, callback) { function wrapCallback(e) { var ne = new _EventObject2["default"](e); callback.call(target, ne); } if (target.addEventListener) { target.addEventListener(eventType, wrapCallback, false); return { remove: function remove() { target.removeEventListener(eventType, wrapCallback, false); } }; } else if (target.attachEvent) { target.attachEvent('on' + eventType, wrapCallback); return { remove: function remove() { target.detachEvent('on' + eventType, wrapCallback); } }; } } module.exports = exports['default']; /***/ }), /***/ 51: /***/ (function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = getRequestAnimationFrame; exports.cancelRequestAnimationFrame = cancelRequestAnimationFrame; var availablePrefixs = ['moz', 'ms', 'webkit']; function requestAnimationFramePolyfill() { var lastTime = 0; return function (callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } function getRequestAnimationFrame() { if (typeof window === 'undefined') { return function () {}; } if (window.requestAnimationFrame) { return window.requestAnimationFrame; } var prefix = availablePrefixs.filter(function (key) { return key + 'RequestAnimationFrame' in window; })[0]; return prefix ? window[prefix + 'RequestAnimationFrame'] : requestAnimationFramePolyfill(); } function cancelRequestAnimationFrame(id) { if (typeof window === 'undefined') { return null; } if (window.cancelAnimationFrame) { return window.cancelAnimationFrame(id); } var prefix = availablePrefixs.filter(function (key) { return key + 'CancelAnimationFrame' in window || key + 'CancelRequestAnimationFrame' in window; })[0]; return prefix ? (window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame']).call(this, id) : clearTimeout(id); } /***/ }), /***/ 52: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _cssAnimation = __webpack_require__(31); var _cssAnimation2 = _interopRequireDefault(_cssAnimation); var _getRequestAnimationFrame = __webpack_require__(51); var _getRequestAnimationFrame2 = _interopRequireDefault(_getRequestAnimationFrame); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var reqAnimFrame = (0, _getRequestAnimationFrame2["default"])(); function animate(node, show, done) { var height = void 0; var requestAnimationFrameId = void 0; return (0, _cssAnimation2["default"])(node, 'ant-motion-collapse', { start: function start() { if (!show) { node.style.height = node.offsetHeight + 'px'; node.style.opacity = 1; } else { height = node.offsetHeight; node.style.height = 0; node.style.opacity = 0; } }, active: function active() { if (requestAnimationFrameId) { (0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); } requestAnimationFrameId = reqAnimFrame(function () { node.style.height = (show ? height : 0) + 'px'; node.style.opacity = show ? 1 : 0; }); }, end: function end() { if (requestAnimationFrameId) { (0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); } node.style.height = ''; node.style.opacity = ''; done(); } }); } var animation = { enter: function enter(node, done) { return animate(node, true, done); }, leave: function leave(node, done) { return animate(node, false, done); }, appear: function appear(node, done) { return animate(node, true, done); } }; exports["default"] = animation; module.exports = exports['default']; /***/ }), /***/ 54: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = undefined; var _defineProperty2 = __webpack_require__(8); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(12); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(14); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(13); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _omit = __webpack_require__(37); var _omit2 = _interopRequireDefault(_omit); var _icon = __webpack_require__(40); var _icon2 = _interopRequireDefault(_icon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; // matchMedia polyfill for // https://github.com/WickyNilliams/enquire.js/issues/82 if (typeof window !== 'undefined') { var matchMediaPolyfill = function matchMediaPolyfill(mediaQuery) { return { media: mediaQuery, matches: false, addListener: function addListener() {}, removeListener: function removeListener() {} }; }; window.matchMedia = window.matchMedia || matchMediaPolyfill; } var dimensionMap = { xs: '480px', sm: '768px', md: '992px', lg: '1200px', xl: '1600px' }; var Sider = function (_React$Component) { (0, _inherits3["default"])(Sider, _React$Component); function Sider(props) { (0, _classCallCheck3["default"])(this, Sider); var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props)); _this.responsiveHandler = function (mql) { _this.setState({ below: mql.matches }); if (_this.state.collapsed !== mql.matches) { _this.setCollapsed(mql.matches, 'responsive'); } }; _this.setCollapsed = function (collapsed, type) { if (!('collapsed' in _this.props)) { _this.setState({ collapsed: collapsed }); } var onCollapse = _this.props.onCollapse; if (onCollapse) { onCollapse(collapsed, type); } }; _this.toggle = function () { var collapsed = !_this.state.collapsed; _this.setCollapsed(collapsed, 'clickTrigger'); }; _this.belowShowChange = function () { _this.setState({ belowShow: !_this.state.belowShow }); }; var matchMedia = void 0; if (typeof window !== 'undefined') { matchMedia = window.matchMedia; } if (matchMedia && props.breakpoint && props.breakpoint in dimensionMap) { _this.mql = matchMedia('(max-width: ' + dimensionMap[props.breakpoint] + ')'); } var collapsed = void 0; if ('collapsed' in props) { collapsed = props.collapsed; } else { collapsed = props.defaultCollapsed; } _this.state = { collapsed: collapsed, below: false }; return _this; } Sider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { if ('collapsed' in nextProps) { this.setState({ collapsed: nextProps.collapsed }); } }; Sider.prototype.componentDidMount = function componentDidMount() { if (this.mql) { this.mql.addListener(this.responsiveHandler); this.responsiveHandler(this.mql); } }; Sider.prototype.componentWillUnmount = function componentWillUnmount() { if (this.mql) { this.mql.removeListener(this.responsiveHandler); } }; Sider.prototype.render = function render() { var _classNames; var _a = this.props, prefixCls = _a.prefixCls, className = _a.className, collapsible = _a.collapsible, reverseArrow = _a.reverseArrow, trigger = _a.trigger, style = _a.style, width = _a.width, collapsedWidth = _a.collapsedWidth, others = __rest(_a, ["prefixCls", "className", "collapsible", "reverseArrow", "trigger", "style", "width", "collapsedWidth"]); var divProps = (0, _omit2["default"])(others, ['collapsed', 'defaultCollapsed', 'onCollapse', 'breakpoint']); var siderWidth = this.state.collapsed ? collapsedWidth : width; // special trigger when collapsedWidth == 0 var zeroWidthTrigger = collapsedWidth === 0 || collapsedWidth === '0' ? _react2["default"].createElement( 'span', { onClick: this.toggle, className: prefixCls + '-zero-width-trigger' }, _react2["default"].createElement(_icon2["default"], { type: 'bars' }) ) : null; var iconObj = { 'expanded': reverseArrow ? _react2["default"].createElement(_icon2["default"], { type: 'right' }) : _react2["default"].createElement(_icon2["default"], { type: 'left' }), 'collapsed': reverseArrow ? _react2["default"].createElement(_icon2["default"], { type: 'left' }) : _react2["default"].createElement(_icon2["default"], { type: 'right' }) }; var status = this.state.collapsed ? 'collapsed' : 'expanded'; var defaultTrigger = iconObj[status]; var triggerDom = trigger !== null ? zeroWidthTrigger || _react2["default"].createElement( 'div', { className: prefixCls + '-trigger', onClick: this.toggle }, trigger || defaultTrigger ) : null; var divStyle = (0, _extends3["default"])({}, style, { flex: '0 0 ' + siderWidth + 'px', width: siderWidth + 'px' }); var siderCls = (0, _classnames2["default"])(className, prefixCls, (_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls + '-collapsed', !!this.state.collapsed), (0, _defineProperty3["default"])(_classNames, prefixCls + '-has-trigger', !!trigger), (0, _defineProperty3["default"])(_classNames, prefixCls + '-below', !!this.state.below), (0, _defineProperty3["default"])(_classNames, prefixCls + '-zero-width', siderWidth === 0 || siderWidth === '0'), _classNames)); return _react2["default"].createElement( 'div', (0, _extends3["default"])({ className: siderCls }, divProps, { style: divStyle }), this.props.children, collapsible || this.state.below && zeroWidthTrigger ? triggerDom : null ); }; return Sider; }(_react2["default"].Component); exports["default"] = Sider; Sider.__ANT_LAYOUT_SIDER = true; Sider.defaultProps = { prefixCls: 'ant-layout-sider', collapsible: false, defaultCollapsed: false, reverseArrow: false, width: 200, collapsedWidth: 64, style: {} }; module.exports = exports['default']; /***/ }), /***/ 55: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _layout = __webpack_require__(56); var _layout2 = _interopRequireDefault(_layout); var _Sider = __webpack_require__(54); var _Sider2 = _interopRequireDefault(_Sider); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } _layout2["default"].Sider = _Sider2["default"]; exports["default"] = _layout2["default"]; module.exports = exports['default']; /***/ }), /***/ 56: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(8); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(12); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(14); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(13); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; function generator(props) { return function (Basic) { return function (_React$Component) { (0, _inherits3["default"])(Adapter, _React$Component); function Adapter() { (0, _classCallCheck3["default"])(this, Adapter); return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments)); } Adapter.prototype.render = function render() { var prefixCls = props.prefixCls; return _react2["default"].createElement(Basic, (0, _extends3["default"])({ prefixCls: prefixCls }, this.props)); }; return Adapter; }(_react2["default"].Component); }; } var Basic = function (_React$Component2) { (0, _inherits3["default"])(Basic, _React$Component2); function Basic() { (0, _classCallCheck3["default"])(this, Basic); return (0, _possibleConstructorReturn3["default"])(this, _React$Component2.apply(this, arguments)); } Basic.prototype.render = function render() { var _a = this.props, prefixCls = _a.prefixCls, className = _a.className, children = _a.children, others = __rest(_a, ["prefixCls", "className", "children"]); var hasSider = void 0; _react2["default"].Children.forEach(children, function (element) { if (element && element.type && element.type.__ANT_LAYOUT_SIDER) { hasSider = true; } }); var divCls = (0, _classnames2["default"])(className, prefixCls, (0, _defineProperty3["default"])({}, prefixCls + '-has-sider', hasSider)); return _react2["default"].createElement( 'div', (0, _extends3["default"])({ className: divCls }, others), children ); }; return Basic; }(_react2["default"].Component); var Layout = generator({ prefixCls: 'ant-layout' })(Basic); var Header = generator({ prefixCls: 'ant-layout-header' })(Basic); var Footer = generator({ prefixCls: 'ant-layout-footer' })(Basic); var Content = generator({ prefixCls: 'ant-layout-content' })(Basic); Layout.Header = Header; Layout.Footer = Footer; Layout.Content = Content; exports["default"] = Layout; module.exports = exports['default']; /***/ }), /***/ 57: [590, 65], /***/ 58: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = undefined; var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(12); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(14); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(13); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcMenu = __webpack_require__(80); var _rcMenu2 = _interopRequireDefault(_rcMenu); var _openAnimation = __webpack_require__(52); var _openAnimation2 = _interopRequireDefault(_openAnimation); var _warning = __webpack_require__(53); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var Menu = function (_React$Component) { (0, _inherits3["default"])(Menu, _React$Component); function Menu(props) { (0, _classCallCheck3["default"])(this, Menu); var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props)); _this.handleClick = function (e) { _this.setOpenKeys([]); var onClick = _this.props.onClick; if (onClick) { onClick(e); } }; _this.handleOpenChange = function (openKeys) { _this.setOpenKeys(openKeys); var onOpenChange = _this.props.onOpenChange; if (onOpenChange) { onOpenChange(openKeys); } }; (0, _warning2["default"])(!('onOpen' in props || 'onClose' in props), '`onOpen` and `onClose` are removed, please use `onOpenChange` instead, ' + 'see: http://u.ant.design/menu-on-open-change.'); var openKeys = void 0; if ('defaultOpenKeys' in props) { openKeys = props.defaultOpenKeys; } else if ('openKeys' in props) { openKeys = props.openKeys; } _this.state = { openKeys: openKeys || [] }; return _this; } Menu.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { if (this.props.mode === 'inline' && nextProps.mode !== 'inline') { this.switchModeFromInline = true; } if ('openKeys' in nextProps) { this.setState({ openKeys: nextProps.openKeys }); } }; Menu.prototype.setOpenKeys = function setOpenKeys(openKeys) { if (!('openKeys' in this.props)) { this.setState({ openKeys: openKeys }); } }; Menu.prototype.render = function render() { var openAnimation = this.props.openAnimation || this.props.openTransitionName; if (this.props.openAnimation === undefined && this.props.openTransitionName === undefined) { switch (this.props.mode) { case 'horizontal': openAnimation = 'slide-up'; break; case 'vertical': // When mode switch from inline // submenu should hide without animation if (this.switchModeFromInline) { openAnimation = ''; this.switchModeFromInline = false; } else { openAnimation = 'zoom-big'; } break; case 'inline': openAnimation = _openAnimation2["default"]; break; default: } } var props = {}; var className = this.props.className + ' ' + this.props.prefixCls + '-' + this.props.theme; if (this.props.mode !== 'inline') { // There is this.state.openKeys for // closing vertical popup submenu after click it props = { openKeys: this.state.openKeys, onClick: this.handleClick, onOpenChange: this.handleOpenChange, openTransitionName: openAnimation, className: className }; } else { props = { openAnimation: openAnimation, className: className }; } return _react2["default"].createElement(_rcMenu2["default"], (0, _extends3["default"])({}, this.props, props)); }; return Menu; }(_react2["default"].Component); exports["default"] = Menu; Menu.Divider = _rcMenu.Divider; Menu.Item = _rcMenu.Item; Menu.SubMenu = _rcMenu.SubMenu; Menu.ItemGroup = _rcMenu.ItemGroup; Menu.defaultProps = { prefixCls: 'ant-menu', className: '', theme: 'light' }; module.exports = exports['default']; /***/ }), /***/ 59: [590, 66], /***/ 60: /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ try { var index = __webpack_require__(30); } catch (err) { var index = __webpack_require__(30); } /** * Whitespace regexp. */ var re = /\s+/; /** * toString reference. */ var toString = Object.prototype.toString; /** * Wrap `el` in a `ClassList`. * * @param {Element} el * @return {ClassList} * @api public */ module.exports = function(el){ return new ClassList(el); }; /** * Initialize a new ClassList for `el`. * * @param {Element} el * @api private */ function ClassList(el) { if (!el || !el.nodeType) { throw new Error('A DOM element reference is required'); } this.el = el; this.list = el.classList; } /** * Add class `name` if not already present. * * @param {String} name * @return {ClassList} * @api public */ ClassList.prototype.add = function(name){ // classList if (this.list) { this.list.add(name); return this; } // fallback var arr = this.array(); var i = index(arr, name); if (!~i) arr.push(name); this.el.className = arr.join(' '); return this; }; /** * Remove class `name` when present, or * pass a regular expression to remove * any which match. * * @param {String|RegExp} name * @return {ClassList} * @api public */ ClassList.prototype.remove = function(name){ if ('[object RegExp]' == toString.call(name)) { return this.removeMatching(name); } // classList if (this.list) { this.list.remove(name); return this; } // fallback var arr = this.array(); var i = index(arr, name); if (~i) arr.splice(i, 1); this.el.className = arr.join(' '); return this; }; /** * Remove all classes matching `re`. * * @param {RegExp} re * @return {ClassList} * @api private */ ClassList.prototype.removeMatching = function(re){ var arr = this.array(); for (var i = 0; i < arr.length; i++) { if (re.test(arr[i])) { this.remove(arr[i]); } } return this; }; /** * Toggle class `name`, can force state via `force`. * * For browsers that support classList, but do not support `force` yet, * the mistake will be detected and corrected. * * @param {String} name * @param {Boolean} force * @return {ClassList} * @api public */ ClassList.prototype.toggle = function(name, force){ // classList if (this.list) { if ("undefined" !== typeof force) { if (force !== this.list.toggle(name, force)) { this.list.toggle(name); // toggle again to correct } } else { this.list.toggle(name); } return this; } // fallback if ("undefined" !== typeof force) { if (!force) { this.remove(name); } else { this.add(name); } } else { if (this.has(name)) { this.remove(name); } else { this.add(name); } } return this; }; /** * Return an array of classes. * * @return {Array} * @api public */ ClassList.prototype.array = function(){ var className = this.el.getAttribute('class') || ''; var str = className.replace(/^\s+|\s+$/g, ''); var arr = str.split(re); if ('' === arr[0]) arr.shift(); return arr; }; /** * Check if class `name` is present. * * @param {String} name * @return {ClassList} * @api public */ ClassList.prototype.has = ClassList.prototype.contains = function(name){ return this.list ? this.list.contains(name) : !! ~index(this.array(), name); }; /***/ }), /***/ 63: /***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var _assign = __webpack_require__(10); var emptyObject = __webpack_require__(44); var _invariant = __webpack_require__(6); if (true) { var warning = __webpack_require__(7); } var MIXINS_KEY = 'mixins'; // Helper function to allow the creation of anonymous functions which do not // have .name set to the name of the variable being assigned to. function identity(fn) { return fn; } var ReactPropTypeLocationNames; if (true) { ReactPropTypeLocationNames = { prop: 'prop', context: 'context', childContext: 'child context', }; } else { ReactPropTypeLocationNames = {}; } function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { /** * Policies that describe methods in `ReactClassInterface`. */ var injectedMixins = []; /** * Composite components are higher-level components that compose other composite * or host components. * * To create a new type of `ReactClass`, pass a specification of * your new class to `React.createClass`. The only requirement of your class * specification is that you implement a `render` method. * * var MyComponent = React.createClass({ * render: function() { * return <div>Hello World</div>; * } * }); * * The class specification supports a specific protocol of methods that have * special meaning (e.g. `render`). See `ReactClassInterface` for * more the comprehensive protocol. Any other properties and methods in the * class specification will be available on the prototype. * * @interface ReactClassInterface * @internal */ var ReactClassInterface = { /** * An array of Mixin objects to include when defining your component. * * @type {array} * @optional */ mixins: 'DEFINE_MANY', /** * An object containing properties and methods that should be defined on * the component's constructor instead of its prototype (static methods). * * @type {object} * @optional */ statics: 'DEFINE_MANY', /** * Definition of prop types for this component. * * @type {object} * @optional */ propTypes: 'DEFINE_MANY', /** * Definition of context types for this component. * * @type {object} * @optional */ contextTypes: 'DEFINE_MANY', /** * Definition of context types this component sets for its children. * * @type {object} * @optional */ childContextTypes: 'DEFINE_MANY', // ==== Definition methods ==== /** * Invoked when the component is mounted. Values in the mapping will be set on * `this.props` if that prop is not specified (i.e. using an `in` check). * * This method is invoked before `getInitialState` and therefore cannot rely * on `this.state` or use `this.setState`. * * @return {object} * @optional */ getDefaultProps: 'DEFINE_MANY_MERGED', /** * Invoked once before the component is mounted. The return value will be used * as the initial value of `this.state`. * * getInitialState: function() { * return { * isOn: false, * fooBaz: new BazFoo() * } * } * * @return {object} * @optional */ getInitialState: 'DEFINE_MANY_MERGED', /** * @return {object} * @optional */ getChildContext: 'DEFINE_MANY_MERGED', /** * Uses props from `this.props` and state from `this.state` to render the * structure of the component. * * No guarantees are made about when or how often this method is invoked, so * it must not have side effects. * * render: function() { * var name = this.props.name; * return <div>Hello, {name}!</div>; * } * * @return {ReactComponent} * @nosideeffects * @required */ render: 'DEFINE_ONCE', // ==== Delegate methods ==== /** * Invoked when the component is initially created and about to be mounted. * This may have side effects, but any external subscriptions or data created * by this method must be cleaned up in `componentWillUnmount`. * * @optional */ componentWillMount: 'DEFINE_MANY', /** * Invoked when the component has been mounted and has a DOM representation. * However, there is no guarantee that the DOM node is in the document. * * Use this as an opportunity to operate on the DOM when the component has * been mounted (initialized and rendered) for the first time. * * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidMount: 'DEFINE_MANY', /** * Invoked before the component receives new props. * * Use this as an opportunity to react to a prop transition by updating the * state using `this.setState`. Current props are accessed via `this.props`. * * componentWillReceiveProps: function(nextProps, nextContext) { * this.setState({ * likesIncreasing: nextProps.likeCount > this.props.likeCount * }); * } * * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop * transition may cause a state change, but the opposite is not true. If you * need it, you are probably looking for `componentWillUpdate`. * * @param {object} nextProps * @optional */ componentWillReceiveProps: 'DEFINE_MANY', /** * Invoked while deciding if the component should be updated as a result of * receiving new props, state and/or context. * * Use this as an opportunity to `return false` when you're certain that the * transition to the new props/state/context will not require a component * update. * * shouldComponentUpdate: function(nextProps, nextState, nextContext) { * return !equal(nextProps, this.props) || * !equal(nextState, this.state) || * !equal(nextContext, this.context); * } * * @param {object} nextProps * @param {?object} nextState * @param {?object} nextContext * @return {boolean} True if the component should update. * @optional */ shouldComponentUpdate: 'DEFINE_ONCE', /** * Invoked when the component is about to update due to a transition from * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` * and `nextContext`. * * Use this as an opportunity to perform preparation before an update occurs. * * NOTE: You **cannot** use `this.setState()` in this method. * * @param {object} nextProps * @param {?object} nextState * @param {?object} nextContext * @param {ReactReconcileTransaction} transaction * @optional */ componentWillUpdate: 'DEFINE_MANY', /** * Invoked when the component's DOM representation has been updated. * * Use this as an opportunity to operate on the DOM when the component has * been updated. * * @param {object} prevProps * @param {?object} prevState * @param {?object} prevContext * @param {DOMElement} rootNode DOM element representing the component. * @optional */ componentDidUpdate: 'DEFINE_MANY', /** * Invoked when the component is about to be removed from its parent and have * its DOM representation destroyed. * * Use this as an opportunity to deallocate any external resources. * * NOTE: There is no `componentDidUnmount` since your component will have been * destroyed by that point. * * @optional */ componentWillUnmount: 'DEFINE_MANY', // ==== Advanced methods ==== /** * Updates the component's currently mounted DOM representation. * * By default, this implements React's rendering and reconciliation algorithm. * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction * @internal * @overridable */ updateComponent: 'OVERRIDE_BASE' }; /** * Mapping from class specification keys to special processing functions. * * Although these are declared like instance properties in the specification * when defining classes using `React.createClass`, they are actually static * and are accessible on the constructor instead of the prototype. Despite * being static, they must be defined outside of the "statics" key under * which all other static methods are defined. */ var RESERVED_SPEC_KEYS = { displayName: function (Constructor, displayName) { Constructor.displayName = displayName; }, mixins: function (Constructor, mixins) { if (mixins) { for (var i = 0; i < mixins.length; i++) { mixSpecIntoComponent(Constructor, mixins[i]); } } }, childContextTypes: function (Constructor, childContextTypes) { if (true) { validateTypeDef(Constructor, childContextTypes, 'childContext'); } Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); }, contextTypes: function (Constructor, contextTypes) { if (true) { validateTypeDef(Constructor, contextTypes, 'context'); } Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); }, /** * Special case getDefaultProps which should move into statics but requires * automatic merging. */ getDefaultProps: function (Constructor, getDefaultProps) { if (Constructor.getDefaultProps) { Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); } else { Constructor.getDefaultProps = getDefaultProps; } }, propTypes: function (Constructor, propTypes) { if (true) { validateTypeDef(Constructor, propTypes, 'prop'); } Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); }, statics: function (Constructor, statics) { mixStaticSpecIntoComponent(Constructor, statics); }, autobind: function () {} }; function validateTypeDef(Constructor, typeDef, location) { for (var propName in typeDef) { if (typeDef.hasOwnProperty(propName)) { // use a warning instead of an _invariant so components // don't show up in prod but only in __DEV__ true ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; } } } function validateMethodOverride(isAlreadyDefined, name) { var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { _invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); } // Disallow defining methods more than once unless explicitly allowed. if (isAlreadyDefined) { _invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); } } /** * Mixin helper which handles policy validation and reserved * specification keys when building React classes. */ function mixSpecIntoComponent(Constructor, spec) { if (!spec) { if (true) { var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; true ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; } return; } _invariant(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); _invariant(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.'); var proto = Constructor.prototype; var autoBindPairs = proto.__reactAutoBindPairs; // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } if (name === MIXINS_KEY) { // We have already handled mixins in a special case above. continue; } var property = spec[name]; var isAlreadyDefined = proto.hasOwnProperty(name); validateMethodOverride(isAlreadyDefined, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactClass methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; if (shouldAutoBind) { autoBindPairs.push(name, property); proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride. _invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === 'DEFINE_MANY_MERGED') { proto[name] = createMergedResultFunction(proto[name], property); } else if (specPolicy === 'DEFINE_MANY') { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; if (true) { // Add verbose displayName to the function, which helps when looking // at profiling tools. if (typeof property === 'function' && spec.displayName) { proto[name].displayName = spec.displayName + '_' + name; } } } } } } } function mixStaticSpecIntoComponent(Constructor, statics) { if (!statics) { return; } for (var name in statics) { var property = statics[name]; if (!statics.hasOwnProperty(name)) { continue; } var isReserved = name in RESERVED_SPEC_KEYS; _invariant(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name); var isInherited = name in Constructor; _invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); Constructor[name] = property; } } /** * Merge two objects, but throw if both contain the same key. * * @param {object} one The first object, which is mutated. * @param {object} two The second object * @return {object} one after it has been mutated to contain everything in two. */ function mergeIntoWithNoDuplicateKeys(one, two) { _invariant(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); for (var key in two) { if (two.hasOwnProperty(key)) { _invariant(one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key); one[key] = two[key]; } } return one; } /** * Creates a function that invokes two functions and merges their return values. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createMergedResultFunction(one, two) { return function mergedResult() { var a = one.apply(this, arguments); var b = two.apply(this, arguments); if (a == null) { return b; } else if (b == null) { return a; } var c = {}; mergeIntoWithNoDuplicateKeys(c, a); mergeIntoWithNoDuplicateKeys(c, b); return c; }; } /** * Creates a function that invokes two functions and ignores their return vales. * * @param {function} one Function to invoke first. * @param {function} two Function to invoke second. * @return {function} Function that invokes the two argument functions. * @private */ function createChainedFunction(one, two) { return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; } /** * Binds a method to the component. * * @param {object} component Component whose method is going to be bound. * @param {function} method Method to be bound. * @return {function} The bound method. */ function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if (true) { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; boundMethod.bind = function (newThis) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } // User is trying to bind() an autobound method; we effectively will // ignore the value of "this" that the user is trying to use, so // let's warn. if (newThis !== component && newThis !== null) { true ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; } else if (!args.length) { true ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; return boundMethod; } var reboundMethod = _bind.apply(boundMethod, arguments); reboundMethod.__reactBoundContext = component; reboundMethod.__reactBoundMethod = method; reboundMethod.__reactBoundArguments = args; return reboundMethod; }; } return boundMethod; } /** * Binds all auto-bound methods in a component. * * @param {object} component Component whose method is going to be bound. */ function bindAutoBindMethods(component) { var pairs = component.__reactAutoBindPairs; for (var i = 0; i < pairs.length; i += 2) { var autoBindKey = pairs[i]; var method = pairs[i + 1]; component[autoBindKey] = bindAutoBindMethod(component, method); } } var IsMountedMixin = { componentDidMount: function () { this.__isMounted = true; }, componentWillUnmount: function () { this.__isMounted = false; } }; /** * Add more to the ReactClass base class. These are all legacy features and * therefore not already part of the modern ReactComponent. */ var ReactClassMixin = { /** * TODO: This will be deprecated because state should always keep a consistent * type signature and the only use case for this, is to avoid that. */ replaceState: function (newState, callback) { this.updater.enqueueReplaceState(this, newState, callback); }, /** * Checks whether or not this composite component is mounted. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function () { if (true) { true ? warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component') : void 0; this.__didWarnIsMounted = true; } return !!this.__isMounted; } }; var ReactClassComponent = function () {}; _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); /** * Creates a composite component class given a class specification. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass * * @param {object} spec Class specification (which must define `render`). * @return {function} Component constructor function. * @public */ function createClass(spec) { // To keep our warnings more understandable, we'll use a little hack here to // ensure that Constructor.name !== 'Constructor'. This makes sure we don't // unnecessarily identify a class without displayName as 'Constructor'. var Constructor = identity(function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (true) { true ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (true) { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }); Constructor.prototype = new ReactClassComponent(); Constructor.prototype.constructor = Constructor; Constructor.prototype.__reactAutoBindPairs = []; injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); mixSpecIntoComponent(Constructor, IsMountedMixin); mixSpecIntoComponent(Constructor, spec); // Initialize the defaultProps property after all mixins have been merged. if (Constructor.getDefaultProps) { Constructor.defaultProps = Constructor.getDefaultProps(); } if (true) { // This is a tag to indicate that the use of these method names is ok, // since it's used with createClass. If it's not, then it's likely a // mistake so we'll warn you to use the static property, property // initializer or constructor respectively. if (Constructor.getDefaultProps) { Constructor.getDefaultProps.isReactClassApproved = {}; } if (Constructor.prototype.getInitialState) { Constructor.prototype.getInitialState.isReactClassApproved = {}; } } _invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); if (true) { true ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; true ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; } // Reduce time spent doing lookups by setting these on the prototype. for (var methodName in ReactClassInterface) { if (!Constructor.prototype[methodName]) { Constructor.prototype[methodName] = null; } } return Constructor; } return createClass; } module.exports = factory; /***/ }), /***/ 64: /***/ (function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var EVENT_NAME_MAP = { transitionend: { transition: 'transitionend', WebkitTransition: 'webkitTransitionEnd', MozTransition: 'mozTransitionEnd', OTransition: 'oTransitionEnd', msTransition: 'MSTransitionEnd' }, animationend: { animation: 'animationend', WebkitAnimation: 'webkitAnimationEnd', MozAnimation: 'mozAnimationEnd', OAnimation: 'oAnimationEnd', msAnimation: 'MSAnimationEnd' } }; var endEvents = []; function detectEvents() { var testEl = document.createElement('div'); var style = testEl.style; if (!('AnimationEvent' in window)) { delete EVENT_NAME_MAP.animationend.animation; } if (!('TransitionEvent' in window)) { delete EVENT_NAME_MAP.transitionend.transition; } for (var baseEventName in EVENT_NAME_MAP) { if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { var baseEvents = EVENT_NAME_MAP[baseEventName]; for (var styleName in baseEvents) { if (styleName in style) { endEvents.push(baseEvents[styleName]); break; } } } } } if (typeof window !== 'undefined' && typeof document !== 'undefined') { detectEvents(); } function addEventListener(node, eventName, eventListener) { node.addEventListener(eventName, eventListener, false); } function removeEventListener(node, eventName, eventListener) { node.removeEventListener(eventName, eventListener, false); } var TransitionEvents = { addEndEventListener: function addEndEventListener(node, eventListener) { if (endEvents.length === 0) { window.setTimeout(eventListener, 0); return; } endEvents.forEach(function (endEvent) { addEventListener(node, endEvent, eventListener); }); }, endEvents: endEvents, removeEndEventListener: function removeEndEventListener(node, eventListener) { if (endEvents.length === 0) { return; } endEvents.forEach(function (endEvent) { removeEventListener(node, endEvent, eventListener); }); } }; exports["default"] = TransitionEvents; module.exports = exports['default']; /***/ }), /***/ 65: 20, /***/ 66: 20, /***/ 67: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin module.exports = {"header":"header___16QSy","footer":"footer___1pUix","content":"content___1rXXt","logo":"logo___Gb1wi"}; /***/ }), /***/ 68: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _ChildrenUtils = __webpack_require__(70); var _AnimateChild = __webpack_require__(69); var _AnimateChild2 = _interopRequireDefault(_AnimateChild); var _util = __webpack_require__(32); var _util2 = _interopRequireDefault(_util); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var defaultKey = 'rc_animate_' + Date.now(); function getChildrenFromProps(props) { var children = props.children; if (_react2["default"].isValidElement(children)) { if (!children.key) { return _react2["default"].cloneElement(children, { key: defaultKey }); } } return children; } function noop() {} var Animate = function (_React$Component) { _inherits(Animate, _React$Component); function Animate(props) { _classCallCheck(this, Animate); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _initialiseProps.call(_this); _this.currentlyAnimatingKeys = {}; _this.keysToEnter = []; _this.keysToLeave = []; _this.state = { children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props)) }; return _this; } Animate.prototype.componentDidMount = function componentDidMount() { var _this2 = this; var showProp = this.props.showProp; var children = this.state.children; if (showProp) { children = children.filter(function (child) { return !!child.props[showProp]; }); } children.forEach(function (child) { if (child) { _this2.performAppear(child.key); } }); }; Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var _this3 = this; this.nextProps = nextProps; var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); var props = this.props; // exclusive needs immediate response if (props.exclusive) { Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { _this3.stop(key); }); } var showProp = props.showProp; var currentlyAnimatingKeys = this.currentlyAnimatingKeys; // last props children if exclusive var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; // in case destroy in showProp mode var newChildren = []; if (showProp) { currentChildren.forEach(function (currentChild) { var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); var newChild = void 0; if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { newChild = _react2["default"].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); } else { newChild = nextChild; } if (newChild) { newChildren.push(newChild); } }); nextChildren.forEach(function (nextChild) { if (!nextChild || !(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { newChildren.push(nextChild); } }); } else { newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); } // need render to avoid update this.setState({ children: newChildren }); nextChildren.forEach(function (child) { var key = child && child.key; if (child && currentlyAnimatingKeys[key]) { return; } var hasPrev = child && (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); if (showProp) { var showInNext = child.props[showProp]; if (hasPrev) { var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); if (!showInNow && showInNext) { _this3.keysToEnter.push(key); } } else if (showInNext) { _this3.keysToEnter.push(key); } } else if (!hasPrev) { _this3.keysToEnter.push(key); } }); currentChildren.forEach(function (child) { var key = child && child.key; if (child && currentlyAnimatingKeys[key]) { return; } var hasNext = child && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); if (showProp) { var showInNow = child.props[showProp]; if (hasNext) { var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); if (!showInNext && showInNow) { _this3.keysToLeave.push(key); } } else if (showInNow) { _this3.keysToLeave.push(key); } } else if (!hasNext) { _this3.keysToLeave.push(key); } }); }; Animate.prototype.componentDidUpdate = function componentDidUpdate() { var keysToEnter = this.keysToEnter; this.keysToEnter = []; keysToEnter.forEach(this.performEnter); var keysToLeave = this.keysToLeave; this.keysToLeave = []; keysToLeave.forEach(this.performLeave); }; Animate.prototype.isValidChildByKey = function isValidChildByKey(currentChildren, key) { var showProp = this.props.showProp; if (showProp) { return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); } return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); }; Animate.prototype.stop = function stop(key) { delete this.currentlyAnimatingKeys[key]; var component = this.refs[key]; if (component) { component.stop(); } }; Animate.prototype.render = function render() { var props = this.props; this.nextProps = props; var stateChildren = this.state.children; var children = null; if (stateChildren) { children = stateChildren.map(function (child) { if (child === null || child === undefined) { return child; } if (!child.key) { throw new Error('must set key for <rc-animate> children'); } return _react2["default"].createElement( _AnimateChild2["default"], { key: child.key, ref: child.key, animation: props.animation, transitionName: props.transitionName, transitionEnter: props.transitionEnter, transitionAppear: props.transitionAppear, transitionLeave: props.transitionLeave }, child ); }); } var Component = props.component; if (Component) { var passedProps = props; if (typeof Component === 'string') { passedProps = _extends({ className: props.className, style: props.style }, props.componentProps); } return _react2["default"].createElement( Component, passedProps, children ); } return children[0] || null; }; return Animate; }(_react2["default"].Component); Animate.propTypes = { component: _propTypes2["default"].any, componentProps: _propTypes2["default"].object, animation: _propTypes2["default"].object, transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), transitionEnter: _propTypes2["default"].bool, transitionAppear: _propTypes2["default"].bool, exclusive: _propTypes2["default"].bool, transitionLeave: _propTypes2["default"].bool, onEnd: _propTypes2["default"].func, onEnter: _propTypes2["default"].func, onLeave: _propTypes2["default"].func, onAppear: _propTypes2["default"].func, showProp: _propTypes2["default"].string }; Animate.defaultProps = { animation: {}, component: 'span', componentProps: {}, transitionEnter: true, transitionLeave: true, transitionAppear: false, onEnd: noop, onEnter: noop, onLeave: noop, onAppear: noop }; var _initialiseProps = function _initialiseProps() { var _this4 = this; this.performEnter = function (key) { // may already remove by exclusive if (_this4.refs[key]) { _this4.currentlyAnimatingKeys[key] = true; _this4.refs[key].componentWillEnter(_this4.handleDoneAdding.bind(_this4, key, 'enter')); } }; this.performAppear = function (key) { if (_this4.refs[key]) { _this4.currentlyAnimatingKeys[key] = true; _this4.refs[key].componentWillAppear(_this4.handleDoneAdding.bind(_this4, key, 'appear')); } }; this.handleDoneAdding = function (key, type) { var props = _this4.props; delete _this4.currentlyAnimatingKeys[key]; // if update on exclusive mode, skip check if (props.exclusive && props !== _this4.nextProps) { return; } var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); if (!_this4.isValidChildByKey(currentChildren, key)) { // exclusive will not need this _this4.performLeave(key); } else { if (type === 'appear') { if (_util2["default"].allowAppearCallback(props)) { props.onAppear(key); props.onEnd(key, true); } } else { if (_util2["default"].allowEnterCallback(props)) { props.onEnter(key); props.onEnd(key, true); } } } }; this.performLeave = function (key) { // may already remove by exclusive if (_this4.refs[key]) { _this4.currentlyAnimatingKeys[key] = true; _this4.refs[key].componentWillLeave(_this4.handleDoneLeaving.bind(_this4, key)); } }; this.handleDoneLeaving = function (key) { var props = _this4.props; delete _this4.currentlyAnimatingKeys[key]; // if update on exclusive mode, skip check if (props.exclusive && props !== _this4.nextProps) { return; } var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); // in case state change is too fast if (_this4.isValidChildByKey(currentChildren, key)) { _this4.performEnter(key); } else { var end = function end() { if (_util2["default"].allowLeaveCallback(props)) { props.onLeave(key); props.onEnd(key, false); } }; if (!(0, _ChildrenUtils.isSameChildren)(_this4.state.children, currentChildren, props.showProp)) { _this4.setState({ children: currentChildren }, end); } else { end(); } } }; }; exports["default"] = Animate; module.exports = exports['default']; /***/ }), /***/ 69: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(19); var _reactDom2 = _interopRequireDefault(_reactDom); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _cssAnimation = __webpack_require__(31); var _cssAnimation2 = _interopRequireDefault(_cssAnimation); var _util = __webpack_require__(32); var _util2 = _interopRequireDefault(_util); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var transitionMap = { enter: 'transitionEnter', appear: 'transitionAppear', leave: 'transitionLeave' }; var AnimateChild = function (_React$Component) { _inherits(AnimateChild, _React$Component); function AnimateChild() { _classCallCheck(this, AnimateChild); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() { this.stop(); }; AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) { if (_util2["default"].isEnterSupported(this.props)) { this.transition('enter', done); } else { done(); } }; AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) { if (_util2["default"].isAppearSupported(this.props)) { this.transition('appear', done); } else { done(); } }; AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) { if (_util2["default"].isLeaveSupported(this.props)) { this.transition('leave', done); } else { // always sync, do not interupt with react component life cycle // update hidden -> animate hidden -> // didUpdate -> animate leave -> unmount (if animate is none) done(); } }; AnimateChild.prototype.transition = function transition(animationType, finishCallback) { var _this2 = this; var node = _reactDom2["default"].findDOMNode(this); var props = this.props; var transitionName = props.transitionName; var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object'; this.stop(); var end = function end() { _this2.stopper = null; finishCallback(); }; if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType; var activeName = name + '-active'; if (nameIsObj && transitionName[animationType + 'Active']) { activeName = transitionName[animationType + 'Active']; } this.stopper = (0, _cssAnimation2["default"])(node, { name: name, active: activeName }, end); } else { this.stopper = props.animation[animationType](node, end); } }; AnimateChild.prototype.stop = function stop() { var stopper = this.stopper; if (stopper) { this.stopper = null; stopper.stop(); } }; AnimateChild.prototype.render = function render() { return this.props.children; }; return AnimateChild; }(_react2["default"].Component); AnimateChild.propTypes = { children: _propTypes2["default"].any }; exports["default"] = AnimateChild; module.exports = exports['default']; /***/ }), /***/ 70: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.toArrayChildren = toArrayChildren; exports.findChildInChildrenByKey = findChildInChildrenByKey; exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; exports.isSameChildren = isSameChildren; exports.mergeChildren = mergeChildren; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function toArrayChildren(children) { var ret = []; _react2["default"].Children.forEach(children, function (child) { ret.push(child); }); return ret; } function findChildInChildrenByKey(children, key) { var ret = null; if (children) { children.forEach(function (child) { if (ret) { return; } if (child && child.key === key) { ret = child; } }); } return ret; } function findShownChildInChildrenByKey(children, key, showProp) { var ret = null; if (children) { children.forEach(function (child) { if (child && child.key === key && child.props[showProp]) { if (ret) { throw new Error('two child with same key for <rc-animate> children'); } ret = child; } }); } return ret; } function findHiddenChildInChildrenByKey(children, key, showProp) { var found = 0; if (children) { children.forEach(function (child) { if (found) { return; } found = child && child.key === key && !child.props[showProp]; }); } return found; } function isSameChildren(c1, c2, showProp) { var same = c1.length === c2.length; if (same) { c1.forEach(function (child, index) { var child2 = c2[index]; if (child && child2) { if (child && !child2 || !child && child2) { same = false; } else if (child.key !== child2.key) { same = false; } else if (showProp && child.props[showProp] !== child2.props[showProp]) { same = false; } } }); } return same; } function mergeChildren(prev, next) { var ret = []; // For each key of `next`, the list of keys to insert before that key in // the combined list var nextChildrenPending = {}; var pendingChildren = []; prev.forEach(function (child) { if (child && findChildInChildrenByKey(next, child.key)) { if (pendingChildren.length) { nextChildrenPending[child.key] = pendingChildren; pendingChildren = []; } } else { pendingChildren.push(child); } }); next.forEach(function (child) { if (child && nextChildrenPending.hasOwnProperty(child.key)) { ret = ret.concat(nextChildrenPending[child.key]); } ret.push(child); }); ret = ret.concat(pendingChildren); return ret; } /***/ }), /***/ 71: /***/ (function(module, exports, __webpack_require__) { 'use strict'; // export this package's api module.exports = __webpack_require__(68); /***/ }), /***/ 72: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var DOMWrap = (0, _createReactClass2["default"])({ displayName: 'DOMWrap', propTypes: { tag: _propTypes2["default"].string, hiddenClassName: _propTypes2["default"].string, visible: _propTypes2["default"].bool }, getDefaultProps: function getDefaultProps() { return { tag: 'div' }; }, render: function render() { var props = (0, _extends3["default"])({}, this.props); if (!props.visible) { props.className = props.className || ''; props.className += ' ' + props.hiddenClassName; } var Tag = props.tag; delete props.tag; delete props.hiddenClassName; delete props.visible; return _react2["default"].createElement(Tag, props); } }); exports["default"] = DOMWrap; module.exports = exports['default']; /***/ }), /***/ 73: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var Divider = (0, _createReactClass2["default"])({ displayName: 'Divider', propTypes: { disabled: _propTypes2["default"].bool, className: _propTypes2["default"].string, rootPrefixCls: _propTypes2["default"].string }, getDefaultProps: function getDefaultProps() { return { disabled: true }; }, render: function render() { var _props = this.props, _props$className = _props.className, className = _props$className === undefined ? '' : _props$className, rootPrefixCls = _props.rootPrefixCls; return _react2["default"].createElement('li', { className: className + ' ' + rootPrefixCls + '-item-divider' }); } }); exports["default"] = Divider; module.exports = exports['default']; /***/ }), /***/ 74: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _MenuMixin = __webpack_require__(33); var _MenuMixin2 = _interopRequireDefault(_MenuMixin); var _util = __webpack_require__(17); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // import React from 'react'; var Menu = (0, _createReactClass2["default"])({ displayName: 'Menu', propTypes: { openSubMenuOnMouseEnter: _propTypes2["default"].bool, closeSubMenuOnMouseLeave: _propTypes2["default"].bool, selectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultSelectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultOpenKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), mode: _propTypes2["default"].string, onClick: _propTypes2["default"].func, onSelect: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, openTransitionName: _propTypes2["default"].string, openAnimation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), level: _propTypes2["default"].number, eventKey: _propTypes2["default"].string, selectable: _propTypes2["default"].bool, children: _propTypes2["default"].any }, mixins: [_MenuMixin2["default"]], getDefaultProps: function getDefaultProps() { return { openSubMenuOnMouseEnter: true, closeSubMenuOnMouseLeave: true, selectable: true, onClick: _util.noop, onSelect: _util.noop, onOpenChange: _util.noop, onDeselect: _util.noop, defaultSelectedKeys: [], defaultOpenKeys: [] }; }, getInitialState: function getInitialState() { var props = this.props; var selectedKeys = props.defaultSelectedKeys; var openKeys = props.defaultOpenKeys; if ('selectedKeys' in props) { selectedKeys = props.selectedKeys || []; } if ('openKeys' in props) { openKeys = props.openKeys || []; } return { selectedKeys: selectedKeys, openKeys: openKeys }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var props = {}; if ('selectedKeys' in nextProps) { props.selectedKeys = nextProps.selectedKeys || []; } if ('openKeys' in nextProps) { props.openKeys = nextProps.openKeys || []; } this.setState(props); }, onDestroy: function onDestroy(key) { var state = this.state; var props = this.props; var selectedKeys = state.selectedKeys; var openKeys = state.openKeys; var index = selectedKeys.indexOf(key); if (!('selectedKeys' in props) && index !== -1) { selectedKeys.splice(index, 1); } index = openKeys.indexOf(key); if (!('openKeys' in props) && index !== -1) { openKeys.splice(index, 1); } }, onItemHover: function onItemHover(e) { var _this = this; var item = e.item; var _props = this.props, mode = _props.mode, closeSubMenuOnMouseLeave = _props.closeSubMenuOnMouseLeave; var _e$openChanges = e.openChanges, openChanges = _e$openChanges === undefined ? [] : _e$openChanges; // special for top sub menu if (mode !== 'inline' && !closeSubMenuOnMouseLeave && item.isSubMenu) { (function () { var activeKey = _this.state.activeKey; var activeItem = _this.getFlatInstanceArray().filter(function (c) { return c && c.props.eventKey === activeKey; })[0]; if (activeItem && activeItem.props.open) { openChanges = openChanges.concat({ key: item.props.eventKey, item: item, originalEvent: e, open: true }); } })(); } openChanges = openChanges.concat(this.getOpenChangesOnItemHover(e)); if (openChanges.length) { this.onOpenChange(openChanges); } }, onSelect: function onSelect(selectInfo) { var props = this.props; if (props.selectable) { // root menu var selectedKeys = this.state.selectedKeys; var selectedKey = selectInfo.key; if (props.multiple) { selectedKeys = selectedKeys.concat([selectedKey]); } else { selectedKeys = [selectedKey]; } if (!('selectedKeys' in props)) { this.setState({ selectedKeys: selectedKeys }); } props.onSelect((0, _extends3["default"])({}, selectInfo, { selectedKeys: selectedKeys })); } }, onClick: function onClick(e) { this.props.onClick(e); }, onOpenChange: function onOpenChange(e_) { var props = this.props; var openKeys = this.state.openKeys.concat(); var changed = false; var processSingle = function processSingle(e) { var oneChanged = false; if (e.open) { oneChanged = openKeys.indexOf(e.key) === -1; if (oneChanged) { openKeys.push(e.key); } } else { var index = openKeys.indexOf(e.key); oneChanged = index !== -1; if (oneChanged) { openKeys.splice(index, 1); } } changed = changed || oneChanged; }; if (Array.isArray(e_)) { // batch change call e_.forEach(processSingle); } else { processSingle(e_); } if (changed) { if (!('openKeys' in this.props)) { this.setState({ openKeys: openKeys }); } props.onOpenChange(openKeys); } }, onDeselect: function onDeselect(selectInfo) { var props = this.props; if (props.selectable) { var selectedKeys = this.state.selectedKeys.concat(); var selectedKey = selectInfo.key; var index = selectedKeys.indexOf(selectedKey); if (index !== -1) { selectedKeys.splice(index, 1); } if (!('selectedKeys' in props)) { this.setState({ selectedKeys: selectedKeys }); } props.onDeselect((0, _extends3["default"])({}, selectInfo, { selectedKeys: selectedKeys })); } }, getOpenTransitionName: function getOpenTransitionName() { var props = this.props; var transitionName = props.openTransitionName; var animationName = props.openAnimation; if (!transitionName && typeof animationName === 'string') { transitionName = props.prefixCls + '-open-' + animationName; } return transitionName; }, isInlineMode: function isInlineMode() { return this.props.mode === 'inline'; }, lastOpenSubMenu: function lastOpenSubMenu() { var lastOpen = []; var openKeys = this.state.openKeys; if (openKeys.length) { lastOpen = this.getFlatInstanceArray().filter(function (c) { return c && openKeys.indexOf(c.props.eventKey) !== -1; }); } return lastOpen[0]; }, renderMenuItem: function renderMenuItem(c, i, subIndex) { if (!c) { return null; } var state = this.state; var extraProps = { openKeys: state.openKeys, selectedKeys: state.selectedKeys, openSubMenuOnMouseEnter: this.props.openSubMenuOnMouseEnter }; return this.renderCommonMenuItem(c, i, subIndex, extraProps); }, render: function render() { var props = (0, _extends3["default"])({}, this.props); props.className += ' ' + props.prefixCls + '-root'; return this.renderRoot(props); } }); exports["default"] = Menu; module.exports = exports['default']; /***/ }), /***/ 75: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _KeyCode = __webpack_require__(18); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _util = __webpack_require__(17); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /* eslint react/no-is-mounted:0 */ var MenuItem = (0, _createReactClass2["default"])({ displayName: 'MenuItem', propTypes: { rootPrefixCls: _propTypes2["default"].string, eventKey: _propTypes2["default"].string, active: _propTypes2["default"].bool, children: _propTypes2["default"].any, selectedKeys: _propTypes2["default"].array, disabled: _propTypes2["default"].bool, title: _propTypes2["default"].string, onSelect: _propTypes2["default"].func, onClick: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, parentMenu: _propTypes2["default"].object, onItemHover: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, onMouseEnter: _propTypes2["default"].func, onMouseLeave: _propTypes2["default"].func }, getDefaultProps: function getDefaultProps() { return { onSelect: _util.noop, onMouseEnter: _util.noop, onMouseLeave: _util.noop }; }, componentWillUnmount: function componentWillUnmount() { var props = this.props; if (props.onDestroy) { props.onDestroy(props.eventKey); } if (props.parentMenu.menuItemInstance === this) { this.clearMenuItemMouseLeaveTimer(); } }, onKeyDown: function onKeyDown(e) { var keyCode = e.keyCode; if (keyCode === _KeyCode2["default"].ENTER) { this.onClick(e); return true; } }, onMouseLeave: function onMouseLeave(e) { var _this = this; var props = this.props; var eventKey = props.eventKey, parentMenu = props.parentMenu; parentMenu.menuItemInstance = this; parentMenu.menuItemMouseLeaveFn = function () { if (props.active) { props.onItemHover({ key: eventKey, item: _this, hover: false, domEvent: e, trigger: 'mouseleave' }); } }; parentMenu.menuItemMouseLeaveTimer = setTimeout(parentMenu.menuItemMouseLeaveFn, 30); props.onMouseLeave({ key: eventKey, domEvent: e }); }, onMouseEnter: function onMouseEnter(e) { var props = this.props; var eventKey = props.eventKey, parentMenu = props.parentMenu; this.clearMenuItemMouseLeaveTimer(parentMenu.menuItemInstance !== this); if (parentMenu.subMenuInstance) { parentMenu.subMenuInstance.clearSubMenuTimers(); } props.onItemHover({ key: eventKey, item: this, hover: true, domEvent: e, trigger: 'mouseenter' }); props.onMouseEnter({ key: eventKey, domEvent: e }); }, onClick: function onClick(e) { var props = this.props; var selected = this.isSelected(); var eventKey = props.eventKey; var info = { key: eventKey, keyPath: [eventKey], item: this, domEvent: e }; props.onClick(info); if (props.multiple) { if (selected) { props.onDeselect(info); } else { props.onSelect(info); } } else if (!selected) { props.onSelect(info); } }, getPrefixCls: function getPrefixCls() { return this.props.rootPrefixCls + '-item'; }, getActiveClassName: function getActiveClassName() { return this.getPrefixCls() + '-active'; }, getSelectedClassName: function getSelectedClassName() { return this.getPrefixCls() + '-selected'; }, getDisabledClassName: function getDisabledClassName() { return this.getPrefixCls() + '-disabled'; }, clearMenuItemMouseLeaveTimer: function clearMenuItemMouseLeaveTimer() { var props = this.props; var callFn = void 0; var parentMenu = props.parentMenu; if (parentMenu.menuItemMouseLeaveTimer) { clearTimeout(parentMenu.menuItemMouseLeaveTimer); parentMenu.menuItemMouseLeaveTimer = null; if (callFn && parentMenu.menuItemMouseLeaveFn) { parentMenu.menuItemMouseLeaveFn(); } parentMenu.menuItemMouseLeaveFn = null; } }, isSelected: function isSelected() { return this.props.selectedKeys.indexOf(this.props.eventKey) !== -1; }, render: function render() { var props = this.props; var selected = this.isSelected(); var classes = {}; classes[this.getActiveClassName()] = !props.disabled && props.active; classes[this.getSelectedClassName()] = selected; classes[this.getDisabledClassName()] = props.disabled; classes[this.getPrefixCls()] = true; classes[props.className] = !!props.className; var attrs = (0, _extends3["default"])({}, props.attribute, { title: props.title, className: (0, _classnames2["default"])(classes), role: 'menuitem', 'aria-selected': selected, 'aria-disabled': props.disabled }); var mouseEvent = {}; if (!props.disabled) { mouseEvent = { onClick: this.onClick, onMouseLeave: this.onMouseLeave, onMouseEnter: this.onMouseEnter }; } var style = (0, _extends3["default"])({}, props.style); if (props.mode === 'inline') { style.paddingLeft = props.inlineIndent * props.level; } return _react2["default"].createElement( 'li', (0, _extends3["default"])({ style: style }, attrs, mouseEvent), props.children ); } }); MenuItem.isMenuItem = 1; exports["default"] = MenuItem; module.exports = exports['default']; /***/ }), /***/ 76: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var MenuItemGroup = (0, _createReactClass2["default"])({ displayName: 'MenuItemGroup', propTypes: { renderMenuItem: _propTypes2["default"].func, index: _propTypes2["default"].number, className: _propTypes2["default"].string, rootPrefixCls: _propTypes2["default"].string }, getDefaultProps: function getDefaultProps() { return { disabled: true }; }, renderInnerMenuItem: function renderInnerMenuItem(item, subIndex) { var _props = this.props, renderMenuItem = _props.renderMenuItem, index = _props.index; return renderMenuItem(item, index, subIndex); }, render: function render() { var props = this.props; var _props$className = props.className, className = _props$className === undefined ? '' : _props$className, rootPrefixCls = props.rootPrefixCls; var titleClassName = rootPrefixCls + '-item-group-title'; var listClassName = rootPrefixCls + '-item-group-list'; return _react2["default"].createElement( 'li', { className: className + ' ' + rootPrefixCls + '-item-group' }, _react2["default"].createElement( 'div', { className: titleClassName }, props.title ), _react2["default"].createElement( 'ul', { className: listClassName }, _react2["default"].Children.map(props.children, this.renderInnerMenuItem) ) ); } }); MenuItemGroup.isMenuItemGroup = true; exports["default"] = MenuItemGroup; module.exports = exports['default']; /***/ }), /***/ 77: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(8); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _SubPopupMenu = __webpack_require__(79); var _SubPopupMenu2 = _interopRequireDefault(_SubPopupMenu); var _KeyCode = __webpack_require__(18); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _classnames = __webpack_require__(5); var _classnames2 = _interopRequireDefault(_classnames); var _util = __webpack_require__(17); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var guid = 0; /* eslint react/no-is-mounted:0 */ var SubMenu = (0, _createReactClass2["default"])({ displayName: 'SubMenu', propTypes: { parentMenu: _propTypes2["default"].object, title: _propTypes2["default"].node, children: _propTypes2["default"].any, selectedKeys: _propTypes2["default"].array, openKeys: _propTypes2["default"].array, onClick: _propTypes2["default"].func, onOpenChange: _propTypes2["default"].func, rootPrefixCls: _propTypes2["default"].string, eventKey: _propTypes2["default"].string, multiple: _propTypes2["default"].bool, active: _propTypes2["default"].bool, onSelect: _propTypes2["default"].func, closeSubMenuOnMouseLeave: _propTypes2["default"].bool, openSubMenuOnMouseEnter: _propTypes2["default"].bool, onDeselect: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, onItemHover: _propTypes2["default"].func, onMouseEnter: _propTypes2["default"].func, onMouseLeave: _propTypes2["default"].func, onTitleMouseEnter: _propTypes2["default"].func, onTitleMouseLeave: _propTypes2["default"].func, onTitleClick: _propTypes2["default"].func }, mixins: [__webpack_require__(78)], getDefaultProps: function getDefaultProps() { return { onMouseEnter: _util.noop, onMouseLeave: _util.noop, onTitleMouseEnter: _util.noop, onTitleMouseLeave: _util.noop, onTitleClick: _util.noop, title: '' }; }, getInitialState: function getInitialState() { this.isSubMenu = 1; return { defaultActiveFirst: false }; }, componentWillUnmount: function componentWillUnmount() { var _props = this.props, onDestroy = _props.onDestroy, eventKey = _props.eventKey, parentMenu = _props.parentMenu; if (onDestroy) { onDestroy(eventKey); } if (parentMenu.subMenuInstance === this) { this.clearSubMenuTimers(); } }, onDestroy: function onDestroy(key) { this.props.onDestroy(key); }, onKeyDown: function onKeyDown(e) { var keyCode = e.keyCode; var menu = this.menuInstance; var isOpen = this.isOpen(); if (keyCode === _KeyCode2["default"].ENTER) { this.onTitleClick(e); this.setState({ defaultActiveFirst: true }); return true; } if (keyCode === _KeyCode2["default"].RIGHT) { if (isOpen) { menu.onKeyDown(e); } else { this.triggerOpenChange(true); this.setState({ defaultActiveFirst: true }); } return true; } if (keyCode === _KeyCode2["default"].LEFT) { var handled = void 0; if (isOpen) { handled = menu.onKeyDown(e); } else { return undefined; } if (!handled) { this.triggerOpenChange(false); handled = true; } return handled; } if (isOpen && (keyCode === _KeyCode2["default"].UP || keyCode === _KeyCode2["default"].DOWN)) { return menu.onKeyDown(e); } }, onOpenChange: function onOpenChange(e) { this.props.onOpenChange(e); }, onMouseEnter: function onMouseEnter(e) { var props = this.props; this.clearSubMenuLeaveTimer(props.parentMenu.subMenuInstance !== this); props.onMouseEnter({ key: props.eventKey, domEvent: e }); }, onTitleMouseEnter: function onTitleMouseEnter(domEvent) { var props = this.props; var parentMenu = props.parentMenu, key = props.eventKey; var item = this; this.clearSubMenuTitleLeaveTimer(parentMenu.subMenuInstance !== item); if (parentMenu.menuItemInstance) { parentMenu.menuItemInstance.clearMenuItemMouseLeaveTimer(true); } var openChanges = []; if (props.openSubMenuOnMouseEnter) { openChanges.push({ key: key, item: item, trigger: 'mouseenter', open: true }); } props.onItemHover({ key: key, item: item, hover: true, trigger: 'mouseenter', openChanges: openChanges }); this.setState({ defaultActiveFirst: false }); props.onTitleMouseEnter({ key: key, domEvent: domEvent }); }, onTitleMouseLeave: function onTitleMouseLeave(e) { var _this = this; var props = this.props; var parentMenu = props.parentMenu, eventKey = props.eventKey; parentMenu.subMenuInstance = this; parentMenu.subMenuTitleLeaveFn = function () { // leave whole sub tree // still active if (props.mode === 'inline' && props.active) { props.onItemHover({ key: eventKey, item: _this, hover: false, trigger: 'mouseleave' }); } props.onTitleMouseLeave({ key: props.eventKey, domEvent: e }); }; parentMenu.subMenuTitleLeaveTimer = setTimeout(parentMenu.subMenuTitleLeaveFn, 100); }, onMouseLeave: function onMouseLeave(e) { var _this2 = this; var props = this.props; var parentMenu = props.parentMenu, eventKey = props.eventKey; parentMenu.subMenuInstance = this; parentMenu.subMenuLeaveFn = function () { // leave whole sub tree // still active if (props.mode !== 'inline') { var isOpen = _this2.isOpen(); if (isOpen && props.closeSubMenuOnMouseLeave && props.active) { props.onItemHover({ key: eventKey, item: _this2, hover: false, trigger: 'mouseleave', openChanges: [{ key: eventKey, item: _this2, trigger: 'mouseleave', open: false }] }); } else { if (props.active) { props.onItemHover({ key: eventKey, item: _this2, hover: false, trigger: 'mouseleave' }); } if (isOpen && props.closeSubMenuOnMouseLeave) { _this2.triggerOpenChange(false); } } } // trigger mouseleave props.onMouseLeave({ key: eventKey, domEvent: e }); }; // prevent popup menu and submenu gap parentMenu.subMenuLeaveTimer = setTimeout(parentMenu.subMenuLeaveFn, 100); }, onTitleClick: function onTitleClick(e) { var props = this.props; props.onTitleClick({ key: props.eventKey, domEvent: e }); if (props.openSubMenuOnMouseEnter) { return; } this.triggerOpenChange(!this.isOpen(), 'click'); this.setState({ defaultActiveFirst: false }); }, onSubMenuClick: function onSubMenuClick(info) { this.props.onClick(this.addKeyPath(info)); }, onSelect: function onSelect(info) { this.props.onSelect(info); }, onDeselect: function onDeselect(info) { this.props.onDeselect(info); }, getPrefixCls: function getPrefixCls() { return this.props.rootPrefixCls + '-submenu'; }, getActiveClassName: function getActiveClassName() { return this.getPrefixCls() + '-active'; }, getDisabledClassName: function getDisabledClassName() { return this.getPrefixCls() + '-disabled'; }, getSelectedClassName: function getSelectedClassName() { return this.getPrefixCls() + '-selected'; }, getOpenClassName: function getOpenClassName() { return this.props.rootPrefixCls + '-submenu-open'; }, saveMenuInstance: function saveMenuInstance(c) { this.menuInstance = c; }, addKeyPath: function addKeyPath(info) { return (0, _extends3["default"])({}, info, { keyPath: (info.keyPath || []).concat(this.props.eventKey) }); }, triggerOpenChange: function triggerOpenChange(open, type) { var key = this.props.eventKey; this.onOpenChange({ key: key, item: this, trigger: type, open: open }); }, clearSubMenuTimers: function clearSubMenuTimers() { var callFn = void 0; this.clearSubMenuLeaveTimer(callFn); this.clearSubMenuTitleLeaveTimer(callFn); }, clearSubMenuTitleLeaveTimer: function clearSubMenuTitleLeaveTimer() { var callFn = void 0; var parentMenu = this.props.parentMenu; if (parentMenu.subMenuTitleLeaveTimer) { clearTimeout(parentMenu.subMenuTitleLeaveTimer); parentMenu.subMenuTitleLeaveTimer = null; if (callFn && parentMenu.subMenuTitleLeaveFn) { parentMenu.subMenuTitleLeaveFn(); } parentMenu.subMenuTitleLeaveFn = null; } }, clearSubMenuLeaveTimer: function clearSubMenuLeaveTimer() { var callFn = void 0; var parentMenu = this.props.parentMenu; if (parentMenu.subMenuLeaveTimer) { clearTimeout(parentMenu.subMenuLeaveTimer); parentMenu.subMenuLeaveTimer = null; if (callFn && parentMenu.subMenuLeaveFn) { parentMenu.subMenuLeaveFn(); } parentMenu.subMenuLeaveFn = null; } }, isChildrenSelected: function isChildrenSelected() { var ret = { find: false }; (0, _util.loopMenuItemRecusively)(this.props.children, this.props.selectedKeys, ret); return ret.find; }, isOpen: function isOpen() { return this.props.openKeys.indexOf(this.props.eventKey) !== -1; }, renderChildren: function renderChildren(children) { var props = this.props; var baseProps = { mode: props.mode === 'horizontal' ? 'vertical' : props.mode, visible: this.isOpen(), level: props.level + 1, inlineIndent: props.inlineIndent, focusable: false, onClick: this.onSubMenuClick, onSelect: this.onSelect, onDeselect: this.onDeselect, onDestroy: this.onDestroy, selectedKeys: props.selectedKeys, eventKey: props.eventKey + '-menu-', openKeys: props.openKeys, openTransitionName: props.openTransitionName, openAnimation: props.openAnimation, onOpenChange: this.onOpenChange, closeSubMenuOnMouseLeave: props.closeSubMenuOnMouseLeave, defaultActiveFirst: this.state.defaultActiveFirst, multiple: props.multiple, prefixCls: props.rootPrefixCls, id: this._menuId, ref: this.saveMenuInstance }; return _react2["default"].createElement( _SubPopupMenu2["default"], baseProps, children ); }, render: function render() { var _classes; var isOpen = this.isOpen(); this.haveOpen = this.haveOpen || isOpen; var props = this.props; var prefixCls = this.getPrefixCls(); var classes = (_classes = {}, (0, _defineProperty3["default"])(_classes, props.className, !!props.className), (0, _defineProperty3["default"])(_classes, prefixCls + '-' + props.mode, 1), _classes); classes[this.getOpenClassName()] = isOpen; classes[this.getActiveClassName()] = props.active; classes[this.getDisabledClassName()] = props.disabled; classes[this.getSelectedClassName()] = this.isChildrenSelected(); if (!this._menuId) { if (props.eventKey) { this._menuId = props.eventKey + '$Menu'; } else { this._menuId = '$__$' + ++guid + '$Menu'; } } classes[prefixCls] = true; classes[prefixCls + '-' + props.mode] = 1; var titleClickEvents = {}; var mouseEvents = {}; var titleMouseEvents = {}; if (!props.disabled) { titleClickEvents = { onClick: this.onTitleClick }; mouseEvents = { onMouseLeave: this.onMouseLeave, onMouseEnter: this.onMouseEnter }; // only works in title, not outer li titleMouseEvents = { onMouseEnter: this.onTitleMouseEnter, onMouseLeave: this.onTitleMouseLeave }; } var style = {}; if (props.mode === 'inline') { style.paddingLeft = props.inlineIndent * props.level; } return _react2["default"].createElement( 'li', (0, _extends3["default"])({ className: (0, _classnames2["default"])(classes) }, mouseEvents), _react2["default"].createElement( 'div', (0, _extends3["default"])({ style: style, className: prefixCls + '-title' }, titleMouseEvents, titleClickEvents, { 'aria-expanded': isOpen, 'aria-owns': this._menuId, 'aria-haspopup': 'true' }), props.title ), this.renderChildren(props.children) ); } }); SubMenu.isSubMenu = 1; exports["default"] = SubMenu; module.exports = exports['default']; /***/ }), /***/ 78: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _KeyCode = __webpack_require__(18); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _addEventListener = __webpack_require__(81); var _addEventListener2 = _interopRequireDefault(_addEventListener); var _contains = __webpack_require__(82); var _contains2 = _interopRequireDefault(_contains); var _reactDom = __webpack_require__(19); var _reactDom2 = _interopRequireDefault(_reactDom); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = { componentDidMount: function componentDidMount() { this.componentDidUpdate(); }, componentDidUpdate: function componentDidUpdate() { if (this.props.mode !== 'inline') { if (this.props.open) { this.bindRootCloseHandlers(); } else { this.unbindRootCloseHandlers(); } } }, handleDocumentKeyUp: function handleDocumentKeyUp(e) { if (e.keyCode === _KeyCode2["default"].ESC) { this.props.onItemHover({ key: this.props.eventKey, item: this, hover: false }); } }, handleDocumentClick: function handleDocumentClick(e) { // If the click originated from within this component // don't do anything. if ((0, _contains2["default"])(_reactDom2["default"].findDOMNode(this), e.target)) { return; } var props = this.props; props.onItemHover({ hover: false, item: this, key: this.props.eventKey }); this.triggerOpenChange(false); }, bindRootCloseHandlers: function bindRootCloseHandlers() { if (!this._onDocumentClickListener) { this._onDocumentClickListener = (0, _addEventListener2["default"])(document, 'click', this.handleDocumentClick); this._onDocumentKeyupListener = (0, _addEventListener2["default"])(document, 'keyup', this.handleDocumentKeyUp); } }, unbindRootCloseHandlers: function unbindRootCloseHandlers() { if (this._onDocumentClickListener) { this._onDocumentClickListener.remove(); this._onDocumentClickListener = null; } if (this._onDocumentKeyupListener) { this._onDocumentKeyupListener.remove(); this._onDocumentKeyupListener = null; } }, componentWillUnmount: function componentWillUnmount() { this.unbindRootCloseHandlers(); } }; module.exports = exports['default']; /***/ }), /***/ 79: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof2 = __webpack_require__(29); var _typeof3 = _interopRequireDefault(_typeof2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(3); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(11); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _MenuMixin = __webpack_require__(33); var _MenuMixin2 = _interopRequireDefault(_MenuMixin); var _rcAnimate = __webpack_require__(71); var _rcAnimate2 = _interopRequireDefault(_rcAnimate); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var SubPopupMenu = (0, _createReactClass2["default"])({ displayName: 'SubPopupMenu', propTypes: { onSelect: _propTypes2["default"].func, onClick: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, onOpenChange: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, openTransitionName: _propTypes2["default"].string, openAnimation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), closeSubMenuOnMouseLeave: _propTypes2["default"].bool, visible: _propTypes2["default"].bool, children: _propTypes2["default"].any }, mixins: [_MenuMixin2["default"]], onDeselect: function onDeselect(selectInfo) { this.props.onDeselect(selectInfo); }, onSelect: function onSelect(selectInfo) { this.props.onSelect(selectInfo); }, onClick: function onClick(e) { this.props.onClick(e); }, onOpenChange: function onOpenChange(e) { this.props.onOpenChange(e); }, onDestroy: function onDestroy(key) { this.props.onDestroy(key); }, onItemHover: function onItemHover(e) { var _e$openChanges = e.openChanges, openChanges = _e$openChanges === undefined ? [] : _e$openChanges; openChanges = openChanges.concat(this.getOpenChangesOnItemHover(e)); if (openChanges.length) { this.onOpenChange(openChanges); } }, getOpenTransitionName: function getOpenTransitionName() { return this.props.openTransitionName; }, renderMenuItem: function renderMenuItem(c, i, subIndex) { if (!c) { return null; } var props = this.props; var extraProps = { openKeys: props.openKeys, selectedKeys: props.selectedKeys, openSubMenuOnMouseEnter: true }; return this.renderCommonMenuItem(c, i, subIndex, extraProps); }, render: function render() { var renderFirst = this.renderFirst; this.renderFirst = 1; this.haveOpened = this.haveOpened || this.props.visible; if (!this.haveOpened) { return null; } var transitionAppear = true; if (!renderFirst && this.props.visible) { transitionAppear = false; } var props = (0, _extends3["default"])({}, this.props); props.className += ' ' + props.prefixCls + '-sub'; var animProps = {}; if (props.openTransitionName) { animProps.transitionName = props.openTransitionName; } else if ((0, _typeof3["default"])(props.openAnimation) === 'object') { animProps.animation = (0, _extends3["default"])({}, props.openAnimation); if (!transitionAppear) { delete animProps.animation.appear; } } return _react2["default"].createElement( _rcAnimate2["default"], (0, _extends3["default"])({}, animProps, { showProp: 'visible', component: '', transitionAppear: transitionAppear }), this.renderRoot(props) ); } }); exports["default"] = SubPopupMenu; module.exports = exports['default']; /***/ }), /***/ 80: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Divider = exports.ItemGroup = exports.MenuItemGroup = exports.MenuItem = exports.Item = exports.SubMenu = undefined; var _Menu = __webpack_require__(74); var _Menu2 = _interopRequireDefault(_Menu); var _SubMenu = __webpack_require__(77); var _SubMenu2 = _interopRequireDefault(_SubMenu); var _MenuItem = __webpack_require__(75); var _MenuItem2 = _interopRequireDefault(_MenuItem); var _MenuItemGroup = __webpack_require__(76); var _MenuItemGroup2 = _interopRequireDefault(_MenuItemGroup); var _Divider = __webpack_require__(73); var _Divider2 = _interopRequireDefault(_Divider); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports.SubMenu = _SubMenu2["default"]; exports.Item = _MenuItem2["default"]; exports.MenuItem = _MenuItem2["default"]; exports.MenuItemGroup = _MenuItemGroup2["default"]; exports.ItemGroup = _MenuItemGroup2["default"]; exports.Divider = _Divider2["default"]; exports["default"] = _Menu2["default"]; /***/ }), /***/ 81: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = addEventListenerWrap; var _addDomEventListener = __webpack_require__(50); var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); var _reactDom = __webpack_require__(19); var _reactDom2 = _interopRequireDefault(_reactDom); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function addEventListenerWrap(target, eventType, cb) { /* eslint camelcase: 2 */ var callback = _reactDom2["default"].unstable_batchedUpdates ? function run(e) { _reactDom2["default"].unstable_batchedUpdates(cb, e); } : cb; return (0, _addDomEventListener2["default"])(target, eventType, callback); } module.exports = exports['default']; /***/ }), /***/ 82: /***/ (function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = contains; function contains(root, n) { var node = n; while (node) { if (node === root) { return true; } node = node.parentNode; } return false; } module.exports = exports['default']; /***/ }), /***/ 83: /***/ (function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = createChainedFunction; /** * Safe chained function * * Will only create a new function if needed, * otherwise will pass back existing functions or null. * * @returns {function|null} */ function createChainedFunction() { var args = [].slice.call(arguments, 0); if (args.length === 1) { return args[0]; } return function chainedFunction() { for (var i = 0; i < args.length; i++) { if (args[i] && args[i].apply) { args[i].apply(this, arguments); } } }; } module.exports = exports['default']; /***/ }), /***/ 85: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(59); var _menu = __webpack_require__(58); var _menu2 = _interopRequireDefault(_menu); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NavigationBar = function NavigationBar() { return _react2.default.createElement( _menu2.default, { theme: 'dark', mode: 'horizontal', defaultSelectedKeys: ['2'], style: { lineHeight: '64px' } }, _react2.default.createElement( _menu2.default.Item, { key: '1' }, 'nav 1' ), _react2.default.createElement( _menu2.default.Item, { key: '2' }, 'nav 2' ), _react2.default.createElement( _menu2.default.Item, { key: '3' }, 'nav 3' ) ); }; NavigationBar.propTypes = {}; exports.default = NavigationBar; module.exports = exports['default']; /***/ }), /***/ 86: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _regenerator = __webpack_require__(35); var _regenerator2 = _interopRequireDefault(_regenerator); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { namespace: 'navigationBar', state: {}, subscriptions: { setup: function setup(_ref) {// eslint-disable-line var dispatch = _ref.dispatch, history = _ref.history; } }, effects: { fetch: _regenerator2.default.mark(function fetch(_ref2, _ref3) { var payload = _ref2.payload; var call = _ref3.call, put = _ref3.put; return _regenerator2.default.wrap(function fetch$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return put({ type: 'save' }); case 2: case 'end': return _context.stop(); } } }, fetch, this); }) }, reducers: { save: function save(state, action) { return (0, _extends3.default)({}, state, action.payload); } } }; module.exports = exports['default']; /***/ }), /***/ 303: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _dva = __webpack_require__(4); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // import styles from './Index.css'; function Index() { return _react2.default.createElement( 'div', null, '\u7528\u6237\u7BA1\u7406' ); } Index.propTypes = {}; exports.default = (0, _dva.connect)()(Index); module.exports = exports['default']; /***/ }), /***/ 304: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _dva = __webpack_require__(4); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // import styles from './Profile.css'; function Profile() { return _react2.default.createElement( 'div', null, '\u4E2A\u4EBA\u8D44\u6599' ); } Profile.propTypes = {}; exports.default = (0, _dva.connect)()(Profile); module.exports = exports['default']; /***/ }), /***/ 305: /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.routes = undefined; exports.RouterConfig = RouterConfig; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _router = __webpack_require__(24); var _Layout = __webpack_require__(39); var _Layout2 = _interopRequireDefault(_Layout); var _Index = __webpack_require__(303); var _Index2 = _interopRequireDefault(_Index); var _Profile = __webpack_require__(304); var _Profile2 = _interopRequireDefault(_Profile); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var routes = exports.routes = _react2.default.createElement( _router.Route, { component: _Layout2.default }, _react2.default.createElement(_router.IndexRoute, { component: _Index2.default }), _react2.default.createElement(_router.Route, { path: 'profile', component: _Profile2.default }) ); function RouterConfig(_ref) { var history = _ref.history; return _react2.default.createElement( _router.Router, { history: history }, routes ); } /***/ }), /***/ 580: /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _dva = __webpack_require__(4); var _dva2 = _interopRequireDefault(_dva); var _router = __webpack_require__(24); __webpack_require__(106); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // 1. Initialize var app = (0, _dva2.default)({ history: _router.hashHistory }); // 2. Plugins // app.use({}); // 3. Model app.model(__webpack_require__(86)); // 4. Router app.router(__webpack_require__(305).RouterConfig); // 5. Start app.start('#root'); /***/ }), /***/ 590: /***/ (function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) { 'use strict'; __webpack_require__(20); __webpack_require__(__webpack_module_template_argument_0__); /***/ }) });
src/index.js
NaNdreas/nilssongames-dragonfly
import React, { Component } from 'react'; import Game from './game'; export default class NilssongamesDragonfly extends Component { componentDidMount() { Game.init(document.getElementById('nilssongames-dragonfly')); } componentWillUnmount() { Game.end(); } render() { return <div id="nilssongames-dragonfly" />; } }
ajax/libs/babel-core/5.0.3/browser.min.js
stefanneculai/cdnjs
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.babel=e()}}(function(){var e,t,n;return function r(e,t,n){function l(s,a){if(!t[s]){if(!e[s]){var o="function"==typeof require&&require;if(!a&&o)return o(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=t[s]={exports:{}};e[s][0].call(p.exports,function(t){var n=e[s][1][t];return l(n?n:t)},p,p.exports,r,e,t,n)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)l(n[s]);return l}({1:[function(e){"use strict";var t=e(".."),n=t.Parser.prototype,r=t.tokTypes;n.isRelational=function(e){return this.type===r.relational&&this.value===e},n.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected()},n.flow_parseDeclareClass=function(e){return this.next(),this.flow_parseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},n.flow_parseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdent(),n=this.startNode(),l=this.startNode();n.typeParameters=this.isRelational("<")?this.flow_parseTypeParameterDeclaration():null,this.expect(r.parenL);var i=this.flow_parseFunctionTypeParams();return n.params=i.params,n.rest=i.rest,this.expect(r.parenR),this.expect(r.colon),n.returnType=this.flow_parseType(),l.typeAnnotation=this.finishNode(n,"FunctionTypeAnnotation"),t.typeAnnotation=this.finishNode(l,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},n.flow_parseDeclare=function(e){return this.type===r._class?this.flow_parseDeclareClass(e):this.type===r._function?this.flow_parseDeclareFunction(e):this.type===r._var?this.flow_parseDeclareVariable(e):this.isContextual("module")?this.flow_parseDeclareModule(e):void this.unexpected()},n.flow_parseDeclareVariable=function(e){return this.next(),e.id=this.flow_parseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},n.flow_parseDeclareModule=function(e){this.next(),e.id=this.type===r.string?this.parseExprAtom():this.parseIdent();var t=e.body=this.startNode(),n=t.body=[];for(this.expect(r.braceL);this.type!==r.braceR;){var l=this.startNode();this.next(),n.push(this.flow_parseDeclare(l))}return this.expect(r.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},n.flow_parseInterfaceish=function(e,t){if(e.id=this.parseIdent(),e.typeParameters=this.isRelational("<")?this.flow_parseTypeParameterDeclaration():null,e["extends"]=[],this.eat(r._extends))do e["extends"].push(this.flow_parseInterfaceExtends());while(this.eat(r.comma));e.body=this.flow_parseObjectType(t)},n.flow_parseInterfaceExtends=function(){var e=this.startNode();return e.id=this.parseIdent(),e.typeParameters=this.isRelational("<")?this.flow_parseTypeParameterInstantiation():null,this.finishNode(e,"InterfaceExtends")},n.flow_parseInterface=function(e){return this.flow_parseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},n.flow_parseTypeAlias=function(e){return e.id=this.parseIdent(),e.typeParameters=this.isRelational("<")?this.flow_parseTypeParameterDeclaration():null,this.expect(r.eq),e.right=this.flow_parseType(),this.semicolon(),this.finishNode(e,"TypeAlias")},n.flow_parseTypeParameterDeclaration=function(){var e=this.startNode();for(e.params=[],this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flow_parseTypeAnnotatableIdentifier()),this.isRelational(">")||this.expect(r.comma);return this.expectRelational(">"),this.finishNode(e,"TypeParameterDeclaration")},n.flow_parseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.inType;for(e.params=[],this.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flow_parseType()),this.isRelational(">")||this.expect(r.comma);return this.expectRelational(">"),this.inType=t,this.finishNode(e,"TypeParameterInstantiation")},n.flow_parseObjectPropertyKey=function(){return this.type===r.num||this.type===r.string?this.parseExprAtom():this.parseIdent(!0)},n.flow_parseObjectTypeIndexer=function(e,t){return e["static"]=t,this.expect(r.bracketL),e.id=this.flow_parseObjectPropertyKey(),this.expect(r.colon),e.key=this.flow_parseType(),this.expect(r.bracketR),this.expect(r.colon),e.value=this.flow_parseType(),this.flow_objectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},n.flow_parseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flow_parseTypeParameterDeclaration()),this.expect(r.parenL);this.type===r.name;)e.params.push(this.flow_parseFunctionTypeParam()),this.type!==r.parenR&&this.expect(r.comma);return this.eat(r.ellipsis)&&(e.rest=this.flow_parseFunctionTypeParam()),this.expect(r.parenR),this.expect(r.colon),e.returnType=this.flow_parseType(),this.finishNode(e,"FunctionTypeAnnotation")},n.flow_parseObjectTypeMethod=function(e,t,n){var r=this.startNodeAt(e);return r.value=this.flow_parseObjectTypeMethodish(this.startNodeAt(e)),r["static"]=t,r.key=n,r.optional=!1,this.flow_objectTypeSemicolon(),this.finishNode(r,"ObjectTypeProperty")},n.flow_parseObjectTypeCallProperty=function(e,t){var n=this.startNode();return e["static"]=t,e.value=this.flow_parseObjectTypeMethodish(n),this.flow_objectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},n.flow_parseObjectType=function(e){var t,n,l,i=this.startNode(),s=!1;for(i.callProperties=[],i.properties=[],i.indexers=[],this.expect(r.braceL);this.type!==r.braceR;){var a=this.markPosition();t=this.startNode(),e&&this.isContextual("static")&&(this.next(),l=!0),this.type===r.bracketL?i.indexers.push(this.flow_parseObjectTypeIndexer(t,l)):this.type===r.parenL||this.isRelational("<")?i.callProperties.push(this.flow_parseObjectTypeCallProperty(t,e)):(n=l&&this.type===r.colon?this.parseIdent():this.flow_parseObjectPropertyKey(),this.isRelational("<")||this.type===r.parenL?i.properties.push(this.flow_parseObjectTypeMethod(a,l,n)):(this.eat(r.question)&&(s=!0),this.expect(r.colon),t.key=n,t.value=this.flow_parseType(),t.optional=s,t["static"]=l,this.flow_objectTypeSemicolon(),i.properties.push(this.finishNode(t,"ObjectTypeProperty"))))}return this.expect(r.braceR),this.finishNode(i,"ObjectTypeAnnotation")},n.flow_objectTypeSemicolon=function(){this.eat(r.semi)||this.type===r.braceR||this.unexpected()},n.flow_parseGenericType=function(e,t){var n=this.startNodeAt(e);for(n.typeParameters=null,n.id=t;this.eat(r.dot);){var l=this.startNodeAt(e);l.qualification=n.id,l.id=this.parseIdent(),n.id=this.finishNode(l,"QualifiedTypeIdentifier")}return this.isRelational("<")&&(n.typeParameters=this.flow_parseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},n.flow_parseVoidType=function(){var e=this.startNode();return this.expect(r._void),this.finishNode(e,"VoidTypeAnnotation")},n.flow_parseTypeofType=function(){var e=this.startNode();return this.expect(r._typeof),e.argument=this.flow_parsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},n.flow_parseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(r.bracketL);this.pos<this.input.length&&this.type!==r.bracketR&&(e.types.push(this.flow_parseType()),this.type!==r.bracketR);)this.expect(r.comma);return this.expect(r.bracketR),this.finishNode(e,"TupleTypeAnnotation")},n.flow_parseFunctionTypeParam=function(){var e=!1,t=this.startNode();return t.name=this.parseIdent(),this.eat(r.question)&&(e=!0),this.expect(r.colon),t.optional=e,t.typeAnnotation=this.flow_parseType(),this.finishNode(t,"FunctionTypeParam")},n.flow_parseFunctionTypeParams=function(){for(var e={params:[],rest:null};this.type===r.name;)e.params.push(this.flow_parseFunctionTypeParam()),this.type!==r.parenR&&this.expect(r.comma);return this.eat(r.ellipsis)&&(e.rest=this.flow_parseFunctionTypeParam()),e},n.flow_identToTypeAnnotation=function(e,t,n){switch(n.name){case"any":return this.finishNode(t,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(t,"BooleanTypeAnnotation");case"number":return this.finishNode(t,"NumberTypeAnnotation");case"string":return this.finishNode(t,"StringTypeAnnotation");default:return this.flow_parseGenericType(e,n)}},n.flow_parsePrimaryType=function(){var e,t,n,l=this.markPosition(),i=this.startNode(),s=!1;switch(this.type){case r.name:return this.flow_identToTypeAnnotation(l,i,this.parseIdent());case r.braceL:return this.flow_parseObjectType();case r.bracketL:return this.flow_parseTupleType();case r.relational:if("<"===this.value)return i.typeParameters=this.flow_parseTypeParameterDeclaration(),this.expect(r.parenL),e=this.flow_parseFunctionTypeParams(),i.params=e.params,i.rest=e.rest,this.expect(r.parenR),this.expect(r.arrow),i.returnType=this.flow_parseType(),this.finishNode(i,"FunctionTypeAnnotation");case r.parenL:if(this.next(),this.type!==r.parenR&&this.type!==r.ellipsis)if(this.type===r.name){var t=this.lookahead().type;s=t!==r.question&&t!==r.colon}else s=!0;return s?(n=this.flow_parseType(),this.expect(r.parenR),this.eat(r.arrow)&&this.raise(i,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),n):(e=this.flow_parseFunctionTypeParams(),i.params=e.params,i.rest=e.rest,this.expect(r.parenR),this.expect(r.arrow),i.returnType=this.flow_parseType(),i.typeParameters=null,this.finishNode(i,"FunctionTypeAnnotation"));case r.string:return i.value=this.value,i.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(i,"StringLiteralTypeAnnotation");default:if(this.type.keyword)switch(this.type.keyword){case"void":return this.flow_parseVoidType();case"typeof":return this.flow_parseTypeofType()}}this.unexpected()},n.flow_parsePostfixType=function(){var e=this.startNode(),t=e.elementType=this.flow_parsePrimaryType();return this.type===r.bracketL?(this.expect(r.bracketL),this.expect(r.bracketR),this.finishNode(e,"ArrayTypeAnnotation")):t},n.flow_parsePrefixType=function(){var e=this.startNode();return this.eat(r.question)?(e.typeAnnotation=this.flow_parsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flow_parsePostfixType()},n.flow_parseIntersectionType=function(){var e=this.startNode(),t=this.flow_parsePrefixType();for(e.types=[t];this.eat(r.bitwiseAND);)e.types.push(this.flow_parsePrefixType());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},n.flow_parseUnionType=function(){var e=this.startNode(),t=this.flow_parseIntersectionType();for(e.types=[t];this.eat(r.bitwiseOR);)e.types.push(this.flow_parseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},n.flow_parseType=function(){var e=this.inType;this.inType=!0;var t=this.flow_parseUnionType();return this.inType=e,t},n.flow_parseTypeAnnotation=function(){var e=this.startNode(),t=this.inType;return this.inType=!0,this.expect(r.colon),e.typeAnnotation=this.flow_parseType(),this.inType=t,this.finishNode(e,"TypeAnnotation")},n.flow_parseTypeAnnotatableIdentifier=function(e,t){var n=(this.startNode(),this.parseIdent()),l=!1;return t&&this.eat(r.question)&&(this.expect(r.question),l=!0),(e||this.type===r.colon)&&(n.typeAnnotation=this.flow_parseTypeAnnotation(),this.finishNode(n,n.type)),l&&(n.optional=!0,this.finishNode(n,n.type)),n},t.plugins.flow=function(e){e.extend("parseFunctionBody",function(e){return function(t,n){return this.type===r.colon&&(t.returnType=this.flow_parseTypeAnnotation()),e.call(this,t,n)}}),e.extend("parseStatement",function(e){return function(t,n){if(this.strict&&this.type===r.name&&"interface"===this.value){var l=this.startNode();return this.next(),this.flow_parseInterface(l)}return e.call(this,t,n)}}),e.extend("parseExpressionStatement",function(e){return function(t,n){if("Identifier"===n.type)if("declare"===n.name){if(this.type===r._class||this.type===r.name||this.type===r._function||this.type===r._var)return this.flow_parseDeclare(t)}else if(this.type===r.name){if("interface"===n.name)return this.flow_parseInterface(t);if("type"===n.name)return this.flow_parseTypeAlias(t)}return e.call(this,t,n)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||e.call(this)}}),e.extend("parseParenItem",function(){return function(e,t){if(this.type===r.colon){var n=this.startNodeAt(t);return n.expression=e,n.typeAnnotation=this.flow_parseTypeAnnotation(),this.finishNode(n,"TypeCastExpression")}return e}}),e.extend("parseClassId",function(e){return function(t,n){e.call(this,t,n),this.isRelational("<")&&(t.typeParameters=this.flow_parseTypeParameterDeclaration())}}),e.extend("readToken",function(e){return function(t){return!this.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(r.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){return this.inType?void 0:e.call(this)}}),e.extend("parseParenArrowList",function(e){return function(t,n,r){for(var l=0;l<n.length;l++){var i=n[l];if("TypeCastExpression"===i.type){var s=i.expression;s.typeAnnotation=i.typeAnnotation,n[l]=s}}return e.call(this,t,n,r)}}),e.extend("parseClassProperty",function(e){return function(t){return this.type===r.colon&&(t.typeAnnotation=this.flow_parseTypeAnnotation()),e.call(this,t)}}),e.extend("isClassProperty",function(e){return function(){return this.type===r.colon||e.call(this)}}),e.extend("parseClassMethod",function(){return function(e,t,n,r){var l;this.isRelational("<")&&(l=this.flow_parseTypeParameterDeclaration()),t.value=this.parseMethod(n,r),t.value.typeParameters=l,e.body.push(this.finishNode(t,"MethodDefinition"))}}),e.extend("parseClassSuper",function(e){return function(t,n){if(e.call(this,t,n),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flow_parseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var l=t["implements"]=[];do{var t=this.startNode();t.id=this.parseIdent(),t.typeParameters=this.isRelational("<")?this.flow_parseTypeParameterInstantiation():null,l.push(this.finishNode(t,"ClassImplements"))}while(this.eat(r.comma))}}}),e.extend("parseObjPropValue",function(e){return function(t){var n;this.isRelational("<")&&(n=this.flow_parseTypeParameterDeclaration(),this.type!==r.parenL&&this.unexpected()),e.apply(this,arguments),t.value.typeParameters=n}}),e.extend("parseAssignableListItemTypes",function(){return function(e){return this.eat(r.question)&&(e.optional=!0),this.type===r.colon&&(e.typeAnnotation=this.flow_parseTypeAnnotation()),this.finishNode(e,e.type),e}}),e.extend("parseImportSpecifiers",function(e){return function(t){if(t.isType=!1,this.isContextual("type")){var n=this.markPosition(),l=this.parseIdent();if(this.type===r.name&&"from"!==this.value||this.type===r.braceL||this.type===r.star)t.isType=!0;else{if(t.specifiers.push(this.parseImportSpecifierDefault(l,n)),this.isContextual("from"))return;this.eat(r.comma)}}e.call(this,t)}}),e.extend("parseFunctionParams",function(e){return function(t){this.isRelational("<")&&(t.typeParameters=this.flow_parseTypeParameterDeclaration()),e.call(this,t)}}),e.extend("parseVarHead",function(e){return function(t){e.call(this,t),this.type===r.colon&&(t.id.typeAnnotation=this.flow_parseTypeAnnotation(),this.finishNode(t.id,t.id.type))}})}},{"..":5}],2:[function(e){"use strict";function t(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?t(e.object)+"."+t(e.property):void 0}var n=e(".."),r=n.tokTypes,l=n.tokContexts;l.j_oTag=new n.TokContext("<tag",!1),l.j_cTag=new n.TokContext("</tag",!1),l.j_expr=new n.TokContext("<tag>...</tag>",!0,!0),r.jsxName=new n.TokenType("jsxName"),r.jsxText=new n.TokenType("jsxText",{beforeExpr:!0}),r.jsxTagStart=new n.TokenType("jsxTagStart"),r.jsxTagEnd=new n.TokenType("jsxTagEnd"),r.jsxTagStart.updateContext=function(){this.context.push(l.j_expr),this.context.push(l.j_oTag),this.exprAllowed=!1},r.jsxTagEnd.updateContext=function(e){var t=this.context.pop();t===l.j_oTag&&e===r.slash||t===l.j_cTag?(this.context.pop(),this.exprAllowed=this.curContext()===l.j_expr):this.exprAllowed=!0};var i=n.Parser.prototype;i.jsx_readToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");var l=this.input.charCodeAt(this.pos);switch(l){case 60:case 123:return this.pos===this.start?60===l&&this.exprAllowed?(++this.pos,this.finishToken(r.jsxTagStart)):this.getTokenFromCode(l):(e+=this.input.slice(t,this.pos),this.finishToken(r.jsxText,e));case 38:e+=this.input.slice(t,this.pos),e+=this.jsx_readEntity(),t=this.pos;break;default:n.isNewLine(l)?(e+=this.input.slice(t,this.pos),++this.pos,13===l&&10===this.input.charCodeAt(this.pos)?(++this.pos,e+="\n"):e+=String.fromCharCode(l),this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos):++this.pos}}},i.jsx_readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var l=this.input.charCodeAt(this.pos);if(l===e)break;38===l?(t+=this.input.slice(n,this.pos),t+=this.jsx_readEntity(),n=this.pos):++this.pos}return t+=this.input.slice(n,this.pos++),this.finishToken(r.string,t)};var s={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},a=/^[\da-fA-F]+$/,o=/^\d+$/;i.jsx_readEntity=function(){var e,t="",n=0,r=this.input[this.pos];"&"!==r&&this.raise(this.pos,"Entity must start with an ampersand");for(var l=++this.pos;this.pos<this.input.length&&n++<10;){if(r=this.input[this.pos++],";"===r){"#"===t[0]?"x"===t[1]?(t=t.substr(2),a.test(t)&&(e=String.fromCharCode(parseInt(t,16)))):(t=t.substr(1),o.test(t)&&(e=String.fromCharCode(parseInt(t,10)))):e=s[t];break}t+=r}return e?e:(this.pos=l,"&")},i.jsx_readWord=function(){var e,t=this.pos;do e=this.input.charCodeAt(++this.pos);while(n.isIdentifierChar(e)||45===e);return this.finishToken(r.jsxName,this.input.slice(t,this.pos))},i.jsx_parseIdentifier=function(){var e=this.startNode();return this.type===r.jsxName?e.name=this.value:this.type.keyword?e.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")},i.jsx_parseNamespacedName=function(){var e=this.markPosition(),t=this.jsx_parseIdentifier();if(!this.eat(r.colon))return t;var n=this.startNodeAt(e);return n.namespace=t,n.name=this.jsx_parseIdentifier(),this.finishNode(n,"JSXNamespacedName")},i.jsx_parseElementName=function(){for(var e=this.markPosition(),t=this.jsx_parseNamespacedName();this.eat(r.dot);){var n=this.startNodeAt(e);n.object=t,n.property=this.jsx_parseIdentifier(),t=this.finishNode(n,"JSXMemberExpression")}return t},i.jsx_parseAttributeValue=function(){switch(this.type){case r.braceL:var e=this.jsx_parseExpressionContainer();return"JSXEmptyExpression"===e.expression.type&&this.raise(e.start,"JSX attributes must only be assigned a non-empty expression"),e;case r.jsxTagStart:case r.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}},i.jsx_parseEmptyExpression=function(){var e=this.start;return this.start=this.lastTokEnd,this.lastTokEnd=e,e=this.startLoc,this.startLoc=this.lastTokEndLoc,this.lastTokEndLoc=e,this.finishNode(this.startNode(),"JSXEmptyExpression")},i.jsx_parseExpressionContainer=function(){var e=this.startNode();return this.next(),e.expression=this.type===r.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(r.braceR),this.finishNode(e,"JSXExpressionContainer")},i.jsx_parseAttribute=function(){var e=this.startNode();return this.eat(r.braceL)?(this.expect(r.ellipsis),e.argument=this.parseMaybeAssign(),this.expect(r.braceR),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsx_parseNamespacedName(),e.value=this.eat(r.eq)?this.jsx_parseAttributeValue():null,this.finishNode(e,"JSXAttribute"))},i.jsx_parseOpeningElementAt=function(e){var t=this.startNodeAt(e);for(t.attributes=[],t.name=this.jsx_parseElementName();this.type!==r.slash&&this.type!==r.jsxTagEnd;)t.attributes.push(this.jsx_parseAttribute());return t.selfClosing=this.eat(r.slash),this.expect(r.jsxTagEnd),this.finishNode(t,"JSXOpeningElement")},i.jsx_parseClosingElementAt=function(e){var t=this.startNodeAt(e);return t.name=this.jsx_parseElementName(),this.expect(r.jsxTagEnd),this.finishNode(t,"JSXClosingElement")},i.jsx_parseElementAt=function(e){var n=this.startNodeAt(e),l=[],i=this.jsx_parseOpeningElementAt(e),s=null;if(!i.selfClosing){e:for(;;)switch(this.type){case r.jsxTagStart:if(e=this.markPosition(),this.next(),this.eat(r.slash)){s=this.jsx_parseClosingElementAt(e);break e}l.push(this.jsx_parseElementAt(e));break;case r.jsxText:l.push(this.parseExprAtom());break;case r.braceL:l.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}t(s.name)!==t(i.name)&&this.raise(s.start,"Expected corresponding JSX closing tag for <"+t(i.name)+">")}return n.openingElement=i,n.closingElement=s,n.children=l,this.finishNode(n,"JSXElement")},i.jsx_parseElement=function(){var e=this.markPosition();return this.next(),this.jsx_parseElementAt(e)},n.plugins.jsx=function(e){e.extend("parseExprAtom",function(e){return function(t){return this.type===r.jsxText?this.parseLiteral(this.value):this.type===r.jsxTagStart?this.jsx_parseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){var i=this.curContext();if(i===l.j_expr)return this.jsx_readToken();if(i===l.j_oTag||i===l.j_cTag){if(n.isIdentifierStart(t))return this.jsx_readWord();if(62==t)return++this.pos,this.finishToken(r.jsxTagEnd);if((34===t||39===t)&&i==l.j_oTag)return this.jsx_readString(t)}return 60===t&&this.exprAllowed?(++this.pos,this.finishToken(r.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.type==r.braceL){var n=this.curContext();n==l.j_oTag?this.context.push(l.b_expr):n==l.j_expr?this.context.push(l.b_tmpl):e.call(this,t),this.exprAllowed=!0}else{if(this.type!==r.slash||t!==r.jsxTagStart)return e.call(this,t);this.context.length-=2,this.context.push(l.j_cTag),this.exprAllowed=!1}}})}},{"..":5}],3:[function(e){"use strict";var t=e("./tokentype").types,n=e("./state").Parser,r=e("./identifier").reservedWords,l=e("./util").has,i=n.prototype;i.checkPropClash=function(e,t){if(!(this.options.ecmaVersion>=6)){var n=e.key,r=void 0;switch(n.type){case"Identifier":r=n.name;break;case"Literal":r=String(n.value);break;default:return}var i=e.kind||"init",s=void 0;if(l(t,r)){s=t[r];var a="init"!==i;((this.strict||a)&&s[i]||!(a^s.init))&&this.raise(n.start,"Redefinition of property")}else s=t[r]={init:!1,get:!1,set:!1};s[i]=!0}},i.parseExpression=function(e,n){var r=this.markPosition(),l=this.parseMaybeAssign(e,n);if(this.type===t.comma){var i=this.startNodeAt(r);for(i.expressions=[l];this.eat(t.comma);)i.expressions.push(this.parseMaybeAssign(e,n));return this.finishNode(i,"SequenceExpression")}return l},i.parseMaybeAssign=function(e,n,r){if(this.type==t._yield&&this.inGenerator)return this.parseYield();var l=void 0;n?l=!1:(n={start:0},l=!0);var i=this.markPosition(),s=this.parseMaybeConditional(e,n);if(r&&(s=r.call(this,s,i)),this.type.isAssign){var a=this.startNodeAt(i);return a.operator=this.value,a.left=this.type===t.eq?this.toAssignable(s):s,n.start=0,this.checkLVal(s),s.parenthesizedExpression&&("ObjectPattern"===s.type?this.raise(s.start,"You're trying to assign to a parenthesized expression, instead of `({ foo }) = {}` use `({ foo } = {})`"):this.raise(s.start,"Parenthesized left hand expressions are illegal")),this.next(),a.right=this.parseMaybeAssign(e),this.finishNode(a,"AssignmentExpression")}return l&&n.start&&this.unexpected(n.start),s},i.parseMaybeConditional=function(e,n){var r=this.markPosition(),l=this.parseExprOps(e,n);if(n&&n.start)return l;if(this.eat(t.question)){var i=this.startNodeAt(r);return i.test=l,i.consequent=this.parseMaybeAssign(),this.expect(t.colon),i.alternate=this.parseMaybeAssign(e),this.finishNode(i,"ConditionalExpression")}return l},i.parseExprOps=function(e,t){var n=this.markPosition(),r=this.parseMaybeUnary(t);return t&&t.start?r:this.parseExprOp(r,n,-1,e)},i.parseExprOp=function(e,n,r,l){var i=this.type.binop;if(null!=i&&(!l||this.type!==t._in)&&i>r){var s=this.startNodeAt(n);s.left=e,s.operator=this.value;var a=this.type;this.next();var o=this.markPosition();return s.right=this.parseExprOp(this.parseMaybeUnary(),o,a.rightAssociative?i-1:i,l),this.finishNode(s,a===t.logicalOR||a===t.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(s,n,r,l)}return e},i.parseMaybeUnary=function(e){if(this.type.prefix){var n=this.startNode(),r=this.type===t.incDec;return n.operator=this.value,n.prefix=!0,this.next(),n.argument=this.parseMaybeUnary(),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(n.argument):this.strict&&"delete"===n.operator&&"Identifier"===n.argument.type&&this.raise(n.start,"Deleting local variable in strict mode"),this.finishNode(n,r?"UpdateExpression":"UnaryExpression")}var l=this.markPosition(),i=this.parseExprSubscripts(e);if(e&&e.start)return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var n=this.startNodeAt(l);n.operator=this.value,n.prefix=!1,n.argument=i,this.checkLVal(i),this.next(),i=this.finishNode(n,"UpdateExpression")}return i},i.parseExprSubscripts=function(e){var t=this.markPosition(),n=this.parseExprAtom(e);return e&&e.start?n:this.parseSubscripts(n,t)},i.parseSubscripts=function(e,n,r){if(this.eat(t.dot)){var l=this.startNodeAt(n);return l.object=e,l.property=this.parseIdent(!0),l.computed=!1,this.parseSubscripts(this.finishNode(l,"MemberExpression"),n,r)}if(this.eat(t.bracketL)){var l=this.startNodeAt(n);return l.object=e,l.property=this.parseExpression(),l.computed=!0,this.expect(t.bracketR),this.parseSubscripts(this.finishNode(l,"MemberExpression"),n,r)}if(!r&&this.eat(t.parenL)){var l=this.startNodeAt(n);return l.callee=e,l.arguments=this.parseExprList(t.parenR,!1),this.parseSubscripts(this.finishNode(l,"CallExpression"),n,r)}if(this.type===t.backQuote){var l=this.startNodeAt(n);return l.tag=e,l.quasi=this.parseTemplate(),this.parseSubscripts(this.finishNode(l,"TaggedTemplateExpression"),n,r)}return e},i.parseExprAtom=function(e){var n=void 0;switch(this.type){case t._this:case t._super:var r=this.type===t._this?"ThisExpression":"Super";return n=this.startNode(),this.next(),this.finishNode(n,r);case t._yield:this.inGenerator&&unexpected();case t._do:if(this.options.features["es7.doExpressions"]){var l=this.startNode();return this.next(),l.body=this.parseBlock(),this.finishNode(l,"DoExpression")}case t.name:var i=this.markPosition();n=this.startNode();var s=this.parseIdent(this.type!==t.name);if(this.options.features["es7.asyncFunctions"])if("async"===s.name){if(this.type===t.parenL){var a=this.parseParenAndDistinguishExpression(i,!0);return a&&"ArrowFunctionExpression"===a.type?a:(n.callee=s,n.arguments=a?"SequenceExpression"===a.type?a.expressions:[a]:[],this.parseSubscripts(this.finishNode(n,"CallExpression"),i))}if(this.type===t.name)return s=this.parseIdent(),this.expect(t.arrow),this.parseArrowExpression(n,[s],!0);if(this.type===t._function&&!this.canInsertSemicolon())return this.next(),this.parseFunction(n,!1,!1,!0)}else if("await"===s.name&&this.inAsync)return this.parseAwait(n);return!this.canInsertSemicolon()&&this.eat(t.arrow)?this.parseArrowExpression(this.startNodeAt(i),[s]):s;case t.regexp:var o=this.value;return n=this.parseLiteral(o.value),n.regex={pattern:o.pattern,flags:o.flags},n;case t.num:case t.string:return this.parseLiteral(this.value);case t._null:case t._true:case t._false:return n=this.startNode(),n.value=this.type===t._null?null:this.type===t._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case t.parenL:return this.parseParenAndDistinguishExpression();case t.bracketL:return n=this.startNode(),this.next(),(this.options.ecmaVersion>=7||this.options.features["es7.comprehensions"])&&this.type===t._for?this.parseComprehension(n,!1):(n.elements=this.parseExprList(t.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression"));case t.braceL:return this.parseObj(!1,e);case t._function:return n=this.startNode(),this.next(),this.parseFunction(n,!1);case t.at:this.parseDecorators();case t._class:return n=this.startNode(),this.takeDecorators(n),this.parseClass(n,!1);case t._new:return this.parseNew();case t.backQuote:return this.parseTemplate();default:this.unexpected()}},i.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(t,"Literal")},i.parseParenExpression=function(){this.expect(t.parenL);var e=this.parseExpression();return this.expect(t.parenR),e},i.parseParenAndDistinguishExpression=function(e,n){e=e||this.markPosition();var r=void 0;if(this.options.ecmaVersion>=6){if(this.next(),(this.options.features["es7.comprehensions"]||this.options.ecmaVersion>=7)&&this.type===t._for)return this.parseComprehension(this.startNodeAt(e),!0);for(var l=this.markPosition(),i=[],s=!0,a={start:0},o=void 0,u=void 0;this.type!==t.parenR;){if(s?s=!1:this.expect(t.comma),this.type===t.ellipsis){var p=this.markPosition();o=this.start,i.push(this.parseParenItem(this.parseRest(),p));break}this.type!==t.parenL||u||(u=this.start),i.push(this.parseMaybeAssign(!1,a,this.parseParenItem))}var c=this.markPosition(); if(this.expect(t.parenR),!this.canInsertSemicolon()&&this.eat(t.arrow))return u&&this.unexpected(u),this.parseParenArrowList(e,i,n);if(!i.length){if(n)return;this.unexpected(this.lastTokStart)}o&&this.unexpected(o),a.start&&this.unexpected(a.start),i.length>1?(r=this.startNodeAt(l),r.expressions=i,this.finishNodeAt(r,"SequenceExpression",c)):r=i[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var d=this.startNodeAt(e);return d.expression=r,this.finishNode(d,"ParenthesizedExpression")}return r.parenthesizedExpression=!0,r},i.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e),t,n)},i.parseParenItem=function(e){return e};var s=[];i.parseNew=function(){var e=this.startNode(),n=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(t.dot))return e.meta=n,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raise(e.property.start,"The only valid meta property for new is new.target"),this.finishNode(e,"MetaProperty");var r=this.markPosition();return e.callee=this.parseSubscripts(this.parseExprAtom(),r,!0),e.arguments=this.eat(t.parenL)?this.parseExprList(t.parenR,!1):s,this.finishNode(e,"NewExpression")},i.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.start,this.end),cooked:this.value},this.next(),e.tail=this.type===t.backQuote,this.finishNode(e,"TemplateElement")},i.parseTemplate=function(){var e=this.startNode();this.next(),e.expressions=[];var n=this.parseTemplateElement();for(e.quasis=[n];!n.tail;)this.expect(t.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(t.braceR),e.quasis.push(n=this.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},i.parseObj=function(e,n){var r=this.startNode(),l=!0,i={};for(r.properties=[],this.next();!this.eat(t.braceR);){if(l)l=!1;else if(this.expect(t.comma),this.afterTrailingComma(t.braceR))break;var s=this.startNode(),a=!1,o=!1,u=void 0;if(this.options.features["es7.objectRestSpread"]&&this.type===t.ellipsis)s=this.parseSpread(),s.type="SpreadProperty",r.properties.push(s);else{if(this.options.ecmaVersion>=6&&(s.method=!1,s.shorthand=!1,(e||n)&&(u=this.markPosition()),e||(a=this.eat(t.star))),this.options.features["es7.asyncFunctions"]&&this.isContextual("async")){(a||e)&&this.unexpected();var p=this.parseIdent();this.type===t.colon||this.type===t.parenL?s.key=p:(o=!0,this.parsePropertyName(s))}else this.parsePropertyName(s);this.parseObjPropValue(s,u,a,o,e,n),this.checkPropClash(s,i),r.properties.push(this.finishNode(s,"Property"))}}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},i.parseObjPropValue=function(e,n,l,i,s,a){this.eat(t.colon)?(e.value=s?this.parseMaybeDefault():this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===t.parenL?(s&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(l,i)):this.options.ecmaVersion>=5&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&this.type!=t.comma&&this.type!=t.braceR?((l||i||s)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1)):this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?(e.kind="init",s?((this.isKeyword(e.key.name)||this.strict&&(r.strictBind(e.key.name)||r.strict(e.key.name))||!this.options.allowReserved&&this.isReservedWord(e.key.name))&&this.raise(e.key.start,"Binding "+e.key.name),e.value=this.parseMaybeDefault(n,e.key)):this.type===t.eq&&a?(a.start||(a.start=this.start),e.value=this.parseMaybeDefault(n,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected()},i.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(t.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),void this.expect(t.bracketR);e.computed=!1}e.key=this.type===t.num||this.type===t.string?this.parseExprAtom():this.parseIdent(!0)},i.initFunction=function(e,t){e.id=null,this.options.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),this.options.features["es7.asyncFunctions"]&&(e.async=!!t)},i.parseMethod=function(e,n){var r=this.startNode();return this.initFunction(r,n),this.expect(t.parenL),r.params=this.parseBindingList(t.parenR,!1,!1),this.options.ecmaVersion>=6&&(r.generator=e),this.parseFunctionBody(r),this.finishNode(r,"FunctionExpression")},i.parseArrowExpression=function(e,t,n){return this.initFunction(e,n),e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},i.parseFunctionBody=function(e,n){var r=n&&this.type!==t.braceL,l=this.inAsync;if(this.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var i=this.inFunction,s=this.inGenerator,a=this.labels;this.inFunction=!0,this.inGenerator=e.generator,this.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.inFunction=i,this.inGenerator=s,this.labels=a}if(this.inAsync=l,this.strict||!r&&e.body.body.length&&this.isUseStrict(e.body.body[0])){var o={},u=this.strict;this.strict=!0,e.id&&this.checkLVal(e.id,!0);for(var p=0;p<e.params.length;p++)this.checkLVal(e.params[p],!0,o);this.strict=u}},i.parseExprList=function(e,n,r,l){for(var i=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(t.comma),n&&this.afterTrailingComma(e))break;i.push(r&&this.type===t.comma?null:this.type===t.ellipsis?this.parseSpread(l):this.parseMaybeAssign(!1,l))}return i},i.parseIdent=function(e){var n=this.startNode();return e&&"never"==this.options.allowReserved&&(e=!1),this.type===t.name?(!e&&(!this.options.allowReserved&&this.isReservedWord(this.value)||this.strict&&r.strict(this.value)&&(this.options.ecmaVersion>=6||-1==this.input.slice(this.start,this.end).indexOf("\\")))&&this.raise(this.start,"The keyword '"+this.value+"' is reserved"),n.name=this.value):e&&this.type.keyword?n.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(n,"Identifier")},i.parseAwait=function(e){return(this.eat(t.semi)||this.canInsertSemicolon())&&this.unexpected(),e.all=this.eat(t.star),e.argument=this.parseMaybeAssign(!0),this.finishNode(e,"AwaitExpression")},i.parseYield=function(){var e=this.startNode();return this.next(),this.type==t.semi||this.canInsertSemicolon()||this.type!=t.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(t.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},i.parseComprehension=function(e,n){for(e.blocks=[];this.type===t._for;){var r=this.startNode();this.next(),this.expect(t.parenL),r.left=this.parseBindingAtom(),this.checkLVal(r.left,!0),this.expectContextual("of"),r.right=this.parseExpression(),this.expect(t.parenR),e.blocks.push(this.finishNode(r,"ComprehensionBlock"))}return e.filter=this.eat(t._if)?this.parseParenExpression():null,e.body=this.parseExpression(),this.expect(n?t.parenR:t.bracketR),e.generator=n,this.finishNode(e,"ComprehensionExpression")}},{"./identifier":4,"./state":12,"./tokentype":16,"./util":17}],4:[function(e,t,n){"use strict";function r(e){function t(e){if(1==e.length)return n+="return str === "+JSON.stringify(e[0])+";";n+="switch(str){";for(var t=0;t<e.length;++t)n+="case "+JSON.stringify(e[t])+":";n+="return true}return false;"}e=e.split(" ");var n="",r=[];e:for(var l=0;l<e.length;++l){for(var i=0;i<r.length;++i)if(r[i][0].length==e[l].length){r[i].push(e[l]);continue e}r.push([e[l]])}if(r.length>3){r.sort(function(e,t){return t.length-e.length}),n+="switch(str.length){";for(var l=0;l<r.length;++l){var s=r[l];n+="case "+s[0].length+":",t(s)}n+="}"}else t(e);return new Function("str",n)}function l(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}}function i(e,t){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&d.test(String.fromCharCode(e)):t===!1?!1:l(e,h)}function s(e,t){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&f.test(String.fromCharCode(e)):t===!1?!1:l(e,h)||l(e,m)}n.isIdentifierStart=i,n.isIdentifierChar=s,n.__esModule=!0;var a={3:r("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),5:r("class enum extends super const export import"),6:r("enum await"),strict:r("implements interface let package private protected public static yield"),strictBind:r("eval arguments")};n.reservedWords=a;var o="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",u={5:r(o),6:r(o+" let const class extends export import yield super")};n.keywords=u;var p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",c="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",d=new RegExp("["+p+"]"),f=new RegExp("["+p+c+"]");p=c=null;var h=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541],m=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]},{}],5:[function(e,t,n){"use strict";function r(e,t){var n=s(t,e),r=n.options.locations?[n.pos,n.curPosition()]:n.pos;return n.nextToken(),n.parseTopLevel(n.options.program||n.startNodeAt(r))}function l(e,t,n){var r=s(n,e,t);return r.nextToken(),r.parseExpression()}function i(e,t){return s(t,e)}function s(e,t){return new o(p(e),String(t))}n.parse=r,n.parseExpressionAt=l,n.tokenizer=i,n.__esModule=!0;var a=e("./state"),o=a.Parser,u=e("./options"),p=u.getOptions;e("./parseutil"),e("./statement"),e("./lval"),e("./expression"),e("./lookahead"),n.Parser=a.Parser,n.plugins=a.plugins,n.defaultOptions=u.defaultOptions;var c=e("./location");n.SourceLocation=c.SourceLocation,n.getLineInfo=c.getLineInfo,n.Node=e("./node").Node;var d=e("./tokentype");n.TokenType=d.TokenType,n.tokTypes=d.types;var f=e("./tokencontext");n.TokContext=f.TokContext,n.tokContexts=f.types;var h=e("./identifier");n.isIdentifierChar=h.isIdentifierChar,n.isIdentifierStart=h.isIdentifierStart,n.Token=e("./tokenize").Token;var m=e("./whitespace");n.isNewLine=m.isNewLine,n.lineBreak=m.lineBreak,n.lineBreakG=m.lineBreakG,e("../plugins/flow"),e("../plugins/jsx");var g="1.0.0";n.version=g},{"../plugins/flow":1,"../plugins/jsx":2,"./expression":3,"./identifier":4,"./location":6,"./lookahead":7,"./lval":8,"./node":9,"./options":10,"./parseutil":11,"./state":12,"./statement":13,"./tokencontext":14,"./tokenize":15,"./tokentype":16,"./whitespace":18}],6:[function(e,t,n){"use strict";function r(e,t){for(var n=1,r=0;;){s.lastIndex=r;var l=s.exec(e);if(!(l&&l.index<t))return new a(n,t-r);++n,r=l.index+l[0].length}}var l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.getLineInfo=r,n.__esModule=!0;var i=e("./state").Parser,s=e("./whitespace").lineBreakG,a=n.Position=function(){function e(t,n){l(this,e),this.line=t,this.column=n}return e.prototype.offset=function(t){return new e(this.line,this.column+t)},e}(),o=(n.SourceLocation=function u(e,t,n){l(this,u),this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},i.prototype);o.raise=function(e,t){var n=r(this.input,e);t+=" ("+n.line+":"+n.column+")";var l=new SyntaxError(t);throw l.pos=e,l.loc=n,l.raisedAt=this.pos,l},o.curPosition=function(){return new a(this.curLine,this.pos-this.lineStart)},o.markPosition=function(){return this.options.locations?[this.start,this.startLoc]:this.start}},{"./state":12,"./whitespace":18}],7:[function(e){"use strict";var t=e("./state").Parser,n=t.prototype,r=["lastTokStartLoc","lastTokEndLoc","lastTokStart","lastTokEnd","lineStart","startLoc","endLoc","start","pos","end","type","value"];n.getState=function(){for(var e={},t=0;t<r.length;t++){var n=r[t];e[n]=this[n]}return e},n.lookahead=function(){var e=this.getState();this.next();var t=this.getState();for(var n in e)this[n]=e[n];return t}},{"./state":12}],8:[function(e){"use strict";var t=e("./tokentype").types,n=e("./state").Parser,r=e("./identifier").reservedWords,l=e("./util").has,i=n.prototype;i.toAssignable=function(e,t){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=0;n<e.properties.length;n++){var r=e.properties[n];"init"!==r.kind&&this.raise(r.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(r.value,t)}break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t);break;case"AssignmentExpression":"="===e.operator?e.type="AssignmentPattern":this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}return e},i.toAssignableList=function(e,t){var n=e.length;if(n){var r=e[n-1];if(r&&"RestElement"==r.type)--n;else if(r&&"SpreadElement"==r.type){r.type="RestElement";var l=r.argument;this.toAssignable(l,t),"Identifier"!==l.type&&"MemberExpression"!==l.type&&"ArrayPattern"!==l.type&&this.unexpected(l.start),--n}}for(var i=0;n>i;i++){var s=e[i];s&&this.toAssignable(s,t)}return e},i.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(e),this.finishNode(t,"SpreadElement")},i.parseRest=function(){var e=this.startNode();return this.next(),e.argument=this.type===t.name||this.type===t.bracketL?this.parseBindingAtom():this.unexpected(),this.finishNode(e,"RestElement")},i.parseBindingAtom=function(){if(this.options.ecmaVersion<6)return this.parseIdent();switch(this.type){case t.name:return this.parseIdent();case t.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(t.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case t.braceL:return this.parseObj(!0);default:this.unexpected()}},i.parseBindingList=function(e,n,r){for(var l=[],i=!0;!this.eat(e);)if(i?i=!1:this.expect(t.comma),n&&this.type===t.comma)l.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===t.ellipsis){l.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(e);break}l.push(this.parseAssignableListItemTypes(this.parseMaybeDefault()))}return l},i.parseAssignableListItemTypes=function(e){return e},i.parseMaybeDefault=function(e,n){if(e=e||this.markPosition(),n=n||this.parseBindingAtom(),!this.eat(t.eq))return n;var r=this.startNodeAt(e);return r.operator="=",r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},i.checkLVal=function(e,t,n){switch(e.type){case"Identifier":this.strict&&(r.strictBind(e.name)||r.strict(e.name))&&this.raise(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(l(n,e.name)&&this.raise(e.start,"Argument name clash in strict mode"),n[e.name]=!0);break;case"MemberExpression":t&&this.raise(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var i=0;i<e.properties.length;i++){var s=e.properties[i];"Property"===s.type&&(s=s.value),this.checkLVal(s,t,n)}break;case"ArrayPattern":for(var i=0;i<e.elements.length;i++){var a=e.elements[i];a&&this.checkLVal(a,t,n)}break;case"AssignmentPattern":this.checkLVal(e.left,t,n);break;case"SpreadProperty":case"RestElement":this.checkLVal(e.argument,t,n);break;default:this.raise(e.start,(t?"Binding":"Assigning to")+" rvalue")}}},{"./identifier":4,"./state":12,"./tokentype":16,"./util":17}],9:[function(e,t,n){"use strict";var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.__esModule=!0;var l=e("./state").Parser,i=e("./location").SourceLocation,s=l.prototype,a=n.Node=function o(){r(this,o)};s.startNode=function(){var e=new a;return e.start=this.start,this.options.locations&&(e.loc=new i(this,this.startLoc)),this.options.directSourceFile&&(e.sourceFile=this.options.directSourceFile),this.options.ranges&&(e.range=[this.start,0]),e},s.startNodeAt=function(e){var t=new a,n=e;return this.options.locations&&(t.loc=new i(this,n[1]),n=e[0]),t.start=n,this.options.directSourceFile&&(t.sourceFile=this.options.directSourceFile),this.options.ranges&&(t.range=[n,0]),t},s.finishNode=function(e,t){return e.type=t,e.end=this.lastTokEnd,this.options.locations&&(e.loc.end=this.lastTokEndLoc),this.options.ranges&&(e.range[1]=this.lastTokEnd),e},s.finishNodeAt=function(e,t,n){return this.options.locations&&(e.loc.end=n[1],n=n[0]),e.type=t,e.end=n,this.options.ranges&&(e.range[1]=n),e}},{"./location":6,"./state":12}],10:[function(e,t,n){"use strict";function r(e){var t={};for(var n in u)t[n]=e&&s(e,n)?e[n]:u[n];return a(t.onToken)&&!function(){var e=t.onToken;t.onToken=function(t){return e.push(t)}}(),a(t.onComment)&&(t.onComment=l(t,t.onComment)),t}function l(e,t){return function(n,r,l,i,s,a){var u={type:n?"Block":"Line",value:r,start:l,end:i};e.locations&&(u.loc=new o(this,s,a)),e.ranges&&(u.range=[l,i]),t.push(u)}}n.getOptions=r,n.__esModule=!0;var i=e("./util"),s=i.has,a=i.isArray,o=e("./location").SourceLocation,u={ecmaVersion:5,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:!0,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{},features:{},strictMode:null};n.defaultOptions=u},{"./location":6,"./util":17}],11:[function(e){"use strict";var t=e("./tokentype").types,n=e("./state").Parser,r=e("./whitespace").lineBreak,l=n.prototype;l.isUseStrict=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value},l.eat=function(e){return this.type===e?(this.next(),!0):!1},l.isContextual=function(e){return this.type===t.name&&this.value===e},l.eatContextual=function(e){return this.value===e&&this.eat(t.name)},l.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},l.canInsertSemicolon=function(){return this.type===t.eof||this.type===t.braceR||r.test(this.input.slice(this.lastTokEnd,this.start))},l.insertSemicolon=function(){return this.canInsertSemicolon()?(this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0):void 0},l.semicolon=function(){this.eat(t.semi)||this.insertSemicolon()||this.unexpected()},l.afterTrailingComma=function(e){return this.type==e?(this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),this.next(),!0):void 0},l.expect=function(e){this.eat(e)||this.unexpected()},l.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")}},{"./state":12,"./tokentype":16,"./whitespace":18}],12:[function(e,t,n){"use strict";function r(e,t,n){this.options=e,this.loadPlugins(this.options.plugins),this.sourceFile=this.options.sourceFile||null,this.isKeyword=s[this.options.ecmaVersion>=6?6:5],this.isReservedWord=i[this.options.ecmaVersion],this.input=t,n?(this.pos=n,this.lineStart=Math.max(0,this.input.lastIndexOf("\n",n)),this.curLine=this.input.slice(0,this.lineStart).split(u).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=null,this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===this.options.sourceType,this.strict=this.options.strictMode===!1?!1:this.inModule,this.inFunction=this.inGenerator=!1,this.labels=[],this.decorators=[],0===this.pos&&this.options.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2)}n.Parser=r,n.__esModule=!0;var l=e("./identifier"),i=l.reservedWords,s=l.keywords,a=e("./tokentype"),o=a.types,u=a.lineBreak;r.prototype.extend=function(e,t){this[e]=t(this[e])};var p={};n.plugins=p,r.prototype.loadPlugins=function(e){for(var t in e){var r=n.plugins[t];if(!r)throw new Error("Plugin '"+t+"' not found");r(this,e[t])}}},{"./identifier":4,"./tokentype":16}],13:[function(e){"use strict";var t=e("./tokentype").types,n=e("./state").Parser,r=e("./whitespace").lineBreak,l=n.prototype;l.parseTopLevel=function(e){var n=!0;for(e.body||(e.body=[]);this.type!==t.eof;){var r=this.parseStatement(!0,!0);e.body.push(r),n&&this.isUseStrict(r)&&this.setStrict(!0),n=!1}return this.next(),this.options.ecmaVersion>=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var i={kind:"loop"},s={kind:"switch"};l.parseStatement=function(e,n){this.type===t.at&&this.parseDecorators(!0);var r=this.type,l=this.startNode();switch(r){case t._break:case t._continue:return this.parseBreakContinueStatement(l,r.keyword);case t._debugger:return this.parseDebuggerStatement(l);case t._do:return this.parseDoStatement(l);case t._for:return this.parseForStatement(l);case t._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(l);case t._class:return e||this.unexpected(),this.takeDecorators(l),this.parseClass(l,!0);case t._if:return this.parseIfStatement(l);case t._return:return this.parseReturnStatement(l);case t._switch:return this.parseSwitchStatement(l);case t._throw:return this.parseThrowStatement(l);case t._try:return this.parseTryStatement(l);case t._let:case t._const:e||this.unexpected();case t._var:return this.parseVarStatement(l,r);case t._while:return this.parseWhileStatement(l);case t._with:return this.parseWithStatement(l);case t.braceL:return this.parseBlock();case t.semi:return this.parseEmptyStatement(l);case t._export:case t._import:return this.options.allowImportExportEverywhere||(n||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===t._import?this.parseImport(l):this.parseExport(l);case t.name:if(this.options.features["es7.asyncFunctions"]&&"async"===this.value&&this.lookahead().type===t._function)return this.next(),this.expect(t._function),this.parseFunction(l,!0,!1,!0);default:var i=this.value,s=this.parseExpression();return r===t.name&&"Identifier"===s.type&&this.eat(t.colon)?this.parseLabeledStatement(l,i,s):this.parseExpressionStatement(l,s)}},l.takeDecorators=function(e){this.decorators.length&&(e.decorators=this.decorators,this.decorators=[])},l.parseDecorators=function(e){for(;this.type===t.at;)this.decorators.push(this.parseDecorator());e&&this.type===t._export||this.type!==t._class&&this.raise(this.start,"Leading decorators must be attached to a class declaration")},l.parseDecorator=function(){this.options.features["es7.decorators"]||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},l.parseBreakContinueStatement=function(e,n){var r="break"==n;this.next(),this.eat(t.semi)||this.insertSemicolon()?e.label=null:this.type!==t.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var l=0;l<this.labels.length;++l){var i=this.labels[l];if(null==e.label||i.name===e.label.name){if(null!=i.kind&&(r||"loop"===i.kind))break;if(e.label&&r)break}}return l===this.labels.length&&this.raise(e.start,"Unsyntactic "+n),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},l.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},l.parseDoStatement=function(e){var n=this.markPosition();if(this.next(),this.labels.push(i),e.body=this.parseStatement(!1),this.labels.pop(),this.options.features["es7.doExpressions"]&&this.type!==t._while){var r=this.startNodeAt(n);return r.expression=this.finishNode(e,"DoExpression"),this.semicolon(),this.finishNode(r,"ExpressionStatement")}return this.expect(t._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(t.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},l.parseForStatement=function(e){if(this.next(),this.labels.push(i),this.expect(t.parenL),this.type===t.semi)return this.parseFor(e,null);if(this.type===t._var||this.type===t._let||this.type===t._const){var n=this.startNode(),r=this.type;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===t._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||r!==t._var&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var l={start:0},s=this.parseExpression(!0,l);return this.type===t._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.toAssignable(s),this.checkLVal(s),this.parseForIn(e,s)):(l.start&&this.unexpected(l.start),this.parseFor(e,s))},l.parseFunctionStatement=function(e){return this.next(),this.parseFunction(e,!0)},l.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!1),e.alternate=this.eat(t._else)?this.parseStatement(!1):null,this.finishNode(e,"IfStatement")},l.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(t.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},l.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(t.braceL),this.labels.push(s);for(var n,r;this.type!=t.braceR;)if(this.type===t._case||this.type===t._default){var l=this.type===t._case;n&&this.finishNode(n,"SwitchCase"),e.cases.push(n=this.startNode()),n.consequent=[],this.next(),l?n.test=this.parseExpression():(r&&this.raise(this.lastTokStart,"Multiple default clauses"),r=!0,n.test=null),this.expect(t.colon)}else n||this.unexpected(),n.consequent.push(this.parseStatement(!0));return n&&this.finishNode(n,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},l.parseThrowStatement=function(e){return this.next(),r.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var a=[];l.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===t._catch){var n=this.startNode();this.next(),this.expect(t.parenL),n.param=this.parseBindingAtom(),this.checkLVal(n.param,!0),this.expect(t.parenR),n.guard=null,n.body=this.parseBlock(),e.handler=this.finishNode(n,"CatchClause")}return e.guardedHandlers=a,e.finalizer=this.eat(t._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},l.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},l.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(i),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},l.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},l.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},l.parseLabeledStatement=function(e,n,r){for(var l=0;l<this.labels.length;++l)this.labels[l].name===n&&this.raise(r.start,"Label '"+n+"' is already declared");var i=this.type.isLoop?"loop":this.type===t._switch?"switch":null;return this.labels.push({name:n,kind:i}),e.body=this.parseStatement(!0),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},l.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},l.parseBlock=function(e){var n=this.startNode(),r=!0,l=void 0;for(n.body=[],this.expect(t.braceL);!this.eat(t.braceR);){var i=this.parseStatement(!0);n.body.push(i),r&&e&&this.isUseStrict(i)&&(l=this.strict,this.setStrict(this.strict=!0)),r=!1}return l===!1&&this.setStrict(!1),this.finishNode(n,"BlockStatement")},l.parseFor=function(e,n){return e.init=n,this.expect(t.semi),e.test=this.type===t.semi?null:this.parseExpression(),this.expect(t.semi),e.update=this.type===t.parenR?null:this.parseExpression(),this.expect(t.parenR),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"ForStatement")},l.parseForIn=function(e,n){var r=this.type===t._in?"ForInStatement":"ForOfStatement";return this.next(),e.left=n,e.right=this.parseExpression(),this.expect(t.parenR),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,r)},l.parseVar=function(e,n,r){for(e.declarations=[],e.kind=r.keyword;;){var l=this.startNode();if(this.parseVarHead(l),this.eat(t.eq)?l.init=this.parseMaybeAssign(n):r!==t._const||this.type===t._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"==l.id.type||n&&(this.type===t._in||this.isContextual("of"))?l.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(l,"VariableDeclarator")),!this.eat(t.comma))break}return e},l.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0)},l.parseFunction=function(e,n,r,l){return this.initFunction(e,l),this.options.ecmaVersion>=6&&(e.generator=this.eat(t.star)),(n||this.type===t.name)&&(e.id=this.parseIdent()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.finishNode(e,n?"FunctionDeclaration":"FunctionExpression")},l.parseFunctionParams=function(e){this.expect(t.parenL),e.params=this.parseBindingList(t.parenR,!1,!1) },l.parseClass=function(e,n){this.next(),this.parseClassId(e,n),this.parseClassSuper(e);var r=this.startNode();for(r.body=[],this.expect(t.braceL);!this.eat(t.braceR);)if(!this.eat(t.semi))if(this.type!==t.at){var l=this.startNode();this.takeDecorators(l);var i=this.eat(t.star),s=!1;this.parsePropertyName(l),this.type===t.parenL||l.computed||"Identifier"!==l.key.type||"static"!==l.key.name?l["static"]=!1:(i&&this.unexpected(),l["static"]=!0,i=this.eat(t.star),this.parsePropertyName(l)),i||"Identifier"!==l.key.type||l.computed||!this.isClassProperty()?(this.options.features["es7.asyncFunctions"]&&this.type!==t.parenL&&!l.computed&&"Identifier"===l.key.type&&"async"===l.key.name&&(s=!0,this.parsePropertyName(l)),l.kind="method",l.computed||i||("Identifier"===l.key.type?this.type===t.parenL||"get"!==l.key.name&&"set"!==l.key.name?l["static"]||"constructor"!==l.key.name||(l.kind="constructor"):(l.kind=l.key.name,this.parsePropertyName(l)):l["static"]||"Literal"!==l.key.type||"constructor"!==l.key.value||(l.kind="constructor")),"constructor"===l.kind&&l.decorators&&this.raise(l.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(r,l,i,s)):r.body.push(this.parseClassProperty(l))}else this.decorators.push(this.parseDecorator());return this.decorators.length&&this.raise(this.start,"You have trailing decorators with no method"),e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,n?"ClassDeclaration":"ClassExpression")},l.isClassProperty=function(){return this.type===t.eq||this.type===t.semi||this.canInsertSemicolon()},l.parseClassProperty=function(e){return this.type===t.eq?(this.options.features["es7.classProperties"]||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.finishNode(e,"ClassProperty")},l.parseClassMethod=function(e,t,n,r){t.value=this.parseMethod(n,r),e.body.push(this.finishNode(t,"MethodDefinition"))},l.parseClassId=function(e,n){e.id=this.type===t.name?this.parseIdent():n?this.unexpected():null},l.parseClassSuper=function(e){e.superClass=this.eat(t._extends)?this.parseExprSubscripts():null},l.parseExport=function(e){if(this.next(),this.type===t.star){var n=this.startNode();if(this.next(),!this.options.features["es7.exportExtensions"]||!this.eatContextual("as"))return this.parseExportFrom(e),this.finishNode(e,"ExportAllDeclaration");n.exported=this.parseIdent(),e.specifiers=[this.finishNode(n,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e)}else if(this.isExportDefaultSpecifier()){var n=this.startNode();if(n.exported=this.parseIdent(!0),e.specifiers=[this.finishNode(n,"ExportDefaultSpecifier")],this.type===t.comma&&this.lookahead().type===t.star){this.expect(t.comma);var r=this.startNode();this.expect(t.star),this.expectContextual("as"),r.exported=this.parseIdent(),e.specifiers.push(this.finishNode(r,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e)}else{if(this.eat(t._default)){var l=this.parseMaybeAssign(),i=!0;return("FunctionExpression"==l.type||"ClassExpression"==l.type)&&(i=!1,l.id&&(l.type="FunctionExpression"==l.type?"FunctionDeclaration":"ClassDeclaration")),e.declaration=l,i&&this.semicolon(),this.checkExport(e),this.finishNode(e,"ExportDefaultDeclaration")}this.type.keyword||this.shouldParseExportDeclaration()?(e.declaration=this.parseStatement(!0),e.specifiers=[],e.source=null):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),e.source=this.eatContextual("from")?this.type===t.string?this.parseExprAtom():this.unexpected():null,this.semicolon())}return this.checkExport(e),this.finishNode(e,"ExportNamedDeclaration")},l.isExportDefaultSpecifier=function(){if(this.type===t.name)return"type"!==this.value&&"async"!==this.value;if(this.type!==t._default)return!1;var e=this.lookahead();return e.type===t.comma||e.type===t.name&&"from"===e.value},l.parseExportSpecifiersMaybe=function(e){this.eat(t.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},l.parseExportFrom=function(e){this.expectContextual("from"),e.source=this.type===t.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.checkExport(e)},l.shouldParseExportDeclaration=function(){return this.options.features["es7.asyncFunctions"]&&this.isContextual("async")},l.checkExport=function(e){if(this.decorators.length){var t=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&t||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},l.parseExportSpecifiers=function(){var e=[],n=!0;for(this.expect(t.braceL);!this.eat(t.braceR);){if(n)n=!1;else if(this.expect(t.comma),this.afterTrailingComma(t.braceR))break;var r=this.startNode();r.local=this.parseIdent(this.type===t._default),r.exported=this.eatContextual("as")?this.parseIdent(!0):r.local,e.push(this.finishNode(r,"ExportSpecifier"))}return e},l.parseImport=function(e){return this.next(),this.type===t.string?(e.specifiers=a,e.source=this.parseExprAtom(),e.kind=""):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.type===t.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},l.parseImportSpecifiers=function(e){var n=!0;if(this.type===t.name){var r=this.markPosition();if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(),r)),!this.eat(t.comma))return}if(this.type===t.star){var l=this.startNode();return this.next(),this.expectContextual("as"),l.local=this.parseIdent(),this.checkLVal(l.local,!0),void e.specifiers.push(this.finishNode(l,"ImportNamespaceSpecifier"))}for(this.expect(t.braceL);!this.eat(t.braceR);){if(n)n=!1;else if(this.expect(t.comma),this.afterTrailingComma(t.braceR))break;var l=this.startNode();l.imported=this.parseIdent(!0),l.local=this.eatContextual("as")?this.parseIdent():l.imported,this.checkLVal(l.local,!0),e.specifiers.push(this.finishNode(l,"ImportSpecifier"))}},l.parseImportSpecifierDefault=function(e,t){var n=this.startNodeAt(t);return n.local=e,this.checkLVal(n.local,!0),this.finishNode(n,"ImportDefaultSpecifier")}},{"./state":12,"./tokentype":16,"./whitespace":18}],14:[function(e,t,n){"use strict";var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.__esModule=!0;var l=e("./state").Parser,i=e("./tokentype").types,s=e("./whitespace").lineBreak,a=n.TokContext=function p(e,t,n,l){r(this,p),this.token=e,this.isExpr=t,this.preserveSpace=n,this.override=l},o={b_stat:new a("{",!1),b_expr:new a("{",!0),b_tmpl:new a("${",!0),p_stat:new a("(",!1),p_expr:new a("(",!0),q_tmpl:new a("`",!0,!0,function(e){return e.readTmplToken()}),f_expr:new a("function",!0)};n.types=o;var u=l.prototype;u.initialContext=function(){return[o.b_stat]},u.braceIsBlock=function(e){var t=void 0;return e===i.colon&&"{"==(t=this.curContext()).token?!t.isExpr:e===i._return?s.test(this.input.slice(this.lastTokEnd,this.start)):e===i._else||e===i.semi||e===i.eof?!0:e==i.braceL?this.curContext()===o.b_stat:!this.exprAllowed},u.updateContext=function(e){var t=void 0,n=this.type;n.keyword&&e==i.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},i.parenR.updateContext=i.braceR.updateContext=function(){if(1==this.context.length)return void(this.exprAllowed=!0);var e=this.context.pop();e===o.b_stat&&this.curContext()===o.f_expr?(this.context.pop(),this.exprAllowed=!1):this.exprAllowed=e===o.b_tmpl?!0:!e.isExpr},i.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?o.b_stat:o.b_expr),this.exprAllowed=!0},i.dollarBraceL.updateContext=function(){this.context.push(o.b_tmpl),this.exprAllowed=!0},i.parenL.updateContext=function(e){var t=e===i._if||e===i._for||e===i._with||e===i._while;this.context.push(t?o.p_stat:o.p_expr),this.exprAllowed=!0},i.incDec.updateContext=function(){},i._function.updateContext=function(){this.curContext()!==o.b_stat&&this.context.push(o.f_expr),this.exprAllowed=!1},i.backQuote.updateContext=function(){this.curContext()===o.q_tmpl?this.context.pop():this.context.push(o.q_tmpl),this.exprAllowed=!1}},{"./state":12,"./tokentype":16,"./whitespace":18}],15:[function(e,t,n){"use strict";function r(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.__esModule=!0;var i=e("./identifier"),s=i.isIdentifierStart,a=i.isIdentifierChar,o=e("./tokentype"),u=o.types,p=o.keywords,c=e("./state").Parser,d=e("./location").SourceLocation,f=e("./whitespace"),h=f.lineBreak,m=f.lineBreakG,g=f.isNewLine,y=f.nonASCIIwhitespace,b=n.Token=function S(e){l(this,S),this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new d(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},v=c.prototype;v.next=function(){this.options.onToken&&this.options.onToken(new b(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},v.getToken=function(){return this.next(),new b(this)},"undefined"!=typeof Symbol&&(v[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}}),v.setStrict=function(e){if(this.strict=e,this.type===u.num||this.type===u.string){if(this.pos=this.start,this.options.locations)for(;this.pos<this.lineStart;)this.lineStart=this.input.lastIndexOf("\n",this.lineStart-2)+1,--this.curLine;this.nextToken()}},v.curContext=function(){return this.context[this.context.length-1]},v.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(u.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},v.readToken=function(e){return s(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},v.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(55295>=e||e>=57344)return e;var t=this.input.charCodeAt(this.pos+1);return(e<<10)+t-56613888},v.skipBlockComment=function(){var e=this.options.onComment&&this.options.locations&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations){m.lastIndex=t;for(var r=void 0;(r=m.exec(this.input))&&r.index<this.pos;)++this.curLine,this.lineStart=r.index+r[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.options.locations&&this.curPosition())},v.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.options.locations&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&10!==r&&13!==r&&8232!==r&&8233!==r;)++this.pos,r=this.input.charCodeAt(this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.options.locations&&this.curPosition())},v.skipSpace=function(){for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);if(32===e)++this.pos;else if(13===e){++this.pos;var t=this.input.charCodeAt(this.pos);10===t&&++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos)}else if(10===e||8232===e||8233===e)++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);else if(e>8&&14>e)++this.pos;else if(47===e){var t=this.input.charCodeAt(this.pos+1);if(42===t)this.skipBlockComment();else{if(47!==t)break;this.skipLineComment(2)}}else if(160===e)++this.pos;else{if(!(e>=5760&&y.test(String.fromCharCode(e))))break;++this.pos}}},v.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},v.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&57>=e)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(u.ellipsis)):(++this.pos,this.finishToken(u.dot))},v.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(u.assign,2):this.finishOp(u.slash,1)},v.readToken_mult_modulo=function(e){var t=42===e?u.star:u.modulo,n=1,r=this.input.charCodeAt(this.pos+1);return 42===r&&(n++,r=this.input.charCodeAt(this.pos+2),t=u.exponent),61===r&&(n++,t=u.assign),this.finishOp(t,n)},v.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.finishOp(124===e?u.logicalOR:u.logicalAND,2):61===t?this.finishOp(u.assign,2):this.finishOp(124===e?u.bitwiseOR:u.bitwiseAND,1)},v.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)},v.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45==t&&62==this.input.charCodeAt(this.pos+2)&&h.test(this.input.slice(this.lastTokEnd,this.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.incDec,2):61===t?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)},v.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(u.assign,n+1):this.finishOp(u.bitShift,n)):33==t&&60==e&&45==this.input.charCodeAt(this.pos+2)&&45==this.input.charCodeAt(this.pos+3)?(this.inModule&&unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(n=61===this.input.charCodeAt(this.pos+2)?3:2),this.finishOp(u.relational,n))},v.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(u.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(61===e?u.eq:u.prefix,1)},v.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 63:return++this.pos,this.finishToken(u.question);case 64:return++this.pos,this.finishToken(u.at);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(u.prefix,1)}this.raise(this.pos,"Unexpected character '"+r(e)+"'")},v.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)};var x=!1;try{new RegExp("￿","u"),x=!0}catch(E){}v.readRegexp=function(){for(var e=void 0,t=void 0,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(h.test(r)&&this.raise(n,"Unterminated regular expression"),e)e=!1;else{if("["===r)t=!0;else if("]"===r&&t)t=!1;else if("/"===r&&!t)break;e="\\"===r}++this.pos}var l=this.input.slice(n,this.pos);++this.pos;var i=this.readWord1(),s=l;if(i){var a=/^[gmsiy]*$/;this.options.ecmaVersion>=6&&(a=/^[gmsiyu]*$/),a.test(i)||this.raise(n,"Invalid regular expression flag"),i.indexOf("u")>=0&&!x&&(s=s.replace(/\\u([a-fA-F0-9]{4})|\\u\{([0-9a-fA-F]+)\}|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}try{new RegExp(s)}catch(o){o instanceof SyntaxError&&this.raise(n,"Error parsing regular expression: "+o.message),this.raise(o)}var p=void 0;try{p=new RegExp(l,i)}catch(c){p=null}return this.finishToken(u.regexp,{pattern:l,flags:i,value:p})},v.readInt=function(e,t){for(var n=this.pos,r=0,l=0,i=null==t?1/0:t;i>l;++l){var s=this.input.charCodeAt(this.pos),a=void 0;if(a=s>=97?s-97+10:s>=65?s-65+10:s>=48&&57>=s?s-48:1/0,a>=e)break;++this.pos,r=r*e+a}return this.pos===n||null!=t&&this.pos-n!==t?null:r},v.readRadixNumber=function(e){this.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.start+2,"Expected number in radix "+e),s(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,t)},v.readNumber=function(e){var t=this.pos,n=!1,r=48===this.input.charCodeAt(this.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number"),46===this.input.charCodeAt(this.pos)&&(++this.pos,this.readInt(10),n=!0);var l=this.input.charCodeAt(this.pos);(69===l||101===l)&&(l=this.input.charCodeAt(++this.pos),(43===l||45===l)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),n=!0),s(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var i=this.input.slice(t,this.pos),a=void 0;return n?a=parseFloat(i):r&&1!==i.length?/[89]/.test(i)||this.strict?this.raise(t,"Invalid number"):a=parseInt(i,8):a=parseInt(i,10),this.finishToken(u.num,a)},v.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t=void 0;return 123===e?(this.options.ecmaVersion<6&&this.unexpected(),++this.pos,t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.unexpected()):t=this.readHexChar(4),t},v.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(),n=this.pos):(g(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(u.string,t)},v.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos===this.start&&this.type===u.template?36===n?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e));92===n?(e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(),t=this.pos):g(n)?(e+=this.input.slice(t,this.pos),++this.pos,13===n&&10===this.input.charCodeAt(this.pos)?(++this.pos,e+="\n"):e+=String.fromCharCode(n),this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos):++this.pos}},v.readEscapedChar=function(){var e=this.input.charCodeAt(++this.pos),t=/^[0-7]+/.exec(this.input.slice(this.pos,this.pos+3));for(t&&(t=t[0]);t&&parseInt(t,8)>255;)t=t.slice(0,-1);if("0"===t&&(t=null),++this.pos,t)return this.strict&&this.raise(this.pos-2,"Octal literal in strict mode"),this.pos+=t.length-1,String.fromCharCode(parseInt(t,8));switch(e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return r(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return" ";case 102:return"\f";case 48:return"\x00";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:return String.fromCharCode(e)}},v.readHexChar=function(e){var t=this.readInt(16,e);return null===t&&this.raise(this.start,"Bad character escape sequence"),t};var _;v.readWord1=function(){_=!1;for(var e="",t=!0,n=this.pos,l=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(a(i,l))this.pos+=65535>=i?1:2;else{if(92!==i)break;_=!0,e+=this.input.slice(n,this.pos);var o=this.pos;117!=this.input.charCodeAt(++this.pos)&&this.raise(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var u=this.readCodePoint();(t?s:a)(u,l)||this.raise(o,"Invalid Unicode escape"),e+=r(u),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},v.readWord=function(){var e=this.readWord1(),t=u.name;return(this.options.ecmaVersion>=6||!_)&&this.isKeyword(e)&&(t=p[e]),this.finishToken(t,e)}},{"./identifier":4,"./location":6,"./state":12,"./tokentype":16,"./whitespace":18}],16:[function(e,t,n){"use strict";function r(e,t){return new s(e,{beforeExpr:!0,binop:t})}function l(e){var t=void 0===arguments[1]?{}:arguments[1];t.keyword=e,p[e]=u["_"+e]=new s(e,t)}var i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.__esModule=!0;var s=n.TokenType=function c(e){var t=void 0===arguments[1]?{}:arguments[1];i(this,c),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},a={beforeExpr:!0},o={startsExpr:!0},u={num:new s("num",o),regexp:new s("regexp",o),string:new s("string",o),name:new s("name",o),eof:new s("eof"),bracketL:new s("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new s("]"),braceL:new s("{",{beforeExpr:!0,startsExpr:!0}),braceR:new s("}"),parenL:new s("(",{beforeExpr:!0,startsExpr:!0}),parenR:new s(")"),comma:new s(",",a),semi:new s(";",a),colon:new s(":",a),dot:new s("."),question:new s("?",a),arrow:new s("=>",a),template:new s("template"),ellipsis:new s("...",a),backQuote:new s("`",o),dollarBraceL:new s("${",{beforeExpr:!0,startsExpr:!0}),at:new s("@"),eq:new s("=",{beforeExpr:!0,isAssign:!0}),assign:new s("_=",{beforeExpr:!0,isAssign:!0}),incDec:new s("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new s("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:r("||",1),logicalAND:r("&&",2),bitwiseOR:r("|",3),bitwiseXOR:r("^",4),bitwiseAND:r("&",5),equality:r("==/!=",6),relational:r("</>",7),bitShift:r("<</>>",8),plusMin:new s("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:r("%",10),star:r("*",10),slash:r("/",10),exponent:new s("**",{beforeExpr:!0,binop:11,rightAssociative:!0})};n.types=u;var p={};n.keywords=p,l("break"),l("case",a),l("catch"),l("continue"),l("debugger"),l("default"),l("do",{isLoop:!0}),l("else",a),l("finally"),l("for",{isLoop:!0}),l("function"),l("if"),l("return",a),l("switch"),l("throw",a),l("try"),l("var"),l("let"),l("const"),l("while",{isLoop:!0}),l("with"),l("new",{beforeExpr:!0,startsExpr:!0}),l("this",o),l("super",o),l("class"),l("extends",a),l("export"),l("import"),l("yield",{beforeExpr:!0,startsExpr:!0}),l("null",o),l("true",o),l("false",o),l("in",{beforeExpr:!0,binop:7}),l("instanceof",{beforeExpr:!0,binop:7}),l("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),l("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),l("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{}],17:[function(e,t,n){"use strict";function r(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.isArray=r,n.has=l,n.__esModule=!0},{}],18:[function(e,t,n){"use strict";function r(e){return 10===e||13===e||8232===e||8233==e}n.isNewLine=r,n.__esModule=!0;var l=/\r\n?|\n|\u2028|\u2029/;n.lineBreak=l;var i=new RegExp(l.source,"g");n.lineBreakG=i;var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;n.nonASCIIwhitespace=s},{}],19:[function(e,t){(function(n){"use strict";var r=t.exports=e("../transformation");r.options=e("../transformation/file/options"),r.version=e("../../../package").version,r.transform=r,r.run=function(e){var t=void 0===arguments[1]?{}:arguments[1];return t.sourceMaps="inline",new Function(r(e,t).code)()},r.load=function(e,t,l,i){var s=void 0===arguments[2]?{}:arguments[2],a=s;a.filename||(a.filename=e);var o=n.ActiveXObject?new n.ActiveXObject("Microsoft.XMLHTTP"):new n.XMLHttpRequest;o.open("GET",e,!0),"overrideMimeType"in o&&o.overrideMimeType("text/plain"),o.onreadystatechange=function(){if(4===o.readyState){var n=o.status;if(0!==n&&200!==n)throw new Error("Could not load "+e);var l=[o.responseText,s];i||r.run.apply(r,l),t&&t(l)}},o.send(null)};var l=function(){for(var e=[],t=["text/ecmascript-6","text/6to5","text/babel","module"],l=0,i=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(){var t=e[l];t instanceof Array&&(r.run.apply(r,t),l++,i())}),s=function(t,n){var l={};t.src?r.load(t.src,function(t){e[n]=t,i()},l,!0):(l.filename="embedded",e[n]=[t.innerHTML,l])},a=n.document.getElementsByTagName("script"),o=0;o<a.length;++o){var u=a[o];t.indexOf(u.type)>=0&&e.push(u)}for(o in e)s(e[o],o);i()};n.addEventListener?n.addEventListener("DOMContentLoaded",l,!1):n.attachEvent&&n.attachEvent("onload",l)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../../package":452,"../transformation":63,"../transformation/file/options":49}],20:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("repeating")),i=n(e("trim-right")),s=n(e("lodash/lang/isBoolean")),a=n(e("lodash/collection/includes")),o=n(e("lodash/lang/isNumber")),u=function(){function e(t,n){r(this,e),this.position=t,this._indent=n.indent.base,this.format=n,this.buf=""}return e.prototype.get=function(){return i(this.buf)},e.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":l(this.format.indent.style,this._indent)},e.prototype.indentSize=function(){return this.getIndent().length},e.prototype.indent=function(){this._indent++},e.prototype.dedent=function(){this._indent--},e.prototype.semicolon=function(){this.push(";")},e.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},e.prototype.rightBrace=function(){this.newline(!0),this.push("}")},e.prototype.keyword=function(e){this.push(e),this.space()},e.prototype.space=function(){this.format.compact||!this.buf||this.isLast(" ")||this.isLast("\n")||this.push(" ")},e.prototype.removeLast=function(e){this.format.compact||this.isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},e.prototype.newline=function(e,t){if(!this.format.compact){if(this.format.concise)return void this.space();if(t||(t=!1),o(e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(t),e--}else s(e)&&(t=e),this._newline(t)}},e.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},e.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var t=this.buf.length-1;t>e&&" "===this.buf[t];)t--;t===e&&(this.buf=this.buf.substring(0,t+1))}},e.prototype.push=function(e,t){if(!this.format.compact&&this._indent&&!t&&"\n"!==e){var n=this.getIndent();e=e.replace(/\n/g,"\n"+n),this.isLast("\n")&&this._push(n)}this._push(e)},e.prototype._push=function(e){this.position.push(e),this.buf+=e},e.prototype.endsWith=function(e){return this.buf.slice(-e.length)===e},e.prototype.isLast=function(e){if(this.format.compact)return!1;var t=this.buf,n=t[t.length-1];return Array.isArray(e)?a(e,n):e===n},e}();t.exports=u},{"lodash/collection/includes":319,"lodash/lang/isBoolean":391,"lodash/lang/isNumber":395,repeating:435,"trim-right":451}],21:[function(e,t,n){"use strict";function r(e,t){t(e.program)}function l(e,t){t.sequence(e.body)}function i(e,t){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),t.sequence(e.body,{indent:!0}),this.removeLast("\n"),this.rightBrace())}n.File=r,n.Program=l,n.BlockStatement=i,n.__esModule=!0},{}],22:[function(e,t,n){"use strict";function r(e,t){t.list(e.decorators),this.push("class"),e.id&&(this.space(),t(e.id)),t(e.typeParameters),e.superClass&&(this.push(" extends "),t(e.superClass),t(e.superTypeParameters)),e["implements"]&&(this.push(" implements "),t.join(e["implements"],{separator:", "})),this.space(),t(e.body)}function l(e,t){0===e.body.length?this.push("{}"):(this.push("{"),this.newline(),this.indent(),t.sequence(e.body),this.dedent(),this.rightBrace())}function i(e,t){t.list(e.decorators),e["static"]&&this.push("static "),t(e.key),t(e.typeAnnotation),e.value&&(this.space(),this.push("="),this.space(),t(e.value)),this.semicolon()}function s(e,t){t.list(e.decorators),e["static"]&&this.push("static "),this._method(e,t)}n.ClassDeclaration=r,n.ClassBody=l,n.ClassProperty=i,n.MethodDefinition=s,n.__esModule=!0,n.ClassExpression=r},{}],23:[function(e,t,n){"use strict";function r(e,t){this.keyword("for"),this.push("("),t(e.left),this.push(" of "),t(e.right),this.push(")")}function l(e,t){this.push(e.generator?"(":"["),t.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),t(e.filter),this.push(")"),this.space()),t(e.body),this.push(e.generator?")":"]")}n.ComprehensionBlock=r,n.ComprehensionExpression=l,n.__esModule=!0},{}],24:[function(e,t,n){"use strict";function r(e,t){var n=/[a-z]$/.test(e.operator),r=e.argument;(E.isUpdateExpression(r)||E.isUnaryExpression(r))&&(n=!0),E.isUnaryExpression(r)&&"!"===r.operator&&(n=!1),this.push(e.operator),n&&this.push(" "),t(e.argument)}function l(e,t){this.push("do"),this.space(),t(e.body)}function i(e,t){e.prefix?(this.push(e.operator),t(e.argument)):(t(e.argument),this.push(e.operator))}function s(e,t){t(e.test),this.space(),this.push("?"),this.space(),t(e.consequent),this.space(),this.push(":"),this.space(),t(e.alternate)}function a(e,t){this.push("new "),t(e.callee),this.push("("),t.list(e.arguments),this.push(")")}function o(e,t){t.list(e.expressions)}function u(){this.push("this")}function p(){this.push("super")}function c(e,t){this.push("@"),t(e.expression)}function d(e,t){t(e.callee),this.push("(");var n=",";e._prettyCall?(n+="\n",this.newline(),this.indent()):n+=" ",t.list(e.arguments,{separator:n}),e._prettyCall&&(this.newline(),this.dedent()),this.push(")")}function f(){this.semicolon()}function h(e,t){t(e.expression),this.semicolon()}function m(e,t){t(e.left),this.push(" "),this.push(e.operator),this.push(" "),t(e.right)}function g(e,t){var n=e.object;if(t(n),!e.computed&&E.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var r=e.computed;E.isLiteral(e.property)&&x(e.property.value)&&(r=!0),r?(this.push("["),t(e.property),this.push("]")):(E.isLiteral(n)&&v(n.value)&&!w.test(n.value.toString())&&this.push("."),this.push("."),t(e.property))}var y=function(e){return e&&e.__esModule?e:{"default":e}},b=function(e){return e&&e.__esModule?e["default"]:e};n.UnaryExpression=r,n.DoExpression=l,n.UpdateExpression=i,n.ConditionalExpression=s,n.NewExpression=a,n.SequenceExpression=o,n.ThisExpression=u,n.Super=p,n.Decorator=c,n.CallExpression=d,n.EmptyStatement=f,n.ExpressionStatement=h,n.AssignmentExpression=m,n.MemberExpression=g,n.__esModule=!0;var v=b(e("is-integer")),x=b(e("lodash/lang/isNumber")),E=y(e("../../types")),_=function(e){return function(t,n){this.push(e),(t.delegate||t.all)&&this.push("*"),t.argument&&(this.space(),n(t.argument))}},S=_("yield"); n.YieldExpression=S;var I=_("await");n.AwaitExpression=I,n.BinaryExpression=m,n.LogicalExpression=m,n.AssignmentPattern=m;var w=/e/i;n.MetaProperty=g},{"../../types":153,"is-integer":303,"lodash/lang/isNumber":395}],25:[function(e,t,n){"use strict";function r(){this.push("any")}function l(e,t){t(e.elementType),this.push("["),this.push("]")}function i(){this.push("bool")}function s(e,t){this.push("declare class "),this._interfaceish(e,t)}function a(e,t){this.push("declare function "),t(e.id),t(e.id.typeAnnotation.typeAnnotation),this.semicolon()}function o(e,t){this.push("declare module "),t(e.id),this.space(),t(e.body)}function u(e,t){this.push("declare var "),t(e.id),t(e.id.typeAnnotation),this.semicolon()}function p(e,t,n){t(e.typeParameters),this.push("("),t.list(e.params),e.rest&&(e.params.length&&(this.push(","),this.space()),this.push("..."),t(e.rest)),this.push(")"),"ObjectTypeProperty"===n.type||"ObjectTypeCallProperty"===n.type||"DeclareFunction"===n.type?this.push(":"):(this.space(),this.push("=>")),this.space(),t(e.returnType)}function c(e,t){t(e.name),e.optional&&this.push("?"),this.push(":"),this.space(),t(e.typeAnnotation)}function d(e,t){t(e.id),t(e.typeParameters)}function f(e,t){t(e.id),t(e.typeParameters),e["extends"].length&&(this.push(" extends "),t.join(e["extends"],{separator:", "})),this.space(),t(e.body)}function h(e,t){this.push("interface "),this._interfaceish(e,t)}function m(e,t){t.join(e.types,{separator:" & "})}function g(e,t){this.push("?"),t(e.typeAnnotation)}function y(){this.push("number")}function b(e){this._stringLiteral(e.value)}function v(){this.push("string")}function x(e,t){this.push("["),t.join(e.types,{separator:", "}),this.push("]")}function E(e,t){this.push("typeof "),t(e.argument)}function _(e,t){this.push("type "),t(e.id),t(e.typeParameters),this.space(),this.push("="),this.space(),t(e.right),this.semicolon()}function S(e,t){this.push(":"),this.space(),e.optional&&this.push("?"),t(e.typeAnnotation)}function I(e,t){this.push("<"),t.join(e.params,{separator:", "}),this.push(">")}function w(e,t){var n=this;this.push("{");var r=e.properties.concat(e.callProperties,e.indexers);r.length&&(this.space(),t.list(r,{separator:!1,indent:!0,iterator:function(){1!==r.length&&(n.semicolon(),n.space())}}),this.space()),this.push("}")}function k(e,t){e["static"]&&this.push("static "),t(e.value)}function A(e,t){e["static"]&&this.push("static "),this.push("["),t(e.id),this.push(":"),this.space(),t(e.key),this.push("]"),this.push(":"),this.space(),t(e.value)}function C(e,t){e["static"]&&this.push("static "),t(e.key),e.optional&&this.push("?"),O.isFunctionTypeAnnotation(e.value)||(this.push(":"),this.space()),t(e.value)}function T(e,t){t(e.qualification),this.push("."),t(e.id)}function j(e,t){t.join(e.types,{separator:" | "})}function M(e,t){this.push("("),t(e.expression),t(e.typeAnnotation),this.push(")")}function P(){this.push("void")}var L=function(e){return e&&e.__esModule?e:{"default":e}};n.AnyTypeAnnotation=r,n.ArrayTypeAnnotation=l,n.BooleanTypeAnnotation=i,n.DeclareClass=s,n.DeclareFunction=a,n.DeclareModule=o,n.DeclareVariable=u,n.FunctionTypeAnnotation=p,n.FunctionTypeParam=c,n.InterfaceExtends=d,n._interfaceish=f,n.InterfaceDeclaration=h,n.IntersectionTypeAnnotation=m,n.NullableTypeAnnotation=g,n.NumberTypeAnnotation=y,n.StringLiteralTypeAnnotation=b,n.StringTypeAnnotation=v,n.TupleTypeAnnotation=x,n.TypeofTypeAnnotation=E,n.TypeAlias=_,n.TypeAnnotation=S,n.TypeParameterInstantiation=I,n.ObjectTypeAnnotation=w,n.ObjectTypeCallProperty=k,n.ObjectTypeIndexer=A,n.ObjectTypeProperty=C,n.QualifiedTypeIdentifier=T,n.UnionTypeAnnotation=j,n.TypeCastExpression=M,n.VoidTypeAnnotation=P,n.__esModule=!0;var O=L(e("../../types"));n.ClassImplements=d,n.GenericTypeAnnotation=d,n.TypeParameterDeclaration=I},{"../../types":153}],26:[function(e,t,n){"use strict";function r(e,t){t(e.name),e.value&&(this.push("="),t(e.value))}function l(e){this.push(e.name)}function i(e,t){t(e.namespace),this.push(":"),t(e.name)}function s(e,t){t(e.object),this.push("."),t(e.property)}function a(e,t){this.push("{..."),t(e.argument),this.push("}")}function o(e,t){this.push("{"),t(e.expression),this.push("}")}function u(e,t){var n=this,r=e.openingElement;t(r),r.selfClosing||(this.indent(),m(e.children,function(e){g.isLiteral(e)?n.push(e.value):t(e)}),this.dedent(),t(e.closingElement))}function p(e,t){this.push("<"),t(e.name),e.attributes.length>0&&(this.push(" "),t.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")}function c(e,t){this.push("</"),t(e.name),this.push(">")}function d(){}var f=function(e){return e&&e.__esModule?e:{"default":e}},h=function(e){return e&&e.__esModule?e["default"]:e};n.JSXAttribute=r,n.JSXIdentifier=l,n.JSXNamespacedName=i,n.JSXMemberExpression=s,n.JSXSpreadAttribute=a,n.JSXExpressionContainer=o,n.JSXElement=u,n.JSXOpeningElement=p,n.JSXClosingElement=c,n.JSXEmptyExpression=d,n.__esModule=!0;var m=h(e("lodash/collection/each")),g=f(e("../../types"))},{"../../types":153,"lodash/collection/each":316}],27:[function(e,t,n){"use strict";function r(e,t){var n=this;t(e.typeParameters),this.push("("),t.list(e.params,{iterator:function(e){e.optional&&n.push("?"),t(e.typeAnnotation)}}),this.push(")"),e.returnType&&t(e.returnType)}function l(e,t){var n=e.value,r=e.kind,l=e.key;("method"===r||"init"===r)&&n.generator&&this.push("*"),("get"===r||"set"===r)&&this.push(r+" "),n.async&&this.push("async "),e.computed?(this.push("["),t(l),this.push("]")):t(l),this._params(n,t),this.push(" "),t(n.body)}function i(e,t){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),t(e.id)):this.space(),this._params(e,t),this.space(),t(e.body)}function s(e,t){e.async&&this.push("async "),1===e.params.length&&o.isIdentifier(e.params[0])?t(e.params[0]):this._params(e,t),this.push(" => "),t(e.body)}var a=function(e){return e&&e.__esModule?e:{"default":e}};n._params=r,n._method=l,n.FunctionExpression=i,n.ArrowFunctionExpression=s,n.__esModule=!0;var o=a(e("../../types"));n.FunctionDeclaration=i},{"../../types":153}],28:[function(e,t,n){"use strict";function r(e,t){t(e.imported),e.local&&e.local!==e.imported&&(this.push(" as "),t(e.local))}function l(e,t){t(e.local)}function i(e,t){t(e.exported)}function s(e,t){t(e.local),e.exported&&e.local!==e.exported&&(this.push(" as "),t(e.exported))}function a(e,t){this.push("* as "),t(e.exported)}function o(e,t){this.push("export *"),e.exported&&(this.push(" as "),t(e.exported)),this.push(" from "),t(e.source),this.semicolon()}function u(e,t){this.push("export "),c.call(this,e,t)}function p(e,t){this.push("export default "),c.call(this,e,t)}function c(e,t){var n=e.specifiers;if(e.declaration){var r=e.declaration;if(t(r),g.isStatement(r)||g.isFunction(r)||g.isClass(r))return}else{var l=n[0],i=!1;(g.isExportDefaultSpecifier(l)||g.isExportNamespaceSpecifier(l))&&(i=!0,t(n.shift()),n.length&&this.push(", ")),(n.length||!n.length&&!i)&&(this.push("{"),n.length&&(this.space(),t.join(n,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),t(e.source))}this.ensureSemicolon()}function d(e,t){this.push("import "),e.isType&&this.push("type ");var n=e.specifiers;if(n&&n.length){var r=e.specifiers[0];(g.isImportDefaultSpecifier(r)||g.isImportNamespaceSpecifier(r))&&(t(e.specifiers.shift()),e.specifiers.length&&this.push(", ")),e.specifiers.length&&(this.push("{"),this.space(),t.join(e.specifiers,{separator:", "}),this.space(),this.push("}")),this.push(" from ")}t(e.source),this.semicolon()}function f(e,t){this.push("* as "),t(e.local)}var h=function(e){return e&&e.__esModule?e:{"default":e}},m=function(e){return e&&e.__esModule?e["default"]:e};n.ImportSpecifier=r,n.ImportDefaultSpecifier=l,n.ExportDefaultSpecifier=i,n.ExportSpecifier=s,n.ExportNamespaceSpecifier=a,n.ExportAllDeclaration=o,n.ExportNamedDeclaration=u,n.ExportDefaultDeclaration=p,n.ImportDeclaration=d,n.ImportNamespaceSpecifier=f,n.__esModule=!0;var g=(m(e("lodash/collection/each")),h(e("../../types")))},{"../../types":153,"lodash/collection/each":316}],29:[function(e,t,n){"use strict";function r(e,t){this.keyword("with"),this.push("("),t(e.object),this.push(")"),t.block(e.body)}function l(e,t){this.keyword("if"),this.push("("),t(e.test),this.push(")"),this.space(),t.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),t.indentOnComments(e.alternate))}function i(e,t){this.keyword("for"),this.push("("),t(e.init),this.push(";"),e.test&&(this.push(" "),t(e.test)),this.push(";"),e.update&&(this.push(" "),t(e.update)),this.push(")"),t.block(e.body)}function s(e,t){this.keyword("while"),this.push("("),t(e.test),this.push(")"),t.block(e.body)}function a(e,t){this.keyword("do"),t(e.body),this.space(),this.keyword("while"),this.push("("),t(e.test),this.push(");")}function o(e,t){t(e.label),this.push(": "),t(e.body)}function u(e,t){this.keyword("try"),t(e.block),this.space(),t(e.handlers?e.handlers[0]:e.handler),e.finalizer&&(this.space(),this.push("finally "),t(e.finalizer))}function p(e,t){this.keyword("catch"),this.push("("),t(e.param),this.push(") "),t(e.body)}function c(e,t){this.push("throw "),t(e.argument),this.semicolon()}function d(e,t){this.keyword("switch"),this.push("("),t(e.discriminant),this.push(")"),this.space(),this.push("{"),t.sequence(e.cases,{indent:!0,addNewlines:function(t,n){return t||e.cases[e.cases.length-1]!==n?void 0:-1}}),this.push("}")}function f(e,t){e.test?(this.push("case "),t(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),t.sequence(e.consequent,{indent:!0}))}function h(){this.push("debugger;")}function m(e,t,n){this.push(e.kind+" ");var r=!1;if(!x.isFor(n))for(var l=0;l<e.declarations.length;l++)e.declarations[l].init&&(r=!0);var i=",";i+=!this.format.compact&&r?"\n"+v(" ",e.kind.length+1):" ",t.list(e.declarations,{separator:i}),(!x.isFor(n)||n.left!==e&&n.init!==e)&&this.semicolon()}function g(e,t){t(e.id),t(e.id.typeAnnotation),e.init&&(this.space(),this.push("="),this.space(),t(e.init))}var y=function(e){return e&&e.__esModule?e:{"default":e}},b=function(e){return e&&e.__esModule?e["default"]:e};n.WithStatement=r,n.IfStatement=l,n.ForStatement=i,n.WhileStatement=s,n.DoWhileStatement=a,n.LabeledStatement=o,n.TryStatement=u,n.CatchClause=p,n.ThrowStatement=c,n.SwitchStatement=d,n.SwitchCase=f,n.DebuggerStatement=h,n.VariableDeclaration=m,n.VariableDeclarator=g,n.__esModule=!0;var v=b(e("repeating")),x=y(e("../../types")),E=function(e){return function(t,n){this.keyword("for"),this.push("("),n(t.left),this.push(" "+e+" "),n(t.right),this.push(")"),n.block(t.body)}},_=E("in");n.ForInStatement=_;var S=E("of");n.ForOfStatement=S;var I=function(e,t){return function(n,r){this.push(e);var l=n[t||"label"];l&&(this.push(" "),r(l)),this.semicolon()}},w=I("continue");n.ContinueStatement=w;var k=I("return","argument");n.ReturnStatement=k;var A=I("break");n.BreakStatement=A},{"../../types":153,repeating:435}],30:[function(e,t,n){"use strict";function r(e,t){t(e.tag),t(e.quasi)}function l(e){this._push(e.value.raw)}function i(e,t){var n=this;this.push("`");var r=e.quasis,l=r.length;a(r,function(r,i){t(r),l>i+1&&(n.push("${ "),t(e.expressions[i]),n.push(" }"))}),this._push("`")}var s=function(e){return e&&e.__esModule?e["default"]:e};n.TaggedTemplateExpression=r,n.TemplateElement=l,n.TemplateLiteral=i,n.__esModule=!0;var a=s(e("lodash/collection/each"))},{"lodash/collection/each":316}],31:[function(e,t,n){"use strict";function r(e){this.push(e.name)}function l(e,t){this.push("..."),t(e.argument)}function i(e,t){var n=e.properties;n.length?(this.push("{"),this.space(),t.list(n,{indent:!0}),this.space(),this.push("}")):this.push("{}")}function s(e,t){if(e.method||"get"===e.kind||"set"===e.kind)this._method(e,t);else{if(e.computed)this.push("["),t(e.key),this.push("]");else if(t(e.key),e.shorthand)return;this.push(":"),this.space(),t(e.value)}}function a(e,t){var n=this,r=e.elements,l=r.length;this.push("["),c(r,function(e,r){e?(r>0&&n.push(" "),t(e),l-1>r&&n.push(",")):n.push(",")}),this.push("]")}function o(e){var t=e.value,n=typeof t;"string"===n?this._stringLiteral(t):"number"===n?this.push(t+""):"boolean"===n?this.push(t?"true":"false"):e.regex?this.push("/"+e.regex.pattern+"/"+e.regex.flags):null===t&&this.push("null")}function u(e){e=JSON.stringify(e),e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),"single"===this.format.quotes&&(e=e.slice(1,-1),e=e.replace(/\\"/g,'"'),e=e.replace(/'/g,"\\'"),e="'"+e+"'"),this.push(e)}var p=function(e){return e&&e.__esModule?e["default"]:e};n.Identifier=r,n.RestElement=l,n.ObjectExpression=i,n.Property=s,n.ArrayExpression=a,n.Literal=o,n._stringLiteral=u,n.__esModule=!0;var c=p(e("lodash/collection/each"));n.SpreadElement=l,n.SpreadProperty=l,n.ObjectPattern=i,n.ArrayPattern=a},{"lodash/collection/each":316}],32:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("detect-indent")),s=r(e("./whitespace")),a=r(e("repeating")),o=r(e("./source-map")),u=r(e("./position")),p=n(e("../messages")),c=r(e("./buffer")),d=r(e("lodash/object/extend")),f=r(e("lodash/collection/each")),h=r(e("./node")),m=n(e("../types")),g=function(){function t(e,n,r){l(this,t),n||(n={}),this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=t.normalizeOptions(r,n,this.tokens),this.opts=n,this.ast=e,this.whitespace=new s(this.tokens,this.comments,this.format),this.position=new u,this.map=new o(this.position,n,r),this.buffer=new c(this.position,this.format)}return t.normalizeOptions=function(e,n,r){var l=" ";if(e){var s=i(e).indent;s&&" "!==s&&(l=s)}var a={comments:null==n.comments||n.comments,compact:n.compact,quotes:t.findCommonStringDelimeter(e,r),indent:{adjustMultilineComment:!0,style:l,base:0}};return"auto"===a.compact&&(a.compact=e.length>1e5,a.compact&&console.error(p.get("codeGeneratorDeopt",n.filename,"100KB"))),a},t.findCommonStringDelimeter=function(e,t){for(var n={single:0,"double":0},r=0,l=0;l<t.length;l++){var i=t[l];if("string"===i.type.label&&!(r>=3)){var s=e.slice(i.start,i.end);"'"===s[0]?n.single++:n.double++,r++}}return n.single>n.double?"single":"double"},t.generators={templateLiterals:e("./generators/template-literals"),comprehensions:e("./generators/comprehensions"),expressions:e("./generators/expressions"),statements:e("./generators/statements"),classes:e("./generators/classes"),methods:e("./generators/methods"),modules:e("./generators/modules"),types:e("./generators/types"),flow:e("./generators/flow"),base:e("./generators/base"),jsx:e("./generators/jsx")},t.prototype.generate=function(){var e=this.ast;this.print(e);var t=[];return f(e.comments,function(e){e._displayed||t.push(e)}),this._printComments(t),{map:this.map.get(),code:this.buffer.get()}},t.prototype.buildPrint=function(e){var t=this,n=function(n,r){return t.print(n,e,r)};return n.sequence=function(e){var r=void 0===arguments[1]?{}:arguments[1];return r.statement=!0,t.printJoin(n,e,r)},n.join=function(e,r){return t.printJoin(n,e,r)},n.list=function(e){var t=void 0===arguments[1]?{}:arguments[1];null==t.separator&&(t.separator=", "),n.join(e,t)},n.block=function(e){return t.printBlock(n,e)},n.indentOnComments=function(e){return t.printAndIndentOnComments(n,e)},n},t.prototype.print=function(e,t){var n=this,r=void 0===arguments[2]?{}:arguments[2];if(e){t&&t._compact&&(e._compact=!0);var l=this.format.concise;e._compact&&(this.format.concise=!0);var i=function(l){if(r.statement||h.isUserWhitespacable(e,t)){var i=0;if(null==e.start||e._ignoreUserWhitespace){l||i++,r.addNewlines&&(i+=r.addNewlines(l,e)||0);var s=h.needsWhitespaceAfter;l&&(s=h.needsWhitespaceBefore),s(e,t)&&i++,n.buffer.buf||(i=0)}else i=l?n.whitespace.getNewlinesBefore(e):n.whitespace.getNewlinesAfter(e);n.newline(i)}};if(!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var s=h.needsParensNoLineTerminator(e,t),a=s||h.needsParens(e,t);a&&this.push("("),s&&this.indent(),this.printLeadingComments(e,t),i(!0),r.before&&r.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),t),s&&(this.newline(),this.dedent()),a&&this.push(")"),this.map.mark(e,"end"),r.after&&r.after(),i(!1),this.printTrailingComments(e,t),this.format.concise=l}},t.prototype.printJoin=function(e,t){var n=this,r=void 0===arguments[2]?{}:arguments[2];if(t&&t.length){var l=t.length;r.indent&&this.indent(),f(t,function(t,i){e(t,{statement:r.statement,addNewlines:r.addNewlines,after:function(){r.iterator&&r.iterator(t,i),r.separator&&l-1>i&&n.push(r.separator)}})}),r.indent&&this.dedent()}},t.prototype.printAndIndentOnComments=function(e,t){var n=!!t.leadingComments;n&&this.indent(),e(t),n&&this.dedent()},t.prototype.printBlock=function(e,t){m.isEmptyStatement(t)?this.semicolon():(this.push(" "),e(t))},t.prototype.generateComment=function(e){var t=e.value;return t="Line"===e.type?"//"+t:"/*"+t+"*/"},t.prototype.printTrailingComments=function(e,t){this._printComments(this.getComments("trailingComments",e,t))},t.prototype.printLeadingComments=function(e,t){this._printComments(this.getComments("leadingComments",e,t))},t.prototype.getComments=function(e,t,n){var r=this;if(m.isExpressionStatement(n))return[];var l=[],i=[t];return m.isExpressionStatement(t)&&i.push(t.argument),f(i,function(t){l=l.concat(r._getComments(e,t))}),l},t.prototype._getComments=function(e,t){return t&&t[e]||[]},t.prototype._printComments=function(e){var t=this;this.format.compact||this.format.comments&&e&&e.length&&f(e,function(e){var n=!1;if(f(t.ast.comments,function(t){return t.start===e.start?(t._displayed&&(n=!0),t._displayed=!0,!1):void 0}),!n){t.newline(t.whitespace.getNewlinesBefore(e));var r=t.position.column,l=t.generateComment(e);if(r&&!t.isLast(["\n"," ","[","{"])&&(t._push(" "),r++),"Block"===e.type&&t.format.indent.adjustMultilineComment){var i=e.loc.start.column;if(i){var s=new RegExp("\\n\\s{1,"+i+"}","g");l=l.replace(s,"\n")}var o=Math.max(t.indentSize(),r);l=l.replace(/\n/g,"\n"+a(" ",o))}0===r&&(l=t.getIndent()+l),t._push(l),t.newline(t.whitespace.getNewlinesAfter(e))}})},t}();f(c.prototype,function(e,t){g.prototype[t]=function(){return e.apply(this.buffer,arguments)}}),f(g.generators,function(e){d(g.prototype,e)}),t.exports=function(e,t,n){var r=new g(e,t,n);return r.generate()},t.exports.CodeGenerator=g},{"../messages":43,"../types":153,"./buffer":20,"./generators/base":21,"./generators/classes":22,"./generators/comprehensions":23,"./generators/expressions":24,"./generators/flow":25,"./generators/jsx":26,"./generators/methods":27,"./generators/modules":28,"./generators/statements":29,"./generators/template-literals":30,"./generators/types":31,"./node":33,"./position":36,"./source-map":37,"./whitespace":38,"detect-indent":295,"lodash/collection/each":316,"lodash/object/extend":404,repeating:435}],33:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("./whitespace")),s=n(e("./parentheses")),a=r(e("lodash/collection/each")),o=r(e("lodash/collection/some")),u=n(e("../../types")),p=function(e,t,n){if(e){for(var r,l=Object.keys(e),i=0;i<l.length;i++){var s=l[i];if(u.is(s,t)){var a=e[s];if(r=a(t,n),null!=r)break}}return r}},c=function(){function e(t,n){l(this,e),this.parent=n,this.node=t}return e.isUserWhitespacable=function(e){return u.isUserWhitespacable(e)},e.needsWhitespace=function(t,n,r){if(!t)return 0;u.isExpressionStatement(t)&&(t=t.expression);var l=p(i.nodes,t,n);if(!l){var s=p(i.list,t,n);if(s)for(var a=0;a<s.length&&!(l=e.needsWhitespace(s[a],t,r));a++);}return l&&l[r]||0},e.needsWhitespaceBefore=function(t,n){return e.needsWhitespace(t,n,"before")},e.needsWhitespaceAfter=function(t,n){return e.needsWhitespace(t,n,"after")},e.needsParens=function(e,t){if(!t)return!1;if(u.isNewExpression(t)&&t.callee===e){if(u.isCallExpression(e))return!0;var n=o(e,function(e){return u.isCallExpression(e)});if(n)return!0}return p(s,e,t)},e.needsParensNoLineTerminator=function(e,t){return t&&e.leadingComments&&e.leadingComments.length?u.isYieldExpression(t)||u.isAwaitExpression(t)?!0:u.isContinueStatement(t)||u.isBreakStatement(t)||u.isReturnStatement(t)||u.isThrowStatement(t)?!0:!1:!1},e}();t.exports=c,a(c,function(e,t){c.prototype[t]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var n=0;n<e.length;n++)e[n+2]=arguments[n];return c[t].apply(null,e)}})},{"../../types":153,"./parentheses":34,"./whitespace":35,"lodash/collection/each":316,"lodash/collection/some":322}],34:[function(e,t,n){"use strict";function r(e,t){return y.isArrayTypeAnnotation(t)}function l(e,t){return y.isMemberExpression(t)&&t.object===e?!0:void 0}function i(e,t){return y.isExpressionStatement(t)?!0:y.isMemberExpression(t)&&t.object===e?!0:!1}function s(e,t){if((y.isCallExpression(t)||y.isNewExpression(t))&&t.callee===e)return!0;if(y.isUnaryLike(t))return!0;if(y.isMemberExpression(t)&&t.object===e)return!0;if(y.isBinary(t)){var n=t.operator,r=b[n],l=e.operator,i=b[l];if(r>i)return!0;if(r===i&&t.right===e)return!0}}function a(e,t){if("in"===e.operator){if(y.isVariableDeclarator(t))return!0;if(y.isFor(t))return!0}}function o(e,t){return y.isForStatement(t)?!1:y.isExpressionStatement(t)&&t.expression===e?!1:!0}function u(e,t){return y.isBinary(t)||y.isUnaryLike(t)||y.isCallExpression(t)||y.isMemberExpression(t)||y.isNewExpression(t)||y.isConditionalExpression(t)||y.isYieldExpression(t)}function p(e,t){return y.isExpressionStatement(t)}function c(e,t){return y.isMemberExpression(t)&&t.object===e}function d(e,t){return y.isExpressionStatement(t)?!0:y.isMemberExpression(t)&&t.object===e?!0:y.isCallExpression(t)&&t.callee===e?!0:void 0}function f(e,t){return y.isUnaryLike(t)?!0:y.isBinary(t)?!0:(y.isCallExpression(t)||y.isNewExpression(t))&&t.callee===e?!0:y.isConditionalExpression(t)&&t.test===e?!0:y.isMemberExpression(t)&&t.object===e?!0:!1}var h=function(e){return e&&e.__esModule?e:{"default":e}},m=function(e){return e&&e.__esModule?e["default"]:e};n.NullableTypeAnnotation=r,n.UpdateExpression=l,n.ObjectExpression=i,n.Binary=s,n.BinaryExpression=a,n.SequenceExpression=o,n.YieldExpression=u,n.ClassExpression=p,n.UnaryLike=c,n.FunctionExpression=d,n.ConditionalExpression=f,n.__esModule=!0;var g=m(e("lodash/collection/each")),y=h(e("../../types")),b={};g([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,t){g(e,function(e){b[e]=t})}),n.FunctionTypeAnnotation=r,n.AssignmentExpression=f},{"../../types":153,"lodash/collection/each":316}],35:[function(e,t,n){"use strict";function r(e){var t=void 0===arguments[1]?{}:arguments[1];if(c.isMemberExpression(e))r(e.object,t),e.computed&&r(e.property,t);else if(c.isBinary(e)||c.isAssignmentExpression(e))r(e.left,t),r(e.right,t);else if(c.isCallExpression(e))t.hasCall=!0,r(e.callee,t);else if(c.isFunction(e))t.hasFunction=!0;else if(c.isIdentifier(e)){var n=t;n.hasHelper||(n.hasHelper=l(e.callee))}return t}function l(e){return c.isMemberExpression(e)?l(e.object)||l(e.property):c.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:c.isCallExpression(e)?l(e.callee):c.isBinary(e)||c.isAssignmentExpression(e)?c.isIdentifier(e.left)&&l(e.left)||l(e.right):!1}function i(e){return c.isLiteral(e)||c.isObjectExpression(e)||c.isArrayExpression(e)||c.isIdentifier(e)||c.isMemberExpression(e)}var s=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e},o=a(e("lodash/lang/isBoolean")),u=a(e("lodash/collection/each")),p=a(e("lodash/collection/map")),c=s(e("../../types"));n.nodes={AssignmentExpression:function(e){var t=r(e.right);return t.hasCall&&t.hasHelper||t.hasFunction?{before:t.hasFunction,after:!0}:void 0},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){return c.isFunction(e.left)||c.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return c.isFunction(e.callee)||l(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var t=0;t<e.declarations.length;t++){var n=e.declarations[t],s=l(n.id)&&!i(n.init);if(!s){var a=r(n.init);s=l(n.init)&&a.hasCall||a.hasFunction}if(s)return{before:!0,after:!0}}},IfStatement:function(e){return c.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0}},n.nodes.Property=n.nodes.SpreadProperty=function(e,t){return t.properties[0]===e?{before:!0}:void 0},n.list={VariableDeclaration:function(e){return p(e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},u({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,t){o(e)&&(e={after:e,before:e}),u([t].concat(c.FLIPPED_ALIAS_KEYS[t]||[]),function(t){n.nodes[t]=function(){return e}})})},{"../../types":153,"lodash/collection/each":316,"lodash/collection/map":320,"lodash/lang/isBoolean":391}],36:[function(e,t){"use strict";var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(){function e(){n(this,e),this.line=1,this.column=0}return e.prototype.push=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?(this.line++,this.column=0):this.column++},e.prototype.unshift=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?this.line--:this.column--},e}();t.exports=r},{}],37:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("source-map")),s=n(e("../types")),a=function(){function e(t,n,r){l(this,e),this.position=t,this.opts=n,n.sourceMaps?(this.map=new i.SourceMapGenerator({file:n.sourceMapName,sourceRoot:n.sourceRoot}),this.map.setSourceContent(n.sourceFileName,r)):this.map=null}return e.prototype.get=function(){var e=this.map;return e?e.toJSON():e},e.prototype.mark=function(e,t){var n=e.loc;if(n){var r=this.map;if(r&&!s.isProgram(e)&&!s.isFile(e)){var l=this.position,i={line:l.line,column:l.column},a=n[t];r.addMapping({source:this.opts.sourceFileName,generated:i,original:a})}}},e}();t.exports=a},{"../types":153,"source-map":439}],38:[function(e,t){"use strict";function n(e,t,n){return e+=t,e>=n&&(e-=n),e}var r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("lodash/collection/sortBy")),s=function(){function e(t,n){l(this,e),this.tokens=i(t.concat(n),"start"),this.used={},this._lastFoundIndex=0}return e.prototype.getNewlinesBefore=function(e){for(var t,r,l,i=this.tokens,s=0;s<i.length;s++){var a=n(s,this._lastFoundIndex,this.tokens.length);if(l=i[a],e.start===l.start){t=i[a-1],r=l,this._lastFoundIndex=a;break}}return this.getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){for(var t,r,l,i=this.tokens,s=0;s<i.length;s++){var a=n(s,this._lastFoundIndex,this.tokens.length);if(l=i[a],e.end===l.end){t=l,r=i[a+1],this._lastFoundIndex=a;break}}if(r&&"eof"===r.type.label)return 1;var o=this.getNewlinesBetween(t,r);return"Line"!==e.type||o?o:1},e.prototype.getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var n=e?e.loc.end.line:1,r=t.loc.start.line,l=0,i=n;r>i;i++)"undefined"==typeof this.used[i]&&(this.used[i]=!0,l++);return l},e}();t.exports=s},{"lodash/collection/sortBy":323}],39:[function(e,t){"use strict";function n(e){var t=a.matchToToken(e);if("name"===t.type&&o.keyword.isReservedWordES6(t.value))return"keyword";if("punctuator"===t.type)switch(t.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return t.type}function r(e){return e.replace(a,function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var l=n(t),i=p[l];return i?t[0].split(c).map(function(e){return i(e)}).join("\n"):t[0]})}var l=function(e){return e&&e.__esModule?e["default"]:e},i=l(e("line-numbers")),s=l(e("repeating")),a=l(e("js-tokens")),o=l(e("esutils")),u=l(e("chalk")),p={string:u.red,punctuator:u.bold,curly:u.green,parens:u.blue.bold,square:u.yellow,keyword:u.cyan,number:u.magenta,regex:u.magenta,comment:u.grey,invalid:u.inverse},c=/\r\n|[\n\r\u2028\u2029]/;t.exports=function(e,t,n){var l=void 0===arguments[3]?{}:arguments[3];n=Math.max(n,0),l.highlightCode&&u.supportsColor&&(e=r(e)),e=e.split(c);var a=Math.max(t-3,0),o=Math.min(e.length,t+3);return t||n||(a=0,o=e.length),i(e.slice(a,o),{start:a+1,before:" ",after:" | ",transform:function(e){e.number===t&&(n&&(e.line+="\n"+e.before+s(" ",e.width)+e.after+s(" ",n-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n")}},{chalk:200,esutils:300,"js-tokens":306,"line-numbers":308,repeating:435}],40:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../types"));t.exports=function(e,t,n){if(e&&"Program"===e.type)return r.file(e,t||[],n||[]);throw new Error("Not a valid ast?")}},{"../types":153}],41:[function(e,t){"use strict";t.exports=function(){return Object.create(null)}},{}],42:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=r(e("./normalize-ast")),i=r(e("estraverse")),s=r(e("./code-frame")),a=n(e("../../acorn"));t.exports=function(e,t,n){try{var r=[],o=[],u={allowImportExportEverywhere:e.looseModules,allowReturnOutsideFunction:e.looseModules,ecmaVersion:6,strictMode:e.strictMode,sourceType:e.sourceType,onComment:r,locations:!0,features:e.features||{},plugins:e.plugins||{},onToken:o,ranges:!0};e.nonStandard&&(u.plugins.jsx=!0,u.plugins.flow=!0);var p=a.parse(t,u);return i.attachComments(p,r,o),p=l(p,r,o),n?n(p):p}catch(c){if(!c._babel){c._babel=!0;var d=c.message=""+e.filename+": "+c.message,f=c.loc;if(f&&(c.codeFrame=s(t,f.line,f.column+1,e),d+="\n"+c.codeFrame),c.stack){var h=c.stack.replace(c.message,d);try{c.stack=h}catch(m){}}}throw c}}},{"../../acorn":5,"./code-frame":39,"./normalize-ast":40,estraverse:296}],43:[function(e,t,n){"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];var i=a[e];if(!i)throw new ReferenceError("Unknown message "+JSON.stringify(e));return n=l(n),i.replace(/\$(\d+)/g,function(e,t){return n[--t]})}function l(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(t){return s.inspect(e)}})}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.get=r,n.parseArgs=l,n.__esModule=!0;var s=i(e("util")),a={tailCallReassignmentDeopt:"Function reference has been reassigned so it's probably be dereferenced so we can't optimise this with confidence",JSXNamespacedTags:"Namespace tags are not supported. ReactJSX is not XML.",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",classesIllegalConstructorKind:"Illegal kind for constructor method",scopeDuplicateDeclaration:"Duplicate declaration $1",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",settersInvalidParamLength:"Setters must have exactly one parameter",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemeberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",modulesIllegalExportName:"Illegal export $1",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",evalInStrictMode:"eval is not allowed in strict mode",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1"}; n.MESSAGES=a},{util:199}],44:[function(e){"use strict";var t=function(e){return e&&e.__esModule?e:{"default":e}},n=function(e){return e&&e.__esModule?e["default"]:e},r=n(e("estraverse")),l=n(e("lodash/object/extend")),i=n(e("ast-types")),s=t(e("./types"));l(r.VisitorKeys,s.VISITOR_KEYS);var a=i.Type.def,o=i.Type.or;a("File").bases("Node").build("program").field("program",a("Program")),a("AssignmentPattern").bases("Pattern").build("left","right").field("left",a("Pattern")).field("right",a("Expression")),a("RestElement").bases("Pattern").build("argument").field("argument",a("expression")),a("DoExpression").bases("Expression").build("body").field("body",[a("Statement")]),a("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",o(a("Declaration"),a("Expression"),null)),a("ExportNamedDeclaration").bases("Declaration").build("declaration").field("declaration",o(a("Declaration"),a("Expression"),null)).field("specifiers",[o(a("ExportSpecifier"))]).field("source",o(a("ModuleSpecifier"),null)),i.finalize()},{"./types":153,"ast-types":171,estraverse:296,"lodash/object/extend":404}],45:[function(e,t){"use strict";function n(e){if(!s.existsSync)return!1;var t=a[e];return null!=t?t:a[e]=s.existsSync(e)}var r=function(e){return e&&e.__esModule?e["default"]:e},l=r(e("lodash/object/merge")),i=r(e("path")),s=r(e("fs")),a={},o={};t.exports=function(e){function t(e,a){var u=i.join(e,a);if(n(u)){var p,c=s.readFileSync(u,"utf8");try{var d,f;d=o,f=c,!d[f]&&(d[f]=JSON.parse(c)),p=d[f]}catch(h){throw h.message=""+u+": "+h.message,h}if(p.breakConfig)return;l(r,p,function(e,t){return Array.isArray(e)?e.concat(t):void 0})}var m=i.dirname(e);m!==e&&t(m,a)}var r=void 0===arguments[1]?{}:arguments[1],a=".babelrc";return t(e,a),r}},{fs:172,"lodash/object/merge":408,path:182}],46:[function(e,t){(function(n){"use strict";function r(e,t,n){k(e,function(e){e.shouldRun||e.ran||e.checkNode(t,n)})}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e},s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e)){for(var n,r=[],l=e[Symbol.iterator]();!(n=l.next()).done&&(r.push(n.value),!t||r.length!==t););return r}throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=i(e("convert-source-map")),u=l(e("./option-parsers")),p=i(e("shebang-regex")),c=i(e("../../traversal/path")),d=i(e("lodash/lang/isFunction")),f=i(e("path-is-absolute")),h=i(e("../../tools/resolve-rc")),m=i(e("source-map")),g=i(e("./../index")),y=i(e("../../generation")),b=i(e("lodash/object/defaults")),v=i(e("lodash/collection/includes")),x=(i(e("../../traversal")),i(e("lodash/object/assign"))),E=i(e("./logger")),_=i(e("../../helpers/parse")),S=(i(e("../../traversal/scope")),i(e("slash"))),I=l(e("../../util")),w=i(e("path")),k=i(e("lodash/collection/each")),A=l(e("../../types")),C={enter:function(e,t,n,l){r(l.stack,e,n)}},T=function(){function t(){var e=void 0===arguments[0]?{}:arguments[0];a(this,t),this.dynamicImportedNoDefault=[],this.dynamicImportIds={},this.dynamicImported=[],this.dynamicImports=[],this.usedHelpers={},this.dynamicData={},this.data={},this.uids={},this.lastStatements=[],this.log=new E(this,e.filename||"unknown"),this.opts=this.normalizeOptions(e),this.ast={},this.buildTransformers()}return t.helpers=["inherits","defaults","create-class","create-decorated-class","tagged-template-literal","tagged-template-literal-loose","interop-require","to-array","to-consumable-array","sliced-to-array","sliced-to-array-loose","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-require-wildcard","typeof","extends","get","set","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global","default-props"],t.options=e("./options"),t.prototype.normalizeOptions=function(e){if(e=x({},e),e.filename){var r=e.filename;f(r)||(r=w.join(n.cwd(),r)),e=h(r,e)}for(var l in e)if("_"!==l[0]){var i=t.options[l];i||this.log.error("Unknown option: "+l,ReferenceError)}for(var l in t.options){var i=t.options[l],s=e[l];if(s||!i.optional){if(s&&i.deprecated)throw new Error("Deprecated option "+l+": "+i.deprecated);null==s&&(s=i["default"]||s);var a=u[i.type];if(a&&(s=a(l,s)),i.alias){var o=e,p=i.alias;o[p]||(o[p]=s)}else e[l]=s}}return e.inputSourceMap&&(e.sourceMaps=!0),e.filename=S(e.filename),e.sourceRoot&&(e.sourceRoot=S(e.sourceRoot)),e.moduleId&&(e.moduleIds=!0),e.basename=w.basename(e.filename,w.extname(e.filename)),e.ignore=I.arrayify(e.ignore,I.regexify),e.only=I.arrayify(e.only,I.regexify),b(e,{moduleRoot:e.sourceRoot}),b(e,{sourceRoot:e.moduleRoot}),b(e,{filenameRelative:e.filename}),b(e,{sourceFileName:e.filenameRelative,sourceMapName:e.filenameRelative}),e.externalHelpers&&this.set("helpersNamespace",A.identifier("babelHelpers")),e},t.prototype.isLoose=function(e){return v(this.opts.loose,e)},t.prototype.buildTransformers=function(){var e=this,t=this.transformers={},n=[],r=[];k(g.transformers,function(l,i){var s=t[i]=l.buildPass(e);s.canTransform()&&(r.push(s),l.metadata.secondPass&&n.push(s),l.manipulateOptions&&l.manipulateOptions(e.opts,e))});for(var l=[],i=[],s=0;s<e.opts.plugins.length;s++)this.addPlugin(e.opts.plugins[s],l,i);r=l.concat(r,i),this.transformerStack=r.concat(n)},t.prototype.getModuleFormatter=function(t){var n=d(t)?t:g.moduleFormatters[t];if(!n){var r=I.resolveRelative(t);r&&(n=e(r))}if(!n)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(t));return new n(this)},t.prototype.addPlugin=function(t,n,r){var l,i="before";if(!t)throw new TypeError("Ilegal kind "+typeof t+" for plugin name "+JSON.stringify(t));if("string"==typeof t){var a=t.split(":"),o=s(a,2);t=o[0];var u=o[1];i=void 0===u?"before":u;var p=I.resolveRelative(t)||I.resolveRelative("babel-plugin-"+t);if(!p)throw new ReferenceError("Unknown plugin "+JSON.stringify(t));l=e(p)}else l=t;if("before"!==i&&"after"!==i)throw new TypeError("Plugin "+JSON.stringify(t)+" has an illegal position of "+JSON.stringify(i));var c=l.key;if(this.transformers[c])throw new ReferenceError("The key for plugin "+JSON.stringify(t)+" of "+c+" collides with an existing plugin");if(!l.buildPass||"Transformer"!==l.constructor.name)throw new TypeError("Plugin "+JSON.stringify(t)+" didn't export default a Transformer instance");var d=this.transformers[c]=l.buildPass(this);if(d.canTransform()){var f=n;"after"===i&&(f=r),f.push(d)}},t.prototype.parseInputSourceMap=function(e){var t=this.opts;if(t.inputSourceMap!==!1){var n=o.fromSource(e);n&&(t.inputSourceMap=n.toObject(),e=o.removeComments(e))}return e},t.prototype.parseShebang=function(e){var t=p.exec(e);return t&&(this.shebang=t[0],e=e.replace(p,"")),e},t.prototype.set=function(e,t){return this.data[e]=t},t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(e){var t=this.data[e];if(t)return t;var n=this.dynamicData[e];return n?this.set(e,n()):void 0},t.prototype.resolveModuleSource=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=this.opts.resolveModuleSource;return t&&(e=t(e,this.opts.filename)),e}),t.prototype.addImport=function(e,t,n){t||(t=e);var r=this.dynamicImportIds[t];if(!r){e=this.resolveModuleSource(e),r=this.dynamicImportIds[t]=this.scope.generateUidIdentifier(t);var l=[A.importDefaultSpecifier(r)],i=A.importDeclaration(l,A.literal(e));i._blockHoist=3,this.dynamicImported.push(i),n&&this.dynamicImportedNoDefault.push(i),this.transformers["es6.modules"].canTransform()?(this.moduleFormatter.importSpecifier(l[0],i,this.dynamicImports),this.moduleFormatter.hasLocalImports=!0):this.dynamicImports.push(i)}return r},t.prototype.isConsequenceExpressionStatement=function(e){return A.isExpressionStatement(e)&&this.lastStatements.indexOf(e)>=0},t.prototype.attachAuxiliaryComment=function(e){var t=this.opts.auxiliaryComment;if(t){var n=e;n.leadingComments||(n.leadingComments=[]),e.leadingComments.push({type:"Line",value:" "+t})}return e},t.prototype.addHelper=function(e){if(!v(t.helpers,e))throw new ReferenceError("Unknown helper "+e);var n=this.ast.program,r=n._declarations&&n._declarations[e];if(r)return r.id;this.usedHelpers[e]=!0;var l=this.get("helperGenerator"),i=this.get("helpersNamespace");if(l)return l(e);if(i){var s=A.identifier(A.toIdentifier(e));return A.memberExpression(i,s)}var a=I.template("helper-"+e);a._compact=!0;var o=this.scope.generateUidIdentifier(e);return this.scope.push({key:e,id:o,init:a}),o},t.prototype.errorWithNode=function(e,t){var n=void 0===arguments[2]?SyntaxError:arguments[2],r=e.loc.start,l=new n("Line "+r.line+": "+t);return l.loc=r,l},t.prototype.addCode=function(e){return e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e,this.parseShebang(e)},t.prototype.shouldIgnore=function(){var e=this.opts,t=e.filename,n=e.ignore,r=e.only;if(r.length){for(var l=0;l<r.length;l++)if(r[l].test(t))return!1;return!0}if(n.length)for(var l=0;l<n.length;l++)if(n[l].test(t))return!0;return!1},t.prototype.parse=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){var t=this;if(this.shouldIgnore())return{metadata:{},code:e,map:null,ast:null};e=this.addCode(e);var n=this.opts,r={highlightCode:n.highlightCode,nonStandard:n.nonStandard,filename:n.filename,plugins:{}},l=r.features={};for(var i in this.transformers){var s=this.transformers[i];l[i]=s.canTransform()}return r.looseModules=this.isLoose("es6.modules"),r.strictMode=l.strict,r.sourceType="module",_(r,e,function(e){return t.transform(e),t.generate()})}),t.prototype.setAst=function(e){this.path=c.get(null,null,e,e,"program",this),this.scope=this.path.scope,this.ast=e,this.path.traverse({enter:function(e,t,n){if(this.isScope())for(var r in n.bindings)n.bindings[r].setTypeAnnotation()}})},t.prototype.transform=function(e){this.log.debug(),this.setAst(e),this.lastStatements=A.getLastStatements(e.program);var t=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);t.init&&this.transformers["es6.modules"].canTransform()&&t.init(),this.checkNode(e),this.call("pre"),k(this.transformerStack,function(e){e.transform()}),this.call("post")},t.prototype.call=function(e){for(var t=this.transformerStack,n=0;n<t.length;n++){var r=t[n].transformer,l=r[e];l&&l(this)}},t.prototype.checkNode=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)this.checkNode(e[n],t);else{var l=this.transformerStack;t||(t=this.scope),r(l,e,t),t.traverse(e,C,{stack:l})}}),t.prototype.mergeSourceMap=function(e){var t=this.opts,n=t.inputSourceMap;if(n){e.sources[0]=n.file;var r=new m.SourceMapConsumer(n),l=new m.SourceMapConsumer(e),i=m.SourceMapGenerator.fromSourceMap(l);i.applySourceMap(r);var s=i.toJSON();return s.sources=n.sources,s.file=n.file,s}return e},t.prototype.generate=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(){var e=this.opts,t=this.ast,n={metadata:{},code:"",map:null,ast:null};if(this.opts.metadataUsedHelpers&&(n.metadata.usedHelpers=Object.keys(this.usedHelpers)),e.ast&&(n.ast=t),!e.code)return n;var r=y(t,e,this.code);return n.code=r.code,n.map=r.map,this.shebang&&(n.code=""+this.shebang+"\n"+n.code),n.map&&(n.map=this.mergeSourceMap(n.map)),("inline"===e.sourceMaps||"both"===e.sourceMaps)&&(n.code+="\n"+o.fromObject(n.map).toComment()),"inline"===e.sourceMaps&&(n.map=null),n}),t}();t.exports=T}).call(this,e("_process"))},{"../../generation":32,"../../helpers/parse":42,"../../tools/resolve-rc":45,"../../traversal":144,"../../traversal/path":148,"../../traversal/scope":149,"../../types":153,"../../util":157,"./../index":63,"./logger":47,"./option-parsers":48,"./options":49,_process:183,"convert-source-map":208,"lodash/collection/each":316,"lodash/collection/includes":319,"lodash/lang/isFunction":393,"lodash/object/assign":402,"lodash/object/defaults":403,path:182,"path-is-absolute":418,"shebang-regex":437,slash:438,"source-map":439}],47:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("../../util")),i=function(){function e(t,n){r(this,e),this.filename=n,this.file=t}return e.prototype._buildMessage=function(e){var t=this.filename;return e&&(t+=": "+e),t},e.prototype.error=function(e){var t=void 0===arguments[1]?Error:arguments[1];throw new t(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts.suppressDeprecationMessages||console.error(e)},e.prototype.debug=function(e){l.debug(this._buildMessage(e))},e.prototype.deopt=function(e,t){l.debug(this._buildMessage(t))},e}();t.exports=i},{"../../util":157}],48:[function(e,t,n){"use strict";function r(e,t){return t=c.arrayify(t),(t.indexOf("all")>=0||t.indexOf(!0)>=0)&&(t=Object.keys(p.transformers)),p._ensureTransformerNames(e,t)}function l(e,t){return+t}function i(e,t){return!!t}function s(e,t){return c.booleanify(t)}function a(e,t){return c.list(t)}var o=function(e){return e&&e.__esModule?e:{"default":e}},u=function(e){return e&&e.__esModule?e["default"]:e};n.transformerList=r,n.number=l,n.boolean=i,n.booleanString=s,n.list=a,n.__esModule=!0;var p=u(e("./../index")),c=o(e("../../util"))},{"../../util":157,"./../index":63}],49:[function(e,t){t.exports={filename:{type:"string",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc","default":"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},moduleId:{description:"specify a custom name for module ids",type:"string"},nonStandard:{type:"boolean","default":!0,description:"enable support for JSX and Flow"},experimental:{deprecated:"use `--stage 0`/`{ stage: 0 }` instead"},highlightCode:{description:"ANSI syntax highlight code frames",type:"boolean","default":!0},suppressDeprecationMessages:{type:"boolean","default":!1,hidden:!0},resolveModuleSource:{hidden:!0},stage:{description:"ECMAScript proposal stage version to allow [0-4]",shorthand:"e",type:"number","default":2},blacklist:{type:"transformerList",description:"blacklist of transformers to NOT use",shorthand:"b"},whitelist:{type:"transformerList",optional:!0,description:"whitelist of transformers to ONLY use",shorthand:"l"},optional:{type:"transformerList",description:"list of optional transformers to enable"},modules:{type:"string",description:"module formatter type to use [common]","default":"common",shorthand:"m"},moduleIds:{type:"boolean","default":!1,shorthand:"M",description:"insert an explicit id for modules"},loose:{type:"transformerList",description:"list of transformers to enable loose mode ON",shorthand:"L"},jsxPragma:{type:"string",description:"custom pragma to use with JSX (same functionality as @jsx comments)","default":"React.createElement",shorthand:"P"},plugins:{type:"list",description:""},ignore:{type:"list",description:"list of glob paths to **not** compile"},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,"default":!0,type:"boolean"},ast:{hidden:!0,"default":!0,type:"boolean"},comments:{type:"boolean","default":!0,description:"output comments in generated output"},compact:{type:"booleanString","default":"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},keepModuleIdExtensions:{type:"boolean",description:"keep extensions when generating module ids","default":!1,shorthand:"k"},auxiliaryComment:{type:"string","default":"",shorthand:"a",description:"attach a comment before all helper declarations and auxiliary code"},externalHelpers:{type:"string","default":!1,shorthand:"r",description:"uses a reference to `babelHelpers` instead of placing helpers at the top of your code."},metadataUsedHelpers:{type:"boolean","default":!1,hidden:!0},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]","default":!1,shorthand:"s"},sourceMapName:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"string",description:"the root from which all sources are relative"},moduleRoot:{type:"string",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},breakConfig:{type:"boolean","default":!1,hidden:!0,description:"stop trying to load .babelrc files"}}},{}],50:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=r(e("./explode-assignable-expression")),i=n(e("../../types"));t.exports=function(e,t){var n=function(e){return e.operator===t.operator+"="},r=function(e,t){return i.assignmentExpression("=",e,t)};e.ExpressionStatement=function(e,s,a,o){if(!o.isConsequenceExpressionStatement(e)){var u=e.expression;if(n(u)){var p=[],c=l(u.left,p,o,a,!0);return p.push(i.expressionStatement(r(c.ref,t.build(c.uid,u.right)))),p}}},e.AssignmentExpression=function(e,i,s,a){if(n(e)){var o=[],u=l(e.left,o,a,s);return o.push(r(u.ref,t.build(u.uid,e.right))),o}},e.BinaryExpression=function(e){return e.operator===t.operator?t.build(e.left,e.right):void 0}}},{"../../types":153,"./explode-assignable-expression":55}],51:[function(e,t){"use strict";function n(e,t){var r=e.blocks.shift();if(r){var i=n(e,t);return i||(i=t(),e.filter&&(i=l.ifStatement(e.filter,l.blockStatement([i])))),l.forOfStatement(l.variableDeclaration("let",[l.variableDeclarator(r.left)]),r.right,l.blockStatement([i]))}}var r=function(e){return e&&e.__esModule?e:{"default":e}};t.exports=n;var l=r(e("../../types"))},{"../../types":153}],52:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=r(e("lodash/lang/isString")),i=n(e("../../messages")),s=r(e("esutils")),a=n(e("./react")),o=n(e("../../types"));t.exports=function(e,t){e.check=function(e){return o.isJSX(e)?!0:a.isCreateClass(e)?!0:!1},e.JSXIdentifier=function(e,t){return"this"===e.name&&o.isReferenced(e,t)?o.thisExpression():s.keyword.isIdentifierName(e.name)?void(e.type="Identifier"):o.literal(e.name)},e.JSXNamespacedName=function(){throw this.errorWithNode(i.get("JSXNamespacedTags"))},e.JSXMemberExpression={exit:function(e){e.computed=o.isLiteral(e.property),e.type="MemberExpression"}},e.JSXExpressionContainer=function(e){return e.expression},e.JSXAttribute={enter:function(e){var t=e.value;o.isLiteral(t)&&l(t.value)&&(t.value=t.value.replace(/\n\s+/g," "))},exit:function(e){var t=e.value||o.literal(!0);return o.inherits(o.property("init",e.name,t),e)}},e.JSXOpeningElement={exit:function(e,r,l,i){var s,a=e.name,u=[];o.isIdentifier(a)?s=a.name:o.isLiteral(a)&&(s=a.value);var p={tagExpr:a,tagName:s,args:u};t.pre&&t.pre(p,i);var c=e.attributes;return c=c.length?n(c,i):o.literal(null),u.push(c),t.post&&t.post(p,i),p.call||o.callExpression(p.callee,u)}};var n=function(e,t){for(var n=[],r=[],l=function(){n.length&&(r.push(o.objectExpression(n)),n=[])};e.length;){var i=e.shift();o.isJSXSpreadAttribute(i)?(l(),r.push(i.argument)):n.push(i)}return l(),1===r.length?e=r[0]:(o.isObjectExpression(r[0])||r.unshift(o.objectExpression([])),e=o.callExpression(t.addHelper("extends"),r)),e};e.JSXElement={enter:function(e){e.children=a.buildChildren(e)},exit:function(e){var t=e.openingElement;return t.arguments=t.arguments.concat(e.children),t.arguments.length>=3&&(t._prettyCall=!0),o.inherits(t,e)}};var r=function(e,t){for(var n=t.arguments[0].properties,r=!0,l=0;l<n.length;l++){var i=n[l];if(o.isIdentifier(i.key,{name:"displayName"})){r=!1;break}}r&&n.unshift(o.property("init",o.identifier("displayName"),o.literal(e)))};e.ExportDefaultDeclaration=function(e,t,n,l){a.isCreateClass(e.declaration)&&r(l.opts.basename,e.declaration)},e.AssignmentExpression=e.Property=e.VariableDeclarator=function(e){var t,n;o.isAssignmentExpression(e)?(t=e.left,n=e.right):o.isProperty(e)?(t=e.key,n=e.value):o.isVariableDeclarator(e)&&(t=e.id,n=e.init),o.isMemberExpression(t)&&(t=t.property),o.isIdentifier(t)&&a.isCreateClass(n)&&r(t.name,n)}}},{"../../messages":43,"../../types":153,"./react":58,esutils:300,"lodash/lang/isString":399}],53:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../../types"));t.exports=function(e){var t=r.functionExpression(null,[],e.body,e.generator,e.async);t.shadow=!0;var n=r.callExpression(t,[]);return e.generator&&(n=r.yieldExpression(n,!0)),r.returnStatement(n)}},{"../../types":153}],54:[function(e,t,n){"use strict";function r(e,t,n,r,l){var i=d.toKeyAlias({computed:r},t),s={};c(e,i)&&(s=e[i]),e[i]=s,s._key=t,r&&(s._computed=!0),s[n]=l}function l(e){for(var t in e)if(e[t]._computed)return!0;return!1}function i(e){for(var t=d.arrayExpression([]),n=0;n<e.properties.length;n++){var r=e.properties[n],l=r.value;l.properties.unshift(d.property("init",d.identifier("key"),d.toComputedKey(r))),t.elements.push(l)}return t}function s(e){var t=d.objectExpression([]);return p(e,function(e){var n=d.objectExpression([]),r=d.property("init",e._key,n,e._computed);p(e,function(e,t){if("_"!==t[0]){var r=e;(d.isMethodDefinition(e)||d.isClassProperty(e))&&(e=e.value);var l=d.property("init",d.identifier(t),e);d.inheritsComments(l,r),d.removeComments(r),n.properties.push(l)}}),t.properties.push(r)}),t}function a(e){return p(e,function(e){e.value&&(e.writable=d.literal(!0)),e.configurable=d.literal(!0),e.enumerable=d.literal(!0)}),s(e)}var o=function(e){return e&&e.__esModule?e:{"default":e}},u=function(e){return e&&e.__esModule?e["default"]:e};n.push=r,n.hasComputed=l,n.toComputedObjectFromClass=i,n.toClassObject=s,n.toDefineObject=a,n.__esModule=!0;var p=(u(e("lodash/lang/cloneDeep")),u(e("../../traversal")),u(e("lodash/collection/each"))),c=u(e("lodash/object/has")),d=o(e("../../types"))},{"../../traversal":144,"../../types":153,"lodash/collection/each":316,"lodash/lang/cloneDeep":388,"lodash/object/has":405}],55:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../../types")),l=function(e,t,n,l){var i;if(r.isIdentifier(e)){if(l.hasBinding(e.name))return e;i=e}else{if(!r.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(i=e.object,r.isIdentifier(i)&&l.hasGlobal(i.name))return i}var s=l.generateUidBasedOnNode(i);return t.push(r.variableDeclaration("var",[r.variableDeclarator(s,i)])),s},i=function(e,t,n,l){var i=e.property,s=r.toComputedKey(e,i);if(r.isLiteral(s))return s;var a=l.generateUidBasedOnNode(i);return t.push(r.variableDeclaration("var",[r.variableDeclarator(a,i)])),a};t.exports=function(e,t,n,s,a){var o;o=r.isIdentifier(e)&&a?e:l(e,t,n,s);var u,p;if(r.isIdentifier(e))u=e,p=o;else{var c=i(e,t,n,s),d=e.computed||r.isLiteral(c);p=u=r.memberExpression(o,c,d)}return{uid:p,ref:u}}},{"../../types":153}],56:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../../types"));t.exports=function(e){for(var t=0,n=0;n<e.params.length;n++)r.isAssignmentPattern(e.params[n])||(t=n+1);return t}},{"../../types":153}],57:[function(e,t,n){"use strict";function r(e,t,n){var r=f(e,t.name,n);return d(r,e,t,n)}function l(e,t,n){var r=p.toComputedKey(e,e.key);if(!p.isLiteral(r))return e;var l=p.toIdentifier(r.value),i=p.identifier(l),s=e.value,a=f(s,l,n);e.value=d(a,s,i,n)}function i(e,t,n){if(e.id)return e;var r;if(!p.isProperty(t)||"init"!==t.kind||t.computed&&!p.isLiteral(t.key)){if(!p.isVariableDeclarator(t))return e;r=t.id}else r=t.key;var l;if(p.isLiteral(r))l=r.value;else{if(!p.isIdentifier(r))return;l=r.name}l=p.toIdentifier(l),r=p.identifier(l);var i=f(e,l,n);return d(i,e,r,n)}var s=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e};n.custom=r,n.property=l,n.bare=i,n.__esModule=!0;var o=a(e("./get-function-arity")),u=s(e("../../util")),p=s(e("../../types")),c={enter:function(e,t,n,r){if(this.isReferencedIdentifier({name:r.name})){var l=n.getBindingIdentifier(r.name);l===r.outerDeclar&&(r.selfReference=!0,this.stop())}}},d=function(e,t,n,r){if(e.selfReference){var l="property-method-assignment-wrapper";t.generator&&(l+="-generator");for(var i=u.template(l,{FUNCTION:t,FUNCTION_ID:n,FUNCTION_KEY:r.generateUidIdentifier(n.name)}),s=i.callee.body.body[0].params,a=0,p=o(t);p>a;a++)s.push(r.generateUidIdentifier("x"));return i}return t.id=n,t},f=function(e,t,n){var r={selfAssignment:!1,selfReference:!1,outerDeclar:n.getBindingIdentifier(t),references:[],name:t},l=n.getOwnBindingInfo(t);return l?"param"===l.kind&&(r.selfReference=!0):n.traverse(e,c,r),r}},{"../../types":153,"../../util":157,"./get-function-arity":56}],58:[function(e,t,n){"use strict";function r(e){if(!e||!u.isCallExpression(e))return!1;if(!p(e.callee))return!1;var t=e.arguments;if(1!==t.length)return!1;var n=t[0];return u.isObjectExpression(n)?!0:!1}function l(e){return e&&/^[a-z]|\-/.test(e)}function i(e,t){var n,r=e.value.split(/\r\n|\n|\r/),l=0;for(n=0;n<r.length;n++)r[n].match(/[^ \t]/)&&(l=n);var i="";for(n=0;n<r.length;n++){var s=r[n],a=0===n,o=n===r.length-1,p=n===l,c=s.replace(/\t/g," ");a||(c=c.replace(/^[ ]+/,"")),o||(c=c.replace(/[ ]+$/,"")),c&&(p||(c+=" "),i+=c)}i&&t.push(u.literal(i))}function s(e){for(var t=[],n=0;n<e.children.length;n++){var r=e.children[n];u.isLiteral(r)&&"string"==typeof r.value?i(r,t):(u.isJSXExpressionContainer(r)&&(r=r.expression),u.isJSXEmptyExpression(r)||t.push(r))}return t}var a=function(e){return e&&e.__esModule?e:{"default":e}},o=function(e){return e&&e.__esModule?e["default"]:e};n.isCreateClass=r,n.isCompatTag=l,n.buildChildren=s,n.__esModule=!0;var u=(o(e("lodash/lang/isString")),a(e("../../types"))),p=u.buildMatchMemberExpression("React.createClass"),c=u.buildMatchMemberExpression("React.Component");n.isReactComponent=c},{"../../types":153,"lodash/lang/isString":399}],59:[function(e,t,n){"use strict";function r(e,t){return o.isLiteral(e)&&e.regex&&e.regex.flags.indexOf(t)>=0}function l(e,t){var n=e.regex.flags.split("");e.regex.flags.indexOf(t)<0||(a(n,t),e.regex.flags=n.join(""))}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};n.is=r,n.pullFlag=l,n.__esModule=!0;var a=s(e("lodash/array/pull")),o=i(e("../../types"))},{"../../types":153,"lodash/array/pull":313}],60:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../../types")),l={enter:function(e){r.isFunction(e)&&this.skip(),r.isAwaitExpression(e)&&(e.type="YieldExpression",e.all&&(e.all=!1,e.argument=r.callExpression(r.memberExpression(r.identifier("Promise"),r.identifier("all")),[e.argument])))}},i={enter:function(e,t,n,l){var i=l.id.name;if(r.isReferencedIdentifier(e,t,{name:i})&&n.bindingIdentifierEquals(i,l.id)){var s;return s=l,!s.ref&&(s.ref=n.generateUidIdentifier(i)),s.ref}}};t.exports=function(e,t,n){e.async=!1,e.generator=!0,n.traverse(e,l,u);var s=r.callExpression(t,[e]),a=e.id;if(e.id=null,r.isFunctionDeclaration(e)){var o=r.variableDeclaration("let",[r.variableDeclarator(a,s)]);return o._blockHoist=!0,o}if(a){var u={id:a};if(n.traverse(e,i,u),u.ref)return n.parent.push({id:u.ref}),r.assignmentExpression("=",u.ref,s)}return s}},{"../../types":153}],61:[function(e,t){"use strict";function n(e,t){return o.isSuper(e)?o.isMemberExpression(t,{computed:!1})?!1:o.isCallExpression(t,{callee:e})?!1:!0:!1}function r(e){return o.isMemberExpression(e)&&o.isSuper(e.object)}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=l(e("../../messages")),o=l(e("../../types")),u={enter:function(e,t,n,r){var l=r.topLevel,i=r.self;if(o.isFunction(e)&&!o.isArrowFunctionExpression(e))return i.traverseLevel(this,!1),this.skip();if(o.isProperty(e,{method:!0})||o.isMethodDefinition(e))return this.skip();var s=l?o.thisExpression:i.getThisReference.bind(i),a=i.specHandle;i.isLoose&&(a=i.looseHandle);var u=a.call(i,this,s);return u&&(this.hasSuper=!0),u!==!0?u:void 0}},p=function(){function e(t){var n=void 0===arguments[1]?!1:arguments[1];s(this,e),this.topLevelThisReference=t.topLevelThisReference,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=n,this.isLoose=t.isLoose,this.scope=t.scope,this.file=t.file,this.opts=t}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,n,r){return o.callExpression(this.file.addHelper("set"),[o.callExpression(o.memberExpression(o.identifier("Object"),o.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():o.memberExpression(this.getObjectRef(),o.identifier("prototype"))]),n?e:o.literal(e.name),t,r])},e.prototype.getSuperProperty=function(e,t,n){return o.callExpression(this.file.addHelper("get"),[o.callExpression(o.memberExpression(o.identifier("Object"),o.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():o.memberExpression(this.getObjectRef(),o.identifier("prototype"))]),t?e:o.literal(e.name),n])},e.prototype.replace=function(){this.traverseLevel(this.methodPath.get("value"),!0)},e.prototype.traverseLevel=function(e,t){var n={self:this,topLevel:t};e.traverse(u,n)},e.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(o.variableDeclaration("var",[o.variableDeclarator(this.topLevelThisReference,o.thisExpression())])),e},e.prototype.getLooseSuperProperty=function(e,t){var n=this.methodNode,r=n.key,l=this.superRef||o.identifier("Function");return t.property===e?void 0:o.isCallExpression(t,{callee:e})?(t.arguments.unshift(o.thisExpression()),"constructor"===r.name?o.memberExpression(l,o.identifier("call")):(e=l,n["static"]||(e=o.memberExpression(e,o.identifier("prototype"))),e=o.memberExpression(e,r,n.computed),o.memberExpression(e,o.identifier("call")))):o.isMemberExpression(t)&&!n["static"]?o.memberExpression(l,o.identifier("prototype")):l},e.prototype.looseHandle=function(e,t){var n=e.node;if(e.isSuper())return this.getLooseSuperProperty(n,e.parent);if(e.isCallExpression()){var r=n.callee;if(!o.isMemberExpression(r))return;if(!o.isSuper(r.object))return;return o.appendToMemberExpression(r,o.identifier("call")),n.arguments.unshift(t()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,n,r){return"="===n.operator?this.setSuperProperty(n.left.property,n.right,n.left.computed,r()):(e||(e=t.scope.generateUidIdentifier("ref")),[o.variableDeclaration("var",[o.variableDeclarator(e,n.left)]),o.expressionStatement(o.assignmentExpression("=",n.left,o.binaryExpression(n.operator[0],e,n.right)))])},e.prototype.specHandle=function(e,t){var l,s,u,p,c=this.methodNode,d=e.parent,f=e.node;if(n(f,d))throw e.errorWithNode(a.get("classesIllegalBareSuper"));if(o.isCallExpression(f)){var h=f.callee;if(o.isSuper(h)){if(l=c.key,s=c.computed,u=f.arguments,"constructor"!==c.key.name||!this.inClass){var m=c.key.name||"METHOD_NAME";throw this.file.errorWithNode(f,a.get("classesIllegalSuperCall",m))}}else r(h)&&(l=h.property,s=h.computed,u=f.arguments)}else if(o.isMemberExpression(f)&&o.isSuper(f.object))l=f.property,s=f.computed;else{if(o.isUpdateExpression(f)&&r(f.argument)){var g=o.binaryExpression(f.operator[0],f.argument,o.literal(1));if(f.prefix)return this.specHandleAssignmentExpression(null,e,g,t); var y=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(y,e,g,t).concat(o.expressionStatement(y))}if(o.isAssignmentExpression(f)&&r(f.left))return this.specHandleAssignmentExpression(null,e,f,t)}if(l){p=t();var b=this.getSuperProperty(l,s,p);return u?1===u.length&&o.isSpreadElement(u[0])?o.callExpression(o.memberExpression(b,o.identifier("apply")),[p,u[0].argument]):o.callExpression(o.memberExpression(b,o.identifier("call")),[p].concat(i(u))):b}},e}();t.exports=p},{"../../messages":43,"../../types":153}],62:[function(e,t,n){"use strict";function r(e){var t=e.body[0];return s.isExpressionStatement(t)&&s.isLiteral(t.expression,{value:"use strict"})}function l(e,t){var n;r(e)&&(n=e.body.shift()),t(),n&&e.body.unshift(n)}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.has=r,n.wrap=l,n.__esModule=!0;var s=i(e("../../types"))},{"../../types":153}],63:[function(e,t){"use strict";function n(e,t){var n=new a(t);return n.parse(e)}var r=function(e){return e&&e.__esModule?e["default"]:e};t.exports=n;var l=r(e("../helpers/normalize-ast")),i=r(e("./transformer")),s=r(e("../helpers/object")),a=r(e("./file")),o=r(e("lodash/collection/each"));n.fromAst=function(e,t,n){e=l(e);var r=new a(n);return r.addCode(t),r.transform(e),r.generate()},n._ensureTransformerNames=function(e,t){for(var r=[],l=0;l<t.length;l++){var i=t[l],s=n.deprecatedTransformerMap[i],a=n.aliasTransformerMap[i];if(a)r.push(a);else if(s)console.error("The transformer "+i+" has been renamed to "+s),t.push(s);else if(n.transformers[i])r.push(i);else{if(!n.namespaces[i])throw new ReferenceError("Unknown transformer "+i+" specified in "+e);r=r.concat(n.namespaces[i])}}return r},n.transformerNamespaces=s(),n.transformers=s(),n.namespaces=s(),n.deprecatedTransformerMap=e("./transformers/deprecated"),n.aliasTransformerMap=e("./transformers/aliases"),n.moduleFormatters=e("./modules");var u=r(e("./transformers"));o(u,function(e,t){var r=t.split(".")[0],l=n.namespaces,s=r;l[s]||(l[s]=[]),n.namespaces[r].push(t),n.transformerNamespaces[t]=r,n.transformers[t]=new i(t,e)})},{"../helpers/normalize-ast":40,"../helpers/object":41,"./file":46,"./modules":71,"./transformer":76,"./transformers":110,"./transformers/aliases":77,"./transformers/deprecated":78,"lodash/collection/each":316}],64:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=function(e){return e&&e.__esModule?e:{"default":e}},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("../../messages")),s=n(e("../../traversal")),a=n(e("lodash/object/extend")),o=n(e("../../helpers/object")),u=r(e("../../util")),p=r(e("../../types")),c={enter:function(e,t,n,r){var l=r.internalRemap[e.name];if(this.isReferencedIdentifier()&&l&&(!n.hasBinding(e.name)||n.bindingIdentifierEquals(e.name,r.localImports[e.name])))return l;if(p.isUpdateExpression(e)){var i=r.getExport(e.argument,n);if(i){this.skip();var s=p.assignmentExpression(e.operator[0]+"=",e.argument,p.literal(1)),a=r.remapExportAssignment(s,i);if(p.isExpressionStatement(t)||e.prefix)return a;var o=[];o.push(a);var u;return u="--"===e.operator?"+":"-",o.push(p.binaryExpression(u,e.argument,p.literal(1))),p.sequenceExpression(o)}}if(p.isAssignmentExpression(e)){var i=r.getExport(e.left,n);if(i)return this.skip(),r.remapExportAssignment(e,i)}}},d={ImportDeclaration:{enter:function(e,t,n,r){r.hasLocalImports=!0,a(r.localImports,this.getBindingIdentifiers()),r.bumpImportOccurences(e)}}},f=s.explode({ExportDeclaration:{enter:function(e,t,n,r){r.hasLocalImports=!0;var l=this.get("declaration");if(l.isStatement()){var i=l.getBindingIdentifiers();for(var s in i){var a=i[s];r._addExport(s,a)}}if(this.isExportNamedDeclaration()&&e.specifiers)for(var o=0;o<e.specifiers.length;o++){var u=e.specifiers[o],c=u.local;c&&r._addExport(c.name,u.exported)}if(!p.isExportDefaultDeclaration(e)){var d=e.specifiers&&1===e.specifiers.length&&p.isSpecifierDefault(e.specifiers[0]);d||(r.hasNonDefaultExports=!0)}e.source&&r.bumpImportOccurences(e)}}}),h=function(){function e(t){l(this,e),this.internalRemap={},this.defaultIds=o(),this.scope=t.scope,this.file=t,this.ids=o(),this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localImportOccurences=o(),this.localExports=o(),this.localImports=o(),this.getLocalExports(),this.getLocalImports()}return e.prototype.transform=function(){this.remapAssignments()},e.prototype.doDefaultExportInterop=function(e){return(p.isExportDefaultDeclaration(e)||p.isSpecifierDefault(e))&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},e.prototype.bumpImportOccurences=function(e){var t=e.source.value,n=this.localImportOccurences,r=n,l=t;r[l]||(r[l]=0),e.specifiers&&(n[t]+=e.specifiers.length)},e.prototype.getLocalExports=function(){this.file.path.traverse(f,this)},e.prototype.getLocalImports=function(){this.file.path.traverse(d,this)},e.prototype.remapAssignments=function(){this.hasLocalImports&&this.file.path.traverse(c,this)},e.prototype.remapExportAssignment=function(e,t){for(var n=e,r=0;r<t.length;r++)n=p.assignmentExpression("=",p.memberExpression(p.identifier("exports"),t[r]),n);return n},e.prototype._addExport=function(e,t){var n,r,l=(n=this.localExports,r=e,!n[r]&&(n[r]={binding:this.scope.getBindingIdentifier(e),exported:[]}),n[r]);l.exported.push(t)},e.prototype.getExport=function(e,t){if(p.isIdentifier(e)){var n=this.localExports[e.name];return n&&n.binding===t.getBindingIdentifier(e.name)?n.exported:void 0}},e.prototype.getModuleName=function(){var e=this.file.opts;if(e.moduleId)return e.moduleId;var t=e.filenameRelative,n="";if(e.moduleRoot&&(n=e.moduleRoot+"/"),!e.filenameRelative)return n+e.filename.replace(/^\//,"");if(e.sourceRoot){var r=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(r,"")}return e.keepModuleIdExtensions||(t=t.replace(/\.(\w*?)$/,"")),n+=t,n=n.replace(/\\/g,"/")},e.prototype._pushStatement=function(e,t){return(p.isClass(e)||p.isFunction(e))&&e.id&&(t.push(p.toStatement(e)),e=e.id),e},e.prototype._hoistExport=function(e,t,n){return p.isFunctionDeclaration(e)&&(t._blockHoist=n||2),t},e.prototype.getExternalReference=function(e,t){var n=this.ids,r=e.source.value;return n[r]?n[r]:this.ids[r]=this._getExternalReference(e,t)},e.prototype.checkExportIdentifier=function(e){if(p.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,i.get("modulesIllegalExportName",e.name))},e.prototype.exportAllDeclaration=function(e,t){var n=this.getExternalReference(e,t);t.push(this.buildExportsWildcard(n,e))},e.prototype.isLoose=function(){return this.file.isLoose("es6.modules")},e.prototype.exportSpecifier=function(e,t,n){if(t.source){var r=this.getExternalReference(t,n);if("default"!==e.local.name||this.noInteropRequireExport){if(r=p.memberExpression(r,e.local),!this.isLoose())return void n.push(this.buildExportsFromAssignment(e.exported,r,t))}else r=p.callExpression(this.file.addHelper("interop-require"),[r]);n.push(this.buildExportsAssignment(e.exported,r,t))}else n.push(this.buildExportsAssignment(e.exported,e.local,t))},e.prototype.buildExportsWildcard=function(e){return p.expressionStatement(p.callExpression(this.file.addHelper("defaults"),[p.identifier("exports"),p.callExpression(this.file.addHelper("interop-require-wildcard"),[e])]))},e.prototype.buildExportsFromAssignment=function(e,t){return this.checkExportIdentifier(e),u.template("exports-from-assign",{INIT:t,ID:p.literal(e.name)},!0)},e.prototype.buildExportsAssignment=function(e,t){return this.checkExportIdentifier(e),u.template("exports-assign",{VALUE:t,KEY:e},!0)},e.prototype.exportDeclaration=function(e,t){var n=e.declaration,r=n.id;p.isExportDefaultDeclaration(e)&&(r=p.identifier("default"));var l;if(p.isVariableDeclaration(n))for(var i=0;i<n.declarations.length;i++){var s=n.declarations[i];s.init=this.buildExportsAssignment(s.id,s.init,e).expression;var a=p.variableDeclaration(n.kind,[s]);0===i&&p.inherits(a,n),t.push(a)}else{var o=n;(p.isFunctionDeclaration(n)||p.isClassDeclaration(n))&&(o=n.id,t.push(n)),l=this.buildExportsAssignment(r,o,e),t.push(l),this._hoistExport(n,l)}},e}();t.exports=h},{"../../helpers/object":41,"../../messages":43,"../../traversal":144,"../../types":153,"../../util":157,"lodash/object/extend":404}],65:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=n(e("../../util"));t.exports=function(e){var t=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return r.inherits(t,e),t}},{"../../util":157}],66:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=n(e("./amd")),l=n(e("./_strict"));t.exports=l(r)},{"./_strict":65,"./amd":67}],67:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=r(e("./_default")),a=r(e("./common")),o=r(e("lodash/collection/includes")),u=r(e("lodash/object/values")),p=(n(e("../../util")),n(e("../../types"))),c=function(e){function t(){this.init=a.prototype.init,i(this,t),null!=e&&e.apply(this,arguments)}return l(t,e),t.prototype.buildDependencyLiterals=function(){var e=[];for(var t in this.ids)e.push(p.literal(t));return e},t.prototype.transform=function(e){s.prototype.transform.apply(this,arguments);var t=e.body,n=[p.literal("exports")];this.passModuleArg&&n.push(p.literal("module")),n=n.concat(this.buildDependencyLiterals()),n=p.arrayExpression(n);var r=u(this.ids);this.passModuleArg&&r.unshift(p.identifier("module")),r.unshift(p.identifier("exports"));var l=p.functionExpression(null,r,p.blockStatement(t)),i=[n,l],a=this.getModuleName();a&&i.unshift(p.literal(a));var o=p.callExpression(p.identifier("define"),i);e.body=[p.expressionStatement(o)]},t.prototype.getModuleName=function(){return this.file.opts.moduleIds?s.prototype.getModuleName.apply(this,arguments):null},t.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},t.prototype.importDeclaration=function(e){this.getExternalReference(e)},t.prototype.importSpecifier=function(e,t,n){var r=t.source.value,l=this.getExternalReference(t);if((p.isImportNamespaceSpecifier(e)||p.isImportDefaultSpecifier(e))&&(this.defaultIds[r]=e.local),o(this.file.dynamicImportedNoDefault,t))this.ids[t.source.value]=l;else if(p.isImportNamespaceSpecifier(e));else if(o(this.file.dynamicImported,t)||!p.isSpecifierDefault(e)||this.noInteropRequireImport){var i=e.imported;p.isSpecifierDefault(e)&&(i=p.identifier("default")),l=p.memberExpression(l,i)}else{var s=this.scope.generateUidIdentifier(e.local.name);n.push(p.variableDeclaration("var",[p.variableDeclarator(s,p.callExpression(this.file.addHelper("interop-require"),[l]))])),l=s}this.internalRemap[e.local.name]=l},t.prototype.exportSpecifier=function(){a.prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.passModuleArg=!0),a.prototype.exportDeclaration.apply(this,arguments)},t}(s);t.exports=c},{"../../types":153,"../../util":157,"./_default":64,"./common":69,"lodash/collection/includes":319,"lodash/object/values":409}],68:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=n(e("./common")),l=n(e("./_strict"));t.exports=l(r)},{"./_strict":65,"./common":69}],69:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=r(e("./_default")),a=r(e("lodash/collection/includes")),o=n(e("../../util")),u=n(e("../../types")),p=function(e){function t(){i(this,t),null!=e&&e.apply(this,arguments)}return l(t,e),t.prototype.init=function(){var e=this.file,t=e.scope;if(t.rename("module"),t.rename("exports"),!this.noInteropRequireImport&&this.hasNonDefaultExports){var n="exports-module-declaration";this.file.isLoose("es6.modules")&&(n+="-loose");var r=o.template(n,!0);r._blockHoist=3,e.ast.program.body.unshift(r)}},t.prototype.importSpecifier=function(e,t,n){var r=e.local,l=this.getExternalReference(t,n);u.isSpecifierDefault(e)?a(this.file.dynamicImportedNoDefault,t)?this.internalRemap[r.name]=l:this.noInteropRequireImport?this.internalRemap[r.name]=u.memberExpression(l,u.identifier("default")):a(this.file.dynamicImported,t)||n.push(u.variableDeclaration("var",[u.variableDeclarator(r,u.callExpression(this.file.addHelper("interop-require"),[l]))])):u.isImportNamespaceSpecifier(e)?(this.noInteropRequireImport||(l=u.callExpression(this.file.addHelper("interop-require-wildcard"),[l])),n.push(u.variableDeclaration("var",[u.variableDeclarator(r,l)]))):this.internalRemap[r.name]=u.memberExpression(l,e.imported)},t.prototype.importDeclaration=function(e,t){t.push(o.template("require",{MODULE_NAME:e.source},!0))},t.prototype.exportSpecifier=function(e,t,n){return this.doDefaultExportInterop(e)?void n.push(o.template("exports-default-assign",{VALUE:e.local},!0)):void s.prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e,t){if(this.doDefaultExportInterop(e)){var n=e.declaration,r=o.template("exports-default-assign",{VALUE:this._pushStatement(n,t)},!0);return u.isFunctionDeclaration(n)&&(r._blockHoist=3),void t.push(r)}s.prototype.exportDeclaration.apply(this,arguments)},t.prototype._getExternalReference=function(e,t){var n,r=(e.source.value,u.callExpression(u.identifier("require"),[e.source]));a(this.file.dynamicImported,e)&&!a(this.file.dynamicImportedNoDefault,e)?(r=u.memberExpression(r,u.identifier("default")),n=e.specifiers[0].local):n=this.scope.generateUidBasedOnNode(e,"import");var l=u.variableDeclaration("var",[u.variableDeclarator(n,r)]);return t.push(l),n},t}(s);t.exports=p},{"../../types":153,"../../util":157,"./_default":64,"lodash/collection/includes":319}],70:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("../../types")),i=function(){function e(){r(this,e)}return e.prototype.exportDeclaration=function(e,t){var n=l.toStatement(e.declaration,!0);n&&t.push(l.inherits(n,e))},e.prototype.exportAllDeclaration=function(){},e.prototype.importDeclaration=function(){},e.prototype.importSpecifier=function(){},e.prototype.exportSpecifier=function(){},e}();t.exports=i},{"../../types":153}],71:[function(e,t){"use strict";t.exports={commonStrict:e("./common-strict"),amdStrict:e("./amd-strict"),umdStrict:e("./umd-strict"),common:e("./common"),system:e("./system"),ignore:e("./ignore"),amd:e("./amd"),umd:e("./umd")}},{"./amd":67,"./amd-strict":66,"./common":69,"./common-strict":68,"./ignore":70,"./system":72,"./umd":74,"./umd-strict":73}],72:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=r(e("./_default")),a=r(e("./amd")),o=n(e("../../util")),u=r(e("lodash/array/last")),p=r(e("lodash/collection/each")),c=r(e("lodash/collection/map")),d=n(e("../../types")),f=function(e,t){return e._blockHoist&&!t.transformers.runtime.canTransform()},h={enter:function(e,t,n,r){if(d.isFunction(e))return this.skip();if(d.isVariableDeclaration(e)){if("var"!==e.kind&&!d.isProgram(t))return;if(f(e,n.file))return;for(var l=[],i=0;i<e.declarations.length;i++){var s=e.declarations[i];if(r.push(d.variableDeclarator(s.id)),s.init){var a=d.expressionStatement(d.assignmentExpression("=",s.id,s.init));l.push(a)}}if(d.isFor(t)){if(t.left===e)return e.declarations[0].id;if(t.init===e)return l}return l}}},m={enter:function(e,t,n,r){d.isFunction(e)&&this.skip(),(d.isFunctionDeclaration(e)||f(e,n.file))&&(r.push(e),this.remove())}},g={enter:function(e,t,n,r){e._importSource===r.source&&(d.isVariableDeclaration(e)?p(e.declarations,function(e){r.hoistDeclarators.push(d.variableDeclarator(e.id)),r.nodes.push(d.expressionStatement(d.assignmentExpression("=",e.id,e.init)))}):r.nodes.push(e),this.remove())}},y=function(e){function t(e){i(this,t),this.exportIdentifier=e.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,s.apply(this,arguments)}return l(t,e),t.prototype._addImportSource=function(e,t){return e&&(e._importSource=t.source&&t.source.value),e},t.prototype.buildExportsWildcard=function(e,t){var n=this.scope.generateUidIdentifier("key"),r=d.memberExpression(e,n,!0),l=d.variableDeclaration("var",[d.variableDeclarator(n)]),i=e,s=d.blockStatement([d.expressionStatement(this.buildExportCall(n,r))]);return this._addImportSource(d.forInStatement(l,i,s),t)},t.prototype.buildExportsAssignment=function(e,t,n){var r=this.buildExportCall(d.literal(e.name),t,!0);return this._addImportSource(r,n)},t.prototype.buildExportsFromAssignment=function(){return this.buildExportsAssignment.apply(this,arguments)},t.prototype.remapExportAssignment=function(e,t){for(var n=e,r=0;r<t.length;r++)n=this.buildExportCall(d.literal(t[r].name),n);return n},t.prototype.buildExportCall=function(e,t,n){var r=d.callExpression(this.exportIdentifier,[e,t]);return n?d.expressionStatement(r):r},t.prototype.importSpecifier=function(e,t,n){a.prototype.importSpecifier.apply(this,arguments);for(var r in this.internalRemap)n.push(d.variableDeclaration("var",[d.variableDeclarator(d.identifier(r),this.internalRemap[r])]));this.internalRemap={},this._addImportSource(u(n),t)},t.prototype.buildRunnerSetters=function(e,t){var n=this.file.scope;return d.arrayExpression(c(this.ids,function(r,l){var i={hoistDeclarators:t,source:l,nodes:[]};return n.traverse(e,g,i),d.functionExpression(null,[r],d.blockStatement(i.nodes))}))},t.prototype.transform=function(e){s.prototype.transform.apply(this,arguments);var t=[],n=this.getModuleName(),r=d.literal(n),l=d.blockStatement(e.body),i=o.template("system",{MODULE_DEPENDENCIES:d.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,MODULE_NAME:r,SETTERS:this.buildRunnerSetters(l,t),EXECUTE:d.functionExpression(null,[],l)},!0),a=i.expression.arguments[2].body.body;n||i.expression.arguments.shift();var u=a.pop();if(this.file.scope.traverse(l,h,t),t.length){var p=d.variableDeclaration("var",t);p._blockHoist=!0,a.unshift(p)}this.file.scope.traverse(l,m,a),a.push(u),e.body=[i]},t}(a);t.exports=y},{"../../types":153,"../../util":157,"./_default":64,"./amd":67,"lodash/array/last":312,"lodash/collection/each":316,"lodash/collection/map":320}],73:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=n(e("./umd")),l=n(e("./_strict"));t.exports=l(r)},{"./_strict":65,"./umd":74}],74:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=r(e("./_default")),a=r(e("./amd")),o=r(e("lodash/object/values")),u=n(e("../../util")),p=n(e("../../types")),c=function(e){function t(){i(this,t),null!=e&&e.apply(this,arguments)}return l(t,e),t.prototype.transform=function(e){s.prototype.transform.apply(this,arguments);var t=e.body,n=[];for(var r in this.ids)n.push(p.literal(r));var l=o(this.ids),i=[p.identifier("exports")];this.passModuleArg&&i.push(p.identifier("module")),i=i.concat(l);var a=p.functionExpression(null,i,p.blockStatement(t)),c=[p.literal("exports")];this.passModuleArg&&c.push(p.literal("module")),c=c.concat(n),c=[p.arrayExpression(c)];var d=u.template("test-exports"),f=u.template("test-module"),h=this.passModuleArg?p.logicalExpression("&&",d,f):d,m=[p.identifier("exports")];this.passModuleArg&&m.push(p.identifier("module")),m=m.concat(n.map(function(e){return p.callExpression(p.identifier("require"),[e])}));var g=[p.memberExpression(p.identifier("module"),p.identifier("exports"))];this.passModuleArg&&g.push(p.identifier("module"));for(var y in this.ids){var b=this.defaultIds[y]||p.identifier(p.toIdentifier(y));g.push(p.memberExpression(p.identifier("global"),b))}var v=this.getModuleName();v&&c.unshift(p.literal(v));var x=u.template("umd-runner-body",{AMD_ARGUMENTS:c,COMMON_TEST:h,COMMON_ARGUMENTS:m,BROWSER_ARGUMENTS:g,GLOBAL_ARG:p.identifier(p.toIdentifier(this.file.opts.basename))});e.body=[p.expressionStatement(p.callExpression(x,[p.thisExpression(),a]))]},t}(a);t.exports=c},{"../../types":153,"../../util":157,"./_default":64,"./amd":67,"lodash/object/values":409}],75:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e["default"]:e},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("lodash/collection/includes")),i=n(e("../traversal")),s=function(){function e(t,n){r(this,e),this.transformer=n,this.shouldRun=!n.check,this.handlers=n.handlers,this.file=t,this.ran=!1}return e.prototype.canTransform=function(){var e=this.transformer,t=this.file.opts,n=e.key;if("_"===n[0])return!0;var r=t.blacklist;if(r.length&&l(r,n))return!1;var i=t.whitelist;if(i)return l(i,n);var s=e.metadata.stage;return null!=s&&s>=t.stage?!0:e.metadata.optional&&!l(t.optional,n)?!1:!0},e.prototype.checkNode=function(e){var t=this.transformer.check;return t?this.shouldRun=t(e):!0},e.prototype.transform=function(){if(this.shouldRun){var e=this.file;e.log.debug("Running transformer "+this.transformer.key),i(e.ast,this.handlers,e.scope,e),this.ran=!0}},e}();t.exports=s},{"../traversal":144,"lodash/collection/includes":319}],76:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("./transformer-pass")),s=r(e("lodash/lang/isFunction")),a=r(e("../traversal")),o=r(e("lodash/lang/isObject")),u=r(e("lodash/object/assign")),p=(n(e("../../acorn")),r(e("./file"))),c=r(e("lodash/collection/each")),d=function(){function e(t,n){l(this,e),n=u({},n);var r=function(e){var t=n[e];return delete n[e],t};this.manipulateOptions=r("manipulateOptions"),this.metadata=r("metadata")||{},this.parser=r("parser"),this.check=r("check"),this.post=r("post"),this.pre=r("pre"),null!=this.metadata.stage&&(this.metadata.optional=!0),this.handlers=this.normalize(n);var i=this;i.opts||(i.opts={}),this.key=t}return e.prototype.normalize=function(e){var t=this;return s(e)&&(e={ast:e}),a.explode(e),c(e,function(n,r){return"_"===r[0]?void(t[r]=n):void("enter"!==r&&"exit"!==r&&(s(n)&&(n={enter:n}),o(n)&&(n.enter||(n.enter=function(){}),n.exit||(n.exit=function(){}),e[r]=n)))}),e},e.prototype.buildPass=function(e){if(!(e instanceof p))throw new TypeError("Transformer "+this.key+" is resolving to a different Babel version to what is doing the actual transformation...");return new i(e,this)},e}();t.exports=d},{"../../acorn":5,"../traversal":144,"./file":46,"./transformer-pass":75,"lodash/collection/each":316,"lodash/lang/isFunction":393,"lodash/lang/isObject":396,"lodash/object/assign":402}],77:[function(e,t){t.exports={useStrict:"strict","es5.runtime":"runtime","es6.runtime":"runtime"}},{}],78:[function(e,t){t.exports={selfContained:"runtime","unicode-regex":"regex.unicode","spec.typeofSymbol":"es6.spec.symbols","es6.symbols":"es6.spec.symbols","es6.blockScopingTDZ":"es6.spec.blockScoping","minification.deadCodeElimination":"utility.deadCodeElimination","minification.removeConsoleCalls":"utility.removeConsole","minification.removeDebugger":"utility.removeDebugger"}},{}],79:[function(e,t,n){"use strict";function r(e){var t=e.property;e.computed&&i.isLiteral(t)&&i.isValidIdentifier(t.value)?(e.property=i.identifier(t.value),e.computed=!1):e.computed||!i.isIdentifier(t)||i.isValidIdentifier(t.name)||(e.property=i.literal(t.name),e.computed=!0)}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.MemberExpression=r,n.__esModule=!0;var i=l(e("../../../types"))},{"../../../types":153}],80:[function(e,t,n){"use strict";function r(e){var t=e.key;i.isLiteral(t)&&i.isValidIdentifier(t.value)?(e.key=i.identifier(t.value),e.computed=!1):e.computed||!i.isIdentifier(t)||i.isValidIdentifier(t.name)||(e.key=i.literal(t.name))}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.Property=r,n.__esModule=!0;var i=l(e("../../../types"))},{"../../../types":153}],81:[function(e,t,n){"use strict";function r(e){return a.isProperty(e)&&("get"===e.kind||"set"===e.kind)}function l(e){var t={},n=!1;return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(n=!0,s.push(t,e.key,e.kind,e.computed,e.value),!1):!0}),n?a.callExpression(a.memberExpression(a.identifier("Object"),a.identifier("defineProperties")),[e,s.toDefineObject(t)]):void 0}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.ObjectExpression=l,n.__esModule=!0;var s=i(e("../../helpers/define-map")),a=i(e("../../../types"))},{"../../../types":153,"../../helpers/define-map":54}],82:[function(e,t,n){"use strict";function r(e){return i.ensureBlock(e),e.expression=!1,e.type="FunctionExpression",e.shadow=!0,e}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.ArrowFunctionExpression=r,n.__esModule=!0;var i=l(e("../../../types")),s=i.isArrowFunctionExpression;n.check=s},{"../../../types":153}],83:[function(e,t,n){"use strict";function r(e,t){if(!v.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(l(e,t))for(var n=0;n<e.declarations.length;n++){var r=e.declarations[n],i=r;i.init||(i.init=v.identifier("undefined"))}return e._let=!0,e.kind="var",!0}function l(e,t){return!v.isFor(t)||!v.isFor(t,{left:e})}function i(e,t){return v.isVariableDeclaration(e,{kind:"var"})&&!r(e,t)}function s(e){for(var t=0;t<e.length;t++)delete e[t]._let}function a(e){return v.isVariableDeclaration(e)&&("let"===e.kind||"const"===e.kind)}function o(e,t,n,i){if(r(e,t)&&l(e)&&i.transformers["es6.spec.blockScoping"].canTransform()){for(var s=[e],a=0;a<e.declarations.length;a++){var o=e.declarations[a];if(o.init){var u=v.assignmentExpression("=",o.id,o.init);u._ignoreBlockScopingTDZ=!0,s.push(v.expressionStatement(u))}o.init=i.addHelper("temporal-undefined")}return e._blockHoist=2,s}}function u(e,t,n,l){var i=e.left||e.init;r(i,e)&&(v.ensureBlock(e),e.body._letDeclarators=[i]);var s=new j(this,this.get("body"),t,n,l);return s.run()}function p(e,t,n,r){if(!v.isLoop(t)){var l=new j(null,this,t,n,r);l.run()}}function c(e,t,n,r){if(v.isReferencedIdentifier(e,t)){var l=r[e.name];if(l){var i=n.getBindingIdentifier(e.name);i===l.binding?e.name=l.uid:this&&this.skip()}}}function d(e,t,n,r){c(e,t,n,r),n.traverse(e,_,r)}var f=function(e){return e&&e.__esModule?e:{"default":e}},h=function(e){return e&&e.__esModule?e["default"]:e},m=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.check=a,n.VariableDeclaration=o,n.Loop=u,n.BlockStatement=p,n.__esModule=!0;var g=h(e("../../../traversal")),y=h(e("../../../helpers/object")),b=f(e("../../../util")),v=f(e("../../../types")),x=h(e("lodash/object/values")),E=h(e("lodash/object/extend"));n.Program=p;var _={enter:c},S={enter:function(e,t,n,r){return this.isFunction()?(this.traverse(I,r),this.skip()):void 0}},I={enter:function(e,t,n,r){if(this.isReferencedIdentifier()){var l=r.letReferences[e.name];l&&n.getBindingIdentifier(e.name)===l&&(r.closurify=!0)}}},w={enter:function(e,t,n,r){if(this.isForStatement())i(e.init,e)&&(e.init=v.sequenceExpression(r.pushDeclar(e.init)));else if(this.isFor())i(e.left,e)&&(e.left=e.left.declarations[0].id);else{if(i(e,t))return r.pushDeclar(e).map(v.expressionStatement);if(this.isFunction())return this.skip()}}},k={enter:function(e,t,n,r){this.isLabeledStatement()&&r.innerLabels.push(e.label.name)}},A={enter:function(e,t,n,r){if(this.isAssignmentExpression()||this.isUpdateExpression()){var l=this.getBindingIdentifiers();for(var i in l)r.outsideReferences[i]===n.getBindingIdentifier(i)&&(r.reassignments[i]=!0)}}},C=function(e){return v.isBreakStatement(e)?"break":v.isContinueStatement(e)?"continue":void 0},T={enter:function(e,t,n,r){var l;if(this.isLoop()&&(r.ignoreLabeless=!0,this.traverse(T,r),r.ignoreLabeless=!1),this.isFunction()||this.isLoop())return this.skip();var i=C(e);if(i){if(e.label){if(r.innerLabels.indexOf(e.label.name)>=0)return;i=""+i+"|"+e.label.name}else{if(r.ignoreLabeless)return;if(v.isBreakStatement(e)&&v.isSwitchCase(t))return}r.hasBreakContinue=!0,r.map[i]=e,l=v.literal(i)}return this.isReturnStatement()&&(r.hasReturn=!0,l=v.objectExpression([v.property("init",v.identifier("v"),e.argument||v.identifier("undefined"))])),l?(l=v.returnStatement(l),v.inherits(l,e)):void 0}},j=function(){function e(t,n,r,l,i){m(this,e),this.parent=r,this.scope=l,this.file=i,this.blockPath=n,this.block=n.node,this.outsideLetReferences=y(),this.hasLetReferences=!1,this.letReferences=this.block._letReferences=y(),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=v.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(!v.isFunction(this.parent)&&!v.isProgram(this.block)&&this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.loopLabel&&!v.isLabeledStatement(this.loopParent)?v.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.remap=function(){var e=!1,t=this.letReferences,n=this.scope,r=y();for(var l in t){var i=t[l];if(n.parentHasBinding(l)||n.hasGlobal(l)){var s=n.generateUidIdentifier(i.name).name;i.name=s,e=!0,r[l]=r[s]={binding:i,uid:s}}}if(e){var a=this.loop;a&&(d(a.right,a,n,r),d(a.test,a,n,r),d(a.update,a,n,r)),this.blockPath.traverse(_,r)}},e.prototype.wrapClosure=function(){var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var n in t){var r=t[n];(this.scope.hasGlobal(r.name)||this.scope.parentHasBinding(r.name))&&(delete t[r.name],delete this.letReferences[r.name],this.scope.rename(r.name),this.letReferences[r.name]=r,t[r.name]=r)}this.has=this.checkLoop(),this.hoistVarDeclarations();var l=x(t),i=x(t),s=v.functionExpression(null,l,v.blockStatement(e.body));s.shadow=!0,this.addContinuations(s),e.body=this.body;var a=s;this.loop&&(a=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(v.variableDeclaration("var",[v.variableDeclarator(a,s)])));var o=v.callExpression(a,i),u=this.scope.generateUidIdentifier("ret"),p=g.hasType(s.body,this.scope,"YieldExpression",v.FUNCTION_TYPES);p&&(s.generator=!0,o=v.yieldExpression(o,!0));var c=g.hasType(s.body,this.scope,"AwaitExpression",v.FUNCTION_TYPES);c&&(s.async=!0,o=v.awaitExpression(o)),this.buildClosure(u,o)},e.prototype.buildClosure=function(e,t){var n=this.has;n.hasReturn||n.hasBreakContinue?this.buildHas(e,t):this.body.push(v.expressionStatement(t)) },e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,A,t);for(var n=0;n<e.params.length;n++){var r=e.params[n];if(t.reassignments[r.name]){var l=this.scope.generateUidIdentifier(r.name);e.params[n]=l,this.scope.rename(r.name,l.name,e),e.body.body.push(v.expressionStatement(v.assignmentExpression("=",r,l)))}}},e.prototype.getLetReferences=function(){for(var e,t=this.block,n=t._letDeclarators||[],l=0;l<n.length;l++)e=n[l],E(this.outsideLetReferences,v.getBindingIdentifiers(e));if(t.body)for(l=0;l<t.body.length;l++)e=t.body[l],r(e,t)&&(n=n.concat(e.declarations));for(l=0;l<n.length;l++){e=n[l];var i=v.getBindingIdentifiers(e);E(this.letReferences,i),this.hasLetReferences=!0}if(this.hasLetReferences){s(n);var a={letReferences:this.letReferences,closurify:!1};return this.blockPath.traverse(S,a),a.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loop,map:{}};return this.blockPath.traverse(k,e),this.blockPath.traverse(T,e),e},e.prototype.hoistVarDeclarations=function(){this.blockPath.traverse(w,this)},e.prototype.pushDeclar=function(e){this.body.push(v.variableDeclaration(e.kind,e.declarations.map(function(e){return v.variableDeclarator(e.id)})));for(var t=[],n=0;n<e.declarations.length;n++){var r=e.declarations[n];if(r.init){var l=v.assignmentExpression("=",r.id,r.init);t.push(v.inherits(l,r))}}return t},e.prototype.buildHas=function(e,t){var n=this.body;n.push(v.variableDeclaration("var",[v.variableDeclarator(e,t)]));var r,l=(this.loop,this.has),i=[];if(l.hasReturn&&(r=b.template("let-scoping-return",{RETURN:e})),l.hasBreakContinue){for(var s in l.map)i.push(v.switchCase(v.literal(s),[l.map[s]]));if(l.hasReturn&&i.push(v.switchCase(null,[r])),1===i.length){var a=i[0];n.push(this.file.attachAuxiliaryComment(v.ifStatement(v.binaryExpression("===",e,a.test),a.consequent[0])))}else{for(var o=0;o<i.length;o++){var u=i[o].consequent[0];if(v.isBreakStatement(u)&&!u.label){var p;u.label=(p=this,!p.loopLabel&&(p.loopLabel=this.file.scope.generateUidIdentifier("loop")),p.loopLabel)}}n.push(this.file.attachAuxiliaryComment(v.switchStatement(e,i)))}}else l.hasReturn&&n.push(this.file.attachAuxiliaryComment(r))},e}()},{"../../../helpers/object":41,"../../../traversal":144,"../../../types":153,"../../../util":157,"lodash/object/extend":404,"lodash/object/values":409}],84:[function(e,t,n){"use strict";function r(e){return m.variableDeclaration("let",[m.variableDeclarator(e.id,m.toExpression(e))])}function l(e,t,n,r){return new x(this,r).run()}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.ClassDeclaration=r,n.ClassExpression=l,n.__esModule=!0;var o=s(e("../../helpers/replace-supers")),u=i(e("../../helpers/name-method")),p=i(e("../../helpers/define-map")),c=i(e("../../../messages")),d=i(e("../../../util")),f=s(e("../../../traversal")),h=(s(e("lodash/collection/each")),s(e("lodash/object/has"))),m=i(e("../../../types")),g="__initializeProperties",y=m.isClass;n.check=y;var b={Identifier:{enter:function(e,t,n,r){this.parentPath.isClassProperty({key:e})||this.isReferenced()&&n.getBinding(e.name)===r.scope.getBinding(e.name)&&(r.references[e.name]=!0)}}},v=f.explode({MethodDefinition:{enter:function(){this.skip()}},Property:{enter:function(e){e.method&&this.skip()}},CallExpression:{enter:function(e,t,n,r){if(this.get("callee").isSuper()&&(r.hasBareSuper=!0,r.bareSuper=this,!r.hasSuper))throw this.errorWithNode("super call is only allowed in derived constructor")}},ThisExpression:{enter:function(e,t,n,r){if(r.hasSuper&&!r.hasBareSuper)throw this.errorWithNode("'this' is not allowed before super()")}}}),x=function(){function e(t,n){a(this,e),this.parent=t.parent,this.scope=t.scope,this.node=t.node,this.path=t,this.file=n,this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={},this.instancePropBody=[],this.instancePropRefs={},this.staticPropBody=[],this.body=[],this.hasConstructor=!1,this.hasDecorators=!1,this.className=this.node.id,this.classRef=this.node.id||this.scope.generateUidIdentifier("class"),this.superName=this.node.superClass||m.identifier("Function"),this.hasSuper=!!this.node.superClass,this.isLoose=n.isLoose("es6.classes")}return e.prototype.run=function(){var e,t=this.superName,n=(this.className,this.node.body.body,this.classRef),r=this.file,l=this.body,i=this.constructorBody=m.blockStatement([]);this.className?(e=m.functionDeclaration(this.className,[],i),l.push(e)):e=m.functionExpression(null,[],i),this.constructor=e;var s=[],a=[];this.hasSuper&&(a.push(t),t=this.scope.generateUidBasedOnNode(t),s.push(t),this.superName=t,l.push(m.expressionStatement(m.callExpression(r.addHelper("inherits"),[n,t])))),this.buildBody(),i.body.unshift(m.expressionStatement(m.callExpression(r.addHelper("class-call-check"),[m.thisExpression(),n])));var o=this.node.decorators;if(o)for(var p=0;p<o.length;p++){var c=o[p];l.push(d.template("class-decorator",{DECORATOR:c.expression,CLASS_REF:n},!0))}if(this.className){if(1===l.length)return m.toExpression(l[0])}else e=u.bare(e,this.parent,this.scope),l.unshift(m.variableDeclaration("var",[m.variableDeclarator(n,e)])),m.inheritsComments(l[0],this.node);return l=l.concat(this.staticPropBody),l.push(m.returnStatement(n)),m.callExpression(m.functionExpression(null,s,m.blockStatement(l)),a)},e.prototype.pushToMap=function(e,t){var n,r=void 0===arguments[2]?"value":arguments[2];e["static"]?(this.hasStaticDescriptors=!0,n=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,n=this.instanceMutatorMap);var l=m.toKeyAlias(e),i={};h(n,l)&&(i=n[l]),n[l]=i;var s=i;if(s._inherits||(s._inherits=[]),i._inherits.push(e),i._key=e.key,t&&(i.enumerable=m.literal(!0)),e.computed&&(i._computed=!0),e.decorators){var a;this.hasDecorators=!0;var o=(a=i,!a.decorators&&(a.decorators=m.arrayExpression([])),a.decorators);o.elements=o.elements.concat(e.decorators.map(function(e){return e.expression}))}if(i.value||i.initializer)throw this.file.errorWithNode(e,"Key conflict with sibling node");"get"===e.kind&&(r="get"),"set"===e.kind&&(r="set"),m.inheritsComments(e.value,e),i[r]=e.value},e.prototype.buildBody=function(){for(var e=this.constructorBody,t=(this.constructor,this.className),n=(this.superName,this.node.body.body),r=this.body,l=this.path.get("body").get("body"),i=0;i<n.length;i++){var s=n[i],a=l[i];if(m.isMethodDefinition(s)){var u="constructor"===s.kind;u&&this.verifyConstructor(a);var c=new o({methodPath:a,methodNode:s,objectRef:this.classRef,superRef:this.superName,isStatic:s["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);c.replace(),u?this.pushConstructor(s,a):this.pushMethod(s)}else m.isClassProperty(s)&&this.pushProperty(s)}if(!this.hasConstructor&&this.hasSuper){var f="class-super-constructor-call";this.isLoose&&(f+="-loose"),e.body.push(d.template(f,{CLASS_NAME:t,SUPER_NAME:this.superName},!0))}this.placePropertyInitializers(),this.userConstructor&&(e.body=e.body.concat(this.userConstructor.body.body),m.inherits(this.constructor,this.userConstructor),m.inherits(this.constructorBody,this.userConstructor.body));var h,g,y="create-class";if(this.hasDecorators&&(y="create-decorated-class"),this.hasInstanceDescriptors&&(h=p.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(g=p.toClassObject(this.staticMutatorMap)),h||g){h&&(h=p.toComputedObjectFromClass(h)),g&&(g=p.toComputedObjectFromClass(g));var b=m.literal(null),v=[this.classRef,b,b,b,b];h&&(v[1]=h),g&&(v[2]=g),this.instanceInitializersId&&(v[3]=this.instanceInitializersId,r.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(v[4]=this.staticInitializersId,r.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var x=0,i=0;i<v.length;i++)v[i]!==b&&(x=i);v=v.slice(0,x+1),r.push(m.expressionStatement(m.callExpression(this.file.addHelper(y),v)))}},e.prototype.buildObjectAssignment=function(e){return m.variableDeclaration("var",[m.variableDeclarator(e,m.objectExpression([]))])},e.prototype.placePropertyInitializers=function(){var e=this.instancePropBody;if(e.length)if(this.hasPropertyCollision()){var t=m.expressionStatement(m.callExpression(m.memberExpression(m.thisExpression(),m.identifier(g)),[]));this.pushMethod(m.methodDefinition(m.identifier(g),m.functionExpression(null,[],m.blockStatement(e))),!0),this.hasSuper?this.bareSuper.insertAfter(t):this.constructorBody.body.unshift(t)}else this.hasSuper?this.hasConstructor?this.bareSuper.insertAfter(e):this.constructorBody.body=this.constructorBody.body.concat(e):this.constructorBody.body=e.concat(this.constructorBody.body)},e.prototype.hasPropertyCollision=function(){if(this.userConstructorPath)for(var e in this.instancePropRefs)if(this.userConstructorPath.scope.hasOwnBinding(e))return!0;return!1},e.prototype.verifyConstructor=function(e){var t={hasBareSuper:!1,bareSuper:null,hasSuper:this.hasSuper,file:this.file};if(e.traverse(v,t),this.bareSuper=t.bareSuper,!t.hasBareSuper&&this.hasSuper)throw e.errorWithNode("Derived constructor must call super()")},e.prototype.pushMethod=function(e,t){if(!t&&m.isLiteral(m.toComputedKey(e),{value:g}))throw this.file.errorWithNode(e,c.get("illegalMethodName",g));if("method"===e.kind&&(u.property(e,this.file,this.scope),this.isLoose)){var n=this.classRef;e["static"]||(n=m.memberExpression(n,m.identifier("prototype")));var r=m.memberExpression(n,e.key,e.computed),l=m.expressionStatement(m.assignmentExpression("=",r,e.value));return m.inheritsComments(l,e),void this.body.push(l)}this.pushToMap(e)},e.prototype.pushProperty=function(e){if(e.value||e.decorators){if(this.scope.traverse(e,b,{references:this.instancePropRefs,scope:this.scope}),e.decorators){var t=[];if(e.value&&t.push(m.returnStatement(e.value)),e.value=m.functionExpression(null,[],m.blockStatement(t)),this.pushToMap(e,!0,"initializer"),e["static"]){var n;this.staticPropBody.push(d.template("call-static-decorator",{INITIALIZERS:(n=this,!n.staticInitializersId&&(n.staticInitializersId=this.scope.generateUidIdentifier("staticInitializers")),n.staticInitializersId),CONSTRUCTOR:this.classRef,KEY:e.key},!0))}else{var r;this.instancePropBody.push(d.template("call-instance-decorator",{INITIALIZERS:(r=this,!r.instanceInitializersId&&(r.instanceInitializersId=this.scope.generateUidIdentifier("instanceInitializers")),r.instanceInitializersId),KEY:e.key},!0))}}else e["static"]?this.pushToMap(e,!0):this.instancePropBody.push(m.expressionStatement(m.assignmentExpression("=",m.memberExpression(m.thisExpression(),e.key),e.value)))}},e.prototype.pushConstructor=function(e,t){var n=t.get("value");n.scope.hasOwnBinding(this.classRef.name)&&n.scope.rename(this.classRef.name);var r=this.constructor,l=e.value;this.userConstructorPath=n,this.userConstructor=l,this.hasConstructor=!0,m.inheritsComments(r,e),r._ignoreUserWhitespace=!0,r.params=l.params,m.inherits(r.body,l.body)},e}()},{"../../../messages":43,"../../../traversal":144,"../../../types":153,"../../../util":157,"../../helpers/define-map":54,"../../helpers/name-method":57,"../../helpers/replace-supers":61,"lodash/collection/each":316,"lodash/object/has":405}],85:[function(e,t,n){"use strict";function r(e){return o.isVariableDeclaration(e,{kind:"const"})||o.isImportDeclaration(e)}function l(e,t,n,r){this.traverse(u,{constants:n.getAllBindingsOfKind("const","module"),file:r})}function i(e){"const"===e.kind&&(e.kind="let")}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.Scopable=l,n.VariableDeclaration=i,n.__esModule=!0;var a=s(e("../../../messages")),o=s(e("../../../types")),u={enter:function(e,t,n,r){if(this.isAssignmentExpression()||this.isUpdateExpression()){var l=this.getBindingIdentifiers();for(var i in l){var s=l[i],o=r.constants[i];if(o){var u=o.identifier;if(s!==u&&n.bindingIdentifierEquals(i,u))throw r.file.errorWithNode(s,a.get("readOnly",i))}}}else this.isScope()&&this.skip()}}},{"../../../messages":43,"../../../types":153}],86:[function(e,t,n){"use strict";function r(e,t,n,r){var l=e.left;if(f.isPattern(l)){var i=n.generateUidIdentifier("ref");return e.left=f.variableDeclaration("var",[f.variableDeclarator(i)]),f.ensureBlock(e),void e.body.body.unshift(f.variableDeclaration("var",[f.variableDeclarator(l,i)]))}if(f.isVariableDeclaration(l)){var s=l.declarations[0].id;if(f.isPattern(s)){var a=n.generateUidIdentifier("ref");e.left=f.variableDeclaration(l.kind,[f.variableDeclarator(a,null)]);var o=[],u=new g({kind:l.kind,file:r,scope:n,nodes:o});u.init(s,a),f.ensureBlock(e);var p=e.body;p.body=o.concat(p.body)}}}function l(e,t,n,r){var l=e.param;if(f.isPattern(l)){var i=n.generateUidIdentifier("ref");e.param=i;var s=[],a=new g({kind:"let",file:r,scope:n,nodes:s});return a.init(l,i),e.body.body=s.concat(e.body.body),e}}function i(e,t,n,r){var l=e.expression;if("AssignmentExpression"===l.type&&f.isPattern(l.left)&&!r.isConsequenceExpressionStatement(e)){var i=new g({operator:l.operator,scope:n,file:r});return i.init(l.left,l.right)}}function s(e,t,n,r){if(f.isPattern(e.left)){var l=n.generateUidIdentifier("temp");n.push({id:l});var i=[];i.push(f.expressionStatement(f.assignmentExpression("=",l,e.right)));var s=new g({operator:e.operator,file:r,scope:n,nodes:i});return s.init(e.left,l),i.push(f.expressionStatement(l)),i}}function a(e){for(var t=0;t<e.declarations.length;t++)if(f.isPattern(e.declarations[t].id))return!0;return!1}function o(e,t,n,r){if(!f.isForInStatement(t)&&!f.isForOfStatement(t)&&a(e)){for(var l,i=[],s=0;s<e.declarations.length;s++){l=e.declarations[s];var o=l.init,u=l.id,p=new g({nodes:i,scope:n,kind:e.kind,file:r});f.isPattern(u)&&o?(p.init(u,o),+s!==e.declarations.length-1&&f.inherits(i[i.length-1],l)):i.push(f.inherits(p.buildVariableAssignment(l.id,l.init),l))}if(!f.isProgram(t)&&!f.isBlockStatement(t)){for(l=null,s=0;s<i.length;s++){if(e=i[s],l||(l=f.variableDeclaration(e.kind,[])),!f.isVariableDeclaration(e)&&l.kind!==e.kind)throw r.errorWithNode(e,d.get("invalidParentForThisNode"));l.declarations=l.declarations.concat(e.declarations)}return l}return i}}function u(e){for(var t=0;t<e.elements.length;t++)if(f.isRestElement(e.elements[t]))return!0;return!1}var p=function(e){return e&&e.__esModule?e:{"default":e}},c=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};n.ForOfStatement=r,n.CatchClause=l,n.ExpressionStatement=i,n.AssignmentExpression=s,n.VariableDeclaration=o,n.__esModule=!0;var d=p(e("../../../messages")),f=p(e("../../../types")),h=f.isPattern;n.check=h,n.ForInStatement=r,n.Function=function(e,t,n,r){var l=[],i=!1;if(e.params=e.params.map(function(t,s){if(!f.isPattern(t))return t;i=!0;var a=n.generateUidIdentifier("ref"),o=new g({blockHoist:e.params.length-s,nodes:l,scope:n,file:r,kind:"let"});return o.init(t,a),a}),i){r.checkNode(l),f.ensureBlock(e);var s=e.body;s.body=l.concat(s.body)}};var m={enter:function(e,t,n,r){this.isReferencedIdentifier()&&r.bindings[e.name]&&(r.deopt=!0,this.stop())}},g=function(){function e(t){c(this,e),this.blockHoist=t.blockHoist,this.operator=t.operator,this.arrays={},this.nodes=t.nodes||[],this.scope=t.scope,this.file=t.file,this.kind=t.kind}return e.prototype.buildVariableAssignment=function(e,t){var n=this.operator;f.isMemberExpression(e)&&(n="=");var r;return r=n?f.expressionStatement(f.assignmentExpression(n,e,t)):f.variableDeclaration(this.kind,[f.variableDeclarator(e,t)]),r._blockHoist=this.blockHoist,r},e.prototype.buildVariableDeclaration=function(e,t){var n=f.variableDeclaration("var",[f.variableDeclarator(e,t)]);return n._blockHoist=this.blockHoist,n},e.prototype.push=function(e,t){f.isObjectPattern(e)?this.pushObjectPattern(e,t):f.isArrayPattern(e)?this.pushArrayPattern(e,t):f.isAssignmentPattern(e)?this.pushAssignmentPattern(e,t):this.nodes.push(this.buildVariableAssignment(e,t))},e.prototype.toArray=function(e,t){return this.file.isLoose("es6.destructuring")||f.isIdentifier(e)&&this.arrays[e.name]?e:this.scope.toArray(e,t)},e.prototype.pushAssignmentPattern=function(e,t){var n=this.scope.generateUidBasedOnNode(t),r=f.variableDeclaration("var",[f.variableDeclarator(n,t)]);r._blockHoist=this.blockHoist,this.nodes.push(r);var l=f.conditionalExpression(f.binaryExpression("===",n,f.identifier("undefined")),e.right,n),i=e.left;f.isPattern(i)?(this.nodes.push(f.expressionStatement(f.assignmentExpression("=",n,l))),this.push(i,n)):this.nodes.push(this.buildVariableAssignment(i,l))},e.prototype.pushObjectSpread=function(e,t,n,r){for(var l=[],i=0;i<e.properties.length;i++){var s=e.properties[i];if(i>=r)break;if(!f.isSpreadProperty(s)){var a=s.key;f.isIdentifier(a)&&(a=f.literal(s.key.name)),l.push(a)}}l=f.arrayExpression(l);var o=f.callExpression(this.file.addHelper("object-without-properties"),[t,l]);this.nodes.push(this.buildVariableAssignment(n.argument,o))},e.prototype.pushObjectProperty=function(e,t){f.isLiteral(e.key)&&(e.computed=!0);var n=e.value,r=f.memberExpression(t,e.key,e.computed);f.isPattern(n)?this.push(n,r):this.nodes.push(this.buildVariableAssignment(n,r))},e.prototype.pushObjectPattern=function(e,t){if(e.properties.length||this.nodes.push(f.expressionStatement(f.callExpression(this.file.addHelper("object-destructuring-empty"),[t]))),e.properties.length>1&&f.isMemberExpression(t)){var n=this.scope.generateUidBasedOnNode(t,this.file);this.nodes.push(this.buildVariableDeclaration(n,t)),t=n}for(var r=0;r<e.properties.length;r++){var l=e.properties[r];f.isSpreadProperty(l)?this.pushObjectSpread(e,t,l,r):this.pushObjectProperty(l,t)}},e.prototype.canUnpackArrayPattern=function(e,t){if(!f.isArrayExpression(t))return!1;if(!(e.elements.length>t.elements.length)){if(e.elements.length<t.elements.length&&!u(e))return!1;for(var n=0;n<e.elements.length;n++)if(!e.elements[n])return!1;var r=f.getBindingIdentifiers(e),l={deopt:!1,bindings:r};return this.scope.traverse(t,m,l),!l.deopt}},e.prototype.pushUnpackedArrayPattern=function(e,t){for(var n=0;n<e.elements.length;n++){var r=e.elements[n];f.isRestElement(r)?this.push(r.argument,f.arrayExpression(t.elements.slice(n))):this.push(r,t.elements[n])}},e.prototype.pushArrayPattern=function(e,t){if(e.elements){if(this.canUnpackArrayPattern(e,t))return this.pushUnpackedArrayPattern(e,t);var n=!u(e)&&e.elements.length,r=this.toArray(t,n);f.isIdentifier(r)?t=r:(t=this.scope.generateUidBasedOnNode(t),this.arrays[t.name]=!0,this.nodes.push(this.buildVariableDeclaration(t,r)));for(var l=0;l<e.elements.length;l++){var i=e.elements[l];if(i){var s;f.isRestElement(i)?(s=this.toArray(t),l>0&&(s=f.callExpression(f.memberExpression(s,f.identifier("slice")),[f.literal(l)])),i=i.argument):s=f.memberExpression(t,f.literal(l),!0),this.push(i,s)}}}},e.prototype.init=function(e,t){if(!f.isArrayExpression(t)&&!f.isMemberExpression(t)){var n=this.scope.generateMemoisedReference(t,!0);n&&(this.nodes.push(this.buildVariableDeclaration(n,t)),t=n)}return this.push(e,t),this.nodes},e}()},{"../../../messages":43,"../../../types":153}],87:[function(e,t,n){"use strict";function r(e,t,n,r){if(this.get("right").isArrayExpression())return l.call(this,e,n,r);var i=c;r.isLoose("es6.forOf")&&(i=p);var s=i(e,t,n,r),a=s.declar,u=s.loop,d=u.body;o.inheritsComments(u,e),o.ensureBlock(e),a&&d.body.push(a),d.body=d.body.concat(e.body.body),o.inherits(u,e),s.replaceParent?(this.parentPath.replaceWithMultiple(s.node),this.remove()):this.replaceWithMultiple(s.node)}function l(e,t){var n=[],r=e.right;if(!o.isIdentifier(r)||!t.hasBinding(r.name)){var l=t.generateUidIdentifier("arr");n.push(o.variableDeclaration("var",[o.variableDeclarator(l,r)])),r=l}var i=t.generateUidIdentifier("i"),s=a.template("for-of-array",{BODY:e.body,KEY:i,ARR:r});o.inherits(s,e),o.ensureBlock(s);var u=o.memberExpression(r,i,!0),p=e.left;return o.isVariableDeclaration(p)?(p.declarations[0].init=u,s.body.body.unshift(p)):s.body.body.unshift(o.expressionStatement(o.assignmentExpression("=",p,u))),n.push(s),n}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.ForOfStatement=r,n._ForOfStatementArray=l,n.__esModule=!0;var s=i(e("../../../messages")),a=i(e("../../../util")),o=i(e("../../../types")),u=o.isForOfStatement;n.check=u;var p=function(e,t,n,r){var l,i,u=e.left;if(o.isIdentifier(u)||o.isPattern(u)||o.isMemberExpression(u))i=u;else{if(!o.isVariableDeclaration(u))throw r.errorWithNode(u,s.get("unknownForHead",u.type));i=n.generateUidIdentifier("ref"),l=o.variableDeclaration(u.kind,[o.variableDeclarator(u.declarations[0].id,i)])}var p=n.generateUidIdentifier("iterator"),c=n.generateUidIdentifier("isArray"),d=a.template("for-of-loose",{LOOP_OBJECT:p,IS_ARRAY:c,OBJECT:e.right,INDEX:n.generateUidIdentifier("i"),ID:i});return l||d.body.body.shift(),{declar:l,node:d,loop:d}},c=function(e,t,n,r){var l,i=e.left,u=n.generateUidIdentifier("step"),p=o.memberExpression(u,o.identifier("value"));if(o.isIdentifier(i)||o.isPattern(i)||o.isMemberExpression(i))l=o.expressionStatement(o.assignmentExpression("=",i,p));else{if(!o.isVariableDeclaration(i))throw r.errorWithNode(i,s.get("unknownForHead",i.type));l=o.variableDeclaration(i.kind,[o.variableDeclarator(i.declarations[0].id,p)])}var c=n.generateUidIdentifier("iterator"),d=a.template("for-of",{ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:n.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:c,STEP_KEY:u,OBJECT:e.right,BODY:null}),f=o.isLabeledStatement(t),h=d[3].block.body,m=h[0];return f&&(h[0]=o.labeledStatement(t.label,m)),{replaceParent:f,declar:l,loop:m,node:d}}},{"../../../messages":43,"../../../types":153,"../../../util":157}],88:[function(e,t,n){"use strict";function r(e,t){if(e._blockHoist)for(var n=0;n<t.length;n++)t[n]._blockHoist=e._blockHoist}function l(e,t,n,r){if(!e.isType){var l=[];if(e.specifiers.length)for(var i=0;i<e.specifiers.length;i++)r.moduleFormatter.importSpecifier(e.specifiers[i],e,l,t);else r.moduleFormatter.importDeclaration(e,l,t);return 1===l.length&&(l[0]._blockHoist=e._blockHoist),l}}function i(e,t,n,l){var i=[];return l.moduleFormatter.exportAllDeclaration(e,i,t),r(e,i),i}function s(e,t,n,l){var i=[];return l.moduleFormatter.exportDeclaration(e,i,t),r(e,i),i}function a(e,t,n,l){if(!this.get("declaration").isTypeAlias()){var i=[];if(e.declaration){if(u.isVariableDeclaration(e.declaration)){var s=e.declaration.declarations[0];s.init=s.init||u.identifier("undefined")}l.moduleFormatter.exportDeclaration(e,i,t)}else if(e.specifiers)for(var a=0;a<e.specifiers.length;a++)l.moduleFormatter.exportSpecifier(e.specifiers[a],e,i,t);return r(e,i),i}}var o=function(e){return e&&e.__esModule?e:{"default":e}};n.ImportDeclaration=l,n.ExportAllDeclaration=i,n.ExportDefaultDeclaration=s,n.ExportNamedDeclaration=a,n.__esModule=!0;var u=o(e("../../../types"));n.check=e("../internal/modules").check},{"../../../types":153,"../internal/modules":115}],89:[function(e,t,n){"use strict";function r(e,t,n,r,l){if(t.method){var i=t.value,s=n.generateUidIdentifier("this"),u=new a({topLevelThisReference:s,getObjectRef:r,methodNode:t,methodPath:e,isStatic:!0,scope:n,file:l});u.replace(),u.hasSuper&&i.body.body.unshift(o.variableDeclaration("var",[o.variableDeclarator(s,o.thisExpression())]))}}function l(e,t,n,l){for(var i,s=function(){return!i&&(i=n.generateUidIdentifier("obj")),i},a=this.get("properties"),u=0;u<e.properties.length;u++)r(a[u],e.properties[u],n,s,l);return i?(n.push({id:i}),o.assignmentExpression("=",i,e)):void 0}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};n.ObjectExpression=l,n.__esModule=!0;var a=s(e("../../helpers/replace-supers")),o=i(e("../../../types")),u=o.isSuper;n.check=u},{"../../../types":153,"../../helpers/replace-supers":61}],90:[function(e,t,n){"use strict";function r(e){return o.isFunction(e)&&u(e)}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e};n.check=r,n.__esModule=!0;var s=i(e("../../helpers/call-delegate")),a=l(e("../../../util")),o=l(e("../../../types")),u=function(e){for(var t=0;t<e.params.length;t++)if(!o.isIdentifier(e.params[t]))return!0;return!1},p={enter:function(e,t,n,r){this.isReferencedIdentifier()&&r.scope.hasOwnBinding(e.name)&&(r.scope.bindingIdentifierEquals(e.name,e)||(r.iife=!0,this.stop()))}};n.Function=function(e,t,n,r){if(u(e)){o.ensureBlock(e);var l=[],i=o.identifier("arguments");i._shadowedFunctionLiteral=!0;for(var c=0,d={iife:!1,scope:n},f=function(t,n,s){var u=a.template("default-parameter",{VARIABLE_NAME:t,DEFAULT_VALUE:n,ARGUMENT_KEY:o.literal(s),ARGUMENTS:i},!0);r.checkNode(u),u._blockHoist=e.params.length-s,l.push(u)},h=this.get("params"),m=0;m<h.length;m++){var g=h[m];if(g.isAssignmentPattern()){var y=g.get("left"),b=g.get("right"),v=n.generateUidIdentifier("x");v._isDefaultPlaceholder=!0,e.params[m]=v,d.iife||(b.isIdentifier()&&n.hasOwnBinding(b.node.name)?d.iife=!0:b.traverse(p,d)),f(y.node,b.node,m)}else g.isRestElement()||(c=m+1),g.isIdentifier()||g.traverse(p,d),r.transformers["es6.spec.blockScoping"].canTransform()&&g.isIdentifier()&&f(g.node,o.identifier("undefined"),m)}e.params=e.params.slice(0,c),d.iife?(l.push(s(e)),e.body=o.blockStatement(l)):e.body.body=l.concat(e.body.body)}}},{"../../../types":153,"../../../util":157,"../../helpers/call-delegate":53}],91:[function(e,t,n){"use strict";function r(e,t){var n,r=e.property;o.isLiteral(r)?(r.value+=t,r.raw=String(r.value)):(n=o.binaryExpression("+",r,o.literal(t)),e.property=n)}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e};n.__esModule=!0;var s=i(e("lodash/lang/isNumber")),a=l(e("../../../util")),o=l(e("../../../types")),u=o.isRestElement;n.check=u;var p={enter:function(e,t,n,r){if(this.isScope()&&!n.bindingIdentifierEquals(r.name,r.outerBinding))return this.skip();if(this.isFunctionDeclaration()||this.isFunctionExpression())return r.noOptimise=!0,this.traverse(p,r),r.noOptimise=!1,this.skip();if(this.isReferencedIdentifier({name:r.name})){if(!r.noOptimise&&o.isMemberExpression(t)&&t.computed){var l=t.property;if(s(l.value)||o.isUnaryExpression(l)||o.isBinaryExpression(l))return void r.candidates.push(this)}r.canOptimise=!1,this.stop()}}},c=function(e){return o.isRestElement(e.params[e.params.length-1])};n.Function=function(e,t,n,l){if(c(e)){var i=e.params.pop().argument,s=o.identifier("arguments");if(s._shadowedFunctionLiteral=!0,o.isPattern(i)){var u=i;i=n.generateUidIdentifier("ref");var d=o.variableDeclaration("let",u.elements.map(function(e,t){var n=o.memberExpression(i,o.literal(t),!0);return o.variableDeclarator(e,n)}));l.checkNode(d),e.body.body.unshift(d)}var f={outerBinding:n.getBindingIdentifier(i.name),canOptimise:!0,candidates:[],method:e,name:i.name};if(this.traverse(p,f),f.canOptimise&&f.candidates.length)for(var h=0;h<f.candidates.length;h++){var m=f.candidates[h];m.replaceWith(s),r(m.parent,e.params.length)}else{var g=o.literal(e.params.length),y=n.generateUidIdentifier("key"),b=n.generateUidIdentifier("len"),v=y,x=b;e.params.length&&(v=o.binaryExpression("-",y,g),x=o.conditionalExpression(o.binaryExpression(">",b,g),o.binaryExpression("-",b,g),o.literal(0)));var E=a.template("rest",{ARGUMENTS:s,ARRAY_KEY:v,ARRAY_LEN:x,START:g,ARRAY:i,KEY:y,LEN:b});E._blockHoist=e.params.length+1,e.body.body.unshift(E)}}}},{"../../../types":153,"../../../util":157,"lodash/lang/isNumber":395}],92:[function(e,t,n){"use strict";function r(e,t,n){for(var r=0;r<e.properties.length;r++){var l=e.properties[r];t.push(o.expressionStatement(o.assignmentExpression("=",o.memberExpression(n,l.key,l.computed||o.isLiteral(l.key)),l.value)))}}function l(e,t,n,r,l){for(var i,s,a=e.properties,u=0;u<a.length;u++)i=a[u],"init"===i.kind&&(s=i.key,!i.computed&&o.isIdentifier(s)&&(i.key=o.literal(s.name)));var p=!1;for(u=0;u<a.length;u++)i=a[u],i.computed&&(p=!0),("init"!==i.kind||!p||o.isLiteral(o.toComputedKey(i,i.key),{value:"__proto__"}))&&(r.push(i),a[u]=null);for(u=0;u<a.length;u++)if(i=a[u]){s=i.key;var c;c=i.computed&&o.isMemberExpression(s)&&o.isIdentifier(s.object,{name:"Symbol"})?o.assignmentExpression("=",o.memberExpression(n,s,!0),i.value):o.callExpression(l.addHelper("define-property"),[n,s,i.value]),t.push(o.expressionStatement(c))}if(1===t.length){var d=t[0].expression;if(o.isCallExpression(d))return d.arguments[0]=o.objectExpression(r),d}}function i(e){return o.isProperty(e)&&e.computed}function s(e,t,n,i){for(var s=!1,a=0;a<e.properties.length&&!(s=o.isProperty(e.properties[a],{computed:!0,kind:"init"}));a++);if(s){var u=[],p=n.generateUidBasedOnNode(t),c=[],d=l;i.isLoose("es6.properties.computed")&&(d=r);var f=d(e,c,p,u,i);return f?f:(c.unshift(o.variableDeclaration("var",[o.variableDeclarator(p,o.objectExpression(u))])),c.push(o.expressionStatement(p)),c)}}var a=function(e){return e&&e.__esModule?e:{"default":e}};n.check=i,n.ObjectExpression=s,n.__esModule=!0;var o=a(e("../../../types"))},{"../../../types":153}],93:[function(e,t,n){"use strict";function r(e){return s.isProperty(e)&&(e.method||e.shorthand)}function l(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1,e.key=s.removeComments(s.clone(e.key)))}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.Property=l,n.__esModule=!0;var s=i(e("../../../types"))},{"../../../types":153}],94:[function(e,t,n){"use strict";function r(e){return s.is(e,"y")}function l(e){return s.is(e,"y")?a.newExpression(a.identifier("RegExp"),[a.literal(e.regex.pattern),a.literal(e.regex.flags)]):void 0}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.Literal=l,n.__esModule=!0;var s=i(e("../../helpers/regex")),a=i(e("../../../types"))},{"../../../types":153,"../../helpers/regex":59}],95:[function(e,t,n){"use strict";function r(e){return o.is(e,"u")}function l(e){o.is(e,"u")&&(e.regex.pattern=a(e.regex.pattern,e.regex.flags),o.pullFlag(e,"u"))}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};n.check=r,n.Literal=l,n.__esModule=!0;var a=s(e("regexpu/rewrite-pattern")),o=i(e("../../helpers/regex"))},{"../../helpers/regex":59,"regexpu/rewrite-pattern":434}],96:[function(e,t,n){"use strict";function r(e,t,n,r){var l=e._letReferences;l&&this.traverse(s,{letRefs:l,file:r})}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.BlockStatement=r,n.__esModule=!0;var i=l(e("../../../types")),s={enter:function(e,t,n,r){if(this.isReferencedIdentifier()&&(!i.isFor(t)||t.left!==e)){var l=r.letRefs[e.name];if(l&&n.getBindingIdentifier(e.name)===l){var s=i.callExpression(r.file.addHelper("temporal-assert-defined"),[e,i.literal(e.name),r.file.addHelper("temporal-undefined")]);return this.skip(),i.isAssignmentExpression(t)||i.isUpdateExpression(t)?void(t._ignoreBlockScopingTDZ||this.parentPath.replaceWith(i.sequenceExpression([s,t]))):i.logicalExpression("&&",s,e)}}}},a={optional:!0};n.metadata=a,n.Program=r,n.Loop=r},{"../../../types":153}],97:[function(e,t,n){"use strict";function r(e,t,n,r){if(this.skip(),"typeof"===e.operator){var l=i.callExpression(r.addHelper("typeof"),[e.argument]);if(this.get("argument").isIdentifier()){var s=i.literal("undefined");return i.conditionalExpression(i.binaryExpression("===",i.unaryExpression("typeof",e.argument),s),s,l)}return l}}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.UnaryExpression=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0};n.metadata=s},{"../../../types":153}],98:[function(e,t,n){"use strict";function r(e,t){if(!i.isTaggedTemplateExpression(t))for(var n=0;n<e.expressions.length;n++)e.expressions[n]=i.callExpression(i.identifier("String"),[e.expressions[n]])}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.TemplateLiteral=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0};n.metadata=s},{"../../../types":153}],99:[function(e,t,n){"use strict"; function r(e,t){return t.file.isLoose("es6.spread")?e.argument:t.toArray(e.argument,!0)}function l(e){for(var t=0;t<e.length;t++)if(c.isSpreadElement(e[t]))return!0;return!1}function i(e,t){for(var n=[],l=[],i=function(){l.length&&(n.push(c.arrayExpression(l)),l=[])},s=0;s<e.length;s++){var a=e[s];c.isSpreadElement(a)?(i(),n.push(r(a,t))):l.push(a)}return i(),n}function s(e,t,n){var r=e.elements;if(l(r)){var s=i(r,n),a=s.shift();return c.isArrayExpression(a)||(s.unshift(a),a=c.arrayExpression([])),c.callExpression(c.memberExpression(a,c.identifier("concat")),s)}}function a(e,t,n){var r=e.arguments;if(l(r)){var s=c.identifier("undefined");e.arguments=[];var a;a=1===r.length&&"arguments"===r[0].argument.name?[r[0].argument]:i(r,n);var o=a.shift();e.arguments.push(a.length?c.callExpression(c.memberExpression(o,c.identifier("concat")),a):o);var u=e.callee;if(this.get("callee").isMemberExpression()){var p=n.generateMemoisedReference(u.object);p?(u.object=c.assignmentExpression("=",p,u.object),s=p):s=u.object,c.appendToMemberExpression(u,c.identifier("apply"))}else e.callee=c.memberExpression(e.callee,c.identifier("apply"));e.arguments.unshift(s)}}function o(e,t,n,r){var s=e.arguments;if(l(s)){var a=i(s,n),o=c.arrayExpression([c.literal(null)]);return s=c.callExpression(c.memberExpression(o,c.identifier("concat")),a),c.newExpression(c.callExpression(c.memberExpression(r.addHelper("bind"),c.identifier("apply")),[e.callee,s]),[])}}var u=function(e){return e&&e.__esModule?e:{"default":e}},p=function(e){return e&&e.__esModule?e["default"]:e};n.ArrayExpression=s,n.CallExpression=a,n.NewExpression=o,n.__esModule=!0;var c=(p(e("lodash/collection/includes")),u(e("../../../types"))),d=c.isSpreadElement;n.check=d},{"../../../types":153,"lodash/collection/includes":319}],100:[function(e,t,n){"use strict";function r(e){return d.blockStatement([d.returnStatement(e)])}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e},s=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=i(e("lodash/collection/reduceRight")),o=l(e("../../../messages")),u=i(e("lodash/array/flatten")),p=l(e("../../../util")),c=i(e("lodash/collection/map")),d=l(e("../../../types"));n.Function=function(e,t,n,r){var l=new g(this,n,r);l.run()};var f={enter:function(e,t,n,r){if(this.isIfStatement())this.get("alternate").isReturnStatement()&&d.ensureBlock(e,"alternate"),this.get("consequent").isReturnStatement()&&d.ensureBlock(e,"consequent");else{if(this.isReturnStatement())return this.skip(),r.subTransform(e.argument);d.isTryStatement(t)?e===t.block?this.skip():t.finalizer&&e!==t.finalizer&&this.skip():this.isFunction()?this.skip():this.isVariableDeclaration()&&(this.skip(),r.vars.push(e))}}},h={enter:function(e,t,n,r){return this.isThisExpression()?(r.needsThis=!0,r.getThisId()):this.isReferencedIdentifier({name:"arguments"})?(r.needsArguments=!0,r.getArgumentsId()):this.isFunction()&&(this.skip(),this.isFunctionDeclaration())?(e=d.variableDeclaration("var",[d.variableDeclarator(e.id,d.toExpression(e))]),e._blockHoist=2,e):void 0}},m={enter:function(e,t,n,r){if(this.isExpressionStatement()){var l=e.expression;if(d.isAssignmentExpression(l))if(r.needsThis||l.left!==r.getThisId()){if(!r.needsArguments&&l.left===r.getArgumentsId()&&d.isArrayExpression(l.right))return c(l.right.elements,function(e){return d.expressionStatement(e)})}else this.remove()}}},g=function(){function e(t,n,r){s(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.setsArguments=!1,this.needsThis=!1,this.ownerId=t.node.id,this.vars=[],this.scope=n,this.path=t,this.file=r,this.node=t.node}return e.prototype.getArgumentsId=function(){var e;return e=this,!e.argumentsId&&(e.argumentsId=this.scope.generateUidIdentifier("arguments")),e.argumentsId},e.prototype.getThisId=function(){var e;return e=this,!e.thisId&&(e.thisId=this.scope.generateUidIdentifier("this")),e.thisId},e.prototype.getLeftId=function(){var e;return e=this,!e.leftId&&(e.leftId=this.scope.generateUidIdentifier("left")),e.leftId},e.prototype.getFunctionId=function(){var e;return e=this,!e.functionId&&(e.functionId=this.scope.generateUidIdentifier("function")),e.functionId},e.prototype.getAgainId=function(){var e;return e=this,!e.againId&&(e.againId=this.scope.generateUidIdentifier("again")),e.againId},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var t=0;t<e.length;t++){var n=e[t];n._isDefaultPlaceholder||this.paramDecls.push(d.variableDeclarator(n,e[t]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBinding(this.ownerId.name);return e&&!e.constant},e.prototype.run=function(){var e=(this.scope,this.node),t=this.ownerId;if(t&&(this.path.traverse(f,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.log.deopt(e,o.get("tailCallReassignmentDeopt"));this.path.traverse(h,this),this.needsThis&&this.needsArguments||this.path.traverse(m,this);var n=d.ensureBlock(e).body;if(this.vars.length>0){var r=u(c(this.vars,function(e){return e.declarations},this)),l=a(r,function(e,t){return d.assignmentExpression("=",t.id,e)},d.identifier("undefined")),i=d.expressionStatement(l);i._blockHoist=1/0,n.unshift(i)}var s=this.paramDecls;s.length>0&&n.unshift(d.variableDeclaration("var",s)),n.unshift(d.expressionStatement(d.assignmentExpression("=",this.getAgainId(),d.literal(!1)))),e.body=p.template("tail-call-body",{AGAIN_ID:this.getAgainId(),THIS_ID:this.thisId,ARGUMENTS_ID:this.argumentsId,FUNCTION_ID:this.getFunctionId(),BLOCK:e.body});var g=[];if(this.needsThis&&g.push(d.variableDeclarator(this.getThisId(),d.thisExpression())),this.needsArguments||this.setsArguments){var y=d.variableDeclarator(this.getArgumentsId());this.needsArguments&&(y.init=d.identifier("arguments")),g.push(y)}var b=this.leftId;b&&g.push(d.variableDeclarator(b)),g.length>0&&e.body.body.unshift(d.variableDeclaration("var",g))}},e.prototype.subTransform=function(e){if(e){var t=this["subTransform"+e.type];return t?t.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var t=this.subTransform(e.consequent),n=this.subTransform(e.alternate);return t||n?(e.type="IfStatement",e.consequent=t?d.toBlock(t):r(e.consequent),e.alternate=n?d.isIfStatement(n)?n:d.toBlock(n):r(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var t=this.subTransform(e.right);if(t){var n=this.getLeftId(),l=d.assignmentExpression("=",n,e.left);return"&&"===e.operator&&(l=d.unaryExpression("!",l)),[d.ifStatement(l,r(n))].concat(t)}},e.prototype.subTransformSequenceExpression=function(e){var t=e.expressions,n=this.subTransform(t[t.length-1]);return n?(1===--t.length&&(e=t[0]),[d.expressionStatement(e)].concat(n)):void 0},e.prototype.subTransformCallExpression=function(e){var t,n,r=e.callee;if(d.isMemberExpression(r,{computed:!1})&&d.isIdentifier(r.property)){switch(r.property.name){case"call":n=d.arrayExpression(e.arguments.slice(1));break;case"apply":n=e.arguments[1]||d.identifier("undefined");break;default:return}t=e.arguments[0],r=r.object}if(d.isIdentifier(r)&&this.scope.bindingIdentifierEquals(r.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var l=[];d.isThisExpression(t)||l.push(d.expressionStatement(d.assignmentExpression("=",this.getThisId(),t||d.identifier("undefined")))),n||(n=d.arrayExpression(e.arguments));var i=this.getArgumentsId(),s=this.getParams();l.push(d.expressionStatement(d.assignmentExpression("=",i,n)));var a,o;if(d.isArrayExpression(n)){var u=n.elements;for(a=0;a<u.length&&a<s.length;a++){o=s[a];var p=u[a]||(u[a]=d.identifier("undefined"));o._isDefaultPlaceholder||(u[a]=d.assignmentExpression("=",o,p))}}else for(this.setsArguments=!0,a=0;a<s.length;a++)o=s[a],o._isDefaultPlaceholder||l.push(d.expressionStatement(d.assignmentExpression("=",o,d.memberExpression(i,d.literal(a),!0))));return l.push(d.expressionStatement(d.assignmentExpression("=",this.getAgainId(),d.literal(!0)))),l.push(d.continueStatement(this.getFunctionId())),l}},e}()},{"../../../messages":43,"../../../types":153,"../../../util":157,"lodash/array/flatten":311,"lodash/collection/map":320,"lodash/collection/reduceRight":321}],101:[function(e,t,n){"use strict";function r(e){return a.isTemplateLiteral(e)||a.isTaggedTemplateExpression(e)}function l(e,t,n,r){for(var l=e.quasi,i=[],s=[],o=[],u=0;u<l.quasis.length;u++){var p=l.quasis[u];s.push(a.literal(p.value.cooked)),o.push(a.literal(p.value.raw))}s=a.arrayExpression(s),o=a.arrayExpression(o);var c="tagged-template-literal";return r.isLoose("es6.templateLiterals")&&(c+="-loose"),i.push(a.callExpression(r.addHelper(c),[s,o])),i=i.concat(l.expressions),a.callExpression(e.tag,i)}function i(e){var t,n=[];for(t=0;t<e.quasis.length;t++){var r=e.quasis[t];n.push(a.literal(r.value.cooked));var l=e.expressions.shift();l&&n.push(l)}if(n.length>1){var i=n[n.length-1];a.isLiteral(i,{value:""})&&n.pop();var s=o(n.shift(),n.shift());for(t=0;t<n.length;t++)s=o(s,n[t]);return s}return n[0]}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.TaggedTemplateExpression=l,n.TemplateLiteral=i,n.__esModule=!0;var a=s(e("../../../types")),o=function(e,t){return a.binaryExpression("+",e,t)}},{"../../../types":153}],102:[function(e,t,n){"use strict";function r(){return!1}n.check=r,n.__esModule=!0;var l={stage:1};n.metadata=l},{}],103:[function(e,t,n){"use strict";function r(){return!1}n.check=r,n.__esModule=!0;var l={stage:0};n.metadata=l},{}],104:[function(e,t,n){"use strict";function r(e,t,n,r){var s=i;return e.generator&&(s=l),s(e,t,n,r)}function l(e){var t=[],n=c.functionExpression(null,[],c.blockStatement(t),!0);return n.shadow=!0,t.push(o(e,function(){return c.expressionStatement(c.yieldExpression(e.body))})),c.callExpression(n,[])}function i(e,t,n){var r=n.generateUidBasedOnNode(t),l=p.template("array-comprehension-container",{KEY:r});l.callee.shadow=!0;var i=l.callee.body,s=i.body;u.hasType(e,n,"YieldExpression",c.FUNCTION_TYPES)&&(l.callee.generator=!0,l=c.yieldExpression(l,!0));var a=s.pop();return s.push(o(e,function(){return p.template("array-push",{STATEMENT:e.body,KEY:r},!0)})),s.push(a),l}var s=function(e){return e&&e.__esModule?e:{"default":e}},a=function(e){return e&&e.__esModule?e["default"]:e};n.ComprehensionExpression=r,n.__esModule=!0;var o=a(e("../../helpers/build-comprehension")),u=a(e("../../../traversal")),p=s(e("../../../util")),c=s(e("../../../types")),d={stage:0};n.metadata=d},{"../../../traversal":144,"../../../types":153,"../../../util":157,"../../helpers/build-comprehension":51}],105:[function(e,t,n){"use strict";n.__esModule=!0;var r={optional:!0,stage:1};n.metadata=r},{}],106:[function(e,t,n){"use strict";function r(e){var t=e.body.body;return t.length?t:i.identifier("undefined")}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.DoExpression=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0,stage:0};n.metadata=s;var a=i.isDoExpression;n.check=a},{"../../../types":153}],107:[function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{"default":e}},l=function(e){return e&&e.__esModule?e["default"]:e};n.__esModule=!0;var i=l(e("../../helpers/build-binary-assignment-operator-transformer")),s=r(e("../../../types")),a={stage:2};n.metadata=a;var o=s.memberExpression(s.identifier("Math"),s.identifier("pow"));i(n,{operator:"**",build:function(e,t){return s.callExpression(o,[e,t])}})},{"../../../types":153,"../../helpers/build-binary-assignment-operator-transformer":50}],108:[function(e,t,n){"use strict";function r(e){return a.isExportDefaultSpecifier(e)||a.isExportNamespaceSpecifier(e)}function l(e,t,n){var r=e.specifiers[0];if(a.isExportNamespaceSpecifier(r)||a.isExportDefaultSpecifier(r)){var i,s=e.specifiers.shift(),o=n.generateUidIdentifier(s.exported.name);i=a.isExportNamespaceSpecifier(s)?a.importNamespaceSpecifier(o):a.importDefaultSpecifier(o),t.push(a.importDeclaration([i],e.source)),t.push(a.exportNamedDeclaration(null,[a.exportSpecifier(o,s.exported)])),l(e,t,n)}}function i(e,t,n){var r=[];return l(e,r,n),r.length?(e.specifiers.length>=1&&r.push(e),r):void 0}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.ExportNamedDeclaration=i,n.__esModule=!0;var a=s(e("../../../types")),o={stage:1};n.metadata=o},{"../../../types":153}],109:[function(e,t,n){"use strict";function r(e){e.whitelist&&e.whitelist.push("es6.destructuring")}function l(e,t,n,r){if(o(e)){for(var l=[],i=[],a=function(){i.length&&(l.push(s.objectExpression(i)),i=[])},u=0;u<e.properties.length;u++){var p=e.properties[u];s.isSpreadProperty(p)?(a(),l.push(p.argument)):i.push(p)}return a(),s.isObjectExpression(l[0])||l.unshift(s.objectExpression([])),s.callExpression(r.addHelper("extends"),l)}}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.manipulateOptions=r,n.ObjectExpression=l,n.__esModule=!0;var s=i(e("../../../types")),a={stage:1};n.metadata=a;var o=function(e){for(var t=0;t<e.properties.length;t++)if(s.isSpreadProperty(e.properties[t]))return!0;return!1}},{"../../../types":153}],110:[function(e,t){"use strict";t.exports={"es7.classProperties":e("./es7/class-properties"),"es7.asyncFunctions":e("./es7/async-functions"),"es7.decorators":e("./es7/decorators"),strict:e("./other/strict"),_validation:e("./internal/validation"),"validation.undeclaredVariableCheck":e("./validation/undeclared-variable-check"),"validation.react":e("./validation/react"),"spec.functionName":e("./spec/function-name"),"es6.arrowFunctions":e("./es6/arrow-functions"),"spec.blockScopedFunctions":e("./spec/block-scoped-functions"),"optimisation.react.constantElements":e("./optimisation/react.constant-elements"),"optimisation.react.inlineElements":e("./optimisation/react.inline-elements"),reactCompat:e("./other/react-compat"),react:e("./other/react"),_modules:e("./internal/modules"),"es7.comprehensions":e("./es7/comprehensions"),"es6.classes":e("./es6/classes"),asyncToGenerator:e("./other/async-to-generator"),bluebirdCoroutines:e("./other/bluebird-coroutines"),"es6.objectSuper":e("./es6/object-super"),"es7.objectRestSpread":e("./es7/object-rest-spread"),"es7.exponentiationOperator":e("./es7/exponentiation-operator"),"es6.spec.templateLiterals":e("./es6/spec.template-literals"),"es6.templateLiterals":e("./es6/template-literals"),"es5.properties.mutators":e("./es5/properties.mutators"),"es6.properties.shorthand":e("./es6/properties.shorthand"),"es6.properties.computed":e("./es6/properties.computed"),"optimisation.flow.forOf":e("./optimisation/flow.for-of"),"es6.forOf":e("./es6/for-of"),"es6.regex.sticky":e("./es6/regex.sticky"),"es6.regex.unicode":e("./es6/regex.unicode"),"es6.constants":e("./es6/constants"),"es6.parameters.rest":e("./es6/parameters.rest"),"es6.spread":e("./es6/spread"),"es6.parameters.default":e("./es6/parameters.default"),"es6.destructuring":e("./es6/destructuring"),"es6.blockScoping":e("./es6/block-scoping"),"es6.spec.blockScoping":e("./es6/spec.block-scoping"),"es6.tailCall":e("./es6/tail-call"),regenerator:e("./other/regenerator"),runtime:e("./other/runtime"),"es7.exportExtensions":e("./es7/export-extensions"),"es6.modules":e("./es6/modules"),_blockHoist:e("./internal/block-hoist"),"spec.protoToAssign":e("./spec/proto-to-assign"),_declarations:e("./internal/declarations"),_shadowFunctions:e("./internal/shadow-functions"),"es7.doExpressions":e("./es7/do-expressions"),"es6.spec.symbols":e("./es6/spec.symbols"),ludicrous:e("./other/ludicrous"),"spec.undefinedToVoid":e("./spec/undefined-to-void"),_strict:e("./internal/strict"),_moduleFormatter:e("./internal/module-formatter"),"es3.propertyLiterals":e("./es3/property-literals"),"es3.memberExpressionLiterals":e("./es3/member-expression-literals"),"utility.removeDebugger":e("./utility/remove-debugger"),"utility.removeConsole":e("./utility/remove-console"),"utility.inlineEnvironmentVariables":e("./utility/inline-environment-variables"),"utility.inlineExpressions":e("./utility/inline-expressions"),"utility.deadCodeElimination":e("./utility/dead-code-elimination"),flow:e("./other/flow"),_cleanUp:e("./internal/cleanup")}},{"./es3/member-expression-literals":79,"./es3/property-literals":80,"./es5/properties.mutators":81,"./es6/arrow-functions":82,"./es6/block-scoping":83,"./es6/classes":84,"./es6/constants":85,"./es6/destructuring":86,"./es6/for-of":87,"./es6/modules":88,"./es6/object-super":89,"./es6/parameters.default":90,"./es6/parameters.rest":91,"./es6/properties.computed":92,"./es6/properties.shorthand":93,"./es6/regex.sticky":94,"./es6/regex.unicode":95,"./es6/spec.block-scoping":96,"./es6/spec.symbols":97,"./es6/spec.template-literals":98,"./es6/spread":99,"./es6/tail-call":100,"./es6/template-literals":101,"./es7/async-functions":102,"./es7/class-properties":103,"./es7/comprehensions":104,"./es7/decorators":105,"./es7/do-expressions":106,"./es7/exponentiation-operator":107,"./es7/export-extensions":108,"./es7/object-rest-spread":109,"./internal/block-hoist":111,"./internal/cleanup":112,"./internal/declarations":113,"./internal/module-formatter":114,"./internal/modules":115,"./internal/shadow-functions":116,"./internal/strict":117,"./internal/validation":118,"./optimisation/flow.for-of":119,"./optimisation/react.constant-elements":120,"./optimisation/react.inline-elements":121,"./other/async-to-generator":122,"./other/bluebird-coroutines":123,"./other/flow":124,"./other/ludicrous":125,"./other/react":127,"./other/react-compat":126,"./other/regenerator":128,"./other/runtime":129,"./other/strict":130,"./spec/block-scoped-functions":131,"./spec/function-name":132,"./spec/proto-to-assign":133,"./spec/undefined-to-void":134,"./utility/dead-code-elimination":135,"./utility/inline-environment-variables":136,"./utility/inline-expressions":137,"./utility/remove-console":138,"./utility/remove-debugger":139,"./validation/react":140,"./validation/undeclared-variable-check":141}],111:[function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e["default"]:e};n.__esModule=!0;var l=r(e("lodash/collection/groupBy")),i=r(e("lodash/array/flatten")),s=r(e("lodash/object/values")),a={exit:function(e){for(var t=!1,n=0;n<e.body.length;n++){var r=e.body[n];r&&null!=r._blockHoist&&(t=!0)}if(t){var a=l(e.body,function(e){var t=e&&e._blockHoist;return null==t&&(t=1),t===!0&&(t=2),t});e.body=i(s(a).reverse())}}};n.BlockStatement=a,n.Program=a},{"lodash/array/flatten":311,"lodash/collection/groupBy":318,"lodash/object/values":409}],112:[function(e,t,n){"use strict";n.__esModule=!0;var r={exit:function(e){return 1===e.expressions.length?e.expressions[0]:void(e.expressions.length||this.remove())}};n.SequenceExpression=r;var l={exit:function(e){e.expression||this.remove()}};n.ExpressionStatement=l;var i={exit:function(e){var t=e.right,n=e.left;if(n||t){if(!n)return t;if(!t)return n}else this.remove()}};n.Binary=i},{}],113:[function(e,t,n){"use strict";function r(e,t,n,r){e._declarations&&i.wrap(e,function(){var t,n={};for(var l in e._declarations){var i=e._declarations[l];t=i.kind||"var";var a=s.variableDeclarator(i.id,i.init);if(i.init)e.body.unshift(r.attachAuxiliaryComment(s.variableDeclaration(t,[a])));else{var o=n,u=t;o[u]||(o[u]=[]),n[t].push(a)}}for(t in n)e.body.unshift(r.attachAuxiliaryComment(s.variableDeclaration(t,n[t])));e._declarations=null})}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.BlockStatement=r,n.__esModule=!0;var i=l(e("../../helpers/strict")),s=l(e("../../../types")),a={secondPass:!0};n.metadata=a,n.Program=r},{"../../../types":153,"../../helpers/strict":62}],114:[function(e,t,n){"use strict";function r(e,t,n,r){i.wrap(e,function(){e.body=r.dynamicImports.concat(e.body)}),r.transformers["es6.modules"].canTransform()&&r.moduleFormatter.transform&&r.moduleFormatter.transform(e)}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.Program=r,n.__esModule=!0;var i=l(e("../../helpers/strict"))},{"../../helpers/strict":62}],115:[function(e,t,n){"use strict";function r(e){return u.isImportDeclaration(e)||u.isExportDeclaration(e)}function l(e,t,n,r){e.source&&(e.source.value=r.resolveModuleSource(e.source.value))}function i(e,t,n){l.apply(this,arguments);var r=e.declaration,i=function(){return r._ignoreUserWhitespace=!0,r};if(u.isClassDeclaration(r))return e.declaration=r.id,[i(),e];if(u.isClassExpression(r)){var s=n.generateUidIdentifier("default");return r=u.variableDeclaration("var",[u.variableDeclarator(s,r)]),e.declaration=s,[i(),e]}return u.isFunctionDeclaration(r)?(e._blockHoist=2,e.declaration=r.id,[i(),e]):void 0}function s(e){l.apply(this,arguments);var t=e.declaration,n=function(){return t._ignoreUserWhitespace=!0,t};if(u.isClassDeclaration(t))return e.specifiers=[u.exportSpecifier(t.id,t.id)],e.declaration=null,[n(),e];if(u.isFunctionDeclaration(t))return e.specifiers=[u.exportSpecifier(t.id,t.id)],e.declaration=null,e._blockHoist=2,[n(),e];if(u.isVariableDeclaration(t)){var r=[],i=this.get("declaration").getBindingIdentifiers();for(var s in i){var a=i[s];r.push(u.exportSpecifier(a,a))}return[t,u.exportNamedDeclaration(null,r)]}}function a(e){for(var t=[],n=[],r=0;r<e.body.length;r++){var l=e.body[r];u.isImportDeclaration(l)?t.push(l):n.push(l)}e.body=t.concat(n)}var o=function(e){return e&&e.__esModule?e:{"default":e}};n.check=r,n.ImportDeclaration=l,n.ExportDefaultDeclaration=i,n.ExportNamedDeclaration=s,n.Program=a,n.__esModule=!0;var u=o(e("../../../types"))},{"../../../types":153}],116:[function(e,t,n){"use strict";function r(e,t,n){var r,l,i={getArgumentsId:function(){return!r&&(r=n.generateUidIdentifier("arguments")),r},getThisId:function(){return!l&&(l=n.generateUidIdentifier("this")),l}};t.traverse(u,i);var s,o=function(t,n){s||(s=e()),s.unshift(a.variableDeclaration("var",[a.variableDeclarator(t,n)]))};r&&o(r,a.identifier("arguments")),l&&o(l,a.thisExpression())}function l(e,t,n){r(function(){return e.body},this,n)}function i(e,t,n){r(function(){return a.ensureBlock(e),e.body.body},this,n)}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.Program=l,n.FunctionDeclaration=i,n.__esModule=!0;var a=s(e("../../../types")),o={enter:function(e,t,n,r){if(this.isClass(e))return this.skip();if(this.isFunction()&&!e.shadow)return this.skip();if(e._shadowedFunctionLiteral)return this.skip();var l;if(this.isIdentifier()&&"arguments"===e.name)l=r.getArgumentsId;else{if(!this.isThisExpression())return;l=r.getThisId}return this.isReferenced()?l():void 0}},u={enter:function(e,t,n,r){return e.shadow?(this.traverse(o,r),e.shadow=!1,this.skip()):this.isFunction()?this.skip():void 0}};n.FunctionExpression=i},{"../../../types":153}],117:[function(e,t,n){"use strict";function r(e,t,n,r){if(r.transformers.strict.canTransform()){var l=r.get("existingStrictDirective");if(!l){l=i.expressionStatement(i.literal("use strict"));var s=e.body[0];s&&(l.leadingComments=s.leadingComments,s.leadingComments=[])}e.body.unshift(l)}}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.Program=r,n.__esModule=!0;var i=l(e("../../../types"))},{"../../../types":153}],118:[function(e,t,n){"use strict";function r(e,t,n,r){var l=e.left;if(u.isVariableDeclaration(l)){var i=l.declarations[0];if(i.init)throw r.errorWithNode(i,o.get("noAssignmentsInForHead"))}}function l(e){if("constructor"!==e.kind){var t=!e.computed&&u.isIdentifier(e.key,{name:"constructor"});if(t||(t=u.isLiteral(e.key,{value:"constructor"})),t)throw this.errorWithNode(o.get("classesIllegalConstructorKind"))}i.apply(this,arguments)}function i(e,t,n,r){if("set"===e.kind){if(1!==e.value.params.length)throw r.errorWithNode(e.value,o.get("settersInvalidParamLength"));var l=e.value.params[0];if(u.isRestElement(l))throw r.errorWithNode(l,o.get("settersNoRest"))}}function s(e){for(var t=0;t<e.body.length;t++){var n=e.body[t];if(!u.isExpressionStatement(n)||!u.isLiteral(n.expression))return;n._blockHoist=1/0}}var a=function(e){return e&&e.__esModule?e:{"default":e}};n.ForOfStatement=r,n.MethodDefinition=l,n.Property=i,n.BlockStatement=s,n.__esModule=!0;var o=a(e("../../../messages")),u=a(e("../../../types")),p={readOnly:!0};n.metadata=p,n.ForInStatement=r,n.Program=s},{"../../../messages":43,"../../../types":153}],119:[function(e,t,n){"use strict";function r(e,t,n,r){return this.get("right").isTypeGeneric("Array")?i.call(this,e,n,r):void 0}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.ForOfStatement=r,n.__esModule=!0;var i=e("../es6/for-of")._ForOfStatementArray,s=l(e("../../../types")),a=s.isForOfStatement;n.check=a;var o=!0;n.optional=o},{"../../../types":153,"../es6/for-of":87}],120:[function(e,t,n){"use strict";function r(e){if(!e._ignoreConstant){var t={isImmutable:!0};this.traverse(s,t),this.skip(),t.isImmutable&&(this.hoist(),e._ignoreConstant=!0)}}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.JSXElement=r,n.__esModule=!0;var i=(l(e("../../helpers/react")),{optional:!0});n.metadata=i;var s={enter:function(e,t,n,r){var l=this,i=function(){r.isImmutable=!1,l.stop()};return this.isJSXClosingElement()?void this.skip():this.isJSXIdentifier({name:"ref"})&&this.parentPath.isJSXAttribute({name:e})?i():void(this.isJSXIdentifier()||this.isIdentifier()||this.isJSXMemberExpression()||this.isImmutable()||i())}}},{"../../helpers/react":58}],121:[function(e,t,n){"use strict";function r(e){for(var t=0;t<e.length;t++){var n=e[t];if(o.isJSXSpreadAttribute(n))return!0;if(l(n,"ref"))return!0}return!1}function l(e,t){return o.isJSXAttribute(e)&&o.isJSXIdentifier(e.name,{name:t})}function i(e,t,n,i){function s(e,t){u(f.properties,o.identifier(e),t)}function u(e,t,n){e.push(o.property("init",t,n))}var p=e.openingElement;if(!r(p.attributes)){var c=!0,d=o.objectExpression([]),f=o.objectExpression([]),h=o.literal(null),m=p.name;o.isJSXIdentifier(m)&&a.isCompatTag(m.name)&&(m=o.literal(m.name),c=!1),s("type",m),s("ref",o.literal(null)),e.children.length&&u(d.properties,o.identifier("children"),o.arrayExpression(a.buildChildren(e)));for(var g=0;g<p.attributes.length;g++){var y=p.attributes[g];l(y,"key")?h=y.value:u(d.properties,y.name,y.value)}return c&&(d=o.callExpression(i.addHelper("default-props"),[o.memberExpression(m,o.identifier("defaultProps")),d])),s("props",d),s("key",h),f}}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.JSXElement=i,n.__esModule=!0;var a=s(e("../../helpers/react")),o=s(e("../../../types")),u={optional:!0};n.metadata=u},{"../../../types":153,"../../helpers/react":58}],122:[function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e["default"]:e};n.__esModule=!0;var l=r(e("../../helpers/remap-async-to-generator"));n.manipulateOptions=e("./bluebird-coroutines").manipulateOptions;var i={optional:!0};n.metadata=i,n.Function=function(e,t,n,r){return e.async&&!e.generator?l(e,r.addHelper("async-to-generator"),n):void 0}},{"../../helpers/remap-async-to-generator":60,"./bluebird-coroutines":123}],123:[function(e,t,n){"use strict";function r(e){e.optional.push("es7.asyncFunctions"),e.blacklist.push("regenerator")}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e};n.manipulateOptions=r,n.__esModule=!0;var s=i(e("../../helpers/remap-async-to-generator")),a=l(e("../../../types")),o={optional:!0};n.metadata=o,n.Function=function(e,t,n,r){return e.async&&!e.generator?s(e,a.memberExpression(r.addImport("bluebird",null,!0),a.identifier("coroutine")),n):void 0}},{"../../../types":153,"../../helpers/remap-async-to-generator":60}],124:[function(e,t,n){"use strict";function r(){this.remove()}function l(e){e.typeAnnotation=null,e.value||this.remove()}function i(e){e["implements"]=null}function s(e){return e.expression}function a(e){e.isType&&this.remove()}function o(){this.get("declaration").isTypeAlias()&&this.remove()}var u=function(e){return e&&e.__esModule?e:{"default":e}};n.Flow=r,n.ClassProperty=l,n.Class=i,n.TypeCastExpression=s,n.ImportDeclaration=a,n.ExportDeclaration=o,n.__esModule=!0;u(e("../../../types"));n.Function=function(e){for(var t=0;t<e.params.length;t++){var n=e.params[t];n.optional=!1}}},{"../../../types":153}],125:[function(e,t,n){"use strict";function r(e){return"in"===e.operator?o.template("ludicrous-in",{LEFT:e.left,RIGHT:e.right}):void 0}function l(e){var t=e.key;a.isLiteral(t)&&"number"==typeof t.value&&(t.value=""+t.value)}function i(e){e.regex&&(e.regex.pattern="foobar",e.regex.flags="")}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.BinaryExpression=r,n.Property=l,n.Literal=i,n.__esModule=!0;var a=s(e("../../../types")),o=s(e("../../../util")),u={optional:!0};n.metadata=u},{"../../../types":153,"../../../util":157}],126:[function(e,t,n){"use strict";function r(e){e.blacklist.push("react")}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.manipulateOptions=r,n.__esModule=!0;var i=l(e("../../helpers/react")),s=l(e("../../../types")),a={optional:!0};n.metadata=a,e("../../helpers/build-react-transformer")(n,{pre:function(e){e.callee=e.tagExpr},post:function(e){i.isCompatTag(e.tagName)&&(e.call=s.callExpression(s.memberExpression(s.memberExpression(s.identifier("React"),s.identifier("DOM")),e.tagExpr,s.isLiteral(e.tagExpr)),e.args))}})},{"../../../types":153,"../../helpers/build-react-transformer":52,"../../helpers/react":58}],127:[function(e,t,n){"use strict";function r(e,t,n,r){for(var l=r.opts.jsxPragma,i=0;i<r.ast.comments.length;i++){var o=r.ast.comments[i],u=a.exec(o.value);if(u){if(l=u[1],"React.DOM"===l)throw r.errorWithNode(o,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}r.set("jsxIdentifier",l.split(".").map(s.identifier).reduce(function(e,t){return s.memberExpression(e,t)}))}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.Program=r,n.__esModule=!0;var i=l(e("../../helpers/react")),s=l(e("../../../types")),a=/^\*\s*@jsx\s+([^\s]+)/;e("../../helpers/build-react-transformer")(n,{pre:function(e){var t=e.tagName,n=e.args;n.push(i.isCompatTag(t)?s.literal(t):e.tagExpr)},post:function(e,t){e.callee=t.get("jsxIdentifier")}})},{"../../../types":153,"../../helpers/build-react-transformer":52,"../../helpers/react":58}],128:[function(e,t,n){"use strict";function r(e){return a.isFunction(e)&&(e.async||e.generator)}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e};n.check=r,n.__esModule=!0;var s=i(e("regenerator-babel")),a=l(e("../../../types")),o={enter:function(e){s.transform(e),this.stop()}};n.Program=o},{"../../../types":153,"regenerator-babel":426}],129:[function(e,t,n){"use strict";function r(e){return"_"!==e.name&&u(s,e.name)}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e},s=i(e("core-js/library")),a=i(e("lodash/collection/includes")),o=l(e("../../../util")),u=i(e("lodash/object/has")),p=l(e("../../../types")),c=p.buildMatchMemberExpression("Symbol.iterator"),d=["Symbol","Promise","Map","WeakMap","Set","WeakSet"],f={enter:function(e,t,n,l){var i;if(this.isMemberExpression()&&this.isReferenced()){var f=e.object;if(i=e.property,!p.isReferenced(f,e))return;if(!e.computed&&r(f)&&u(s[f.name],i.name)&&!n.getBindingIdentifier(f.name))return this.skip(),p.prependToMemberExpression(e,l.get("coreIdentifier"))}else{if(this.isReferencedIdentifier()&&!p.isMemberExpression(t)&&a(d,e.name)&&!n.getBindingIdentifier(e.name))return p.memberExpression(l.get("coreIdentifier"),e);if(this.isCallExpression()){var h=e.callee;return e.arguments.length?!1:p.isMemberExpression(h)&&h.computed?(i=h.property,c(i)?o.template("corejs-iterator",{CORE_ID:l.get("coreIdentifier"),VALUE:h.object}):!1):!1}if(this.isBinaryExpression()){if("in"!==e.operator)return;var m=e.left;if(!c(m))return;return o.template("corejs-is-iterator",{CORE_ID:l.get("coreIdentifier"),VALUE:e.right})}}}};n.metadata={optional:!0},n.Program=function(e,t,n,r){this.traverse(f,r)},n.pre=function(e){e.set("helperGenerator",function(t){return e.addImport("babel-runtime/helpers/"+t,t)}),e.setDynamic("coreIdentifier",function(){return e.addImport("babel-runtime/core-js","core") }),e.setDynamic("regeneratorIdentifier",function(){return e.addImport("babel-runtime/regenerator","regeneratorRuntime")})},n.Identifier=function(e,t,n,r){return this.isReferencedIdentifier({name:"regeneratorRuntime"})?r.get("regeneratorIdentifier"):void 0}},{"../../../types":153,"../../../util":157,"core-js/library":209,"lodash/collection/includes":319,"lodash/object/has":405}],130:[function(e,t,n){"use strict";function r(e,t,n,r){var l=e.body[0];u.isExpressionStatement(l)&&u.isLiteral(l.expression,{value:"use strict"})&&r.set("existingStrictDirective",e.body.shift())}function l(){this.skip()}function i(){return u.identifier("undefined")}function s(e,t,n,r){if(u.isIdentifier(e.callee,{name:"eval"}))throw r.errorWithNode(e,o.get("evalInStrictMode"))}var a=function(e){return e&&e.__esModule?e:{"default":e}};n.Program=r,n.FunctionExpression=l,n.ThisExpression=i,n.CallExpression=s,n.__esModule=!0;var o=a(e("../../../messages")),u=a(e("../../../types"));n.FunctionDeclaration=l,n.Class=l},{"../../../messages":43,"../../../types":153}],131:[function(e,t,n){"use strict";function r(e,t,n){for(var r=0;r<t[e].length;r++){var l=t[e][r];if(a.isFunctionDeclaration(l)){var i=a.variableDeclaration("let",[a.variableDeclarator(l.id,a.toExpression(l))]);i._blockHoist=2,l.id=null,t[e][r]=i,n.checkNode(i)}}}function l(e,t,n,l){a.isFunction(t)&&t.body===e||a.isExportDeclaration(t)||r("body",e,l)}function i(e,t,n,l){r("consequent",e,l)}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.BlockStatement=l,n.SwitchCase=i,n.__esModule=!0;var a=s(e("../../../types"))},{"../../../types":153}],132:[function(e,t,n){"use strict";n.__esModule=!0;var r=e("../../helpers/name-method");n.FunctionExpression=r.bare,n.ArrowFunctionExpression=r.bare},{"../../helpers/name-method":57}],133:[function(e,t,n){"use strict";function r(e){return c.isLiteral(c.toComputedKey(e,e.key),{value:"__proto__"})}function l(e){var t=e.left;return c.isMemberExpression(t)&&c.isLiteral(c.toComputedKey(t,t.property),{value:"__proto__"})}function i(e,t,n){return c.expressionStatement(c.callExpression(n.addHelper("defaults"),[t,e.right]))}function s(e,t,n,r){if(l(e)){var s=[],a=e.left.object,o=n.generateMemoisedReference(a);return s.push(c.expressionStatement(c.assignmentExpression("=",o,a))),s.push(i(e,o,r)),o&&s.push(o),s}}function a(e,t,n,r){var s=e.expression;if(c.isAssignmentExpression(s,{operator:"="}))return l(s)?i(s,s.left.object,r):void 0}function o(e,t,n,l){for(var i,s=0;s<e.properties.length;s++){var a=e.properties[s];r(a)&&(i=a.value,d(e.properties,a))}if(i){var o=[c.objectExpression([]),i];return e.properties.length&&o.push(e),c.callExpression(l.addHelper("extends"),o)}}var u=function(e){return e&&e.__esModule?e["default"]:e},p=function(e){return e&&e.__esModule?e:{"default":e}};n.AssignmentExpression=s,n.ExpressionStatement=a,n.ObjectExpression=o,n.__esModule=!0;var c=p(e("../../../types")),d=u(e("lodash/array/pull")),f={secondPass:!0,optional:!0};n.metadata=f},{"../../../types":153,"lodash/array/pull":313}],134:[function(e,t,n){"use strict";function r(e){return"undefined"===e.name&&this.isReferenced()?i.unaryExpression("void",i.literal(0),!0):void 0}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.Identifier=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0,react:!0};n.metadata=s},{"../../../types":153}],135:[function(e,t,n){"use strict";function r(e){if(s.isBlockStatement(e)){for(var t=!1,n=0;n<e.body.length;n++){var r=e.body[n];s.isBlockScoped(r)&&(t=!0)}if(!t)return e.body}return e}function l(e){var t=this.get("test").evaluateTruthy();return t===!0?e.consequent:t===!1?e.alternate:void 0}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.ConditionalExpression=l,n.__esModule=!0;var s=i(e("../../../types")),a={optional:!0};n.metadata=a;var o={exit:function(e){var t=e.consequent,n=e.alternate,l=this.get("test").evaluateTruthy();return l===!0?r(t):l===!1?n?r(n):this.remove():(s.isBlockStatement(n)&&!n.body.length&&(n=e.alternate=null),void(s.isBlockStatement(t)&&!t.body.length&&s.isBlockStatement(n)&&n.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=s.unaryExpression("!",test,!0))))}};n.IfStatement=o},{"../../../types":153}],136:[function(e,t,n){(function(t){"use strict";function r(e){if(a(e.object)){var n=this.toComputedKey();if(i.isLiteral(n))return i.valueToNode(t.env[n.value])}}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.MemberExpression=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0};n.metadata=s;var a=i.buildMatchMemberExpression("process.env")}).call(this,e("_process"))},{"../../../types":153,_process:183}],137:[function(e,t,n){"use strict";function r(){var e=this.evaluate();return e.confident?s.valueToNode(e.value):void 0}function l(){}var i=function(e){return e&&e.__esModule?e:{"default":e}};n.Expression=r,n.Identifier=l,n.__esModule=!0;var s=i(e("../../../types")),a={optional:!0};n.metadata=a},{"../../../types":153}],138:[function(e,t,n){"use strict";function r(e,t){this.get("callee").matchesPattern("console",!0)&&(i.isExpressionStatement(t)?this.parentPath.remove():this.remove())}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.CallExpression=r,n.__esModule=!0;var i=l(e("../../../types")),s={optional:!0};n.metadata=s},{"../../../types":153}],139:[function(e,t,n){"use strict";function r(){this.get("expression").isIdentifier({name:"debugger"})&&this.remove()}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.ExpressionStatement=r,n.__esModule=!0;var i=(l(e("../../../types")),{optional:!0});n.metadata=i},{"../../../types":153}],140:[function(e,t,n){"use strict";function r(e,t){if(o.isLiteral(e)){var n=e.value,r=n.toLowerCase();if("react"===r&&n!==r)throw t.errorWithNode(e,a.get("didYouMean","react"))}}function l(e,t,n,l){this.get("callee").isIdentifier({name:"require"})&&1===e.arguments.length&&r(e.arguments[0],l)}function i(e,t,n,l){r(e.source,l)}var s=function(e){return e&&e.__esModule?e:{"default":e}};n.CallExpression=l,n.ModuleDeclaration=i,n.__esModule=!0;var a=s(e("../../../messages")),o=s(e("../../../types"))},{"../../../messages":43,"../../../types":153}],141:[function(e,t,n){"use strict";function r(e,t,n,r){if(this.isReferenced()&&!n.hasBinding(e.name)){var l,i=n.getAllBindings(),o=-1;for(var u in i){var p=s(e.name,u);0>=p||p>3||o>=p||(l=u,o=p)}var c;throw c=l?a.get("undeclaredVariableSuggestion",e.name,l):a.get("undeclaredVariable",e.name),r.errorWithNode(e,c,ReferenceError)}}var l=function(e){return e&&e.__esModule?e:{"default":e}},i=function(e){return e&&e.__esModule?e["default"]:e};n.Identifier=r,n.__esModule=!0;var s=i(e("leven")),a=l(e("../../../messages")),o={optional:!0};n.metadata=o},{"../../../messages":43,leven:307}],142:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("../types")),i=function(){function e(t){var n=t.identifier,l=t.scope,i=t.path,s=t.kind;r(this,e),this.identifier=n,this.constant=!0,this.scope=l,this.path=i,this.kind=s}return e.prototype.setTypeAnnotation=function(){var e=this.path.getTypeAnnotation();this.typeAnnotationInferred=e.inferred,this.typeAnnotation=e.annotation},e.prototype.isTypeGeneric=function(){var e;return(e=this.path).isTypeGeneric.apply(e,arguments)},e.prototype.assignTypeGeneric=function(e,t){var n=null;t&&(t=l.typeParameterInstantiation(t)),this.assignType(l.genericTypeAnnotation(l.identifier(e),n))},e.prototype.assignType=function(e){this.typeAnnotation=e},e.prototype.reassign=function(){this.constant=!1,this.typeAnnotationInferred&&(this.typeAnnotation=null)},e.prototype.isCompatibleWithType=function(){return!1},e}();t.exports=i},{"../types":153}],143:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("./path")),s=(r(e("lodash/array/compact")),n(e("../types")),function(){function e(t,n,r,i){l(this,e),this.parentPath=i,this.scope=t,this.state=r,this.opts=n}return e.prototype.create=function(e,t,n){return i.get(this.parentPath,this,e,t,n)},e.prototype.visitMultiple=function(e,t){if(0===e.length)return!1;for(var n=[],r=this.queue=[],l=!1,i=0;i<e.length;i++)e[i]&&r.push(this.create(t,e,i));for(var i=0;i<r.length;i++){var s=r[i];if(!(n.indexOf(s.node)>=0)&&(n.push(s.node),s.visit())){l=!0;break}}for(var i=0;i<r.length;i++);return l},e.prototype.visitSingle=function(e,t){return this.create(e,e,t).visit()},e.prototype.visit=function(e,t){var n=e[t];if(n)return Array.isArray(n)?this.visitMultiple(n,e,t):this.visitSingle(e,t)},e}());t.exports=s},{"../types":153,"./path":148,"lodash/array/compact":310}],144:[function(e,t){"use strict";function n(e,t,r,l,i){if(e){if(!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error("Must pass a scope and parentPath unless traversing a Program/File got a "+e.type+" node");if(t||(t={}),t.enter||(t.enter=function(){}),t.exit||(t.exit=function(){}),Array.isArray(e))for(var s=0;s<e.length;s++)n.node(e[s],t,r,l,i);else n.node(e,t,r,l,i)}}function r(e){for(var t=0;t<p.length;t++){var n=p[t];null!=e[n]&&(e[n]=null)}for(var n in e){var r=e[n];Array.isArray(r)&&delete r._paths}}function l(e,t,n,r){e.type===r.type&&(r.has=!0,this.skip())}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};t.exports=n;var a=s(e("./context")),o=s(e("lodash/collection/includes")),u=i(e("../types"));n.node=function(e,t,n,r,l){var i=u.VISITOR_KEYS[e.type];if(i)for(var s=new a(n,t,r,l),o=0;o<i.length;o++)if(s.visit(e,i[o]))return};var p=["trailingComments","leadingComments","extendedRange","_declarations","_scopeInfo","_paths","tokens","range","start","end","loc","raw"],c={noScope:!0,exit:r};n.removeProperties=function(e){return n(e,c),r(e),e},n.explode=function(e){for(var t in e){var n=e[t],r=u.FLIPPED_ALIAS_KEYS[t];if(r)for(var l=0;l<r.length;l++){var i=e,s=r[l];i[s]||(i[s]=n)}}return e},n.hasType=function(e,t,r,i){if(o(i,e.type))return!1;if(e.type===r)return!0;var s={has:!1,type:r};return n(e,{blacklist:i,enter:l},t,s),s.has}},{"../types":153,"./context":143,"lodash/collection/includes":319}],145:[function(e,t,n){"use strict";function r(){var e,t=this.node;if(this.isMemberExpression())e=t.property;else{if(!this.isProperty())throw new ReferenceError("todo");e=t.key}return t.computed||i.isIdentifier(e)&&(e=i.literal(e.name)),e}var l=function(e){return e&&e.__esModule?e:{"default":e}};n.toComputedKey=r,n.__esModule=!0;var i=l(e("../../types"))},{"../../types":153}],146:[function(e,t,n){"use strict";function r(){var e=this.evaluate();return e.confident?!!e.value:void 0}function l(){function e(n){if(t){var r=n.node;if(n.isSequenceExpression()){var l=n.get("expressions");return e(l[l.length-1])}if(n.isLiteral()&&(!r.regex||null!==r.value))return r.value;if(n.isConditionalExpression())return e(e(n.get("test"))?n.get("consequent"):n.get("alternate"));if(n.isIdentifier({name:"undefined"}))return void 0;if(n.isIdentifier()||n.isMemberExpression())return n=n.resolve(),n?e(n):t=!1;if(n.isUnaryExpression({prefix:!0})){var i=e(n.get("argument"));switch(r.operator){case"void":return void 0;case"!":return!i;case"+":return+i;case"-":return-i}}if(n.isArrayExpression()||n.isObjectExpression(),n.isLogicalExpression()){var s=e(n.get("left")),a=e(n.get("right"));switch(r.operator){case"||":return s||a;case"&&":return s&&a}}if(n.isBinaryExpression()){var s=e(n.get("left")),a=e(n.get("right"));switch(r.operator){case"-":return s-a;case"+":return s+a;case"/":return s/a;case"*":return s*a;case"%":return s%a;case"<":return a>s;case">":return s>a;case"<=":return a>=s;case">=":return s>=a;case"==":return s==a;case"!=":return s!=a;case"===":return s===a;case"!==":return s!==a}}t=!1}}var t=!0,n=e(this);return t||(n=void 0),{confident:t,value:n}}n.evaluateTruthy=r,n.evaluate=l,n.__esModule=!0},{}],147:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=n(e("../../transformation/helpers/react")),i=n(e("../../types")),s={enter:function(e,t,n,r){if((!this.isJSXIdentifier()||!l.isCompatTag(e.name))&&(this.isJSXIdentifier()||this.isIdentifier())&&this.isReferenced()){var i=n.getBinding(e.name);if(i!==r.scope.getBinding(e.name))return;i&&i.constant?r.bindings[e.name]=i:(n.dump(),r.foundIncompatible=!0,this.stop())}}},a=function(){function e(t,n){r(this,e),this.foundIncompatible=!1,this.bindings={},this.scope=n,this.scopes=[],this.path=t}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var n=this.bindings[t];if(!e.bindingIdentifierEquals(t,n.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;this.scopes.push(e)}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this.scopes,t=e.pop();return t.path.isFunction()?this.hasNonParamBindings()?this.getNextScopeStatementParent():t.path.get("body").get("body")[0]:t.path.isProgram()?this.getNextScopeStatementParent():void 0},e.prototype.getNextScopeStatementParent=function(){var e=this.scopes.pop();return e?e.path.getStatementParent():void 0},e.prototype.hasNonParamBindings=function(){for(var e in this.bindings){var t=this.bindings[e];if("param"!==t.kind)return!0}return!1},e.prototype.run=function(){if(this.path.traverse(s,this),!this.foundIncompatible){this.getCompatibleScopes();var e=this.getAttachmentPath();if(e){var t=e.scope.generateUidIdentifier("ref");e.insertBefore([i.variableDeclaration("var",[i.variableDeclarator(t,this.path.node)])]),this.path.replaceWith(t)}}},e}();t.exports=a},{"../../transformation/helpers/react":58,"../../types":153}],148:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(){function e(e,t){for(var n in t){var r=t[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=r(e("./hoister")),a=r(e("lodash/lang/isBoolean")),o=r(e("lodash/lang/isNumber")),u=(r(e("lodash/lang/isRegExp")),r(e("lodash/lang/isString"))),p=r(e("../index")),c=r(e("lodash/collection/includes")),d=r(e("lodash/object/assign")),f=(r(e("lodash/object/extend")),r(e("../scope"))),h=n(e("../../types")),m={enter:function(e,t,n){if(this.isFunction())return this.skip();if(this.isVariableDeclaration()&&"var"===e.kind){var r=this.getBindingIdentifiers();for(var l in r)n.push({id:r[l]});for(var i=[],s=0;s<e.declarations.length;s++){var a=e.declarations[s];a.init&&i.push(h.expressionStatement(h.assignmentExpression("=",a.id,a.init)))}return i}}},g=function(){function e(t,n){i(this,e),this.container=n,this.parent=t,this.data={}}return e.get=function(t,n,r,l,i,s){for(var a,o,u=l[i],p=(a=l,!a._paths&&(a._paths=[]),a._paths),c=0;c<p.length;c++){var d=p[c];if(d.node===u){o=d;break}}return o||(o=new e(r,l),p.push(o)),o.setContext(t,n,i,s),o},e.getScope=function(e,t,n){var r=t;return e.isScope()&&(r=new f(e,t,n)),r},e.prototype.queueNode=function(e){this.context&&this.context.queue.push(e)},e.prototype.insertBefore=function(e){if(e=this._verifyNodeList(e),this.checkNodes(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isPreviousType("Statement"))if(this._maybePopFromStatements(e),Array.isArray(this.container))this._containerInsertBefore(e);else{if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this.container[this.key]=h.blockStatement(e)}else{if(!this.isPreviousType("Expression"))throw new Error("No clue what to do with this node type.");this.node&&e.push(this.node),this.replaceExpressionWithStatements(e)}},e.prototype._containerInsert=function(e,t){this.updateSiblingKeys(e,t.length);for(var n=0;n<t.length;n++){var r=e+n;this.container.splice(r,0,t[n]),this.context&&this.queueNode(this.context.create(this.parent,this.container,r))}},e.prototype._containerInsertBefore=function(e){this._containerInsert(this.key,e)},e.prototype._containerInsertAfter=function(e){this._containerInsert(this.key+1,e)},e.prototype._maybePopFromStatements=function(e){var t=e[e.length-1];h.isExpressionStatement(t)&&h.isIdentifier(t.expression)&&e.pop()},e.prototype.isStatementOrBlock=function(){return h.isLabeledStatement(this.parent)||h.isBlockStatement(this.container)?!1:c(h.STATEMENT_OR_BLOCK_KEYS,this.key)},e.prototype.insertAfter=function(e){if(e=this._verifyNodeList(e),this.checkNodes(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isPreviousType("Statement"))if(this._maybePopFromStatements(e),Array.isArray(this.container))this._containerInsertAfter(e);else{if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this.container[this.key]=h.blockStatement(e)}else{if(!this.isPreviousType("Expression"))throw new Error("No clue what to do with this node type.");if(this.node){var t=this.scope.generateTemp();e.unshift(h.expressionStatement(h.assignmentExpression("=",t,this.node))),e.push(h.expressionStatement(t))}this.replaceExpressionWithStatements(e)}},e.prototype.updateSiblingKeys=function(e,t){for(var n=this.container._paths,r=0;r<n.length;r++){var l=n[r];l.key>=e&&(l.key+=t)}},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e,t){var n=this.data[e];return!n&&t&&(n=this.data[e]=t),n},e.prototype.setScope=function(t){this.scope=e.getScope(this,this.context&&this.context.scope,t)},e.prototype.clearContext=function(){this.context=null},e.prototype.setContext=function(e,t,n,r){this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.parentPath=e||this.parentPath,this.key=n,t&&(this.context=t,this.state=t.state,this.opts=t.opts),this.type=this.node&&this.node.type,this.setScope(r)},e.prototype._remove=function(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this.container[this.key]=null},e.prototype.remove=function(){var e=!1;return this.parentPath&&(e||(e=this.parentPath.isExpressionStatement()),e||(e=this.parentPath.isSequenceExpression()&&1===this.parent.expressions.length),e)?this.parentPath.remove():(this._remove(),void(this.removed=!0))},e.prototype.skip=function(){this.shouldSkip=!0},e.prototype.stop=function(){this.shouldStop=!0,this.shouldSkip=!0},e.prototype.errorWithNode=function(e){var t=void 0===arguments[1]?SyntaxError:arguments[1],n=this.node.loc.start,r=new t("Line "+n.line+": "+e);return r.loc=n,r},e.prototype.replaceInline=function(e){return Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.remove()):this.replaceWithMultiple(e):this.replaceWith(e)},e.prototype._verifyNodeList=function(e){e.constructor!==Array&&(e=[e]);for(var t=0;t<e.length;t++){var n=e[t];if(!n)throw new Error("Node list has falsy node with the index of "+t);if("object"!=typeof n)throw new Error("Node list contains a non-object node with the index of "+t);if(!n.type)throw new Error("Node list contains a node without a type with the index of "+t)}return e},e.prototype.replaceWithMultiple=function(e){e=this._verifyNodeList(e),h.inheritsComments(e[0],this.node),this.container[this.key]=null,this.insertAfter(e),this.node||this.remove()},e.prototype.replaceWith=function(e,t){if(this.removed)throw new Error("You can't replace this node, we've already removed it");if(!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(Array.isArray(e)){if(t)return this.replaceWithMultiple(e);throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`")}if(this.isPreviousType("Expression")&&h.isStatement(e))return this.replaceExpressionWithStatements([e]);var n=this.node;n&&h.inheritsComments(e,n),this.container[this.key]=e,this.type=e.type,this.setScope(),this.checkNodes([e])},e.prototype.checkNodes=function(e){var t=this.scope,n=t&&t.file;if(n)for(var r=0;r<e.length;r++)n.checkNode(e[r],t)},e.prototype.getStatementParent=function(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e},e.prototype.getLastStatements=function(){var e=[],t=function(t){t&&(e=e.concat(t.getLastStatements()))};return this.isIfStatement()?(t(this.get("consequent")),t(this.get("alternate"))):this.isDoExpression()?t(this.get("body")):this.isProgram()||this.isBlockStatement()?t(this.get("body").pop()):e.push(this),e},e.prototype.replaceExpressionWithStatements=function(e){var t=h.toSequenceExpression(e,this.scope);if(t)return this.replaceWith(t);var n=h.functionExpression(null,[],h.blockStatement(e));n.shadow=!0;for(var r=this.getLastStatements(),l=0;l<r.length;l++){var i=r[l];i.isExpressionStatement()&&i.replaceWith(h.returnStatement(i.node.expression))}return this.replaceWith(h.callExpression(n,[])),this.traverse(m),this.node},e.prototype.call=function(e){var t=this.node;if(t){var n=this.opts,r=n[e]||n;n[t.type]&&(r=n[t.type][e]||r);var l=r.call(this,t,this.parent,this.scope,this.state);l&&this.replaceWith(l,!0)}},e.prototype.isBlacklisted=function(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1},e.prototype.visit=function(){if(this.isBlacklisted())return!1;if(this.call("enter"),this.shouldSkip)return this.shouldStop;var e=this.node,t=this.opts;if(e)if(Array.isArray(e))for(var n=0;n<e.length;n++)p.node(e[n],t,this.scope,this.state,this);else p.node(e,t,this.scope,this.state,this),this.call("exit");return this.shouldStop},e.prototype.getSibling=function(t){return e.get(this.parentPath,null,this.parent,this.container,t,this.file)},e.prototype.get=function(t){var n=this,r=t.split(".");if(1===r.length){var l=this.node,i=l[t];return Array.isArray(i)?i.map(function(t,r){return e.get(n,null,l,i,r)}):e.get(this,null,l,l,t)}for(var s=this,a=0;a>r.length;a++){var o=r[a];s="."===o?s.parentPath:s.get(r[a])}return s},e.prototype.has=function(e){return!!this.node[e]},e.prototype.is=function(e){return this.has(e)},e.prototype.isnt=function(e){return!this.has(e)},e.prototype.getTypeAnnotation=function(){if(this.typeInfo)return this.typeInfo;var e=this.typeInfo={inferred:!1,annotation:null},t=this.node.typeAnnotation;return t||(e.inferred=!0,t=this.inferType(this)),t&&(h.isTypeAnnotation(t)&&(t=t.typeAnnotation),e.annotation=t),e},e.prototype.resolve=function(){if(this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve()}else{if(this.isIdentifier()){var e=this.scope.getBinding(this.node.name);if(!e||!e.constant)return;return e.path===this?this:e.path.resolve()}if(!this.isMemberExpression())return this;var t=this.toComputedKey();if(!h.isLiteral(t))return;var n=t.value,r=this.get("object").resolve();if(!r||!r.isObjectExpression())return;for(var l=r.get("properties"),i=0;i<l.length;i++){var s=l[i];if(s.isProperty()){var a=s.get("key"),o=s.isnt("computed")&&a.isIdentifier({name:n});if(o||(o=a.isLiteral({value:n})),o)return s.get("value")}}}},e.prototype.inferType=function(e){if(e=e.resolve()){if(e.isRestElement()||e.parentPath.isRestElement()||e.isArrayExpression())return h.genericTypeAnnotation(h.identifier("Array"));if(e.parentPath.isTypeCastExpression())return e.parentPath.node.typeAnnotation;if(e.isTypeCastExpression())return e.node.typeAnnotation;if(e.isObjectExpression())return h.genericTypeAnnotation(h.identifier("Object"));if(e.isFunction())return h.identifier("Function");if(e.isLiteral()){var t=e.node.value;if(u(t))return h.stringTypeAnnotation();if(o(t))return h.numberTypeAnnotation();if(a(t))return h.booleanTypeAnnotation()}if(e.isCallExpression()){var n=e.get("callee").resolve();if(n&&n.isFunction())return n.node.returnType}}},e.prototype.isScope=function(){return h.isScope(this.node,this.parent)},e.prototype.isReferencedIdentifier=function(e){return h.isReferencedIdentifier(this.node,this.parent,e)},e.prototype.isReferenced=function(){return h.isReferenced(this.node,this.parent)},e.prototype.isBlockScoped=function(){return h.isBlockScoped(this.node)},e.prototype.isVar=function(){return h.isVar(this.node)},e.prototype.isPreviousType=function(e){return h.isType(this.type,e)},e.prototype.isTypeGeneric=function(e){var t=void 0===arguments[1]?{}:arguments[1],n=this.getTypeAnnotation(),r=n.annotation;return r?r.inferred&&t.inference===!1?!1:h.isGenericTypeAnnotation(r)&&h.isIdentifier(r.id,{name:e})?t.requireTypeParameters&&!r.typeParameters?!1:!0:!1:!1},e.prototype.getBindingIdentifiers=function(){return h.getBindingIdentifiers(this.node)},e.prototype.traverse=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t){p(this.node,e,this.scope,t,this)}),e.prototype.hoist=function(){var e=void 0===arguments[0]?this.scope:arguments[0],t=new s(this,e);return t.run()},e.prototype.matchesPattern=function(e,t){var n=e.split(".");if(!this.isMemberExpression())return!1;for(var r=[this.node],l=0;r.length;){var i=r.shift();if(t&&l===n.length)return!0;if(h.isIdentifier(i)){if(n[l]!==i.name)return!1}else{if(!h.isLiteral(i)){if(h.isMemberExpression(i)){if(i.computed&&!h.isLiteral(i.property))return!1;r.push(i.object),r.push(i.property);continue}return!1}if(n[l]!==i.value)return!1}if(++l>n.length)return!1}return!0},l(e,{node:{get:function(){return this.removed?null:this.container[this.key]},set:function(){throw new Error("Don't use `path.node = newNode;`, use `path.replaceWith(newNode)` or `path.replaceWithMultiple([newNode])`")}}}),e}();t.exports=g,d(g.prototype,e("./evaluation")),d(g.prototype,e("./conversion"));for(var y=0;y<h.TYPES.length;y++)!function(){var e=h.TYPES[y],t="is"+e;g.prototype[t]=function(e){return h[t](this.node,e)}}()},{"../../types":153,"../index":144,"../scope":149,"./conversion":145,"./evaluation":146,"./hoister":147,"lodash/collection/includes":319,"lodash/lang/isBoolean":391,"lodash/lang/isNumber":395,"lodash/lang/isRegExp":398,"lodash/lang/isString":399,"lodash/object/assign":402,"lodash/object/extend":404}],149:[function(e,t){"use strict";var n=function(e){return e&&e.__esModule?e:{"default":e}},r=function(e){return e&&e.__esModule?e["default"]:e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(e("lodash/collection/includes")),s=r(e("./index")),a=r(e("lodash/object/defaults")),o=n(e("../messages")),u=r(e("./binding")),p=r(e("globals")),c=r(e("lodash/array/flatten")),d=r(e("lodash/object/extend")),f=r(e("../helpers/object")),h=r(e("lodash/collection/each")),m=n(e("../types")),g={enter:function(e,t,n,r){var l=this;return m.isFor(e)&&h(m.FOR_INIT_KEYS,function(e){var t=l.get(e);t.isVar()&&r.scope.registerBinding("var",t)}),this.isFunction()?this.skip():void(r.blockId&&e===r.blockId||this.isBlockScoped()||this.isExportDeclaration()&&m.isDeclaration(e.declaration)||this.isDeclaration()&&r.scope.registerDeclaration(this))}},y={enter:function(e,t,n,r){m.isReferencedIdentifier(e,t)&&!n.hasBinding(e.name)?r.addGlobal(e):m.isLabeledStatement(e)?r.addGlobal(e):m.isAssignmentExpression(e)?n.registerConstantViolation(this.get("left"),this.get("right")):m.isUpdateExpression(e)?n.registerConstantViolation(this.get("argument"),null):m.isUnaryExpression(e)&&"delete"===e.operator&&n.registerConstantViolation(this.get("left"),null)}},b={enter:function(e,t,n,r){(this.isFunctionDeclaration()||this.isBlockScoped())&&r.registerDeclaration(this),this.isScope()&&this.skip()}},v=function(){function e(t,n,r){if(l(this,e),n&&n.block===t.node)return n;var i=t.getData("scope");return i&&i.parent===n?i:(t.setData("scope",this),this.parent=n,this.file=n?n.file:r,this.parentBlock=t.parent,this.block=t.node,this.path=t,void this.crawl())}return e.globals=c([p.builtin,p.browser,p.node].map(Object.keys)),e.contextVariables=["this","arguments","super"],e.prototype.traverse=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e,t,n){s(e,t,this,n,this.path)}),e.prototype.generateTemp=function(){var e=void 0===arguments[0]?"temp":arguments[0],t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(e){return m.identifier(this.generateUid(e))},e.prototype.generateUid=function(e){e=m.toIdentifier(e).replace(/^_+/,"");var t,n=0;do t=this._generateUid(e,n),n++;while(this.hasBinding(t)||this.hasGlobal(t)||this.hasUid(t));return this.file.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var n=e;return t>1&&(n+=t),"_"+n},e.prototype.hasUid=function(e){var t=this;do{if(t.file.uids[e])return!0;t=t.parent}while(t);return!1},e.prototype.generateUidBasedOnNode=function(e,t){var n=e;m.isAssignmentExpression(e)?n=e.left:m.isVariableDeclarator(e)?n=e.id:m.isProperty(n)&&(n=n.key);var r=[],l=function(e){var t=function(){return e.apply(this,arguments)};return t.toString=function(){return e.toString()},t}(function(e){if(m.isModuleDeclaration(e))if(e.specifiers&&e.specifiers.length)for(var t=0;t<e.specifiers.length;t++)l(e.specifiers[t]);else l(e.source);else if(m.isModuleSpecifier(e))l(e.local);else if(m.isMemberExpression(e))l(e.object),l(e.property);else if(m.isIdentifier(e))r.push(e.name);else if(m.isLiteral(e))r.push(e.value);else if(m.isCallExpression(e))l(e.callee);else if(m.isObjectExpression(e)||m.isObjectPattern(e))for(var t=0;t<e.properties.length;t++){var n=e.properties[t];l(n.key||n.argument)}});l(n);var i=r.join("$");return i=i.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(i)},e.prototype.generateMemoisedReference=function(e,t){if(m.isThisExpression(e)||m.isSuper(e))return null;if(m.isIdentifier(e)&&this.hasBinding(e.name))return null;var n=this.generateUidBasedOnNode(e);return t||this.push({id:n}),n},e.prototype.checkBlockScopedCollisions=function(e,t,n){var r=this.getOwnBindingInfo(t);if(r&&"param"!==e&&!("hoisted"===e&&"let"===r.kind||"let"!==r.kind&&"const"!==r.kind&&"module"!==r.kind&&"param"!==r.kind))throw this.file.errorWithNode(n,o.get("scopeDuplicateDeclaration",t),TypeError)},e.prototype.rename=function(e,t,n){t||(t=this.generateUidIdentifier(e).name);var r=this.getBinding(e);if(r){var l=r.identifier,i=r.scope;i.traverse(n||i.block,{enter:function(n,r,i){if(m.isReferencedIdentifier(n,r)&&n.name===e)n.name=t;else if(m.isDeclaration(n)){var s=this.getBindingIdentifiers();for(var a in s)a===e&&(s[a].name=t)}else this.isScope()&&(i.bindingIdentifierEquals(e,l)||this.skip())}}),n||(i.removeOwnBinding(e),i.bindings[t]=r,l.name=t)}},e.prototype.dump=function(){var e=this;do console.log(e.block.type,"Bindings:",Object.keys(e.bindings));while(e=e.parent);console.log("-------------")},e.prototype.toArray=function(e,t){var n=this.file;if(m.isIdentifier(e)){var r=this.getBinding(e.name);if(r&&r.isTypeGeneric("Array",{inference:!1}))return e}if(m.isArrayExpression(e))return e;if(m.isIdentifier(e,{name:"arguments"}))return m.callExpression(m.memberExpression(n.addHelper("slice"),m.identifier("call")),[e]);var l="to-array",i=[e];return t===!0?l="to-consumable-array":t&&(i.push(m.literal(t)),l="sliced-to-array",this.file.isLoose("es6.forOf")&&(l+="-loose")),m.callExpression(n.addHelper(l),i)},e.prototype.registerDeclaration=function(e){var t=e.node;if(m.isFunctionDeclaration(t))this.registerBinding("hoisted",e);else if(m.isVariableDeclaration(t))for(var n=e.get("declarations"),r=0;r<n.length;r++)this.registerBinding(t.kind,n[r]); else m.isClassDeclaration(t)?this.registerBinding("let",e):m.isImportDeclaration(t)||m.isExportDeclaration(t)?this.registerBinding("module",e):this.registerBinding("unknown",e)},e.prototype.registerConstantViolation=function(e,t){var n=e.getBindingIdentifiers();for(var r in n){var l=this.getBinding(r);if(l){if(t){var i=t.typeAnnotation;if(i&&l.isCompatibleWithType(i))continue}l.reassign()}}},e.prototype.registerBinding=function(e,t){if(!e)throw new ReferenceError("no `kind`");var n=t.getBindingIdentifiers();for(var r in n){var l=n[r];this.checkBlockScopedCollisions(e,r,l),this.bindings[r]=new u({identifier:l,scope:this,path:t,kind:e})}},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasGlobal=function(e){var t=this;do if(t.globals[e])return!0;while(t=t.parent);return!1},e.prototype.recrawl=function(){this.path.setData("scopeInfo",null),this.crawl()},e.prototype.crawl=function(){var e=this.path,t=this.block._scopeInfo;if(t)return d(this,t);if(t=this.block._scopeInfo={bindings:f(),globals:f()},d(this,t),e.isLoop())for(var n=0;n<m.FOR_INIT_KEYS.length;n++){var r=e.get(m.FOR_INIT_KEYS[n]);r.isBlockScoped()&&this.registerBinding("let",r)}if(e.isFunctionExpression()&&e.has("id")&&(m.isProperty(e.parent,{method:!0})||this.registerBinding("var",e.get("id"))),e.isClass()&&e.has("id")&&this.registerBinding("var",e.get("id")),e.isFunction()){for(var l=e.get("params"),n=0;n<l.length;n++)this.registerBinding("param",l[n]);this.traverse(e.get("body").node,b,this)}(e.isBlockStatement()||e.isProgram())&&this.traverse(e.node,b,this),e.isCatchClause()&&this.registerBinding("let",e.get("param")),e.isComprehensionExpression()&&this.registerBinding("let",e),(e.isProgram()||e.isFunction())&&this.traverse(e.node,g,{blockId:e.get("id").node,scope:this}),e.isProgram()&&this.traverse(e.node,y,this)},e.prototype.push=function(e){var t=this.block;(m.isLoop(t)||m.isCatchClause(t)||m.isFunction(t))&&(m.ensureBlock(t),t=t.body),m.isBlockStatement(t)||m.isProgram(t)||(t=this.getBlockParent().block);var n=t;n._declarations||(n._declarations={}),t._declarations[e.key||e.id.name]={kind:e.kind||"var",id:e.id,init:e.init}},e.prototype.getFunctionParent=function(){for(var e=this;e.parent&&!m.isFunction(e.block);)e=e.parent;return e},e.prototype.getBlockParent=function(){for(var e=this;e.parent&&!m.isFunction(e.block)&&!m.isLoop(e.block)&&!m.isFunction(e.block);)e=e.parent;return e},e.prototype.getAllBindings=function(){var e=f(),t=this;do a(e,t.bindings),t=t.parent;while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=f(),t=0;t<arguments.length;t++){var n=arguments[t],r=this;do{for(var l in r.bindings){var i=r.bindings[l];i.kind===n&&(e[l]=i)}r=r.parent}while(r)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.getBinding=function(e){var t=this;do{var n=t.getOwnBindingInfo(e);if(n)return n}while(t=t.parent)},e.prototype.getOwnBindingInfo=function(e){return this.bindings[e]},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBindingInfo(e)},e.prototype.hasBinding=function(t){return t?this.hasOwnBinding(t)?!0:this.parentHasBinding(t)?!0:this.file.uids[t]?!0:i(e.globals,t)?!0:i(e.contextVariables,t)?!0:!1:!1},e.prototype.parentHasBinding=function(e){return this.parent&&this.parent.hasBinding(e)},e.prototype.removeOwnBinding=function(e){this.bindings[e]=null},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e)},e}();t.exports=v},{"../helpers/object":41,"../messages":43,"../types":153,"./binding":142,"./index":144,globals:302,"lodash/array/flatten":311,"lodash/collection/each":316,"lodash/collection/includes":319,"lodash/object/defaults":403,"lodash/object/extend":404}],150:[function(e,t){t.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement","Loop","While","Scopable"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement","Loop","While","Scopable"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ImportSpecifier:["ModuleSpecifier"],ExportSpecifier:["ModuleSpecifier"],ImportDefaultSpecifier:["ModuleSpecifier"],ExportDefaultSpecifier:["ModuleSpecifier"],ExportNamespaceSpecifier:["ModuleSpecifier"],ExportDefaultFromSpecifier:["ModuleSpecifier"],ExportAllDeclaration:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],ExportDefaultDeclaration:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],ExportNamedDeclaration:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],ImportDeclaration:["Statement","Declaration","ModuleDeclaration"],ArrowFunctionExpression:["Scopable","Function","Expression"],FunctionDeclaration:["Scopable","Function","Statement","Declaration"],FunctionExpression:["Scopable","Function","Expression"],BlockStatement:["Scopable","Statement"],Program:["Scopable"],CatchClause:["Scopable"],LogicalExpression:["Binary","Expression"],BinaryExpression:["Binary","Expression"],UnaryExpression:["UnaryLike","Expression"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Scopable","Class","Statement","Declaration"],ClassExpression:["Scopable","Class","Expression"],ForOfStatement:["Scopable","Statement","For","Loop"],ForInStatement:["Scopable","Statement","For","Loop"],ForStatement:["Scopable","Statement","For","Loop"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],AssignmentPattern:["Pattern"],Property:["UserWhitespacable"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression","Scopable"],ConditionalExpression:["Expression"],DoExpression:["Expression"],Identifier:["Expression"],Literal:["Expression"],MemberExpression:["Expression"],MetaProperty:["Expression"],NewExpression:["Expression"],ObjectExpression:["Expression"],SequenceExpression:["Expression"],TaggedTemplateExpression:["Expression"],ThisExpression:["Expression"],Super:["Expression"],UpdateExpression:["Expression"],JSXEmptyExpression:["Expression"],JSXMemberExpression:["Expression"],YieldExpression:["Expression"],AnyTypeAnnotation:["Flow"],ArrayTypeAnnotation:["Flow"],BooleanTypeAnnotation:["Flow"],ClassImplements:["Flow"],DeclareClass:["Flow"],DeclareFunction:["Flow"],DeclareModule:["Flow"],DeclareVariable:["Flow"],FunctionTypeAnnotation:["Flow"],FunctionTypeParam:["Flow"],GenericTypeAnnotation:["Flow"],InterfaceExtends:["Flow"],InterfaceDeclaration:["Flow"],IntersectionTypeAnnotation:["Flow"],NullableTypeAnnotation:["Flow"],NumberTypeAnnotation:["Flow"],StringLiteralTypeAnnotation:["Flow"],StringTypeAnnotation:["Flow"],TupleTypeAnnotation:["Flow"],TypeofTypeAnnotation:["Flow"],TypeAlias:["Flow"],TypeAnnotation:["Flow"],TypeCastExpression:["Flow"],TypeParameterDeclaration:["Flow"],TypeParameterInstantiation:["Flow"],ObjectTypeAnnotation:["Flow"],ObjectTypeCallProperty:["Flow","UserWhitespacable"],ObjectTypeIndexer:["Flow","UserWhitespacable"],ObjectTypeProperty:["Flow","UserWhitespacable"],QualifiedTypeIdentifier:["Flow"],UnionTypeAnnotation:["Flow"],VoidTypeAnnotation:["Flow"],JSXAttribute:["JSX","Immutable"],JSXClosingElement:["JSX","Immutable"],JSXElement:["JSX","Immutable","Expression"],JSXEmptyExpression:["JSX","Immutable"],JSXExpressionContainer:["JSX","Immutable"],JSXIdentifier:["JSX"],JSXMemberExpression:["JSX"],JSXNamespacedName:["JSX"],JSXOpeningElement:["JSX","Immutable"],JSXSpreadAttribute:["JSX"]}},{}],151:[function(e,t){t.exports={ArrayExpression:{elements:null},ArrowFunctionExpression:{params:null,body:null},AssignmentExpression:{operator:null,left:null,right:null},BinaryExpression:{operator:null,left:null,right:null},BlockStatement:{body:null},CallExpression:{callee:null,arguments:null},ConditionalExpression:{test:null,consequent:null,alternate:null},ExpressionStatement:{expression:null},File:{program:null,comments:null,tokens:null},FunctionExpression:{id:null,params:null,body:null,generator:!1,async:!1},FunctionDeclaration:{id:null,params:null,body:null,generator:!1},GenericTypeAnnotation:{id:null,typeParameters:null},Identifier:{name:null},IfStatement:{test:null,consequent:null,alternate:null},ImportDeclaration:{specifiers:null,source:null},ImportSpecifier:{local:null,imported:null},LabeledStatement:{label:null,body:null},Literal:{value:null},LogicalExpression:{operator:null,left:null,right:null},MemberExpression:{object:null,property:null,computed:!1},MethodDefinition:{key:null,value:null,kind:"method",computed:!1,"static":!1},NewExpression:{callee:null,arguments:null},ObjectExpression:{properties:null},Program:{body:null},Property:{kind:null,key:null,value:null,computed:!1},ReturnStatement:{argument:null},SequenceExpression:{expressions:null},TemplateLiteral:{quasis:null,expressions:null},ThrowExpression:{argument:null},UnaryExpression:{operator:null,argument:null,prefix:null},VariableDeclaration:{kind:null,declarations:null},VariableDeclarator:{id:null,init:null},WithStatement:{object:null,body:null},YieldExpression:{argument:null,delegate:null}}},{}],152:[function(e,t,n){"use strict";function r(e){var t=void 0===arguments[1]?e.key||e.property:arguments[1];return function(){return e.computed||v.isIdentifier(t)&&(t=v.literal(t.name)),t}()}function l(e,t){function n(e){for(var t=!1,i=[],s=0;s<e.length;s++){var a=e[s];if(v.isExpression(a))i.push(a);else if(v.isExpressionStatement(a))i.push(a.expression);else{if(v.isVariableDeclaration(a)){if("var"!==a.kind)return l=!0;b(a.declarations,function(e){var t=v.getBindingIdentifiers(e);for(var n in t)r.push({kind:a.kind,id:t[n]});e.init&&i.push(v.assignmentExpression("=",e.id,e.init))}),t=!0;continue}if(v.isIfStatement(a)){var o=a.consequent?n([a.consequent]):v.identifier("undefined"),u=a.alternate?n([a.alternate]):v.identifier("undefined");if(!o||!u)return l=!0;i.push(v.conditionalExpression(a.test,o,u))}else{if(!v.isBlockStatement(a))return l=!0;i.push(n(a.body))}}t=!1}return t&&i.push(v.identifier("undefined")),1===i.length?i[0]:v.sequenceExpression(i)}var r=[],l=!1,i=n(e);if(!l){for(var s=0;s<r.length;s++)t.push(r[s]);return i}}function i(e){var t=void 0===arguments[1]?e.key:arguments[1];return function(){var n;return n=v.isIdentifier(t)?t.name:JSON.stringify(v.isLiteral(t)?t.value:y.removeProperties(v.cloneDeep(t))),e.computed&&(n="["+n+"]"),n}()}function s(e){return v.isIdentifier(e)?e.name:(e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),v.isValidIdentifier(e)||(e="_"+e),e||"_")}function a(e,t){if(v.isStatement(e))return e;var n,r=!1;if(v.isClass(e))r=!0,n="ClassDeclaration";else if(v.isFunction(e))r=!0,n="FunctionDeclaration";else if(v.isAssignmentExpression(e))return v.expressionStatement(e);if(r&&!e.id&&(n=!1),!n){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=n,e}function o(e){if(v.isExpressionStatement(e)&&(e=e.expression),v.isClass(e)?e.type="ClassExpression":v.isFunction(e)&&(e.type="FunctionExpression"),v.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")}function u(e,t){return v.isBlockStatement(e)?e:(v.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(v.isStatement(e)||(e=v.isFunction(t)?v.returnStatement(e):v.expressionStatement(e)),e=[e]),v.blockStatement(e))}function p(e){if(void 0===e)return v.identifier("undefined");if(e===!0||e===!1||null===e||g(e)||h(e)||m(e))return v.literal(e);if(Array.isArray(e))return v.arrayExpression(e.map(v.valueToNode));if(f(e)){var t=[];for(var n in e){var r;r=v.isValidIdentifier(n)?v.identifier(n):v.literal(n),t.push(v.property("init",r,v.valueToNode(e[n])))}return v.objectExpression(t)}throw new Error("don't know how to turn this value into a node")}var c=function(e){return e&&e.__esModule?e:{"default":e}},d=function(e){return e&&e.__esModule?e["default"]:e};n.toComputedKey=r,n.toSequenceExpression=l,n.toKeyAlias=i,n.toIdentifier=s,n.toStatement=a,n.toExpression=o,n.toBlock=u,n.valueToNode=p,n.__esModule=!0;var f=d(e("lodash/lang/isPlainObject")),h=d(e("lodash/lang/isNumber")),m=d(e("lodash/lang/isRegExp")),g=d(e("lodash/lang/isString")),y=d(e("../traversal")),b=d(e("lodash/collection/each")),v=c(e("./index"))},{"../traversal":144,"./index":153,"lodash/collection/each":316,"lodash/lang/isNumber":395,"lodash/lang/isPlainObject":397,"lodash/lang/isRegExp":398,"lodash/lang/isString":399}],153:[function(e,t,n){"use strict";function r(e,t){var n=_["is"+e]=function(n,r){return _.is(e,n,r,t)};_["assert"+e]=function(t,r){if(r||(r={}),!n(t,r))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(r))}}function l(e,t,n){if(!t)return!1;var r=i(t.type,e);return r?"undefined"==typeof n?!0:_.shallowEqual(t,n):!1}function i(e,t){if(e===t)return!0;var n=_.FLIPPED_ALIAS_KEYS[t];return n?n.indexOf(e)>-1:!1}function s(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var l=n[r];if(e[l]!==t[l])return!1}return!0}function a(e,t,n){return e.object=_.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!n,e}function o(e,t){return e.object=_.memberExpression(t,e.object),e}function u(e){var t=void 0===arguments[1]?"body":arguments[1];return e[t]=_.toBlock(e[t],e)}function p(e){var t={};for(var n in e)"_"!==n[0]&&(t[n]=e[n]);return t}function c(e){var t={};for(var n in e)if("_"!==n[0]){var r=e[n];r&&(r.type?r=_.cloneDeep(r):Array.isArray(r)&&(r=r.map(_.cloneDeep))),t[n]=r}return t}function d(e,t){var n=e.split(".");return function(e){if(!_.isMemberExpression(e))return!1;for(var r=[e],l=0;r.length;){var i=r.shift();if(t&&l===n.length)return!0;if(_.isIdentifier(i)){if(n[l]!==i.name)return!1}else{if(!_.isLiteral(i)){if(_.isMemberExpression(i)){if(i.computed&&!_.isLiteral(i.property))return!1;r.push(i.object),r.push(i.property);continue}return!1}if(n[l]!==i.value)return!1}if(++l>n.length)return!1}return!0}}function f(e){return x(A,function(t){delete e[t]}),e}function h(e,t){return e&&t&&x(A,function(n){e[n]=E(b([].concat(e[n],t[n])))}),e}function m(e,t){return e&&t?(e._declarations=t._declarations,e._scopeInfo=t._scopeInfo,e.range=t.range,e.start=t.start,e.loc=t.loc,e.end=t.end,e.typeAnnotation=t.typeAnnotation,e.returnType=t.returnType,_.inheritsComments(e,t),e):e}var g=function(e){return e&&e.__esModule?e["default"]:e};n.is=l,n.isType=i,n.shallowEqual=s,n.appendToMemberExpression=a,n.prependToMemberExpression=o,n.ensureBlock=u,n.clone=p,n.cloneDeep=c,n.buildMatchMemberExpression=d,n.removeComments=f,n.inheritsComments=h,n.inherits=m,n.__esModule=!0;var y=g(e("to-fast-properties")),b=g(e("lodash/array/compact")),v=g(e("lodash/object/assign")),x=g(e("lodash/collection/each")),E=g(e("lodash/array/uniq")),_=n,S=["consequent","body","alternate"];n.STATEMENT_OR_BLOCK_KEYS=S;var I=["Array","Object","Number","Boolean","Date","Array","String","Promise","Set","Map","WeakMap","WeakSet","Uint16Array","ArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Uint32Array","Int32Array","Float32Array","Int16Array","Float64Array"];n.NATIVE_TYPE_NAMES=I;var w=["body","expressions"];n.FLATTENABLE_KEYS=w;var k=["left","init"];n.FOR_INIT_KEYS=k;var A=["leadingComments","trailingComments"];n.COMMENT_KEYS=A;var C=e("./visitor-keys");n.VISITOR_KEYS=C;var T=e("./builder-keys");n.BUILDER_KEYS=T;var j=e("./alias-keys");n.ALIAS_KEYS=j,_.FLIPPED_ALIAS_KEYS={},x(_.VISITOR_KEYS,function(e,t){r(t,!0)}),x(_.ALIAS_KEYS,function(e,t){x(e,function(e){var n,r,l=(n=_.FLIPPED_ALIAS_KEYS,r=e,!n[r]&&(n[r]=[]),n[r]);l.push(t)})}),x(_.FLIPPED_ALIAS_KEYS,function(e,t){_[t.toUpperCase()+"_TYPES"]=e,r(t,!1)});var M=Object.keys(_.VISITOR_KEYS).concat(Object.keys(_.FLIPPED_ALIAS_KEYS));n.TYPES=M,x(_.VISITOR_KEYS,function(e,t){if(!_.BUILDER_KEYS[t]){var n={};x(e,function(e){n[e]=null}),_.BUILDER_KEYS[t]=n}}),x(_.BUILDER_KEYS,function(e,t){_[t[0].toLowerCase()+t.slice(1)]=function(){var n={};n.start=null,n.type=t;var r=0;for(var l in e){var i=arguments[r++];void 0===i&&(i=e[l]),n[l]=i}return n}}),y(_),y(_.VISITOR_KEYS),n.__esModule=!0,v(_,e("./retrievers")),v(_,e("./validators")),v(_,e("./converters"))},{"./alias-keys":150,"./builder-keys":151,"./converters":152,"./retrievers":154,"./validators":155,"./visitor-keys":156,"lodash/array/compact":310,"lodash/array/uniq":314,"lodash/collection/each":316,"lodash/object/assign":402,"to-fast-properties":450}],154:[function(e,t,n){"use strict";function r(e){for(var t=[].concat(e),n=a();t.length;){var r=t.shift();if(r){var l=o.getBindingIdentifiers.keys[r.type];if(o.isIdentifier(r))n[r.name]=r;else if(o.isExportDeclaration(r))o.isDeclaration(e.declaration)&&t.push(e.declaration);else if(l)for(var i=0;i<l.length;i++){var s=l[i];t=t.concat(r[s]||[])}}}return n}function l(e){var t=[],n=function(e){t=t.concat(l(e))};return o.isIfStatement(e)?(n(e.consequent),n(e.alternate)):o.isFor(e)||o.isWhile(e)?n(e.body):o.isProgram(e)||o.isBlockStatement(e)?n(e.body[e.body.length-1]):o.isLoop()||e&&t.push(e),t}var i=function(e){return e&&e.__esModule?e:{"default":e}},s=function(e){return e&&e.__esModule?e["default"]:e};n.getBindingIdentifiers=r,n.getLastStatements=l,n.__esModule=!0;var a=s(e("../helpers/object")),o=i(e("./index"));r.keys={UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],VariableDeclarator:["id"],FunctionDeclaration:["id"],FunctionExpression:["id"],ClassDeclaration:["id"],ClassExpression:["id"],SpreadElement:["argument"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],ComprehensionBlock:["left"],AssignmentPattern:["left"],ComprehensionExpression:["blocks"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]}},{"../helpers/object":41,"./index":153}],155:[function(e,t,n){"use strict";function r(e,t){switch(t.type){case"MemberExpression":return t.property===e&&t.computed?!0:t.object===e?!0:!1;case"MetaProperty":return!1;case"Property":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var n=0;n<t.params.length;n++){var r=t.params[n];if(r===e)return!1}return t.id!==e;case"ExportSpecifier":return t.exported!==e;case"ImportSpecifier":return t.imported!==e;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"MethodDefinition":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1;case"ImportSpecifier":return!1;case"ImportNamespaceSpecifier":return!1}return!0}function l(e,t,n){return(g.isIdentifier(e,n)||g.isJSXIdentifier(e,n))&&g.isReferenced(e,t)}function i(e){return h(e)&&m.keyword.isIdentifierName(e)&&!m.keyword.isReservedWordES6(e,!0)}function s(e){return g.isVariableDeclaration(e)&&("var"!==e.kind||e._let)}function a(e){return g.isFunctionDeclaration(e)||g.isClassDeclaration(e)||g.isLet(e)}function o(e){return g.isVariableDeclaration(e,{kind:"var"})&&!e._let}function u(e){return g.isImportDefaultSpecifier(e)||g.isExportDefaultSpecifier(e)||g.isIdentifier(e.imported||e.exported,{name:"default"})}function p(e,t){return g.isBlockStatement(e)&&g.isFunction(t,{body:e})?!1:g.isScopable(e)}function c(e){return g.isType(e.type,"Immutable")?!0:g.isLiteral(e)?e.regex?!1:!0:g.isIdentifier(e)&&"undefined"===e.name?!0:!1}var d=function(e){return e&&e.__esModule?e:{"default":e}},f=function(e){return e&&e.__esModule?e["default"]:e};n.isReferenced=r,n.isReferencedIdentifier=l,n.isValidIdentifier=i,n.isLet=s,n.isBlockScoped=a,n.isVar=o,n.isSpecifierDefault=u,n.isScope=p,n.isImmutable=c,n.__esModule=!0;var h=f(e("lodash/lang/isString")),m=f(e("esutils")),g=d(e("./index"))},{"./index":153,esutils:300,"lodash/lang/isString":399}],156:[function(e,t){t.exports={ArrayExpression:["elements"],ArrayPattern:["elements","typeAnnotation"],ArrowFunctionExpression:["params","body","returnType"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass","typeParameters","superTypeParameters","implements"],ClassExpression:["id","body","superClass","typeParameters","superTypeParameters","implements"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],Decorator:["expression"],DebuggerStatement:[],DoWhileStatement:["body","test"],DoExpression:["body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation"],IfStatement:["test","consequent","alternate"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["imported","local"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties","typeAnnotation"],Program:["body"],Property:["key","value"],RestElement:["argument","typeAnnotation"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],Super:[],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"],ExportAllDeclaration:["source","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportDefaultSpecifier:["exported"],ExportNamespaceSpecifier:["exported"],ExportSpecifier:["local","exported"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],ClassImplements:["id","typeParameters"],ClassProperty:["key","value","typeAnnotation"],DeclareClass:["id","typeParameters","extends","body"],DeclareFunction:["id"],DeclareModule:["id","body"],DeclareVariable:["id"],FunctionTypeAnnotation:["typeParameters","params","rest","returnType"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],IntersectionTypeAnnotation:["types"],NullableTypeAnnotation:["typeAnnotation"],NumberTypeAnnotation:[],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],TupleTypeAnnotation:["types"],TypeofTypeAnnotation:["argument"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],ObjectTypeAnnotation:["properties","indexers","callProperties"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value"],ObjectTypeProperty:["key","value"],QualifiedTypeIdentifier:["id","qualification"],UnionTypeAnnotation:["types"],VoidTypeAnnotation:[],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","closingElement","children"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"]}},{}],157:[function(e,t,n){(function(t,r){"use strict";function l(e,t){var n=t||l.EXTENSIONS,r=T.extname(e);return _(n,r)}function i(t){try{return e.resolve(t)}catch(n){return null}}function s(e){R||(R=new k,R.paths=k._nodeModulePaths(t.cwd()));try{return k._resolveFilename(e,R)}catch(n){return null}}function a(e){return e?e.split(","):[]}function o(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(g).join("|"),"i")),I(e))return E.makeRe(e,{nocase:!0});if(w(e))return e;throw new TypeError("illegal type for regexify")}function u(e,t){if(!e)return[];if(v(e))return u([e],t);if(I(e))return u(a(e),t);if(Array.isArray(e))return t&&(e=e.map(t)),e;throw new TypeError("illegal type for arrayify")}function p(e){return"true"===e?!0:"false"===e?!1:e}function c(e,t,r){var l=n.templates[e];if(!l)throw new ReferenceError("unknown template "+e);if(t===!0&&(r=!0,t=null),l=b(l),A(t)||S(l,N,null,t),l.body.length>1)return l.body;var i=l.body[0];return!r&&L.isExpressionStatement(i)?i.expression:i}function d(e,t){var n=C({filename:e,looseModules:!0},t).program;return n=S.removeProperties(n)}function f(){var e={},t=T.join(r,"transformation/templates");if(!P.existsSync(t))throw new ReferenceError(x.get("missingTemplatesDirectory"));return j(P.readdirSync(t),function(n){if("."!==n[0]){var r=T.basename(n,T.extname(n)),l=T.join(t,n),i=P.readFileSync(l,"utf8");e[r]=d(l,i)}}),e}var h=function(e){return e&&e.__esModule?e:{"default":e}},m=function(e){return e&&e.__esModule?e["default"]:e};n.canCompile=l,n.resolve=i,n.resolveRelative=s,n.list=a,n.regexify=o,n.arrayify=u,n.booleanify=p,n.template=c,n.parseTemplate=d,n.__esModule=!0,e("./patch");var g=m(e("lodash/string/escapeRegExp")),y=m(e("debug/node")),b=m(e("lodash/lang/cloneDeep")),v=m(e("lodash/lang/isBoolean")),x=h(e("./messages")),E=m(e("minimatch")),_=m(e("lodash/collection/contains")),S=m(e("./traversal")),I=m(e("lodash/lang/isString")),w=m(e("lodash/lang/isRegExp")),k=m(e("module")),A=m(e("lodash/lang/isEmpty")),C=m(e("./helpers/parse")),T=m(e("path")),j=m(e("lodash/collection/each")),M=m(e("lodash/object/has")),P=m(e("fs")),L=h(e("./types")),O=e("util");n.inherits=O.inherits,n.inspect=O.inspect;var D=y("babel");n.debug=D,l.EXTENSIONS=[".js",".jsx",".es6",".es"];var R,N={enter:function(e,t,n,r){L.isExpressionStatement(e)&&(e=e.expression),L.isIdentifier(e)&&M(r,e.name)&&(this.skip(),this.replaceInline(r[e.name]))}};try{n.templates=e("../../templates.json")}catch(F){if("MODULE_NOT_FOUND"!==F.code)throw F;n.templates=f()}}).call(this,e("_process"),"/lib/babel")},{"../../templates.json":453,"./helpers/parse":42,"./messages":43,"./patch":44,"./traversal":144,"./types":153,_process:183,"debug/node":293,fs:172,"lodash/collection/contains":315,"lodash/collection/each":316,"lodash/lang/cloneDeep":388,"lodash/lang/isBoolean":391,"lodash/lang/isEmpty":392,"lodash/lang/isRegExp":398,"lodash/lang/isString":399,"lodash/object/has":405,"lodash/string/escapeRegExp":410,minimatch:414,module:172,path:182,util:199}],158:[function(e){var t=e("../lib/types"),n=t.Type,r=n.def,l=n.or,i=t.builtInTypes,s=i.string,a=i.number,o=i.boolean,u=i.RegExp,p=e("../lib/shared"),c=p.defaults,d=p.geq;r("Printable").field("loc",l(r("SourceLocation"),null),c["null"],!0),r("Node").bases("Printable").field("type",s).field("comments",l([r("Comment")],null),c["null"],!0),r("SourceLocation").build("start","end","source").field("start",r("Position")).field("end",r("Position")).field("source",l(s,null),c["null"]),r("Position").build("line","column").field("line",d(1)).field("column",d(0)),r("Program").bases("Node").build("body").field("body",[r("Statement")]),r("Function").bases("Node").field("id",l(r("Identifier"),null),c["null"]).field("params",[r("Pattern")]).field("body",l(r("BlockStatement"),r("Expression"))),r("Statement").bases("Node"),r("EmptyStatement").bases("Statement").build(),r("BlockStatement").bases("Statement").build("body").field("body",[r("Statement")]),r("ExpressionStatement").bases("Statement").build("expression").field("expression",r("Expression")),r("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",r("Expression")).field("consequent",r("Statement")).field("alternate",l(r("Statement"),null),c["null"]),r("LabeledStatement").bases("Statement").build("label","body").field("label",r("Identifier")).field("body",r("Statement")),r("BreakStatement").bases("Statement").build("label").field("label",l(r("Identifier"),null),c["null"]),r("ContinueStatement").bases("Statement").build("label").field("label",l(r("Identifier"),null),c["null"]),r("WithStatement").bases("Statement").build("object","body").field("object",r("Expression")).field("body",r("Statement")),r("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",r("Expression")).field("cases",[r("SwitchCase")]).field("lexical",o,c["false"]),r("ReturnStatement").bases("Statement").build("argument").field("argument",l(r("Expression"),null)),r("ThrowStatement").bases("Statement").build("argument").field("argument",r("Expression")),r("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",r("BlockStatement")).field("handler",l(r("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[r("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[r("CatchClause")],c.emptyArray).field("finalizer",l(r("BlockStatement"),null),c["null"]),r("CatchClause").bases("Node").build("param","guard","body").field("param",r("Pattern")).field("guard",l(r("Expression"),null),c["null"]).field("body",r("BlockStatement")),r("WhileStatement").bases("Statement").build("test","body").field("test",r("Expression")).field("body",r("Statement")),r("DoWhileStatement").bases("Statement").build("body","test").field("body",r("Statement")).field("test",r("Expression")),r("ForStatement").bases("Statement").build("init","test","update","body").field("init",l(r("VariableDeclaration"),r("Expression"),null)).field("test",l(r("Expression"),null)).field("update",l(r("Expression"),null)).field("body",r("Statement")),r("ForInStatement").bases("Statement").build("left","right","body","each").field("left",l(r("VariableDeclaration"),r("Expression"))).field("right",r("Expression")).field("body",r("Statement")).field("each",o),r("DebuggerStatement").bases("Statement").build(),r("Declaration").bases("Statement"),r("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",r("Identifier")),r("FunctionExpression").bases("Function","Expression").build("id","params","body"),r("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",l("var","let","const")).field("declarations",[l(r("VariableDeclarator"),r("Identifier"))]),r("VariableDeclarator").bases("Node").build("id","init").field("id",r("Pattern")).field("init",l(r("Expression"),null)),r("Expression").bases("Node","Pattern"),r("ThisExpression").bases("Expression").build(),r("ArrayExpression").bases("Expression").build("elements").field("elements",[l(r("Expression"),null)]),r("ObjectExpression").bases("Expression").build("properties").field("properties",[r("Property")]),r("Property").bases("Node").build("kind","key","value").field("kind",l("init","get","set")).field("key",l(r("Literal"),r("Identifier"))).field("value",l(r("Expression"),r("Pattern"))),r("SequenceExpression").bases("Expression").build("expressions").field("expressions",[r("Expression")]); var f=l("-","+","!","~","typeof","void","delete");r("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",f).field("argument",r("Expression")).field("prefix",o,c["true"]);var h=l("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");r("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",r("Expression")).field("right",r("Expression"));var m=l("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");r("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",m).field("left",r("Pattern")).field("right",r("Expression"));var g=l("++","--");r("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",g).field("argument",r("Expression")).field("prefix",o);var y=l("||","&&");r("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",y).field("left",r("Expression")).field("right",r("Expression")),r("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",r("Expression")).field("consequent",r("Expression")).field("alternate",r("Expression")),r("NewExpression").bases("Expression").build("callee","arguments").field("callee",r("Expression")).field("arguments",[r("Expression")]),r("CallExpression").bases("Expression").build("callee","arguments").field("callee",r("Expression")).field("arguments",[r("Expression")]),r("MemberExpression").bases("Expression").build("object","property","computed").field("object",r("Expression")).field("property",l(r("Identifier"),r("Expression"))).field("computed",o),r("Pattern").bases("Node"),r("ObjectPattern").bases("Pattern").build("properties").field("properties",[l(r("PropertyPattern"),r("Property"))]),r("PropertyPattern").bases("Pattern").build("key","pattern").field("key",l(r("Literal"),r("Identifier"))).field("pattern",r("Pattern")),r("ArrayPattern").bases("Pattern").build("elements").field("elements",[l(r("Pattern"),null)]),r("SwitchCase").bases("Node").build("test","consequent").field("test",l(r("Expression"),null)).field("consequent",[r("Statement")]),r("Identifier").bases("Node","Expression","Pattern").build("name").field("name",s),r("Literal").bases("Node","Expression").build("value").field("value",l(s,o,null,a,u)),r("Comment").bases("Printable").field("value",s).field("leading",o,c["true"]).field("trailing",o,c["false"]),r("Block").bases("Comment").build("value","leading","trailing"),r("Line").bases("Comment").build("value","leading","trailing")},{"../lib/shared":169,"../lib/types":170}],159:[function(e){e("./core");var t=e("../lib/types"),n=t.Type.def,r=t.Type.or,l=t.builtInTypes,i=l.string,s=l.boolean;n("XMLDefaultDeclaration").bases("Declaration").field("namespace",n("Expression")),n("XMLAnyName").bases("Expression"),n("XMLQualifiedIdentifier").bases("Expression").field("left",r(n("Identifier"),n("XMLAnyName"))).field("right",r(n("Identifier"),n("Expression"))).field("computed",s),n("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",r(n("Identifier"),n("Expression"))).field("computed",s),n("XMLAttributeSelector").bases("Expression").field("attribute",n("Expression")),n("XMLFilterExpression").bases("Expression").field("left",n("Expression")).field("right",n("Expression")),n("XMLElement").bases("XML","Expression").field("contents",[n("XML")]),n("XMLList").bases("XML","Expression").field("contents",[n("XML")]),n("XML").bases("Node"),n("XMLEscape").bases("XML").field("expression",n("Expression")),n("XMLText").bases("XML").field("text",i),n("XMLStartTag").bases("XML").field("contents",[n("XML")]),n("XMLEndTag").bases("XML").field("contents",[n("XML")]),n("XMLPointTag").bases("XML").field("contents",[n("XML")]),n("XMLName").bases("XML").field("contents",r(i,[n("XML")])),n("XMLAttribute").bases("XML").field("value",i),n("XMLCdata").bases("XML").field("contents",i),n("XMLComment").bases("XML").field("contents",i),n("XMLProcessingInstruction").bases("XML").field("target",i).field("contents",r(i,null))},{"../lib/types":170,"./core":158}],160:[function(e){e("./core");var t=e("../lib/types"),n=t.Type.def,r=t.Type.or,l=t.builtInTypes,i=l.boolean,s=(l.object,l.string),a=e("../lib/shared").defaults;n("Function").field("generator",i,a["false"]).field("expression",i,a["false"]).field("defaults",[r(n("Expression"),null)],a.emptyArray).field("rest",r(n("Identifier"),null),a["null"]),n("FunctionDeclaration").build("id","params","body","generator","expression"),n("FunctionExpression").build("id","params","body","generator","expression"),n("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,a["null"]).field("generator",!1,a["false"]),n("YieldExpression").bases("Expression").build("argument","delegate").field("argument",r(n("Expression"),null)).field("delegate",i,a["false"]),n("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",r(n("Expression"),null)),n("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",r(n("Expression"),null)),n("ComprehensionBlock").bases("Node").build("left","right","each").field("left",n("Pattern")).field("right",n("Expression")).field("each",i),n("ModuleSpecifier").bases("Literal").build("value").field("value",s),n("Property").field("key",r(n("Literal"),n("Identifier"),n("Expression"))).field("method",i,a["false"]).field("shorthand",i,a["false"]).field("computed",i,a["false"]),n("PropertyPattern").field("key",r(n("Literal"),n("Identifier"),n("Expression"))).field("computed",i,a["false"]),n("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",r("init","get","set","")).field("key",r(n("Literal"),n("Identifier"),n("Expression"))).field("value",n("Function")).field("computed",i,a["false"]),n("SpreadElement").bases("Node").build("argument").field("argument",n("Expression")),n("ArrayExpression").field("elements",[r(n("Expression"),n("SpreadElement"),null)]),n("NewExpression").field("arguments",[r(n("Expression"),n("SpreadElement"))]),n("CallExpression").field("arguments",[r(n("Expression"),n("SpreadElement"))]),n("SpreadElementPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("ArrayPattern").field("elements",[r(n("Pattern"),null,n("SpreadElement"))]);var o=r(n("MethodDefinition"),n("VariableDeclarator"),n("ClassPropertyDefinition"),n("ClassProperty"));n("ClassProperty").bases("Declaration").build("key").field("key",r(n("Literal"),n("Identifier"),n("Expression"))).field("computed",i,a["false"]),n("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",o),n("ClassBody").bases("Declaration").build("body").field("body",[o]),n("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",n("Identifier")).field("body",n("ClassBody")).field("superClass",r(n("Expression"),null),a["null"]),n("ClassExpression").bases("Expression").build("id","body","superClass").field("id",r(n("Identifier"),null),a["null"]).field("body",n("ClassBody")).field("superClass",r(n("Expression"),null),a["null"]).field("implements",[n("ClassImplements")],a.emptyArray),n("ClassImplements").bases("Node").build("id").field("id",n("Identifier")).field("superClass",r(n("Expression"),null),a["null"]),n("Specifier").bases("Node"),n("NamedSpecifier").bases("Specifier").field("id",n("Identifier")).field("name",r(n("Identifier"),null),a["null"]),n("ExportSpecifier").bases("NamedSpecifier").build("id","name"),n("ExportBatchSpecifier").bases("Specifier").build(),n("ImportSpecifier").bases("NamedSpecifier").build("id","name"),n("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",n("Identifier")),n("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",n("Identifier")),n("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",i).field("declaration",r(n("Declaration"),n("Expression"),null)).field("specifiers",[r(n("ExportSpecifier"),n("ExportBatchSpecifier"))],a.emptyArray).field("source",r(n("ModuleSpecifier"),null),a["null"]),n("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[r(n("ImportSpecifier"),n("ImportNamespaceSpecifier"),n("ImportDefaultSpecifier"))],a.emptyArray).field("source",n("ModuleSpecifier")),n("TaggedTemplateExpression").bases("Expression").field("tag",n("Expression")).field("quasi",n("TemplateLiteral")),n("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[n("TemplateElement")]).field("expressions",[n("Expression")]),n("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:s,raw:s}).field("tail",i)},{"../lib/shared":169,"../lib/types":170,"./core":158}],161:[function(e){e("./core");var t=e("../lib/types"),n=t.Type.def,r=t.Type.or,l=t.builtInTypes,i=l.boolean,s=e("../lib/shared").defaults;n("Function").field("async",i,s["false"]),n("SpreadProperty").bases("Node").build("argument").field("argument",n("Expression")),n("ObjectExpression").field("properties",[r(n("Property"),n("SpreadProperty"))]),n("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("ObjectPattern").field("properties",[r(n("PropertyPattern"),n("SpreadPropertyPattern"),n("Property"),n("SpreadProperty"))]),n("AwaitExpression").bases("Expression").build("argument","all").field("argument",r(n("Expression"),null)).field("all",i,s["false"])},{"../lib/shared":169,"../lib/types":170,"./core":158}],162:[function(e){e("./core");var t=e("../lib/types"),n=t.Type.def,r=t.Type.or,l=t.builtInTypes,i=l.string,s=l.boolean,a=e("../lib/shared").defaults;n("JSXAttribute").bases("Node").build("name","value").field("name",r(n("JSXIdentifier"),n("JSXNamespacedName"))).field("value",r(n("Literal"),n("JSXExpressionContainer"),null),a["null"]),n("JSXIdentifier").bases("Node").build("name").field("name",i),n("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",n("JSXIdentifier")).field("name",n("JSXIdentifier")),n("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",r(n("JSXIdentifier"),n("JSXMemberExpression"))).field("property",n("JSXIdentifier")).field("computed",s,a.false);var o=r(n("JSXIdentifier"),n("JSXNamespacedName"),n("JSXMemberExpression"));n("JSXSpreadAttribute").bases("Node").build("argument").field("argument",n("Expression"));var u=[r(n("JSXAttribute"),n("JSXSpreadAttribute"))];n("JSXExpressionContainer").bases("Expression").build("expression").field("expression",n("Expression")),n("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",n("JSXOpeningElement")).field("closingElement",r(n("JSXClosingElement"),null),a["null"]).field("children",[r(n("JSXElement"),n("JSXExpressionContainer"),n("JSXText"),n("Literal"))],a.emptyArray).field("name",o,function(){return this.openingElement.name}).field("selfClosing",s,function(){return this.openingElement.selfClosing}).field("attributes",u,function(){return this.openingElement.attributes}),n("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",o).field("attributes",u,a.emptyArray).field("selfClosing",s,a["false"]),n("JSXClosingElement").bases("Node").build("name").field("name",o),n("JSXText").bases("Literal").build("value").field("value",i),n("JSXEmptyExpression").bases("Expression").build(),n("Type").bases("Node"),n("AnyTypeAnnotation").bases("Type"),n("VoidTypeAnnotation").bases("Type"),n("NumberTypeAnnotation").bases("Type"),n("StringTypeAnnotation").bases("Type"),n("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",i).field("raw",i),n("BooleanTypeAnnotation").bases("Type"),n("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",n("Type")),n("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[n("FunctionTypeParam")]).field("returnType",n("Type")).field("rest",r(n("FunctionTypeParam"),null)).field("typeParameters",r(n("TypeParameterDeclaration"),null)),n("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",n("Identifier")).field("typeAnnotation",n("Type")).field("optional",s),n("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",n("Type")),n("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[n("ObjectTypeProperty")]).field("indexers",[n("ObjectTypeIndexer")],a.emptyArray).field("callProperties",[n("ObjectTypeCallProperty")],a.emptyArray),n("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",r(n("Literal"),n("Identifier"))).field("value",n("Type")).field("optional",s),n("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",n("Identifier")).field("key",n("Type")).field("value",n("Type")),n("ObjectTypeCallProperty").bases("Node").build("value").field("value",n("FunctionTypeAnnotation")).field("static",s,!1),n("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",r(n("Identifier"),n("QualifiedTypeIdentifier"))).field("id",n("Identifier")),n("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",r(n("Identifier"),n("QualifiedTypeIdentifier"))).field("typeParameters",r(n("TypeParameterInstantiation"),null)),n("MemberTypeAnnotation").bases("Type").build("object","property").field("object",n("Identifier")).field("property",r(n("MemberTypeAnnotation"),n("GenericTypeAnnotation"))),n("UnionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",n("Type")),n("Identifier").field("typeAnnotation",r(n("TypeAnnotation"),null),a["null"]),n("TypeParameterDeclaration").bases("Node").build("params").field("params",[n("Identifier")]),n("TypeParameterInstantiation").bases("Node").build("params").field("params",[n("Type")]),n("Function").field("returnType",r(n("TypeAnnotation"),null),a["null"]).field("typeParameters",r(n("TypeParameterDeclaration"),null),a["null"]),n("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",n("TypeAnnotation")).field("static",s,!1),n("ClassImplements").field("typeParameters",r(n("TypeParameterInstantiation"),null),a["null"]),n("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",n("Identifier")).field("typeParameters",r(n("TypeParameterDeclaration"),null),a["null"]).field("body",n("ObjectTypeAnnotation")).field("extends",[n("InterfaceExtends")]),n("InterfaceExtends").bases("Node").build("id").field("id",n("Identifier")).field("typeParameters",r(n("TypeParameterInstantiation"),null)),n("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",n("Identifier")).field("typeParameters",r(n("TypeParameterDeclaration"),null)).field("right",n("Type")),n("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",n("Expression")).field("typeAnnotation",n("TypeAnnotation")),n("TupleTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("DeclareVariable").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareFunction").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareClass").bases("InterfaceDeclaration").build("id"),n("DeclareModule").bases("Statement").build("id","body").field("id",r(n("Identifier"),n("Literal"))).field("body",n("BlockStatement"))},{"../lib/shared":169,"../lib/types":170,"./core":158}],163:[function(e){e("./core");var t=e("../lib/types"),n=t.Type.def,r=t.Type.or,l=e("../lib/shared").geq;n("ForOfStatement").bases("Statement").build("left","right","body").field("left",r(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("LetStatement").bases("Statement").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Statement")),n("LetExpression").bases("Expression").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Expression")),n("GraphExpression").bases("Expression").build("index","expression").field("index",l(0)).field("expression",n("Literal")),n("GraphIndexExpression").bases("Expression").build("index").field("index",l(0))},{"../lib/shared":169,"../lib/types":170,"./core":158}],164:[function(e,t){function n(e,t,n){return c.check(n)?n.length=0:n=null,l(e,t,n)}function r(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function l(e,t,n){return e===t?!0:c.check(e)?i(e,t,n):d.check(e)?s(e,t,n):f.check(e)?f.check(t)&&+e===+t:h.check(e)?h.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t}function i(e,t,n){c.assert(e);var r=e.length;if(!c.check(t)||t.length!==r)return n&&n.push("length"),!1;for(var i=0;r>i;++i){if(n&&n.push(i),i in e!=i in t)return!1;if(!l(e[i],t[i],n))return!1;n&&a.strictEqual(n.pop(),i)}return!0}function s(e,t,n){if(d.assert(e),!d.check(t))return!1;if(e.type!==t.type)return n&&n.push("type"),!1;var r=u(e),i=r.length,s=u(t),o=s.length;if(i===o){for(var c=0;i>c;++c){var f=r[c],h=p(e,f),g=p(t,f);if(n&&n.push(f),!l(h,g,n))return!1;n&&a.strictEqual(n.pop(),f)}return!0}if(!n)return!1;var y=Object.create(null);for(c=0;i>c;++c)y[r[c]]=!0;for(c=0;o>c;++c){if(f=s[c],!m.call(y,f))return n.push(f),!1;delete y[f]}for(f in y){n.push(f);break}return!1}var a=e("assert"),o=e("../main"),u=o.getFieldNames,p=o.getFieldValue,c=o.builtInTypes.array,d=o.builtInTypes.object,f=o.builtInTypes.Date,h=o.builtInTypes.RegExp,m=Object.prototype.hasOwnProperty;n.assert=function(e,t){var l=[];n(e,t,l)||(0===l.length?a.strictEqual(e,t):a.ok(!1,"Nodes differ in the following path: "+l.map(r).join("")))},t.exports=n},{"../main":171,assert:173}],165:[function(e,t){function n(e,t,r){o.ok(this instanceof n),h.call(this,e,t,r)}function r(e){return p.BinaryExpression.check(e)||p.LogicalExpression.check(e)}function l(e){return p.CallExpression.check(e)?!0:f.check(e)?e.some(l):p.Node.check(e)?u.someField(e,function(e,t){return l(t)}):!1}function i(e){for(var t,n;e.parent;e=e.parent){if(t=e.node,n=e.parent.node,p.BlockStatement.check(n)&&"body"===e.parent.name&&0===e.name)return o.strictEqual(n.body[0],t),!0;if(p.ExpressionStatement.check(n)&&"expression"===e.name)return o.strictEqual(n.expression,t),!0;if(p.SequenceExpression.check(n)&&"expressions"===e.parent.name&&0===e.name)o.strictEqual(n.expressions[0],t);else if(p.CallExpression.check(n)&&"callee"===e.name)o.strictEqual(n.callee,t);else if(p.MemberExpression.check(n)&&"object"===e.name)o.strictEqual(n.object,t);else if(p.ConditionalExpression.check(n)&&"test"===e.name)o.strictEqual(n.test,t);else if(r(n)&&"left"===e.name)o.strictEqual(n.left,t);else{if(!p.UnaryExpression.check(n)||n.prefix||"argument"!==e.name)return!1;o.strictEqual(n.argument,t)}}return!0}function s(e){if(p.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(p.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else p.IfStatement.check(e.node)&&a(e);return e}function a(e){var t=e.get("test").value,n=e.get("alternate").value,r=e.get("consequent").value;if(r||n){if(!r&&n){var l=c.unaryExpression("!",t,!0);p.UnaryExpression.check(t)&&"!"===t.operator&&(l=t.argument),e.get("test").replace(l),e.get("consequent").replace(n),e.get("alternate").replace()}}else{var i=c.expressionStatement(t);e.replace(i)}}var o=e("assert"),u=e("./types"),p=u.namedTypes,c=u.builders,d=u.builtInTypes.number,f=u.builtInTypes.array,h=e("./path"),m=e("./scope");e("util").inherits(n,h);var g=n.prototype;Object.defineProperties(g,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),g.replace=function(){return delete this.node,delete this.parent,delete this.scope,h.prototype.replace.apply(this,arguments)},g.prune=function(){var e=this.parent;return this.replace(),s(e)},g._computeNode=function(){var e=this.value;if(p.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},g._computeParent=function(){var e=this.value,t=this.parentPath;if(!p.Node.check(e)){for(;t&&!p.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!p.Node.check(t.value);)t=t.parentPath;return t||null},g._computeScope=function(){var e=this.value,t=this.parentPath,n=t&&t.scope;return p.Node.check(e)&&m.isEstablishedBy(e)&&(n=new m(this,n)),n||null},g.getValueProperty=function(e){return u.getFieldValue(this.value,e)},g.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var n=this.value;if(!p.Expression.check(n))return!1;if("Identifier"===n.type)return!1;for(;!p.Node.check(t.value);)if(t=t.parentPath,!t)return!1;var r=t.value;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===r.type&&"object"===this.name&&r.object===n;case"BinaryExpression":case"LogicalExpression":switch(r.type){case"CallExpression":return"callee"===this.name&&r.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&r.object===n;case"BinaryExpression":case"LogicalExpression":var i=r.operator,t=y[i],s=n.operator,a=y[s];if(t>a)return!0;if(t===a&&"right"===this.name)return o.strictEqual(r.right,n),!0;default:return!1}case"SequenceExpression":switch(r.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(r.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===r.type&&d.check(n.value)&&"object"===this.name&&r.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&r.callee===n;case"ConditionalExpression":return"test"===this.name&&r.test===n;case"MemberExpression":return"object"===this.name&&r.object===n;default:return!1}default:if("NewExpression"===r.type&&"callee"===this.name&&r.callee===n)return l(n)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var y={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){y[e]=t})}),g.canBeFirstInStatement=function(){var e=this.node;return!p.FunctionExpression.check(e)&&!p.ObjectExpression.check(e)},g.firstInStatement=function(){return i(this)},t.exports=n},{"./path":167,"./scope":168,"./types":170,assert:173,util:199}],166:[function(e,t){function n(){o.ok(this instanceof n),this._reusableContextStack=[],this._methodNameTable=r(this),this._shouldVisitComments=m.call(this._methodNameTable,"Block")||m.call(this._methodNameTable,"Line"),this.Context=s(this),this._visiting=!1,this._changeReported=!1}function r(e){var t=Object.create(null);for(var n in e)/^visit[A-Z]/.test(n)&&(t[n.slice("visit".length)]=!0);for(var r=u.computeSupertypeLookupTable(t),l=Object.create(null),t=Object.keys(r),i=t.length,s=0;i>s;++s){var a=t[s];n="visit"+r[a],h.check(e[n])&&(l[a]=n)}return l}function l(e,t){for(var n in t)m.call(t,n)&&(e[n]=t[n]);return e}function i(e,t){o.ok(e instanceof p),o.ok(t instanceof n);var r=e.value;if(d.check(r))e.each(t.visitWithoutReset,t);else if(f.check(r)){var l=u.getFieldNames(r);t._shouldVisitComments&&r.comments&&l.indexOf("comments")<0&&l.push("comments");for(var i=l.length,s=[],a=0;i>a;++a){var c=l[a];m.call(r,c)||(r[c]=u.getFieldValue(r,c)),s.push(e.get(c))}for(var a=0;i>a;++a)t.visitWithoutReset(s[a])}else;return e.value}function s(e){function t(r){o.ok(this instanceof t),o.ok(this instanceof n),o.ok(r instanceof p),Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=r,this.needToCallTraverse=!0,Object.seal(this)}o.ok(e instanceof n);var r=t.prototype=Object.create(e);return r.constructor=t,l(r,b),t}var a,o=e("assert"),u=e("./types"),p=e("./node-path"),c=u.namedTypes.Printable,d=u.builtInTypes.array,f=u.builtInTypes.object,h=u.builtInTypes.function,m=Object.prototype.hasOwnProperty;n.fromMethodsObject=function(e){function t(){o.ok(this instanceof t),n.call(this)}if(e instanceof n)return e;if(!f.check(e))return new n;var r=t.prototype=Object.create(g);return r.constructor=t,l(r,e),l(t,n),h.assert(t.fromMethodsObject),h.assert(t.visit),new t},n.visit=function(e,t){return n.fromMethodsObject(t).visit(e)};var g=n.prototype,y=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");g.visit=function(){o.ok(!this._visiting,y),this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,t=new Array(e),n=0;e>n;++n)t[n]=arguments[n];t[0]instanceof p||(t[0]=new p({root:t[0]}).get("root")),this.reset.apply(this,t);try{var r=this.visitWithoutReset(t[0]),l=!0}finally{if(this._visiting=!1,!l&&this._abortRequested)return t[0].value}return r},g.AbortRequest=function(){},g.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},g.reset=function(){},g.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);o.ok(e instanceof p);var t=e.value,n=c.check(t)&&this._methodNameTable[t.type];if(!n)return i(e,this);var r=this.acquireContext(e);try{return r.invokeVisitorMethod(n)}finally{this.releaseContext(r)}},g.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},g.releaseContext=function(e){o.ok(e instanceof this.Context),this._reusableContextStack.push(e),e.currentPath=null},g.reportChanged=function(){this._changeReported=!0},g.wasChangeReported=function(){return this._changeReported};var b=Object.create(null);b.reset=function(e){return o.ok(this instanceof this.Context),o.ok(e instanceof p),this.currentPath=e,this.needToCallTraverse=!0,this},b.invokeVisitorMethod=function(e){o.ok(this instanceof this.Context),o.ok(this.currentPath instanceof p);var t=this.visitor[e].call(this,this.currentPath);t===!1?this.needToCallTraverse=!1:t!==a&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),o.strictEqual(this.needToCallTraverse,!1,"Must either call this.traverse or return false in "+e);var n=this.currentPath;return n&&n.value},b.traverse=function(e,t){return o.ok(this instanceof this.Context),o.ok(e instanceof p),o.ok(this.currentPath instanceof p),this.needToCallTraverse=!1,i(e,n.fromMethodsObject(t||this.visitor))},b.visit=function(e,t){return o.ok(this instanceof this.Context),o.ok(e instanceof p),o.ok(this.currentPath instanceof p),this.needToCallTraverse=!1,n.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},b.reportChanged=function(){this.visitor.reportChanged()},b.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},t.exports=n},{"./node-path":165,"./types":170,assert:173}],167:[function(e,t){function n(e,t,r){o.ok(this instanceof n),t?o.ok(t instanceof n):(t=null,r=null),this.value=e,this.parentPath=t,this.name=r,this.__childCache=null}function r(e){return e.__childCache||(e.__childCache=Object.create(null))}function l(e,t){var n=r(e),l=e.getValueProperty(t),i=n[t];return p.call(n,t)&&i.value===l||(i=n[t]=new e.constructor(l,e,t)),i}function i(){}function s(e,t,n,l){if(d.assert(e.value),0===t)return i;var s=e.value.length;if(1>s)return i;var a=arguments.length;2===a?(n=0,l=s):3===a?(n=Math.max(n,0),l=s):(n=Math.max(n,0),l=Math.min(l,s)),f.assert(n),f.assert(l);for(var u=Object.create(null),c=r(e),h=n;l>h;++h)if(p.call(e.value,h)){var m=e.get(h);o.strictEqual(m.name,h);var g=h+t;m.name=g,u[g]=m,delete c[h]}return delete c.length,function(){for(var t in u){var n=u[t];o.strictEqual(n.name,+t),c[t]=n,e.value[t]=n.value}}}function a(e){o.ok(e instanceof n);var t=e.parentPath;if(!t)return e;var l=t.value,i=r(t);if(l[e.name]===e.value)i[e.name]=e;else if(d.check(l)){var s=l.indexOf(e.value);s>=0&&(i[e.name=s]=e)}else l[e.name]=e.value,i[e.name]=e;return o.strictEqual(l[e.name],e.value),o.strictEqual(e.parentPath.get(e.name),e),e}var o=e("assert"),u=Object.prototype,p=u.hasOwnProperty,c=e("./types"),d=c.builtInTypes.array,f=c.builtInTypes.number,h=Array.prototype,m=(h.slice,h.map,n.prototype);m.getValueProperty=function(e){return this.value[e]},m.get=function(){for(var e=this,t=arguments,n=t.length,r=0;n>r;++r)e=l(e,t[r]);return e},m.each=function(e,t){for(var n=[],r=this.value.length,l=0,l=0;r>l;++l)p.call(this.value,l)&&(n[l]=this.get(l));for(t=t||this,l=0;r>l;++l)p.call(n,l)&&e.call(t,n[l])},m.map=function(e,t){var n=[];return this.each(function(t){n.push(e.call(this,t))},t),n},m.filter=function(e,t){var n=[];return this.each(function(t){e.call(this,t)&&n.push(t)},t),n},m.shift=function(){var e=s(this,-1),t=this.value.shift();return e(),t},m.unshift=function(){var e=s(this,arguments.length),t=this.value.unshift.apply(this.value,arguments);return e(),t},m.push=function(){return d.assert(this.value),delete r(this).length,this.value.push.apply(this.value,arguments)},m.pop=function(){d.assert(this.value);var e=r(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},m.insertAt=function(e){var t=arguments.length,n=s(this,t-1,e);if(n===i)return this;e=Math.max(e,0);for(var r=1;t>r;++r)this.value[e+r-1]=arguments[r];return n(),this},m.insertBefore=function(){for(var e=this.parentPath,t=arguments.length,n=[this.name],r=0;t>r;++r)n.push(arguments[r]);return e.insertAt.apply(e,n)},m.insertAfter=function(){for(var e=this.parentPath,t=arguments.length,n=[this.name+1],r=0;t>r;++r)n.push(arguments[r]);return e.insertAt.apply(e,n)},m.replace=function(e){var t=[],n=this.parentPath.value,l=r(this.parentPath),i=arguments.length;if(a(this),d.check(n)){for(var u=n.length,p=s(this.parentPath,i-1,this.name+1),c=[this.name,1],f=0;i>f;++f)c.push(arguments[f]);var h=n.splice.apply(n,c);if(o.strictEqual(h[0],this.value),o.strictEqual(n.length,u-1+i),p(),0===i)delete this.value,delete l[this.name],this.__childCache=null;else{for(o.strictEqual(n[this.name],e),this.value!==e&&(this.value=e,this.__childCache=null),f=0;i>f;++f)t.push(this.parentPath.get(this.name+f));o.strictEqual(t[0],this)}}else 1===i?(this.value!==e&&(this.__childCache=null),this.value=n[this.name]=e,t.push(this)):0===i?(delete n[this.name],delete this.value,this.__childCache=null):o.ok(!1,"Could not replace path");return t},t.exports=n},{"./types":170,assert:173}],168:[function(e,t){function n(t,r){a.ok(this instanceof n),a.ok(t instanceof e("./node-path")),y.assert(t.value);var l;r?(a.ok(r instanceof n),l=r.depth+1):(r=null,l=0),Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!r,enumerable:!0},depth:{value:l},parent:{value:r},bindings:{value:{}}})}function r(e,t){var n=e.value;y.assert(n),p.CatchClause.check(n)?s(e.get("param"),t):l(e,t) }function l(e,t){var n=e.value;e.parent&&p.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&s(e.parent.get("id"),t),n&&(f.check(n)?e.each(function(e){i(e,t)}):p.Function.check(n)?(e.get("params").each(function(e){s(e,t)}),i(e.get("body"),t)):p.VariableDeclarator.check(n)?(s(e.get("id"),t),i(e.get("init"),t)):"ImportSpecifier"===n.type||"ImportNamespaceSpecifier"===n.type||"ImportDefaultSpecifier"===n.type?s(e.get(n.name?"name":"id"),t):c.check(n)&&!d.check(n)&&o.eachField(n,function(n,r){var l=e.get(n);a.strictEqual(l.value,r),i(l,t)}))}function i(e,t){var n=e.value;if(!n||d.check(n));else if(p.FunctionDeclaration.check(n))s(e.get("id"),t);else if(p.ClassDeclaration&&p.ClassDeclaration.check(n))s(e.get("id"),t);else if(y.check(n)){if(p.CatchClause.check(n)){var r=n.param.name,i=h.call(t,r);l(e.get("body"),t),i||delete t[r]}}else l(e,t)}function s(e,t){var n=e.value;p.Pattern.assert(n),p.Identifier.check(n)?h.call(t,n.name)?t[n.name].push(e):t[n.name]=[e]:p.ObjectPattern&&p.ObjectPattern.check(n)?e.get("properties").each(function(e){var n=e.value;p.Pattern.check(n)?s(e,t):p.Property.check(n)?s(e.get("value"),t):p.SpreadProperty&&p.SpreadProperty.check(n)&&s(e.get("argument"),t)}):p.ArrayPattern&&p.ArrayPattern.check(n)?e.get("elements").each(function(e){var n=e.value;p.Pattern.check(n)?s(e,t):p.SpreadElement&&p.SpreadElement.check(n)&&s(e.get("argument"),t)}):p.PropertyPattern&&p.PropertyPattern.check(n)?s(e.get("pattern"),t):(p.SpreadElementPattern&&p.SpreadElementPattern.check(n)||p.SpreadPropertyPattern&&p.SpreadPropertyPattern.check(n))&&s(e.get("argument"),t)}var a=e("assert"),o=e("./types"),u=o.Type,p=o.namedTypes,c=p.Node,d=p.Expression,f=o.builtInTypes.array,h=Object.prototype.hasOwnProperty,m=o.builders,g=[p.Program,p.Function,p.CatchClause],y=u.or.apply(u,g);n.isEstablishedBy=function(e){return y.check(e)};var b=n.prototype;b.didScan=!1,b.declares=function(e){return this.scan(),h.call(this.bindings,e)},b.declareTemporary=function(e){e?a.ok(/^[a-z$_]/i.test(e),e):e="t$",e+=this.depth.toString(36)+"$",this.scan();for(var t=0;this.declares(e+t);)++t;var n=e+t;return this.bindings[n]=o.builders.identifier(n)},b.injectTemporary=function(e,t){e||(e=this.declareTemporary());var n=this.path.get("body");return p.BlockStatement.check(n.value)&&(n=n.get("body")),n.unshift(m.variableDeclaration("var",[m.variableDeclarator(e,t||null)])),e},b.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];r(this.path,this.bindings),this.didScan=!0}},b.getBindings=function(){return this.scan(),this.bindings},b.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},b.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},t.exports=n},{"./node-path":165,"./types":170,assert:173}],169:[function(e,t,n){var r=e("../lib/types"),l=r.Type,i=r.builtInTypes,s=i.number;n.geq=function(e){return new l(function(t){return s.check(t)&&t>=e},s+" >= "+e)},n.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var a=l.or(i.string,i.number,i.boolean,i.null,i.undefined);n.isPrimitive=new l(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},a.toString())},{"../lib/types":170}],170:[function(e,t,n){function r(e,t){var n=this;h.ok(n instanceof r,n),h.strictEqual(v.call(e),x,e+" is not a function");var l=v.call(t);h.ok(l===x||l===E,t+" is neither a function nor a string"),Object.defineProperties(n,{name:{value:t},check:{value:function(t,r){var l=e.call(n,t,r);return!l&&r&&v.call(r)===x&&r(n,t),l}}})}function l(e){return C.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":A.check(e)?"["+e.map(l).join(", ")+"]":JSON.stringify(e)}function i(e,t){var n=v.call(e);return Object.defineProperty(I,t,{enumerable:!0,value:new r(function(e){return v.call(e)===n},t)}),I[t]}function s(e,t){return e instanceof r?e:e instanceof o?e.type:A.check(e)?r.fromArray(e):C.check(e)?r.fromObject(e):k.check(e)?new r(e,t):new r(function(t){return t===e},j.check(t)?function(){return e+""}:t)}function a(e,t,n,r){var l=this;h.ok(l instanceof a),w.assert(e),t=s(t);var i={name:{value:e},type:{value:t},hidden:{value:!!r}};k.check(n)&&(i.defaultFn={value:n}),Object.defineProperties(l,i)}function o(e){var t=this;h.ok(t instanceof o),Object.defineProperties(t,{typeName:{value:e},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new r(function(e,n){return t.check(e,n)},e)}})}function u(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function p(e){var t=o.fromValue(e);return t?t.fieldNames.slice(0):("type"in e&&h.ok(!1,"did not recognize object of type "+JSON.stringify(e.type)),Object.keys(e))}function c(e,t){var n=o.fromValue(e);if(n){var r=n.allFields[t];if(r)return r.getValue(e)}return e[t]}function d(e,t){t.length=0,t.push(e);for(var n=Object.create(null),r=0;r<t.length;++r){e=t[r];var l=P[e];h.strictEqual(l.finalized,!0),_.call(n,e)&&delete t[n[e]],n[e]=r,t.push.apply(t,l.baseNames)}for(var i=0,s=i,a=t.length;a>s;++s)_.call(t,s)&&(t[i++]=t[s]);t.length=i}function f(e,t){return Object.keys(t).forEach(function(n){e[n]=t[n]}),e}var h=e("assert"),m=Array.prototype,g=m.slice,y=(m.map,m.forEach),b=Object.prototype,v=b.toString,x=v.call(function(){}),E=v.call(""),_=b.hasOwnProperty,S=r.prototype;n.Type=r,S.assert=function(e,t){if(!this.check(e,t)){var n=l(e);return h.ok(!1,n+" does not match type "+this),!1}return!0},S.toString=function(){var e=this.name;return w.check(e)?e:k.check(e)?e.call(this)+"":e+" type"};var I={};n.builtInTypes=I;var w=i("","string"),k=i(function(){},"function"),A=i([],"array"),C=i({},"object"),T=(i(/./,"RegExp"),i(new Date,"Date"),i(3,"number")),j=(i(!0,"boolean"),i(null,"null"),i(void 0,"undefined"));r.or=function(){for(var e=[],t=arguments.length,n=0;t>n;++n)e.push(s(arguments[n]));return new r(function(n,r){for(var l=0;t>l;++l)if(e[l].check(n,r))return!0;return!1},function(){return e.join(" | ")})},r.fromArray=function(e){return h.ok(A.check(e)),h.strictEqual(e.length,1,"only one element type is permitted for typed arrays"),s(e[0]).arrayOf()},S.arrayOf=function(){var e=this;return new r(function(t,n){return A.check(t)&&t.every(function(t){return e.check(t,n)})},function(){return"["+e+"]"})},r.fromObject=function(e){var t=Object.keys(e).map(function(t){return new a(t,e[t])});return new r(function(e,n){return C.check(e)&&t.every(function(t){return t.type.check(e[t.name],n)})},function(){return"{ "+t.join(", ")+" }"})};var M=a.prototype;M.toString=function(){return JSON.stringify(this.name)+": "+this.type},M.getValue=function(e){var t=e[this.name];return j.check(t)?(this.defaultFn&&(t=this.defaultFn.call(e)),t):t},r.def=function(e){return w.assert(e),_.call(P,e)?P[e]:P[e]=new o(e)};var P=Object.create(null);o.fromValue=function(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&_.call(P,t)){var n=P[t];if(n.finalized)return n}}return null};var L=o.prototype;L.isSupertypeOf=function(e){return e instanceof o?(h.strictEqual(this.finalized,!0),h.strictEqual(e.finalized,!0),_.call(e.allSupertypes,this.typeName)):void h.ok(!1,e+" is not a Def")},n.getSupertypeNames=function(e){h.ok(_.call(P,e));var t=P[e];return h.strictEqual(t.finalized,!0),t.supertypeList.slice(1)},n.computeSupertypeLookupTable=function(e){for(var t={},n=Object.keys(P),r=n.length,l=0;r>l;++l){var i=n[l],s=P[i];h.strictEqual(s.finalized,!0);for(var a=0;a<s.supertypeList.length;++a){var o=s.supertypeList[a];if(_.call(e,o)){t[i]=o;break}}}return t},L.checkAllFields=function(e,t){function n(n){var l=r[n],i=l.type,s=l.getValue(e);return i.check(s,t)}var r=this.allFields;return h.strictEqual(this.finalized,!0),C.check(e)&&Object.keys(r).every(n)},L.check=function(e,t){if(h.strictEqual(this.finalized,!0,"prematurely checking unfinalized type "+this.typeName),!C.check(e))return!1;var n=o.fromValue(e);return n?t&&n===this?this.checkAllFields(e,t):this.isSupertypeOf(n)?t?n.checkAllFields(e,t)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,t):!1},L.bases=function(){var e=this.baseNames;return h.strictEqual(this.finalized,!1),y.call(arguments,function(t){w.assert(t),e.indexOf(t)<0&&e.push(t)}),this},Object.defineProperty(L,"buildable",{value:!1});var O={};n.builders=O;var D={};n.defineMethod=function(e,t){var n=D[e];return j.check(t)?delete D[e]:(k.assert(t),Object.defineProperty(D,e,{enumerable:!0,configurable:!0,value:t})),n},L.build=function(){var e=this;return Object.defineProperty(e,"buildParams",{value:g.call(arguments),writable:!1,enumerable:!1,configurable:!0}),h.strictEqual(e.finalized,!1),w.arrayOf().assert(e.buildParams),e.buildable?e:(e.field("type",e.typeName,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(O,u(e.typeName),{enumerable:!0,value:function(){function t(t,s){if(!_.call(i,t)){var a=e.allFields;h.ok(_.call(a,t),t);var o,u=a[t],p=u.type;if(T.check(s)&&r>s)o=n[s];else if(u.defaultFn)o=u.defaultFn.call(i);else{var c="no value or default function given for field "+JSON.stringify(t)+" of "+e.typeName+"("+e.buildParams.map(function(e){return a[e]}).join(", ")+")";h.ok(!1,c)}p.check(o)||h.ok(!1,l(o)+" does not match field "+u+" of type "+e.typeName),i[t]=o}}var n=arguments,r=n.length,i=Object.create(D);return h.ok(e.finalized,"attempting to instantiate unfinalized type "+e.typeName),e.buildParams.forEach(function(e,n){t(e,n)}),Object.keys(e.allFields).forEach(function(e){t(e)}),h.strictEqual(i.type,e.typeName),i}}),e)},L.field=function(e,t,n,r){return h.strictEqual(this.finalized,!1),this.ownFields[e]=new a(e,t,n,r),this};var R={};n.namedTypes=R,n.getFieldNames=p,n.getFieldValue=c,n.eachField=function(e,t,n){p(e).forEach(function(n){t.call(this,n,c(e,n))},n)},n.someField=function(e,t,n){return p(e).some(function(n){return t.call(this,n,c(e,n))},n)},Object.defineProperty(L,"finalized",{value:!1}),L.finalize=function(){if(!this.finalized){var e=this.allFields,t=this.allSupertypes;this.baseNames.forEach(function(n){var r=P[n];r.finalize(),f(e,r.allFields),f(t,r.allSupertypes)}),f(e,this.ownFields),t[this.typeName]=this,this.fieldNames.length=0;for(var n in e)_.call(e,n)&&!e[n].hidden&&this.fieldNames.push(n);Object.defineProperty(R,this.typeName,{enumerable:!0,value:this.type}),Object.defineProperty(this,"finalized",{value:!0}),d(this.typeName,this.supertypeList)}},n.finalize=function(){Object.keys(P).forEach(function(e){P[e].finalize()})}},{assert:173}],171:[function(e,t,n){var r=e("./lib/types");e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/fb-harmony"),r.finalize(),n.Type=r.Type,n.builtInTypes=r.builtInTypes,n.namedTypes=r.namedTypes,n.builders=r.builders,n.defineMethod=r.defineMethod,n.getFieldNames=r.getFieldNames,n.getFieldValue=r.getFieldValue,n.eachField=r.eachField,n.someField=r.someField,n.getSupertypeNames=r.getSupertypeNames,n.astNodesAreEquivalent=e("./lib/equiv"),n.finalize=r.finalize,n.NodePath=e("./lib/node-path"),n.PathVisitor=e("./lib/path-visitor"),n.visit=n.PathVisitor.visit},{"./def/core":158,"./def/e4x":159,"./def/es6":160,"./def/es7":161,"./def/fb-harmony":162,"./def/mozilla":163,"./lib/equiv":164,"./lib/node-path":165,"./lib/path-visitor":166,"./lib/types":170}],172:[function(){},{}],173:[function(e,t){function n(e,t){return d.isUndefined(t)?""+t:d.isNumber(t)&&!isFinite(t)?t.toString():d.isFunction(t)||d.isRegExp(t)?t.toString():t}function r(e,t){return d.isString(e)?e.length<t?e:e.slice(0,t):e}function l(e){return r(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+r(JSON.stringify(e.expected,n),128)}function i(e,t,n,r,l){throw new m.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:l})}function s(e,t){e||i(e,!0,t,"==",m.ok)}function a(e,t){if(e===t)return!0;if(d.isBuffer(e)&&d.isBuffer(t)){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return d.isDate(e)&&d.isDate(t)?e.getTime()===t.getTime():d.isRegExp(e)&&d.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:d.isObject(e)||d.isObject(t)?u(e,t):e==t}function o(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function u(e,t){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(t))return e===t;var n=o(e),r=o(t);if(n&&!r||!n&&r)return!1;if(n)return e=f.call(e),t=f.call(t),a(e,t);var l,i,s=g(e),u=g(t);if(s.length!=u.length)return!1;for(s.sort(),u.sort(),i=s.length-1;i>=0;i--)if(s[i]!=u[i])return!1;for(i=s.length-1;i>=0;i--)if(l=s[i],!a(e[l],t[l]))return!1;return!0}function p(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function c(e,t,n,r){var l;d.isString(n)&&(r=n,n=null);try{t()}catch(s){l=s}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!l&&i(l,n,"Missing expected exception"+r),!e&&p(l,n)&&i(l,n,"Got unwanted exception"+r),e&&l&&n&&!p(l,n)||!e&&l)throw l}var d=e("util/"),f=Array.prototype.slice,h=Object.prototype.hasOwnProperty,m=t.exports=s;m.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=l(this),this.generatedMessage=!0);var t=e.stackStartFunction||i;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,s=t.name,a=r.indexOf("\n"+s);if(a>=0){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}},d.inherits(m.AssertionError,Error),m.fail=i,m.ok=s,m.equal=function(e,t,n){e!=t&&i(e,t,n,"==",m.equal)},m.notEqual=function(e,t,n){e==t&&i(e,t,n,"!=",m.notEqual)},m.deepEqual=function(e,t,n){a(e,t)||i(e,t,n,"deepEqual",m.deepEqual)},m.notDeepEqual=function(e,t,n){a(e,t)&&i(e,t,n,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(e,t,n){e!==t&&i(e,t,n,"===",m.strictEqual)},m.notStrictEqual=function(e,t,n){e===t&&i(e,t,n,"!==",m.notStrictEqual)},m.throws=function(){c.apply(this,[!0].concat(f.call(arguments)))},m.doesNotThrow=function(){c.apply(this,[!1].concat(f.call(arguments)))},m.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)h.call(e,n)&&t.push(n);return t}},{"util/":199}],174:[function(e,t,n){arguments[4][172][0].apply(n,arguments)},{dup:172}],175:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))return new r(e,t,n);var l,i=typeof e;if("number"===i)l=+e;else if("string"===i)l=r.byteLength(e,t);else{if("object"!==i||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&R(e.data)&&(e=e.data),l=+e.length}if(l>N)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+N.toString(16)+" bytes");0>l?l=0:l>>>=0;var s=this;r.TYPED_ARRAY_SUPPORT?s=r._augment(new Uint8Array(l)):(s.length=l,s._isBuffer=!0);var a;if(r.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)s._set(e);else if(k(e))if(r.isBuffer(e))for(a=0;l>a;a++)s[a]=e.readUInt8(a);else for(a=0;l>a;a++)s[a]=(e[a]%256+256)%256;else if("string"===i)s.write(e,0,t);else if("number"===i&&!r.TYPED_ARRAY_SUPPORT&&!n)for(a=0;l>a;a++)s[a]=0;return l>0&&l<=r.poolSize&&(s.parent=F),s}function l(e,t,n){if(!(this instanceof l))return new l(e,t,n);var i=new r(e,t,n);return delete i.parent,i}function i(e,t,n,r){n=Number(n)||0;var l=e.length-n;r?(r=Number(r),r>l&&(r=l)):r=l;var i=t.length;if(i%2!==0)throw new Error("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;r>s;s++){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))throw new Error("Invalid hex string");e[n+s]=a}return s}function s(e,t,n,r){var l=P(C(t,e.length-n),e,n,r);return l}function a(e,t,n,r){var l=P(T(t),e,n,r);return l}function o(e,t,n,r){return a(e,t,n,r)}function u(e,t,n,r){var l=P(M(t),e,n,r);return l}function p(e,t,n,r){var l=P(j(t,e.length-n),e,n,r);return l}function c(e,t,n){return O.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function d(e,t,n){var r="",l="";n=Math.min(e.length,n);for(var i=t;n>i;i++)e[i]<=127?(r+=L(l)+String.fromCharCode(e[i]),l=""):l+="%"+e[i].toString(16);return r+L(l)}function f(e,t,n){var r="";n=Math.min(e.length,n);for(var l=t;n>l;l++)r+=String.fromCharCode(127&e[l]);return r}function h(e,t,n){var r="";n=Math.min(e.length,n);for(var l=t;n>l;l++)r+=String.fromCharCode(e[l]);return r}function m(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var l="",i=t;n>i;i++)l+=A(e[i]);return l}function g(e,t,n){for(var r=e.slice(t,n),l="",i=0;i<r.length;i+=2)l+=String.fromCharCode(r[i]+256*r[i+1]);return l}function y(e,t,n){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function b(e,t,n,l,i,s){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||s>t)throw new RangeError("value is out of bounds");if(n+l>e.length)throw new RangeError("index out of range")}function v(e,t,n,r){0>t&&(t=65535+t+1);for(var l=0,i=Math.min(e.length-n,2);i>l;l++)e[n+l]=(t&255<<8*(r?l:1-l))>>>8*(r?l:1-l)}function x(e,t,n,r){0>t&&(t=4294967295+t+1);for(var l=0,i=Math.min(e.length-n,4);i>l;l++)e[n+l]=t>>>8*(r?l:3-l)&255}function E(e,t,n,r,l,i){if(t>l||i>t)throw new RangeError("value is out of bounds");if(n+r>e.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function _(e,t,n,r,l){return l||E(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),D.write(e,t,n,r,23,4),n+4}function S(e,t,n,r,l){return l||E(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),D.write(e,t,n,r,52,8),n+8}function I(e){if(e=w(e).replace($,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function w(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function k(e){return R(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function A(e){return 16>e?"0"+e.toString(16):e.toString(16)}function C(e,t){t=t||1/0;for(var n,r=e.length,l=null,i=[],s=0;r>s;s++){if(n=e.charCodeAt(s),n>55295&&57344>n){if(!l){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}l=n;continue}if(56320>n){(t-=3)>-1&&i.push(239,191,189),l=n;continue}n=l-55296<<10|n-56320|65536,l=null}else l&&((t-=3)>-1&&i.push(239,191,189),l=null);if(128>n){if((t-=1)<0)break;i.push(n)}else if(2048>n){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(65536>n){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(2097152>n))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function T(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function j(e,t){for(var n,r,l,i=[],s=0;s<e.length&&!((t-=2)<0);s++)n=e.charCodeAt(s),r=n>>8,l=n%256,i.push(l),i.push(r);return i}function M(e){return O.toByteArray(I(e))}function P(e,t,n,r){for(var l=0;r>l&&!(l+n>=t.length||l>=e.length);l++)t[l+n]=e[l];return l}function L(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}var O=e("base64-js"),D=e("ieee754"),R=e("is-array");n.Buffer=r,n.SlowBuffer=l,n.INSPECT_MAX_BYTES=50,r.poolSize=8192;var N=1073741823,F={};r.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}(),r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,l=t.length,i=0,s=Math.min(n,l);s>i&&e[i]===t[i];i++);return i!==s&&(n=e[i],l=t[i]),l>n?-1:n>l?1:0},r.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(e,t){if(!R(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===e.length)return new r(0);if(1===e.length)return e[0];var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var l=new r(t),i=0;for(n=0;n<e.length;n++){var s=e[n];s.copy(l,i),i+=s.length}return l},r.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"ascii":case"binary":case"raw":n=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;case"hex":n=e.length>>>1;break;case"utf8":case"utf-8":n=C(e).length;break;case"base64":n=M(e).length;break;default:n=e.length}return n},r.prototype.length=void 0,r.prototype.parent=void 0,r.prototype.toString=function(e,t,n){var r=!1;if(t>>>=0,n=void 0===n||1/0===n?this.length:n>>>0,e||(e="utf8"),0>t&&(t=0),n>this.length&&(n=this.length),t>=n)return"";for(;;)switch(e){case"hex":return m(this,t,n);case"utf8":case"utf-8":return d(this,t,n);case"ascii":return f(this,t,n);case"binary":return h(this,t,n);case"base64":return c(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}},r.prototype.equals=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===r.compare(this,e)},r.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},r.prototype.compare=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:r.compare(this,e)},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.write=function(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var l=r;r=t,t=n,n=l}if(t=Number(t)||0,0>n||0>t||t>this.length)throw new RangeError("attempt to write outside buffer bounds");var c=this.length-t;n?(n=Number(n),n>c&&(n=c)):n=c,r=String(r||"utf8").toLowerCase();var d;switch(r){case"hex":d=i(this,e,t,n);break;case"utf8":case"utf-8":d=s(this,e,t,n);break;case"ascii":d=a(this,e,t,n);break;case"binary":d=o(this,e,t,n);break;case"base64":d=u(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":d=p(this,e,t,n);break;default:throw new TypeError("Unknown encoding: "+r)}return d},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e);var l;if(r.TYPED_ARRAY_SUPPORT)l=r._augment(this.subarray(e,t));else{var i=t-e;l=new r(i,void 0,!0);for(var s=0;i>s;s++)l[s]=this[s+e]}return l.length&&(l.parent=this.parent||this),l},r.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||y(e,t,this.length);for(var r=this[e],l=1,i=0;++i<t&&(l*=256);)r+=this[e+i]*l;return r},r.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||y(e,t,this.length);for(var r=this[e+--t],l=1;t>0&&(l*=256);)r+=this[e+--t]*l;return r},r.prototype.readUInt8=function(e,t){return t||y(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||y(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||y(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||y(e,t,this.length);for(var r=this[e],l=1,i=0;++i<t&&(l*=256);)r+=this[e+i]*l;return l*=128,r>=l&&(r-=Math.pow(2,8*t)),r},r.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||y(e,t,this.length);for(var r=t,l=1,i=this[e+--r];r>0&&(l*=256);)i+=this[e+--r]*l;return l*=128,i>=l&&(i-=Math.pow(2,8*t)),i},r.prototype.readInt8=function(e,t){return t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||y(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(e,t){t||y(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(e,t){return t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||y(e,4,this.length),D.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||y(e,4,this.length),D.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||y(e,8,this.length),D.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||y(e,8,this.length),D.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||b(this,e,t,n,Math.pow(2,8*n),0);var l=1,i=0;for(this[t]=255&e;++i<n&&(l*=256);)this[t+i]=e/l>>>0&255;return t+n},r.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||b(this,e,t,n,Math.pow(2,8*n),0);var l=n-1,i=1;for(this[t+l]=255&e;--l>=0&&(i*=256);)this[t+l]=e/i>>>0&255;return t+n},r.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e,t+1},r.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):v(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):v(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e):x(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):x(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,n,r){e=+e,t>>>=0,r||b(this,e,t,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var l=0,i=1,s=0>e?1:0;for(this[t]=255&e;++l<n&&(i*=256);)this[t+l]=(e/i>>0)-s&255;return t+n},r.prototype.writeIntBE=function(e,t,n,r){e=+e,t>>>=0,r||b(this,e,t,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var l=n-1,i=1,s=0>e?1:0;for(this[t+l]=255&e;--l>=0&&(i*=256);)this[t+l]=(e/i>>0)-s&255;return t+n},r.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=e,t+1},r.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):v(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):v(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):x(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||b(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):x(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,n){return _(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){return _(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){return S(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){return S(this,e,t,!1,n)},r.prototype.copy=function(e,t,n,l){var i=this;if(n||(n=0),l||0===l||(l=this.length),t>=e.length&&(t=e.length),t||(t=0),l>0&&n>l&&(l=n),l===n)return 0;if(0===e.length||0===i.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=i.length)throw new RangeError("sourceStart out of bounds");if(0>l)throw new RangeError("sourceEnd out of bounds");l>this.length&&(l=this.length),e.length-t<l-n&&(l=e.length-t+n);var s=l-n;if(1e3>s||!r.TYPED_ARRAY_SUPPORT)for(var a=0;s>a;a++)e[a+t]=this[a+n];else e._set(this.subarray(n,n+s),t);return s},r.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),t>n)throw new RangeError("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof e)for(r=t;n>r;r++)this[r]=e;else{var l=C(e.toString()),i=l.length;for(r=t;n>r;r++)this[r]=l[r%i]}return this}},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r.TYPED_ARRAY_SUPPORT)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var B=r.prototype;r._augment=function(e){return e.constructor=r,e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=B.get,e.set=B.set,e.write=B.write,e.toString=B.toString,e.toLocaleString=B.toString,e.toJSON=B.toJSON,e.equals=B.equals,e.compare=B.compare,e.copy=B.copy,e.slice=B.slice,e.readUIntLE=B.readUIntLE,e.readUIntBE=B.readUIntBE,e.readUInt8=B.readUInt8,e.readUInt16LE=B.readUInt16LE,e.readUInt16BE=B.readUInt16BE,e.readUInt32LE=B.readUInt32LE,e.readUInt32BE=B.readUInt32BE,e.readIntLE=B.readIntLE,e.readIntBE=B.readIntBE,e.readInt8=B.readInt8,e.readInt16LE=B.readInt16LE,e.readInt16BE=B.readInt16BE,e.readInt32LE=B.readInt32LE,e.readInt32BE=B.readInt32BE,e.readFloatLE=B.readFloatLE,e.readFloatBE=B.readFloatBE,e.readDoubleLE=B.readDoubleLE,e.readDoubleBE=B.readDoubleBE,e.writeUInt8=B.writeUInt8,e.writeUIntLE=B.writeUIntLE,e.writeUIntBE=B.writeUIntBE,e.writeUInt16LE=B.writeUInt16LE,e.writeUInt16BE=B.writeUInt16BE,e.writeUInt32LE=B.writeUInt32LE,e.writeUInt32BE=B.writeUInt32BE,e.writeIntLE=B.writeIntLE,e.writeIntBE=B.writeIntBE,e.writeInt8=B.writeInt8,e.writeInt16LE=B.writeInt16LE,e.writeInt16BE=B.writeInt16BE,e.writeInt32LE=B.writeInt32LE,e.writeInt32BE=B.writeInt32BE,e.writeFloatLE=B.writeFloatLE,e.writeFloatBE=B.writeFloatBE,e.writeDoubleLE=B.writeDoubleLE,e.writeDoubleBE=B.writeDoubleBE,e.fill=B.fill,e.inspect=B.inspect,e.toArrayBuffer=B.toArrayBuffer,e};var $=/[^+\/0-9A-z\-]/g},{"base64-js":176,ieee754:177,"is-array":178}],176:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s||t===c?62:t===a||t===d?63:o>t?-1:o+10>t?t-o+26+26:p+26>t?t-p:u+26>t?t-u+26:void 0}function n(e){function n(e){u[c++]=e}var r,l,s,a,o,u;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=e.length;o="="===e.charAt(p-2)?2:"="===e.charAt(p-1)?1:0,u=new i(3*e.length/4-o),s=o>0?e.length-4:e.length;var c=0;for(r=0,l=0;s>r;r+=4,l+=3)a=t(e.charAt(r))<<18|t(e.charAt(r+1))<<12|t(e.charAt(r+2))<<6|t(e.charAt(r+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===o?(a=t(e.charAt(r))<<2|t(e.charAt(r+1))>>4,n(255&a)):1===o&&(a=t(e.charAt(r))<<10|t(e.charAt(r+1))<<4|t(e.charAt(r+2))>>2,n(a>>8&255),n(255&a)),u}function l(e){function t(e){return r.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var l,i,s,a=e.length%3,o="";for(l=0,s=e.length-a;s>l;l+=3)i=(e[l]<<16)+(e[l+1]<<8)+e[l+2],o+=n(i);switch(a){case 1:i=e[e.length-1],o+=t(i>>2),o+=t(i<<4&63),o+="==";break;case 2:i=(e[e.length-2]<<8)+e[e.length-1],o+=t(i>>10),o+=t(i>>4&63),o+=t(i<<2&63),o+="=" }return o}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),o="0".charCodeAt(0),u="a".charCodeAt(0),p="A".charCodeAt(0),c="-".charCodeAt(0),d="_".charCodeAt(0);e.toByteArray=n,e.fromByteArray=l}("undefined"==typeof n?this.base64js={}:n)},{}],177:[function(e,t,n){n.read=function(e,t,n,r,l){var i,s,a=8*l-r-1,o=(1<<a)-1,u=o>>1,p=-7,c=n?l-1:0,d=n?-1:1,f=e[t+c];for(c+=d,i=f&(1<<-p)-1,f>>=-p,p+=a;p>0;i=256*i+e[t+c],c+=d,p-=8);for(s=i&(1<<-p)-1,i>>=-p,p+=r;p>0;s=256*s+e[t+c],c+=d,p-=8);if(0===i)i=1-u;else{if(i===o)return s?0/0:1/0*(f?-1:1);s+=Math.pow(2,r),i-=u}return(f?-1:1)*s*Math.pow(2,i-r)},n.write=function(e,t,n,r,l,i){var s,a,o,u=8*i-l-1,p=(1<<u)-1,c=p>>1,d=23===l?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,h=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=p):(s=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-s))<1&&(s--,o*=2),t+=s+c>=1?d/o:d*Math.pow(2,1-c),t*o>=2&&(s++,o/=2),s+c>=p?(a=0,s=p):s+c>=1?(a=(t*o-1)*Math.pow(2,l),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,l),s=0));l>=8;e[n+f]=255&a,f+=h,a/=256,l-=8);for(s=s<<l|a,u+=l;u>0;e[n+f]=255&s,f+=h,s/=256,u-=8);e[n+f-h]|=128*m}},{}],178:[function(e,t){var n=Array.isArray,r=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==r.call(e)}},{}],179:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function l(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!l(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,l,a,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(l=arguments.length,a=new Array(l-1),o=1;l>o;o++)a[o-1]=arguments[o];n.apply(this,a)}else if(i(n)){for(l=arguments.length,a=new Array(l-1),o=1;l>o;o++)a[o-1]=arguments[o];for(u=n.slice(),l=u.length,o=0;l>o;o++)u[o].apply(this,a)}return!0},n.prototype.addListener=function(e,t){var l;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned){var l;l=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,l&&l>0&&this._events[e].length>l&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),l||(l=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var l=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,l,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,l=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(a=s;a-->0;)if(n[a]===t||n[a].listener&&n[a].listener===t){l=a;break}if(0>l)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(l,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],180:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],181:[function(e,t){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],182:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var l=e[r];"."===l?e.splice(r,1):".."===l?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var l=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return l.exec(e).slice(1)};n.resolve=function(){for(var n="",l=!1,i=arguments.length-1;i>=-1&&!l;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,l="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!l).join("/"),(l?"/":"")+n||"."},n.normalize=function(e){var l=n.isAbsolute(e),i="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!l).join("/"),e||l||(e="."),e&&i&&(e+="/"),(l?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var l=r(e.split("/")),i=r(t.split("/")),s=Math.min(l.length,i.length),a=s,o=0;s>o;o++)if(l[o]!==i[o]){a=o;break}for(var u=[],o=a;o<l.length;o++)u.push("..");return u=u.concat(i.slice(a)),u.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=i(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=i(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return i(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return 0>t&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:183}],183:[function(e,t){function n(){if(!s){s=!0;for(var e,t=i.length;t;){e=i,i=[];for(var n=-1;++n<t;)e[n]();t=i.length}s=!1}}function r(){}var l=t.exports={},i=[],s=!1;l.nextTick=function(e){i.push(e),s||setTimeout(n,0)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=r,l.addListener=r,l.once=r,l.off=r,l.removeListener=r,l.removeAllListeners=r,l.emit=r,l.binding=function(){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],184:[function(e,t){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":185}],185:[function(e,t){(function(n){function r(e){return this instanceof r?(o.call(this,e),u.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",l)):new r(e)}function l(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function i(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}t.exports=r;var s=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},a=e("core-util-is");a.inherits=e("inherits");var o=e("./_stream_readable"),u=e("./_stream_writable");a.inherits(r,o),i(s(u.prototype),function(e){r.prototype[e]||(r.prototype[e]=u.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":187,"./_stream_writable":189,_process:183,"core-util-is":190,inherits:180}],186:[function(e,t){function n(e){return this instanceof n?void r.call(this,e):new n(e)}t.exports=n;var r=e("./_stream_transform"),l=e("core-util-is");l.inherits=e("inherits"),l.inherits(n,r),n.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":188,"core-util-is":190,inherits:180}],187:[function(e,t){(function(n){function r(t,n){var r=e("./_stream_duplex");t=t||{};var l=t.highWaterMark,i=t.objectMode?16:16384;this.highWaterMark=l||0===l?l:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!t.objectMode,n instanceof r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(C||(C=e("string_decoder/").StringDecoder),this.decoder=new C(t.encoding),this.encoding=t.encoding)}function l(t){e("./_stream_duplex");return this instanceof l?(this._readableState=new r(t,this),this.readable=!0,void k.call(this)):new l(t)}function i(e,t,n,r,l){var i=u(t,n);if(i)e.emit("error",i);else if(A.isNullOrUndefined(n))t.reading=!1,t.ended||p(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!l){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&l){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||l||r||(n=t.decoder.write(n)),l||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,l?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&c(e)),f(e,t);else l||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=j)e=j;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function o(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||A.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function u(e,t){var n=null;return A.isBuffer(t)||A.isString(t)||A.isNullOrUndefined(t)||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,c(e)}function c(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(T("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){d(e)}):d(e))}function d(e){T("emit readable"),e.emit("readable"),b(e)}function f(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){h(e,t)}))}function h(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(T("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function m(e){return function(){var t=e._readableState;T("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&w.listenerCount(e,"data")&&(t.flowing=!0,b(e))}}function g(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(function(){y(e,t)}))}function y(e,t){t.resumeScheduled=!1,e.emit("resume"),b(e),t.flowing&&!t.reading&&e.read(0)}function b(e){var t=e._readableState;if(T("flow",t.flowing),t.flowing)do var n=e.read();while(null!==n&&t.flowing)}function v(e,t){var n,r=t.buffer,l=t.length,i=!!t.decoder,s=!!t.objectMode;if(0===r.length)return null;if(0===l)n=null;else if(s)n=r.shift();else if(!e||e>=l)n=i?r.join(""):I.concat(r,l),r.length=0;else if(e<r[0].length){var a=r[0];n=a.slice(0,e),r[0]=a.slice(e)}else if(e===r[0].length)n=r.shift();else{n=i?"":new I(e);for(var o=0,u=0,p=r.length;p>u&&e>o;u++){var a=r[0],c=Math.min(e-o,a.length);i?n+=a.slice(0,c):a.copy(n,o,0,c),c<a.length?r[0]=a.slice(c):r.shift(),o+=c}}return n}function x(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function E(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function _(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=l;var S=e("isarray"),I=e("buffer").Buffer;l.ReadableState=r;var w=e("events").EventEmitter;w.listenerCount||(w.listenerCount=function(e,t){return e.listeners(t).length});var k=e("stream"),A=e("core-util-is");A.inherits=e("inherits");var C,T=e("util");T=T&&T.debuglog?T.debuglog("stream"):function(){},A.inherits(l,k),l.prototype.push=function(e,t){var n=this._readableState;return A.isString(e)&&!n.objectMode&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=new I(e,t),t="")),i(this,n,e,t,!1)},l.prototype.unshift=function(e){var t=this._readableState;return i(this,t,e,"",!0)},l.prototype.setEncoding=function(t){return C||(C=e("string_decoder/").StringDecoder),this._readableState.decoder=new C(t),this._readableState.encoding=t,this};var j=8388608;l.prototype.read=function(e){T("read",e);var t=this._readableState,n=e;if((!A.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return T("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):c(this),null;if(e=o(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var r=t.needReadable;T("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,T("length less than watermark",r)),(t.ended||t.reading)&&(r=!1,T("reading or ended",r)),r&&(T("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=o(n,t));var l;return l=e>0?v(e,t):null,A.isNull(l)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&x(this),A.isNull(l)||this.emit("data",l),l},l.prototype._read=function(){this.emit("error",new Error("not implemented"))},l.prototype.pipe=function(e,t){function r(e){T("onunpipe"),e===c&&i()}function l(){T("onend"),e.end()}function i(){T("cleanup"),e.removeListener("close",o),e.removeListener("finish",u),e.removeListener("drain",g),e.removeListener("error",a),e.removeListener("unpipe",r),c.removeListener("end",l),c.removeListener("end",i),c.removeListener("data",s),!d.awaitDrain||e._writableState&&!e._writableState.needDrain||g()}function s(t){T("ondata");var n=e.write(t);!1===n&&(T("false write response, pause",c._readableState.awaitDrain),c._readableState.awaitDrain++,c.pause())}function a(t){T("onerror",t),p(),e.removeListener("error",a),0===w.listenerCount(e,"error")&&e.emit("error",t)}function o(){e.removeListener("finish",u),p()}function u(){T("onfinish"),e.removeListener("close",o),p()}function p(){T("unpipe"),c.unpipe(e)}var c=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,T("pipe count=%d opts=%j",d.pipesCount,t);var f=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,h=f?l:i;d.endEmitted?n.nextTick(h):c.once("end",h),e.on("unpipe",r);var g=m(c);return e.on("drain",g),c.on("data",s),e._events&&e._events.error?S(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",o),e.once("finish",u),e.emit("pipe",c),d.flowing||(T("pipe resume"),c.resume()),e},l.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var l=0;r>l;l++)n[l].emit("unpipe",this);return this}var l=_(t.pipes,e);return-1===l?this:(t.pipes.splice(l,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},l.prototype.on=function(e,t){var r=k.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var l=this._readableState;if(!l.readableListening)if(l.readableListening=!0,l.emittedReadable=!1,l.needReadable=!0,l.reading)l.length&&c(this,l);else{var i=this;n.nextTick(function(){T("readable nexttick read 0"),i.read(0)})}}return r},l.prototype.addListener=l.prototype.on,l.prototype.resume=function(){var e=this._readableState;return e.flowing||(T("resume"),e.flowing=!0,e.reading||(T("resume read 0"),this.read(0)),g(this,e)),this},l.prototype.pause=function(){return T("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(T("pause"),this._readableState.flowing=!1,this.emit("pause")),this},l.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(T("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(l){if(T("wrapped data"),t.decoder&&(l=t.decoder.write(l)),l&&(t.objectMode||l.length)){var i=r.push(l);i||(n=!0,e.pause())}});for(var l in e)A.isFunction(e[l])&&A.isUndefined(this[l])&&(this[l]=function(t){return function(){return e[t].apply(e,arguments)}}(l));var i=["error","close","destroy","pause","resume"];return E(i,function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){T("wrapped _read",t),n&&(n=!1,e.resume())},r},l._fromList=v}).call(this,e("_process"))},{"./_stream_duplex":185,_process:183,buffer:175,"core-util-is":190,events:179,inherits:180,isarray:181,stream:195,"string_decoder/":196,util:174}],188:[function(e,t){function n(e,t){this.afterTransform=function(e,n){return r(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,n){var r=e._transformState;r.transforming=!1;var l=r.writecb;if(!l)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,a.isNullOrUndefined(n)||e.push(n),l&&l(t);var i=e._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&e._read(i.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),this._transformState=new n(e,this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){a.isFunction(this._flush)?this._flush(function(e){i(t,e)}):i(t)})}function i(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=l;var s=e("./_stream_duplex"),a=e("core-util-is");a.inherits=e("inherits"),a.inherits(l,s),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},l.prototype._transform=function(){throw new Error("not implemented")},l.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var l=this._readableState;(r.needTransform||l.needReadable||l.length<l.highWaterMark)&&this._read(l.highWaterMark)}},l.prototype._read=function(){var e=this._transformState;a.isNull(e.writechunk)||!e.writecb||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))}},{"./_stream_duplex":185,"core-util-is":190,inherits:180}],189:[function(e,t){(function(n){function r(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function l(t,n){var r=e("./_stream_duplex");t=t||{};var l=t.highWaterMark,i=t.objectMode?16:16384;this.highWaterMark=l||0===l?l:i,this.objectMode=!!t.objectMode,n instanceof r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=t.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){f(n,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function i(t){var n=e("./_stream_duplex");return this instanceof i||this instanceof n?(this._writableState=new l(t,this),this.writable=!0,void S.call(this)):new i(t)}function s(e,t,r){var l=new Error("write after end");e.emit("error",l),n.nextTick(function(){r(l)})}function a(e,t,r,l){var i=!0;if(!(_.isBuffer(r)||_.isString(r)||_.isNullOrUndefined(r)||t.objectMode)){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),n.nextTick(function(){l(s)}),i=!1}return i}function o(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&_.isString(t)&&(t=new E(t,n)),t}function u(e,t,n,l,i){n=o(t,n,l),_.isBuffer(n)&&(l="buffer");var s=t.objectMode?1:n.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked?t.buffer.push(new r(n,l,i)):p(e,t,!1,s,n,l,i),a}function p(e,t,n,r,l,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(l,t.onwrite):e._write(l,i,t.onwrite),t.sync=!1}function c(e,t,r,l,i){r?n.nextTick(function(){t.pendingcb--,i(l)}):(t.pendingcb--,i(l)),e._writableState.errorEmitted=!0,e.emit("error",l)}function d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function f(e,t){var r=e._writableState,l=r.sync,i=r.writecb;if(d(r),t)c(e,r,l,t,i);else{var s=y(e,r);s||r.corked||r.bufferProcessing||!r.buffer.length||g(e,r),l?n.nextTick(function(){h(e,r,s,i)}):h(e,r,s,i)}}function h(e,t,n,r){n||m(e,t),t.pendingcb--,r(),v(e,t)}function m(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function g(e,t){if(t.bufferProcessing=!0,e._writev&&t.buffer.length>1){for(var n=[],r=0;r<t.buffer.length;r++)n.push(t.buffer[r].callback);t.pendingcb++,p(e,t,!0,t.length,t.buffer,"",function(e){for(var r=0;r<n.length;r++)t.pendingcb--,n[r](e)}),t.buffer=[]}else{for(var r=0;r<t.buffer.length;r++){var l=t.buffer[r],i=l.chunk,s=l.encoding,a=l.callback,o=t.objectMode?1:i.length;if(p(e,t,!1,o,i,s,a),t.writing){r++;break}}r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}t.bufferProcessing=!1}function y(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function b(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function v(e,t){var n=y(e,t);return n&&(0===t.pendingcb?(b(e,t),t.finished=!0,e.emit("finish")):b(e,t)),n}function x(e,t,r){t.ending=!0,v(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0}t.exports=i;var E=e("buffer").Buffer;i.WritableState=l;var _=e("core-util-is");_.inherits=e("inherits");var S=e("stream");_.inherits(i,S),i.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},i.prototype.write=function(e,t,n){var r=this._writableState,l=!1;return _.isFunction(t)&&(n=t,t=null),_.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),_.isFunction(n)||(n=function(){}),r.ended?s(this,r,n):a(this,r,e,n)&&(r.pendingcb++,l=u(this,r,e,t,n)),l},i.prototype.cork=function(){var e=this._writableState;e.corked++},i.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.buffer.length||g(this,e))},i.prototype._write=function(e,t,n){n(new Error("not implemented"))},i.prototype._writev=null,i.prototype.end=function(e,t,n){var r=this._writableState;_.isFunction(e)?(n=e,e=null,t=null):_.isFunction(t)&&(n=t,t=null),_.isNullOrUndefined(e)||this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||x(this,r,n)}}).call(this,e("_process"))},{"./_stream_duplex":185,_process:183,buffer:175,"core-util-is":190,inherits:180,stream:195}],190:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function r(e){return"boolean"==typeof e}function l(e){return null===e}function i(e){return null==e}function s(e){return"number"==typeof e}function a(e){return"string"==typeof e}function o(e){return"symbol"==typeof e}function u(e){return void 0===e}function p(e){return c(e)&&"[object RegExp]"===y(e)}function c(e){return"object"==typeof e&&null!==e}function d(e){return c(e)&&"[object Date]"===y(e)}function f(e){return c(e)&&("[object Error]"===y(e)||e instanceof Error)}function h(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function g(t){return e.isBuffer(t)}function y(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=r,n.isNull=l,n.isNullOrUndefined=i,n.isNumber=s,n.isString=a,n.isSymbol=o,n.isUndefined=u,n.isRegExp=p,n.isObject=c,n.isDate=d,n.isError=f,n.isFunction=h,n.isPrimitive=m,n.isBuffer=g}).call(this,e("buffer").Buffer)},{buffer:175}],191:[function(e,t){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":186}],192:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=e("stream"),n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":185,"./lib/_stream_passthrough.js":186,"./lib/_stream_readable.js":187,"./lib/_stream_transform.js":188,"./lib/_stream_writable.js":189,stream:195}],193:[function(e,t){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":188}],194:[function(e,t){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":189}],195:[function(e,t){function n(){r.call(this)}t.exports=n;var r=e("events").EventEmitter,l=e("inherits");l(n,r),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&u.pause&&u.pause()}function l(){u.readable&&u.resume&&u.resume()}function i(){p||(p=!0,e.end())}function s(){p||(p=!0,"function"==typeof e.destroy&&e.destroy())}function a(e){if(o(),0===r.listenerCount(this,"error"))throw e}function o(){u.removeListener("data",n),e.removeListener("drain",l),u.removeListener("end",i),u.removeListener("close",s),u.removeListener("error",a),e.removeListener("error",a),u.removeListener("end",o),u.removeListener("close",o),e.removeListener("close",o)}var u=this;u.on("data",n),e.on("drain",l),e._isStdio||t&&t.end===!1||(u.on("end",i),u.on("close",s));var p=!1;return u.on("error",a),e.on("error",a),u.on("end",o),u.on("close",o),e.on("close",o),e.emit("pipe",u),e}},{events:179,inherits:180,"readable-stream/duplex.js":184,"readable-stream/passthrough.js":191,"readable-stream/readable.js":192,"readable-stream/transform.js":193,"readable-stream/writable.js":194}],196:[function(e,t,n){function r(e){if(e&&!o(e))throw new Error("Unknown encoding: "+e)}function l(e){return e.toString(this.encoding)}function i(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function s(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var a=e("buffer").Buffer,o=a.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},u=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=s;break;default:return void(this.write=l)}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(!(r>=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var l=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,l),l-=this.charReceived),t+=e.toString(this.encoding,0,l);var l=t.length-1,r=t.charCodeAt(l);if(r>=55296&&56319>=r){var i=this.surrogateSize;return this.charLength+=i,this.charReceived+=i,this.charBuffer.copy(this.charBuffer,i,0,i),e.copy(this.charBuffer,0,0,i),t.substring(0,l)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,l=this.encoding;t+=r.slice(0,n).toString(l)}return t}},{buffer:175}],197:[function(e,t,n){function r(){throw new Error("tty.ReadStream is not implemented")}function l(){throw new Error("tty.ReadStream is not implemented")}n.isatty=function(){return!1},n.ReadStream=r,n.WriteStream=l},{}],198:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],199:[function(e,t,n){(function(t,r){function l(e,t){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(t)?r.showHidden=t:t&&n._extend(r,t),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),o(r,e,r.depth)}function i(e,t){var n=l.styles[t];return n?"["+l.colors[n][0]+"m"+e+"["+l.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function o(e,t,r){if(e.customInspect&&t&&k(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var l=t.inspect(r,e);return v(l)||(l=o(e,l,r)),l}var i=u(e,t);if(i)return i;var s=Object.keys(t),m=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),w(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(t);if(0===s.length){if(k(t)){var g=t.name?": "+t.name:"";return e.stylize("[Function"+g+"]","special")}if(_(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(I(t))return e.stylize(Date.prototype.toString.call(t),"date");if(w(t))return p(t)}var y="",b=!1,x=["{","}"];if(h(t)&&(b=!0,x=["[","]"]),k(t)){var E=t.name?": "+t.name:"";y=" [Function"+E+"]"}if(_(t)&&(y=" "+RegExp.prototype.toString.call(t)),I(t)&&(y=" "+Date.prototype.toUTCString.call(t)),w(t)&&(y=" "+p(t)),0===s.length&&(!b||0==t.length))return x[0]+y+x[1];if(0>r)return _(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var S;return S=b?c(e,t,r,m,s):s.map(function(n){return d(e,t,r,m,n,b)}),e.seen.pop(),f(S,y,x)}function u(e,t){if(E(t))return e.stylize("undefined","undefined"); if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return b(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):g(t)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,n,r,l){for(var i=[],s=0,a=t.length;a>s;++s)i.push(M(t,String(s))?d(e,t,n,r,String(s),!0):"");return l.forEach(function(l){l.match(/^\d+$/)||i.push(d(e,t,n,r,l,!0))}),i}function d(e,t,n,r,l,i){var s,a,u;if(u=Object.getOwnPropertyDescriptor(t,l)||{value:t[l]},u.get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),M(r,l)||(s="["+l+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(n)?o(e,u.value,null):o(e,u.value,n-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),E(s)){if(i&&l.match(/^\d+$/))return a;s=JSON.stringify(""+l),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function f(e,t,n){var r=0,l=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return l>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return null==e}function b(e){return"number"==typeof e}function v(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function E(e){return void 0===e}function _(e){return S(e)&&"[object RegExp]"===C(e)}function S(e){return"object"==typeof e&&null!==e}function I(e){return S(e)&&"[object Date]"===C(e)}function w(e){return S(e)&&("[object Error]"===C(e)||e instanceof Error)}function k(e){return"function"==typeof e}function A(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function C(e){return Object.prototype.toString.call(e)}function T(e){return 10>e?"0"+e.toString(10):e.toString(10)}function j(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/%[sdj%]/g;n.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(l(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,i=r.length,s=String(e).replace(P,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),a=r[n];i>n;a=r[++n])s+=g(a)||!S(a)?" "+a:" "+l(a);return s},n.deprecate=function(e,l){function i(){if(!s){if(t.throwDeprecation)throw new Error(l);t.traceDeprecation?console.trace(l):console.error(l),s=!0}return e.apply(this,arguments)}if(E(r.process))return function(){return n.deprecate(e,l).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return i};var L,O={};n.debuglog=function(e){if(E(L)&&(L=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!O[e])if(new RegExp("\\b"+e+"\\b","i").test(L)){var r=t.pid;O[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else O[e]=function(){};return O[e]},n.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=h,n.isBoolean=m,n.isNull=g,n.isNullOrUndefined=y,n.isNumber=b,n.isString=v,n.isSymbol=x,n.isUndefined=E,n.isRegExp=_,n.isObject=S,n.isDate=I,n.isError=w,n.isFunction=k,n.isPrimitive=A,n.isBuffer=e("./support/isBuffer");var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",j(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!S(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":198,_process:183,inherits:180}],200:[function(e,t){(function(n){"use strict";function r(e){this.enabled=e&&void 0!==e.enabled?e.enabled:c}function l(e){var t=function n(){return i.apply(n,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=h,t}function i(){var e=arguments,t=e.length,n=0!==t&&String(arguments[0]);if(t>1)for(var r=1;t>r;r++)n+=" "+e[r];if(!this.enabled||!n)return n;for(var l=this._styles,i=l.length;i--;){var s=o[l[i]];n=s.open+n.replace(s.closeRe,s.open)+s.close}return n}function s(){var e={};return Object.keys(f).forEach(function(t){e[t]={get:function(){return l.call(this,[t])}}}),e}var a=e("escape-string-regexp"),o=e("ansi-styles"),u=e("strip-ansi"),p=e("has-ansi"),c=e("supports-color"),d=Object.defineProperties;"win32"===n.platform&&(o.blue.open="");var f=function(){var e={};return Object.keys(o).forEach(function(t){o[t].closeRe=new RegExp(a(o[t].close),"g"),e[t]={get:function(){return l.call(this,this._styles.concat(t))}}}),e}(),h=d(function(){},f);d(r.prototype,s()),t.exports=new r,t.exports.styles=o,t.exports.hasColor=p,t.exports.stripColor=u,t.exports.supportsColor=c}).call(this,e("_process"))},{_process:183,"ansi-styles":201,"escape-string-regexp":202,"has-ansi":203,"strip-ansi":205,"supports-color":207}],201:[function(e,t){"use strict";var n=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]}};n.colors.grey=n.colors.gray,Object.keys(n).forEach(function(e){var t=n[e];Object.keys(t).forEach(function(e){var r=t[e];n[e]=t[e]={open:"["+r[0]+"m",close:"["+r[1]+"m"}}),Object.defineProperty(n,e,{value:t,enumerable:!1})})},{}],202:[function(e,t){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],203:[function(e,t){"use strict";var n=e("ansi-regex"),r=new RegExp(n().source);t.exports=r.test.bind(r)},{"ansi-regex":204}],204:[function(e,t){"use strict";t.exports=function(){return/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g}},{}],205:[function(e,t){"use strict";var n=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{"ansi-regex":206}],206:[function(e,t,n){arguments[4][204][0].apply(n,arguments)},{dup:204}],207:[function(e,t){(function(e){"use strict";var n=e.argv;t.exports=function(){return"FORCE_COLOR"in e.env?!0:-1!==n.indexOf("--no-color")||-1!==n.indexOf("--no-colors")||-1!==n.indexOf("--color=false")?!1:-1!==n.indexOf("--color")||-1!==n.indexOf("--colors")||-1!==n.indexOf("--color=true")||-1!==n.indexOf("--color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"UPSTART_JOB"in e.env?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e("_process"))},{_process:183}],208:[function(e,t,n){(function(t){"use strict";function r(e){return new t(e,"base64").toString()}function l(e){return e.split(",").pop()}function i(e,t){var n=p.exec(e);p.lastIndex=0;var r=n[1]||n[2],l=o.join(t,r);try{return a.readFileSync(l,"utf8")}catch(i){throw new Error("An error occurred while trying to read the map file at "+l+"\n"+i)}}function s(e,t){t=t||{};try{t.isFileComment&&(e=i(e,t.commentFileDir)),t.hasComment&&(e=l(e)),t.isEncoded&&(e=r(e)),(t.isJSON||t.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}catch(n){return console.error(n),null}}var a=e("fs"),o=e("path"),u=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset:\S+;)?base64,(.*)$/gm,p=/(?:\/\/[@#][ \t]+sourceMappingURL=(.+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;s.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},s.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},s.prototype.toComment=function(){var e=this.toBase64();return"//# sourceMappingURL=data:application/json;base64,"+e},s.prototype.toObject=function(){return JSON.parse(this.toJSON())},s.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},s.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},s.prototype.getProperty=function(e){return this.sourcemap[e]},n.fromObject=function(e){return new s(e)},n.fromJSON=function(e){return new s(e,{isJSON:!0})},n.fromBase64=function(e){return new s(e,{isEncoded:!0})},n.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new s(e,{isEncoded:!0,hasComment:!0})},n.fromMapFileComment=function(e,t){return new s(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},n.fromSource=function(e){var t=e.match(u);return u.lastIndex=0,t?n.fromComment(t.pop()):null},n.fromMapFileSource=function(e,t){var r=e.match(p);return p.lastIndex=0,r?n.fromMapFileComment(r.pop(),t):null},n.removeComments=function(e){return u.lastIndex=0,e.replace(u,"")},n.removeMapFileComments=function(e){return p.lastIndex=0,e.replace(p,"")},n.__defineGetter__("commentRegex",function(){return u.lastIndex=0,u}),n.__defineGetter__("mapFileCommentRegex",function(){return p.lastIndex=0,p})}).call(this,e("buffer").Buffer)},{buffer:175,fs:172,path:182}],209:[function(e,t){e("./shim"),e("./modules/core.dict"),e("./modules/core.iter-helpers"),e("./modules/core.$for"),e("./modules/core.delay"),e("./modules/core.binding"),e("./modules/core.object"),e("./modules/core.array.turn"),e("./modules/core.number.iterator"),e("./modules/core.number.math"),e("./modules/core.string.escape-html"),e("./modules/core.date"),e("./modules/core.global"),e("./modules/core.log"),t.exports=e("./modules/$").core},{"./modules/$":223,"./modules/core.$for":235,"./modules/core.array.turn":236,"./modules/core.binding":237,"./modules/core.date":238,"./modules/core.delay":239,"./modules/core.dict":240,"./modules/core.global":241,"./modules/core.iter-helpers":242,"./modules/core.log":243,"./modules/core.number.iterator":244,"./modules/core.number.math":245,"./modules/core.object":246,"./modules/core.string.escape-html":247,"./shim":291}],210:[function(e,t){"use strict";var n=e("./$");t.exports=function(e){return function(t){var r,l=n.toObject(this),i=n.toLength(l.length),s=n.toIndex(arguments[1],i);if(e&&t!=t){for(;i>s;)if(r=l[s++],r!=r)return!0}else for(;i>s;s++)if((e||s in l)&&l[s]===t)return e||s;return!e&&-1}}},{"./$":223}],211:[function(e,t){"use strict";var n=e("./$"),r=e("./$.ctx");t.exports=function(e){var t=1==e,l=2==e,i=3==e,s=4==e,a=6==e,o=5==e||a;return function(u){for(var p,c,d=Object(n.assertDefined(this)),f=n.ES5Object(d),h=r(u,arguments[1],3),m=n.toLength(f.length),g=0,y=t?Array(m):l?[]:void 0;m>g;g++)if((o||g in f)&&(p=f[g],c=h(p,g,d),e))if(t)y[g]=c;else if(c)switch(e){case 3:return!0;case 5:return p;case 6:return g;case 2:y.push(p)}else if(s)return!1;return a?-1:i||s?s:y}}},{"./$":223,"./$.ctx":218}],212:[function(e,t){function n(e,t,n){if(!e)throw TypeError(n?t+n:t)}var r=e("./$");n.def=r.assertDefined,n.fn=function(e){if(!r.isFunction(e))throw TypeError(e+" is not a function!");return e},n.obj=function(e){if(!r.isObject(e))throw TypeError(e+" is not an object!");return e},n.inst=function(e,t,n){if(!(e instanceof t))throw TypeError(n+": use the 'new' operator!");return e},t.exports=n},{"./$":223}],213:[function(e,t){var n=e("./$");t.exports=Object.assign||function(e){for(var t=Object(n.assertDefined(e)),r=arguments.length,l=1;r>l;)for(var i,s=n.ES5Object(arguments[l++]),a=n.getKeys(s),o=a.length,u=0;o>u;)t[i=a[u++]]=s[i];return t}},{"./$":223}],214:[function(e,t){function n(e){return i.call(e).slice(8,-1)}var r=e("./$"),l=e("./$.wks")("toStringTag"),i={}.toString;n.classof=function(e){var t,r;return void 0==e?void 0===e?"Undefined":"Null":"string"==typeof(r=(t=Object(e))[l])?r:n(t)},n.set=function(e,t,n){e&&!r.has(e=n?e:e.prototype,l)&&r.hide(e,l,t)},t.exports=n},{"./$":223,"./$.wks":234}],215:[function(e,t){"use strict";function n(e,t){if(!c(e))return("string"==typeof e?"S":"P")+e;if(h(e))return"F";if(!u(e,m)){if(!t)return"E";d(e,m,++E)}return"O"+e[m]}function r(e,t){var r,l=n(t);if("F"!=l)return e[g][l];for(r=e[b];r;r=r.n)if(r.k==t)return r}var l=e("./$"),i=e("./$.ctx"),s=e("./$.uid").safe,a=e("./$.assert"),o=e("./$.iter"),u=l.has,p=l.set,c=l.isObject,d=l.hide,f=o.step,h=Object.isFrozen||l.core.Object.isFrozen,m=s("id"),g=s("O1"),y=s("last"),b=s("first"),v=s("iter"),x=l.DESC?s("size"):"size",E=0;t.exports={getConstructor:function(e,t,n){function s(r){var i=a.inst(this,s,e);p(i,g,l.create(null)),p(i,x,0),p(i,y,void 0),p(i,b,void 0),void 0!=r&&o.forOf(r,t,i[n],i)}return l.mix(s.prototype,{clear:function(){for(var e=this,t=e[g],n=e[b];n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete t[n.i];e[b]=e[y]=void 0,e[x]=0},"delete":function(e){var t=this,n=r(t,e);if(n){var l=n.n,i=n.p;delete t[g][n.i],n.r=!0,i&&(i.n=l),l&&(l.p=i),t[b]==n&&(t[b]=l),t[y]==n&&(t[y]=i),t[x]--}return!!n},forEach:function(e){for(var t,n=i(e,arguments[1],3);t=t?t.n:this[b];)for(n(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!r(this,e)}}),l.DESC&&l.setDesc(s.prototype,"size",{get:function(){return a.def(this[x])}}),s},def:function(e,t,l){var i,s,a=r(e,t);return a?a.v=l:(e[y]=a={i:s=n(t,!0),k:t,v:l,p:i=e[y],n:void 0,r:!1},e[b]||(e[b]=a),i&&(i.n=a),e[x]++,"F"!=s&&(e[g][s]=a)),e},getEntry:r,getIterConstructor:function(){return function(e,t){p(this,v,{o:e,k:t})}},next:function(){for(var e=this[v],t=e.k,n=e.l;n&&n.r;)n=n.p;return e.o&&(e.l=n=n?n.n:e.o[b])?"key"==t?f(0,n.k):"value"==t?f(0,n.v):f(0,[n.k,n.v]):(e.o=void 0,f(1))}}},{"./$":223,"./$.assert":212,"./$.ctx":218,"./$.iter":222,"./$.uid":232}],216:[function(e,t){"use strict";function n(e,t){return y.call(e.array,function(e){return e[0]===t})}function r(e){return e[m]||p(e,m,{array:[],get:function(e){var t=n(this,e);return t?t[1]:void 0},has:function(e){return!!n(this,e)},set:function(e,t){var r=n(this,e);r?r[1]=t:this.array.push([e,t])},"delete":function(e){var t=b.call(this.array,function(t){return t[0]===e});return~t&&this.array.splice(t,1),!!~t}})[m]}var l=e("./$"),i=e("./$.uid").safe,s=e("./$.assert"),a=e("./$.iter").forOf,o=l.has,u=l.isObject,p=l.hide,c=Object.isFrozen||l.core.Object.isFrozen,d=0,f=i("id"),h=i("weak"),m=i("leak"),g=e("./$.array-methods"),y=g(5),b=g(6);t.exports={getConstructor:function(e,t,n){function i(r){l.set(s.inst(this,i,e),f,d++),void 0!=r&&a(r,t,this[n],this)}return l.mix(i.prototype,{"delete":function(e){return u(e)?c(e)?r(this)["delete"](e):o(e,h)&&o(e[h],this[f])&&delete e[h][this[f]]:!1},has:function(e){return u(e)?c(e)?r(this).has(e):o(e,h)&&o(e[h],this[f]):!1}}),i},def:function(e,t,n){return c(s.obj(t))?r(e).set(t,n):(o(t,h)||p(t,h,{}),t[h][e[f]]=n),e},leakStore:r,WEAK:h,ID:f}},{"./$":223,"./$.array-methods":211,"./$.assert":212,"./$.iter":222,"./$.uid":232}],217:[function(e,t){"use strict";var n=e("./$"),r=e("./$.def"),l=e("./$.iter"),i=e("./$.assert").inst;t.exports=function(t,s,a,o,u){function p(e,t){var r=h[e];n.FW&&(h[e]=function(e,n){var l=r.call(this,0===e?0:e,n);return t?this:l})}var c=n.g[t],d=c,f=o?"set":"add",h=d&&d.prototype,m={};if(n.isFunction(d)&&(u||!l.BUGGY&&h.forEach&&h.entries)){var g,y=new d,b=y[f](u?{}:-0,1);(l.fail(function(e){new d(e)})||l.DANGER_CLOSING)&&(d=function(e){i(this,d,t);var n=new c;return void 0!=e&&l.forOf(e,o,n[f],n),n},d.prototype=h,n.FW&&(h.constructor=d)),u||y.forEach(function(e,t){g=1/t===-1/0}),g&&(p("delete"),p("has"),o&&p("get")),(g||b!==y)&&p(f,!0)}else d=a.getConstructor(t,o,f),n.mix(d.prototype,s);return e("./$.cof").set(d,t),e("./$.species")(d),m[t]=d,r(r.G+r.W+r.F*(d!=c),m),u||l.std(d,t,a.getIterConstructor(),a.next,o?"key+value":"value",!o,!0),d}},{"./$":223,"./$.assert":212,"./$.cof":214,"./$.def":219,"./$.iter":222,"./$.species":229}],218:[function(e,t){var n=e("./$.assert").fn;t.exports=function(e,t,r){if(n(e),~r&&void 0===t)return e;switch(r){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,l){return e.call(t,n,r,l)}}return function(){return e.apply(t,arguments)}}},{"./$.assert":212}],219:[function(e,t){function n(e,t){return function(){return e.apply(t,arguments)}}function r(e,t,o){var u,p,c,d,f=e&r.G,h=f?i:e&r.S?i[t]:(i[t]||{}).prototype,m=f?s:s[t]||(s[t]={});f&&(o=t);for(u in o)p=!(e&r.F)&&h&&u in h,p&&u in m||(c=p?h[u]:o[u],f&&!a(h[u])?d=o[u]:e&r.B&&p?d=n(c,i):e&r.W&&h[u]==c?!function(e){d=function(t){return this instanceof e?new e(t):e(t)},d.prototype=e.prototype}(c):d=e&r.P&&a(c)?n(Function.call,c):c,l.hide(m,u,d))}var l=e("./$"),i=l.g,s=l.core,a=l.isFunction;r.F=1,r.G=2,r.S=4,r.P=8,r.B=16,r.W=32,t.exports=r},{"./$":223}],220:[function(e,t){t.exports=function(e){return e.FW=!1,e.path=e.core,e}},{}],221:[function(e,t){t.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3]);case 5:return r?e(t[0],t[1],t[2],t[3],t[4]):e.call(n,t[0],t[1],t[2],t[3],t[4])}return e.apply(n,t)}},{}],222:[function(e,t){"use strict";function n(e,t){a.hide(e,d,t),f in[]&&a.hide(e,f,t)}function r(e,t,r,l){var i=e.prototype,s=i[d]||i[f]||l&&i[l]||r;if(a.FW&&n(i,s),s!==r){var o=a.getProto(s.call(new e));u.set(o,t+" Iterator",!0),a.FW&&a.has(i,f)&&n(o,a.that)}return h[t]=s,h[t+" Iterator"]=a.that,s}function l(e){var t=a.g.Symbol,n=e[t&&t.iterator||f],r=n||e[d]||h[u.classof(e)];return c(r.call(e))}function i(e){var t=e["return"];void 0!==t&&c(t.call(e))}function s(e,t,n,r){try{return r?t(c(n)[0],n[1]):t(n)}catch(l){throw i(e),l}}var a=e("./$"),o=e("./$.ctx"),u=e("./$.cof"),p=e("./$.def"),c=e("./$.assert").obj,d=e("./$.wks")("iterator"),f="@@iterator",h={},m={},g="keys"in[]&&!("next"in[].keys());n(m,a.that);var y=!0;!function(){try{var e=[1].keys();e["return"]=function(){y=!1},Array.from(e,function(){throw 2})}catch(t){}}();var b=t.exports={BUGGY:g,DANGER_CLOSING:y,fail:function(e){var t=!0;try{var n=[[{},1]],r=n[d](),l=r.next;r.next=function(){return t=!1,l.call(this)},n[d]=function(){return r},e(n)}catch(i){}return t},Iterators:h,prototype:m,step:function(e,t){return{value:t,done:!!e}},stepCall:s,close:i,is:function(e){var t=Object(e),n=a.g.Symbol,r=n&&n.iterator||f;return r in t||d in t||a.has(h,u.classof(t))},get:l,set:n,create:function(e,t,n,r){e.prototype=a.create(r||b.prototype,{next:a.desc(1,n)}),u.set(e,t+" Iterator")},define:r,std:function(e,t,n,l,i,s,o){function u(e){return function(){return new n(this,e)}}b.create(n,t,l);var c,d,f=u("key+value"),h=u("value"),m=e.prototype;if("value"==i?h=r(e,t,h,"values"):f=r(e,t,f,"entries"),i&&(c={entries:f,keys:s?h:u("key"),values:h},p(p.P+p.F*g,t,c),o))for(d in c)d in m||a.hide(m,d,c[d])},forOf:function(e,t,n,r){for(var a,u=l(e),p=o(n,r,t?2:1);!(a=u.next()).done;)if(s(u,p,a.value,t)===!1)return i(u)}}},{"./$":223,"./$.assert":212,"./$.cof":214,"./$.ctx":218,"./$.def":219,"./$.wks":234}],223:[function(e,t){"use strict";function n(e){return isNaN(e=+e)?0:(e>0?h:f)(e)}function r(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}function l(e,t,n){return e[t]=n,e}function i(e){return y?function(t,n,l){return v.setDesc(t,n,r(e,l))}:l}function s(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function a(e){return"function"==typeof e}function o(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}var u="undefined"!=typeof self?self:Function("return this")(),p={},c=Object.defineProperty,d={}.hasOwnProperty,f=Math.ceil,h=Math.floor,m=Math.max,g=Math.min,y=!!function(){try{return 2==c({},"a",{get:function(){return 2}}).a}catch(e){}}(),b=i(1),v=t.exports=e("./$.fw")({g:u,core:p,html:u.document&&document.documentElement,isObject:s,isFunction:a,it:function(e){return e},that:function(){return this},toInteger:n,toLength:function(e){return e>0?g(n(e),9007199254740991):0},toIndex:function(e,t){return e=n(e),0>e?m(e+t,0):g(e,t)},has:function(e,t){return d.call(e,t)},create:Object.create,getProto:Object.getPrototypeOf,DESC:y,desc:r,getDesc:Object.getOwnPropertyDescriptor,setDesc:c,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:o,ES5Object:Object,toObject:function(e){return v.ES5Object(o(e))},hide:b,def:i(0),set:u.Symbol?l:b,mix:function(e,t){for(var n in t)b(e,n,t[n]);return e},each:[].forEach});"undefined"!=typeof __e&&(__e=p),"undefined"!=typeof __g&&(__g=u)},{"./$.fw":220}],224:[function(e,t){var n=e("./$");t.exports=function(e,t){for(var r,l=n.toObject(e),i=n.getKeys(l),s=i.length,a=0;s>a;)if(l[r=i[a++]]===t)return r}},{"./$":223}],225:[function(e,t){var n=e("./$"),r=e("./$.assert").obj;t.exports=function(e){return r(e),n.getSymbols?n.getNames(e).concat(n.getSymbols(e)):n.getNames(e)}},{"./$":223,"./$.assert":212}],226:[function(e,t){"use strict";var n=e("./$"),r=e("./$.invoke"),l=e("./$.assert").fn;t.exports=function(){for(var e=l(this),t=arguments.length,i=Array(t),s=0,a=n.path._,o=!1;t>s;)(i[s]=arguments[s++])===a&&(o=!0);return function(){var n,l=this,s=arguments.length,u=0,p=0;if(!o&&!s)return r(e,i,l);if(n=i.slice(),o)for(;t>u;u++)n[u]===a&&(n[u]=arguments[p++]);for(;s>p;)n.push(arguments[p++]);return r(e,n,l)}}},{"./$":223,"./$.assert":212,"./$.invoke":221}],227:[function(e,t){"use strict";t.exports=function(e,t,n){var r=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(n?t:this).replace(e,r)}}},{}],228:[function(e,t){var n=e("./$"),r=e("./$.assert");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(t,l){try{l=e("./$.ctx")(Function.call,n.getDesc(Object.prototype,"__proto__").set,2),l({},[])}catch(i){t=!0}return function(e,i){return r.obj(e),r(null===i||n.isObject(i),i,": can't set as prototype!"),t?e.__proto__=i:l(e,i),e}}():void 0)},{"./$":223,"./$.assert":212,"./$.ctx":218}],229:[function(e,t){var n=e("./$");t.exports=function(t){n.DESC&&n.FW&&n.setDesc(t,e("./$.wks")("species"),{configurable:!0,get:n.that})}},{"./$":223,"./$.wks":234}],230:[function(e,t){"use strict";var n=e("./$");t.exports=function(e){return function(t){var r,l,i=String(n.assertDefined(this)),s=n.toInteger(t),a=i.length;return 0>s||s>=a?e?"":void 0:(r=i.charCodeAt(s),55296>r||r>56319||s+1===a||(l=i.charCodeAt(s+1))<56320||l>57343?e?i.charAt(s):r:e?i.slice(s,s+2):(r-55296<<10)+(l-56320)+65536)}}},{"./$":223}],231:[function(e,t){"use strict";function n(){var e=+this;if(a.has(v,e)){var t=v[e];delete v[e],t()}}function r(e){n.call(e.data)}var l,i,s,a=e("./$"),o=e("./$.ctx"),u=e("./$.cof"),p=e("./$.invoke"),c=a.g,d=a.isFunction,f=c.setImmediate,h=c.clearImmediate,m=c.postMessage,g=c.addEventListener,y=c.MessageChannel,b=0,v={},x="onreadystatechange";d(f)&&d(h)||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++b]=function(){p(d(e)?e:Function(e),t)},l(b),b},h=function(e){delete v[e]},"process"==u(c.process)?l=function(e){c.process.nextTick(o(n,e,1))}:g&&d(m)&&!a.g.importScripts?(l=function(e){m(e,"*")},g("message",r,!1)):d(y)?(i=new y,s=i.port2,i.port1.onmessage=r,l=o(s.postMessage,s,1)):l=a.g.document&&x in document.createElement("script")?function(e){a.html.appendChild(document.createElement("script"))[x]=function(){a.html.removeChild(this),n.call(e)}}:function(e){setTimeout(o(n,e,1),0)}),t.exports={set:f,clear:h}},{"./$":223,"./$.cof":214,"./$.ctx":218,"./$.invoke":221}],232:[function(e,t){function n(e){return"Symbol("+e+")_"+(++r+Math.random()).toString(36)}var r=0;n.safe=e("./$").g.Symbol||n,t.exports=n},{"./$":223}],233:[function(e,t){var n=e("./$"),r=e("./$.wks")("unscopables");!n.FW||r in[]||n.hide(Array.prototype,r,{}),t.exports=function(e){n.FW&&([][r][e]=!0)}},{"./$":223,"./$.wks":234}],234:[function(e,t){var n=e("./$").g,r={};t.exports=function(t){return r[t]||(r[t]=n.Symbol&&n.Symbol[t]||e("./$.uid").safe("Symbol."+t))}},{"./$":223,"./$.uid":232}],235:[function(e){"use strict";function t(e,n){return this instanceof t?(this[p]=f(e),void(this[o]=!!n)):new t(e,n)}function n(e){function t(e,t,n){this[p]=f(e),this[o]=e[o],this[u]=l(t,n,e[o]?2:1)}return m(t,"Chain",e,g),h(t.prototype,r.that),t}var r=e("./$"),l=e("./$.ctx"),i=e("./$.uid").safe,s=e("./$.def"),a=e("./$.iter"),o=i("entries"),u=i("fn"),p=i("iter"),c=a.forOf,d=a.stepCall,f=a.get,h=a.set,m=a.create;m(t,"Wrapper",function(){return this[p].next()});var g=t.prototype;h(g,function(){return this[p]});var y=n(function(){var e=this[p].next();return e.done?e:a.step(0,d(this[p],this[u],e.value,this[o]))}),b=n(function(){for(;;){var e=this[p].next();if(e.done||d(this[p],this[u],e.value,this[o]))return e}});r.mix(g,{of:function(e,t){c(this,this[o],e,t)},array:function(e,t){var n=[];return c(void 0!=e?this.map(e,t):this,!1,n.push,n),n},filter:function(e,t){return new b(this,e,t)},map:function(e,t){return new y(this,e,t)}}),t.isIterable=a.is,t.getIterator=f,s(s.G+s.F,{$for:t})},{"./$":223,"./$.ctx":218,"./$.def":219,"./$.iter":222,"./$.uid":232}],236:[function(e){"use strict";var t=e("./$"),n=e("./$.def"),r=e("./$.assert").fn;n(n.P+n.F,"Array",{turn:function(e,n){r(e);for(var l=void 0==n?[]:Object(n),i=t.ES5Object(this),s=t.toLength(i.length),a=0;s>a&&e(l,i[a],a++,this)!==!1;);return l}}),e("./$.unscope")("turn")},{"./$":223,"./$.assert":212,"./$.def":219,"./$.unscope":233}],237:[function(e){"use strict";function t(e){var t=this,l={};return s(t,o,function(e){return void 0!==e&&e in t?n.has(l,e)?l[e]:l[e]=r(t[e],t,-1):u.call(t)})[o](e)}var n=e("./$"),r=e("./$.ctx"),l=e("./$.def"),i=e("./$.invoke"),s=n.hide,a=e("./$.assert").fn,o=n.DESC?e("./$.uid")("tie"):"toLocaleString",u={}.toLocaleString;n.core._=n.path._=n.path._||{},l(l.P+l.F,"Function",{part:e("./$.partial"),only:function(e,t){var r=a(this),l=n.toLength(e),s=arguments.length>1;return function(){for(var e=Math.min(l,arguments.length),n=Array(e),a=0;e>a;)n[a]=arguments[a++];return i(r,n,s?t:this)}}}),s(n.path._,"toString",function(){return o}),s(Object.prototype,o,t),n.DESC||s(Array.prototype,o,t)},{"./$":223,"./$.assert":212,"./$.ctx":218,"./$.def":219,"./$.invoke":221,"./$.partial":226,"./$.uid":232}],238:[function(e){function t(e){return e>9?e:"0"+e}function n(e){return function(n,r){function i(t){return s[e+t]()}var s=this,o=u[l.has(u,r)?r:p];return String(n).replace(a,function(e){switch(e){case"s":return i(c);case"ss":return t(i(c));case"m":return i(d);case"mm":return t(i(d));case"h":return i(f);case"hh":return t(i(f));case"D":return i(h);case"DD":return t(i(h));case"W":return o[0][i("Day")];case"N":return i(m)+1;case"NN":return t(i(m)+1);case"M":return o[2][i(m)];case"MM":return o[1][i(m)];case"Y":return i(g);case"YY":return t(i(g)%100)}return e})}}function r(e,t){function n(e){var n=[];return l.each.call(t.months.split(","),function(t){n.push(t.replace(o,"$"+e))}),n}return u[e]=[t.weekdays.split(","),n(1),n(2)],s}var l=e("./$"),i=e("./$.def"),s=l.core,a=/\b\w\w?\b/g,o=/:(.*)\|(.*)$/,u={},p="en",c="Seconds",d="Minutes",f="Hours",h="Date",m="Month",g="FullYear";i(i.P+i.F,h,{format:n("get"),formatUTC:n("getUTC")}),r(p,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"}),r("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"}),s.locale=function(e){return l.has(u,e)?p=e:p},s.addLocale=r},{"./$":223,"./$.def":219}],239:[function(e){var t=e("./$"),n=e("./$.def"),r=e("./$.partial");n(n.G+n.F,{delay:function(e){return new(t.core.Promise||t.g.Promise)(function(t){setTimeout(r.call(t,!0),e)})}})},{"./$":223,"./$.def":219,"./$.partial":226}],240:[function(e){function t(e){var t=a.create(null);return void 0!=e&&(h.is(e)?h.forOf(e,!0,function(e,n){t[e]=n}):p(t,e)),t}function n(e,t){a.set(this,d,{o:y(e),a:g(e),i:0,k:t})}function r(e){return function(t){return new n(t,e)}}function l(e,t){return"function"==typeof e?e:t}function i(e){var n=1==e,r=4==e;return function(i,s,a){var u,p,c,d=o(s,a,3),f=y(i),h=n||7==e||2==e?new(l(this,t)):void 0;for(u in f)if(b(f,u)&&(p=f[u],c=d(p,u,i),e))if(n)h[u]=c;else if(c)switch(e){case 2:h[u]=p;break;case 3:return!0;case 5:return p;case 6:return u;case 7:h[c[0]]=c[1]}else if(r)return!1;return 3==e||r?r:h}}function s(e){return function(n,r,i){f.fn(r);var s,a,o,u=y(n),p=g(u),c=p.length,d=0;for(e?s=void 0==i?new(l(this,t)):Object(i):arguments.length<3?(f(c,"Reduce of empty object with no initial value"),s=u[p[d++]]):s=Object(i);c>d;)if(b(u,a=p[d++]))if(o=r(s,u[a],a,n),e){if(o===!1)break}else s=o;return s}}var a=e("./$"),o=e("./$.ctx"),u=e("./$.def"),p=e("./$.assign"),c=e("./$.keyof"),d=e("./$.uid").safe("iter"),f=e("./$.assert"),h=e("./$.iter"),m=h.step,g=a.getKeys,y=a.toObject,b=a.has;t.prototype=null,h.create(n,"Dict",function(){var e,t=this[d],n=t.o,r=t.a,l=t.k;do if(t.i>=r.length)return t.o=void 0,m(1);while(!b(n,e=r[t.i++]));return"key"==l?m(0,e):"value"==l?m(0,n[e]):m(0,[e,n[e]])});var v=i(6);u(u.G+u.F,{Dict:a.mix(t,{keys:r("key"),values:r("value"),entries:r("key+value"),forEach:i(0),map:i(1),filter:i(2),some:i(3),every:i(4),find:i(5),findKey:v,mapPairs:i(7),reduce:s(!1),turn:s(!0),keyOf:c,includes:function(e,t){return void 0!==(t==t?c(e,t):v(e,function(e){return e!=e}))},has:b,get:function(e,t){return b(e,t)?e[t]:void 0},set:a.def,isDict:function(e){return a.isObject(e)&&a.getProto(e)===t.prototype}})})},{"./$":223,"./$.assert":212,"./$.assign":213,"./$.ctx":218,"./$.def":219,"./$.iter":222,"./$.keyof":224,"./$.uid":232}],241:[function(e){var t=e("./$.def");t(t.G+t.F,{global:e("./$").g})},{"./$":223,"./$.def":219}],242:[function(e){var t=e("./$").core,n=e("./$.iter");t.isIterable=n.is,t.getIterator=n.get},{"./$":223,"./$.iter":222}],243:[function(e){var t=e("./$"),n=e("./$.def"),r={},l=!0;t.each.call("assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,markTimeline,profile,profileEnd,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(","),function(e){r[e]=function(){return l&&t.g.console&&t.isFunction(console[e])?Function.apply.call(console[e],console,arguments):void 0}}),n(n.G+n.F,{log:e("./$.assign")(r.log,r,{enable:function(){l=!0},disable:function(){l=!1}})})},{"./$":223,"./$.assign":213,"./$.def":219}],244:[function(e){"use strict";function t(e){n.set(this,r,{l:n.toLength(e),i:0})}var n=e("./$"),r=e("./$.uid").safe("iter"),l=e("./$.iter"),i=l.step,s="Number";l.create(t,s,function(){var e=this[r],t=e.i++;return t<e.l?i(0,t):i(1)}),l.define(Number,s,function(){return new t(this)})},{"./$":223,"./$.iter":222,"./$.uid":232}],245:[function(e){"use strict";var t=e("./$"),n=e("./$.def"),r=e("./$.invoke"),l={};l.random=function(e){var t=+this,n=void 0==e?0:+e,r=Math.min(t,n);return Math.random()*(Math.max(t,n)-r)+r},t.FW&&t.each.call("round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc".split(","),function(e){var t=Math[e];t&&(l[e]=function(){for(var e=[+this],n=0;arguments.length>n;)e.push(arguments[n++]); return r(t,e)})}),n(n.P+n.F,"Number",l)},{"./$":223,"./$.def":219,"./$.invoke":221}],246:[function(e){function t(e,t){for(var r,i=l(n.toObject(t)),s=i.length,a=0;s>a;)n.setDesc(e,r=i[a++],n.getDesc(t,r));return e}var n=e("./$"),r=e("./$.def"),l=e("./$.own-keys");r(r.S+r.F,"Object",{isObject:n.isObject,classof:e("./$.cof").classof,define:t,make:function(e,r){return t(n.create(e),r)}})},{"./$":223,"./$.cof":214,"./$.def":219,"./$.own-keys":225}],247:[function(e){var t,n=e("./$.def"),r=e("./$.replacer"),l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"},i={};for(t in l)i[l[t]]=t;n(n.P+n.F,"String",{escapeHTML:r(/[&<>"']/g,l),unescapeHTML:r(/&(?:amp|lt|gt|quot|apos);/g,i)})},{"./$.def":219,"./$.replacer":227}],248:[function(e){function t(e,t){return function(n){var r,l=w(n),i=0,s=[];for(r in l)r!=d&&E(l,r)&&s.push(r);for(;t>i;)E(l,r=e[i++])&&(~b.call(s,r)||s.push(r));return s}}function n(e){return!a.isObject(e)}function r(){}function l(e){return function(){return e.apply(a.ES5Object(this),arguments)}}function i(e){return function(t,n){f.fn(t);var r=w(this),l=k(r.length),i=e?l-1:0,s=e?-1:1;if(arguments.length<2)for(;;){if(i in r){n=r[i],i+=s;break}i+=s,f(e?i>=0:l>i,"Reduce of empty array with no initial value")}for(;e?i>=0:l>i;i+=s)i in r&&(n=t(n,r[i],i,this));return n}}function s(e){return e>9?e:"0"+e}var a=e("./$"),o=e("./$.cof"),u=e("./$.def"),p=e("./$.invoke"),c=e("./$.array-methods"),d=e("./$.uid").safe("__proto__"),f=e("./$.assert"),h=f.obj,m=Object.prototype,g=[],y=g.slice,b=g.indexOf,v=o.classof,x=Object.defineProperties,E=a.has,_=a.setDesc,S=a.getDesc,I=a.isFunction,w=a.toObject,k=a.toLength,A=!1;if(!a.DESC){try{A=8==_(document.createElement("div"),"x",{get:function(){return 8}}).x}catch(C){}a.setDesc=function(e,t,n){if(A)try{return _(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(h(e)[t]=n.value),e},a.getDesc=function(e,t){if(A)try{return S(e,t)}catch(n){}return E(e,t)?a.desc(!m.propertyIsEnumerable.call(e,t),e[t]):void 0},x=function(e,t){h(e);for(var n,r=a.getKeys(t),l=r.length,i=0;l>i;)a.setDesc(e,n=r[i++],t[n]);return e}}u(u.S+u.F*!a.DESC,"Object",{getOwnPropertyDescriptor:a.getDesc,defineProperty:a.setDesc,defineProperties:x});var T="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),j=T.concat("length","prototype"),M=T.length,P=function(){var e,t=document.createElement("iframe"),n=M;for(t.style.display="none",a.html.appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script>"),e.close(),P=e.F;n--;)delete P.prototype[T[n]];return P()};u(u.S,"Object",{getPrototypeOf:a.getProto=a.getProto||function(e){return e=Object(f.def(e)),E(e,d)?e[d]:I(e.constructor)&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?m:null},getOwnPropertyNames:a.getNames=a.getNames||t(j,j.length,!0),create:a.create=a.create||function(e,t){var n;return null!==e?(r.prototype=h(e),n=new r,r.prototype=null,n[d]=e):n=P(),void 0===t?n:x(n,t)},keys:a.getKeys=a.getKeys||t(T,M,!1),seal:a.it,freeze:a.it,preventExtensions:a.it,isSealed:n,isFrozen:n,isExtensible:a.isObject}),u(u.P,"Function",{bind:function(e){function t(){var l=r.concat(y.call(arguments));return p(n,l,this instanceof t?a.create(n.prototype):e)}var n=f.fn(this),r=y.call(arguments,1);return n.prototype&&(t.prototype=n.prototype),t}}),0 in Object("z")&&"z"=="z"[0]||(a.ES5Object=function(e){return"String"==o(e)?e.split(""):Object(e)}),u(u.P+u.F*(a.ES5Object!=Object),"Array",{slice:l(y),join:l(g.join)}),u(u.S,"Array",{isArray:function(e){return"Array"==o(e)}}),u(u.P,"Array",{forEach:a.each=a.each||c(0),map:c(1),filter:c(2),some:c(3),every:c(4),reduce:i(!1),reduceRight:i(!0),indexOf:b=b||e("./$.array-includes")(!1),lastIndexOf:function(e,t){var n=w(this),r=k(n.length),l=r-1;for(arguments.length>1&&(l=Math.min(l,a.toInteger(t))),0>l&&(l=k(r+l));l>=0;l--)if(l in n&&n[l]===e)return l;return-1}}),u(u.P,"String",{trim:e("./$.replacer")(/^\s*([\s\S]*\S)?\s*$/,"$1")}),u(u.S,"Date",{now:function(){return+new Date}}),u(u.P,"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),n=e.getUTCMilliseconds(),r=0>t?"-":t>9999?"+":"";return r+("00000"+Math.abs(t)).slice(r?-6:-4)+"-"+s(e.getUTCMonth()+1)+"-"+s(e.getUTCDate())+"T"+s(e.getUTCHours())+":"+s(e.getUTCMinutes())+":"+s(e.getUTCSeconds())+"."+(n>99?n:"0"+s(n))+"Z"}}),"Object"==v(function(){return arguments}())&&(o.classof=function(e){var t=v(e);return"Object"==t&&I(e.callee)?"Arguments":t})},{"./$":223,"./$.array-includes":210,"./$.array-methods":211,"./$.assert":212,"./$.cof":214,"./$.def":219,"./$.invoke":221,"./$.replacer":227,"./$.uid":232}],249:[function(e){"use strict";var t=e("./$"),n=e("./$.def"),r=t.toIndex;n(n.P,"Array",{copyWithin:function(e,n){var l=Object(t.assertDefined(this)),i=t.toLength(l.length),s=r(e,i),a=r(n,i),o=arguments[2],u=void 0===o?i:r(o,i),p=Math.min(u-a,i-s),c=1;for(s>a&&a+p>s&&(c=-1,a=a+p-1,s=s+p-1);p-->0;)a in l?l[s]=l[a]:delete l[s],s+=c,a+=c;return l}}),e("./$.unscope")("copyWithin")},{"./$":223,"./$.def":219,"./$.unscope":233}],250:[function(e){"use strict";var t=e("./$"),n=e("./$.def"),r=t.toIndex;n(n.P,"Array",{fill:function(e){for(var n=Object(t.assertDefined(this)),l=t.toLength(n.length),i=r(arguments[1],l),s=arguments[2],a=void 0===s?l:r(s,l);a>i;)n[i++]=e;return n}}),e("./$.unscope")("fill")},{"./$":223,"./$.def":219,"./$.unscope":233}],251:[function(e){var t=e("./$.def");t(t.P,"Array",{findIndex:e("./$.array-methods")(6)}),e("./$.unscope")("findIndex")},{"./$.array-methods":211,"./$.def":219,"./$.unscope":233}],252:[function(e){var t=e("./$.def");t(t.P,"Array",{find:e("./$.array-methods")(5)}),e("./$.unscope")("find")},{"./$.array-methods":211,"./$.def":219,"./$.unscope":233}],253:[function(e){var t=e("./$"),n=e("./$.ctx"),r=e("./$.def"),l=e("./$.iter"),i=l.stepCall;r(r.S+r.F*l.DANGER_CLOSING,"Array",{from:function(e){var r,s,a,o,u=Object(t.assertDefined(e)),p=arguments[1],c=void 0!==p,d=c?n(p,arguments[2],2):void 0,f=0;if(l.is(u))for(o=l.get(u),s=new("function"==typeof this?this:Array);!(a=o.next()).done;f++)s[f]=c?i(o,d,[a.value,f],!0):a.value;else for(s=new("function"==typeof this?this:Array)(r=t.toLength(u.length));r>f;f++)s[f]=c?d(u[f],f):u[f];return s.length=f,s}})},{"./$":223,"./$.ctx":218,"./$.def":219,"./$.iter":222}],254:[function(e){var t=e("./$"),n=e("./$.unscope"),r=e("./$.uid").safe("iter"),l=e("./$.iter"),i=l.step,s=l.Iterators;l.std(Array,"Array",function(e,n){t.set(this,r,{o:t.toObject(e),i:0,k:n})},function(){var e=this[r],t=e.o,n=e.k,l=e.i++;return!t||l>=t.length?(e.o=void 0,i(1)):"key"==n?i(0,l):"value"==n?i(0,t[l]):i(0,[l,t[l]])},"value"),s.Arguments=s.Array,n("keys"),n("values"),n("entries")},{"./$":223,"./$.iter":222,"./$.uid":232,"./$.unscope":233}],255:[function(e){var t=e("./$.def");t(t.S,"Array",{of:function(){for(var e=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>e;)n[e]=arguments[e++];return n.length=t,n}})},{"./$.def":219}],256:[function(e){e("./$.species")(Array)},{"./$.species":229}],257:[function(e){"use strict";var t=e("./$"),n="name",r=t.setDesc,l=Function.prototype;n in l||t.FW&&t.DESC&&r(l,n,{configurable:!0,get:function(){var e=String(this).match(/^\s*function ([^ (]*)/),l=e?e[1]:"";return t.has(this,n)||r(this,n,t.desc(5,l)),l},set:function(e){t.has(this,n)||r(this,n,t.desc(0,e))}})},{"./$":223}],258:[function(e){"use strict";var t=e("./$.collection-strong");e("./$.collection")("Map",{get:function(e){var n=t.getEntry(this,e);return n&&n.v},set:function(e,n){return t.def(this,0===e?0:e,n)}},t,!0)},{"./$.collection":217,"./$.collection-strong":215}],259:[function(e){function t(e){return isFinite(e=+e)&&0!=e?0>e?-t(-e):u(e+p(e*e+1)):e}function n(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:o(e)-1}var r=1/0,l=e("./$.def"),i=Math.E,s=Math.pow,a=Math.abs,o=Math.exp,u=Math.log,p=Math.sqrt,c=Math.ceil,d=Math.floor,f=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1};l(l.S,"Math",{acosh:function(e){return(e=+e)<1?0/0:isFinite(e)?u(e/i+p(e+1)*p(e-1)/i)+1:e},asinh:t,atanh:function(e){return 0==(e=+e)?e:u((1+e)/(1-e))/2},cbrt:function(e){return f(e=+e)*s(a(e),1/3)},clz32:function(e){return(e>>>=0)?32-e.toString(2).length:32},cosh:function(e){return(o(e=+e)+o(-e))/2},expm1:n,fround:function(e){return new Float32Array([e])[0]},hypot:function(){for(var e,t=0,n=arguments.length,l=n,i=Array(n),a=-r;n--;){if(e=i[n]=+arguments[n],e==r||e==-r)return r;e>a&&(a=e)}for(a=e||1;l--;)t+=s(i[l]/a,2);return a*p(t)},imul:function(e,t){var n=65535,r=+e,l=+t,i=n&r,s=n&l;return 0|i*s+((n&r>>>16)*s+i*(n&l>>>16)<<16>>>0)},log1p:function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:u(1+e)},log10:function(e){return u(e)/Math.LN10},log2:function(e){return u(e)/Math.LN2},sign:f,sinh:function(e){return a(e=+e)<1?(n(e)-n(-e))/2:(o(e-1)-o(-e-1))*(i/2)},tanh:function(e){var t=n(e=+e),l=n(-e);return t==r?1:l==r?-1:(t-l)/(o(e)+o(-e))},trunc:function(e){return(e>0?d:c)(e)}})},{"./$.def":219}],260:[function(e){"use strict";function t(e){var t,n;if(i(t=e.valueOf)&&!l(n=t.call(e)))return n;if(i(t=e.toString)&&!l(n=t.call(e)))return n;throw TypeError("Can't convert object to number")}function n(e){if(l(e)&&(e=t(e)),"string"==typeof e&&e.length>2&&48==e.charCodeAt(0)){var n=!1;switch(e.charCodeAt(1)){case 66:case 98:n=!0;case 79:case 111:return parseInt(e.slice(2),n?2:8)}}return+e}var r=e("./$"),l=r.isObject,i=r.isFunction,s="Number",a=r.g[s],o=a,u=a.prototype;!r.FW||a("0o1")&&a("0b1")||(a=function p(e){return this instanceof p?new o(n(e)):n(e)},r.each.call(r.DESC?r.getNames(o):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),function(e){r.has(o,e)&&!r.has(a,e)&&r.setDesc(a,e,r.getDesc(o,e))}),a.prototype=u,u.constructor=a,r.hide(r.g,s,a))},{"./$":223}],261:[function(e){function t(e){return!n.isObject(e)&&isFinite(e)&&i(e)===e}var n=e("./$"),r=e("./$.def"),l=Math.abs,i=Math.floor,s=9007199254740991;r(r.S,"Number",{EPSILON:Math.pow(2,-52),isFinite:function(e){return"number"==typeof e&&isFinite(e)},isInteger:t,isNaN:function(e){return e!=e},isSafeInteger:function(e){return t(e)&&l(e)<=s},MAX_SAFE_INTEGER:s,MIN_SAFE_INTEGER:-s,parseFloat:parseFloat,parseInt:parseInt})},{"./$":223,"./$.def":219}],262:[function(e){var t=e("./$.def");t(t.S,"Object",{assign:e("./$.assign")})},{"./$.assign":213,"./$.def":219}],263:[function(e){var t=e("./$.def");t(t.S,"Object",{is:function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}})},{"./$.def":219}],264:[function(e){var t=e("./$.def");t(t.S,"Object",{setPrototypeOf:e("./$.set-proto")})},{"./$.def":219,"./$.set-proto":228}],265:[function(e){function t(e,t){var s=(n.core.Object||{})[e]||Object[e],a=0,o={};o[e]=1==t?function(e){return l(e)?s(e):e}:2==t?function(e){return l(e)?s(e):!0}:3==t?function(e){return l(e)?s(e):!1}:4==t?function(e,t){return s(i(e),t)}:5==t?function(e){return s(Object(n.assertDefined(e)))}:function(e){return s(i(e))};try{s("z")}catch(u){a=1}r(r.S+r.F*a,"Object",o)}var n=e("./$"),r=e("./$.def"),l=n.isObject,i=n.toObject;t("freeze",1),t("seal",1),t("preventExtensions",1),t("isFrozen",2),t("isSealed",2),t("isExtensible",3),t("getOwnPropertyDescriptor",4),t("getPrototypeOf",5),t("keys"),t("getOwnPropertyNames")},{"./$":223,"./$.def":219}],266:[function(e){"use strict";var t=e("./$"),n=e("./$.cof"),r={};r[e("./$.wks")("toStringTag")]="z",t.FW&&"z"!=n(r)&&t.hide(Object.prototype,"toString",function(){return"[object "+n.classof(this)+"]"})},{"./$":223,"./$.cof":214,"./$.wks":234}],267:[function(e){"use strict";function t(e){var t=E(e)[u];return void 0!=t?t:e}var n,r=e("./$"),l=e("./$.ctx"),i=e("./$.cof"),s=e("./$.def"),a=e("./$.assert"),o=e("./$.iter"),u=e("./$.wks")("species"),p=e("./$.uid").safe("record"),c=o.forOf,d="Promise",f=r.g,h=f.process,m=h&&h.nextTick||e("./$.task").set,g=f[d],y=g,b=r.isFunction,v=r.isObject,x=a.fn,E=a.obj;b(g)&&b(g.resolve)&&g.resolve(n=new g(function(){}))==n||function(){function e(e){var t;return v(e)&&(t=e.then),b(t)?t:!1}function t(e){var n,r=e[p],l=r.c,i=0;if(r.h)return!0;for(;l.length>i;)if(n=l[i++],n.fail||t(n.P))return!0}function n(n,r){var l=n.c;(r||l.length)&&m(function(){var s=n.p,a=n.v,o=1==n.s,u=0;if(r&&!t(s))setTimeout(function(){t(s)||("process"==i(h)?h.emit("unhandledRejection",a,s):f.console&&b(console.error)&&console.error("Unhandled promise rejection",a))},1e3);else for(;l.length>u;)!function(t){var r,l,i=o?t.ok:t.fail;try{i?(o||(n.h=!0),r=i===!0?a:i(a),r===t.P?t.rej(TypeError(d+"-chain cycle")):(l=e(r))?l.call(r,t.res,t.rej):t.res(r)):t.rej(a)}catch(s){t.rej(s)}}(l[u++]);l.length=0})}function s(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,n(t,!0))}function o(t){var r,i,a=this;if(!a.d){a.d=!0,a=a.r||a;try{(r=e(t))?(i={r:a,d:!1},r.call(t,l(o,i,1),l(s,i,1))):(a.v=t,a.s=1,n(a))}catch(u){s.call(i||{r:a,d:!1},u)}}}g=function(e){x(e);var t={p:a.inst(this,g,d),c:[],s:0,d:!1,v:void 0,h:!1};r.hide(this,p,t);try{e(l(o,t,1),l(s,t,1))}catch(n){s.call(t,n)}},r.mix(g.prototype,{then:function(e,t){var r=E(E(this).constructor)[u],l={ok:b(e)?e:!0,fail:b(t)?t:!1},i=l.P=new(void 0!=r?r:g)(function(e,t){l.res=x(e),l.rej=x(t)}),s=this[p];return s.c.push(l),s.s&&n(s),i},"catch":function(e){return this.then(void 0,e)}})}(),s(s.G+s.W+s.F*(g!=y),{Promise:g}),s(s.S,d,{reject:function(e){return new(t(this))(function(t,n){n(e)})},resolve:function(e){return v(e)&&p in e&&r.getProto(e)===this.prototype?e:new(t(this))(function(t){t(e)})}}),s(s.S+s.F*(o.fail(function(e){g.all(e)["catch"](function(){})})||o.DANGER_CLOSING),d,{all:function(e){var n=t(this),l=[];return new n(function(t,i){c(e,!1,l.push,l);var s=l.length,a=Array(s);s?r.each.call(l,function(e,r){n.resolve(e).then(function(e){a[r]=e,--s||t(a)},i)}):t(a)})},race:function(e){var n=t(this);return new n(function(t,r){c(e,!1,function(e){n.resolve(e).then(t,r)})})}}),i.set(g,d),e("./$.species")(g)},{"./$":223,"./$.assert":212,"./$.cof":214,"./$.ctx":218,"./$.def":219,"./$.iter":222,"./$.species":229,"./$.task":231,"./$.uid":232,"./$.wks":234}],268:[function(e){function t(e){var t,n=[];for(t in e)n.push(t);i.set(this,u,{o:e,a:n,i:0})}function n(e){return function(t){y(t);try{return e.apply(void 0,arguments),!0}catch(n){return!1}}}function r(e,t){var n,l=arguments.length<3?e:arguments[2],s=f(y(e),t);return s?i.has(s,"value")?s.value:void 0===s.get?void 0:s.get.call(l):d(n=m(e))?r(n,t,l):void 0}function l(e,t,n){var r,s,a=arguments.length<4?e:arguments[3],o=f(y(e),t);if(!o){if(d(s=m(e)))return l(s,t,n,a);o=i.desc(0)}return i.has(o,"value")?o.writable!==!1&&d(a)?(r=f(a,t)||i.desc(0),r.value=n,h(a,t,r),!0):!1:void 0===o.set?!1:(o.set.call(a,n),!0)}var i=e("./$"),s=e("./$.def"),a=e("./$.set-proto"),o=e("./$.iter"),u=e("./$.uid").safe("iter"),p=o.step,c=e("./$.assert"),d=i.isObject,f=i.getDesc,h=i.setDesc,m=i.getProto,g=Function.apply,y=c.obj,b=Object.isExtensible||i.it;o.create(t,"Object",function(){var e,t=this[u],n=t.a;do if(t.i>=n.length)return p(1);while(!((e=n[t.i++])in t.o));return p(0,e)});var v={apply:e("./$.ctx")(Function.call,g,3),construct:function(e,t){var n=c.fn(arguments.length<3?e:arguments[2]).prototype,r=i.create(d(n)?n:Object.prototype),l=g.call(e,r,t);return d(l)?l:r},defineProperty:n(h),deleteProperty:function(e,t){var n=f(y(e),t);return n&&!n.configurable?!1:delete e[t]},enumerate:function(e){return new t(y(e))},get:r,getOwnPropertyDescriptor:function(e,t){return f(y(e),t)},getPrototypeOf:function(e){return m(y(e))},has:function(e,t){return t in e},isExtensible:function(e){return!!b(y(e))},ownKeys:e("./$.own-keys"),preventExtensions:n(Object.preventExtensions||i.it),set:l};a&&(v.setPrototypeOf=function(e,t){return a(y(e),t),!0}),s(s.G,{Reflect:{}}),s(s.S,"Reflect",v)},{"./$":223,"./$.assert":212,"./$.ctx":218,"./$.def":219,"./$.iter":222,"./$.own-keys":225,"./$.set-proto":228,"./$.uid":232}],269:[function(e){var t=e("./$"),n=e("./$.cof"),r=t.g.RegExp,l=r,i=r.prototype;t.FW&&t.DESC&&(function(){try{return"/a/i"==r(/a/g,"i")}catch(e){}}()||(r=function(e,t){return new l("RegExp"==n(e)&&void 0!==t?e.source:e,t)},t.each.call(t.getNames(l),function(e){e in r||t.setDesc(r,e,{configurable:!0,get:function(){return l[e]},set:function(t){l[e]=t}})}),i.constructor=r,r.prototype=i,t.hide(t.g,"RegExp",r)),"g"!=/./g.flags&&t.setDesc(i,"flags",{configurable:!0,get:e("./$.replacer")(/^.*\/(\w*)$/,"$1")})),e("./$.species")(r)},{"./$":223,"./$.cof":214,"./$.replacer":227,"./$.species":229}],270:[function(e){"use strict";var t=e("./$.collection-strong");e("./$.collection")("Set",{add:function(e){return t.def(this,e=0===e?0:e,e)}},t)},{"./$.collection":217,"./$.collection-strong":215}],271:[function(e){var t=e("./$.def");t(t.P,"String",{codePointAt:e("./$.string-at")(!1)})},{"./$.def":219,"./$.string-at":230}],272:[function(e){"use strict";var t=e("./$"),n=e("./$.cof"),r=e("./$.def"),l=t.toLength;r(r.P,"String",{endsWith:function(e){if("RegExp"==n(e))throw TypeError();var r=String(t.assertDefined(this)),i=arguments[1],s=l(r.length),a=void 0===i?s:Math.min(l(i),s);return e+="",r.slice(a-e.length,a)===e}})},{"./$":223,"./$.cof":214,"./$.def":219}],273:[function(e){var t=e("./$.def"),n=e("./$").toIndex,r=String.fromCharCode;t(t.S,"String",{fromCodePoint:function(){for(var e,t=[],l=arguments.length,i=0;l>i;){if(e=+arguments[i++],n(e,1114111)!==e)throw RangeError(e+" is not a valid code point");t.push(65536>e?r(e):r(((e-=65536)>>10)+55296,e%1024+56320))}return t.join("")}})},{"./$":223,"./$.def":219}],274:[function(e){"use strict";var t=e("./$"),n=e("./$.cof"),r=e("./$.def");r(r.P,"String",{includes:function(e){if("RegExp"==n(e))throw TypeError();return!!~String(t.assertDefined(this)).indexOf(e,arguments[1])}})},{"./$":223,"./$.cof":214,"./$.def":219}],275:[function(e){var t=e("./$").set,n=e("./$.string-at")(!0),r=e("./$.uid").safe("iter"),l=e("./$.iter"),i=l.step;l.std(String,"String",function(e){t(this,r,{o:String(e),i:0})},function(){var e,t=this[r],l=t.o,s=t.i;return s>=l.length?i(1):(e=n.call(l,s),t.i+=e.length,i(0,e))})},{"./$":223,"./$.iter":222,"./$.string-at":230,"./$.uid":232}],276:[function(e){var t=e("./$"),n=e("./$.def");n(n.S,"String",{raw:function(e){for(var n=t.toObject(e.raw),r=t.toLength(n.length),l=arguments.length,i=[],s=0;r>s;)i.push(String(n[s++])),l>s&&i.push(String(arguments[s]));return i.join("")}})},{"./$":223,"./$.def":219}],277:[function(e){"use strict";var t=e("./$"),n=e("./$.def");n(n.P,"String",{repeat:function(e){var n=String(t.assertDefined(this)),r="",l=t.toInteger(e);if(0>l||1/0==l)throw RangeError("Count can't be negative");for(;l>0;(l>>>=1)&&(n+=n))1&l&&(r+=n);return r}})},{"./$":223,"./$.def":219}],278:[function(e){"use strict";var t=e("./$"),n=e("./$.cof"),r=e("./$.def");r(r.P,"String",{startsWith:function(e){if("RegExp"==n(e))throw TypeError();var r=String(t.assertDefined(this)),l=t.toLength(Math.min(arguments[1],r.length));return e+="",r.slice(l,l+e.length)===e}})},{"./$":223,"./$.cof":214,"./$.def":219}],279:[function(e){"use strict";function t(e){var t=m[e]=n.set(n.create(p.prototype),f,e);return n.DESC&&d&&n.setDesc(Object.prototype,e,{configurable:!0,set:function(t){a(this,e,t)}}),t}var n=e("./$"),r=e("./$.cof").set,l=e("./$.uid"),i=e("./$.def"),s=n.has,a=n.hide,o=n.getNames,u=n.toObject,p=n.g.Symbol,c=p,d=!1,f=l.safe("tag"),h={},m={};n.isFunction(p)||(p=function(e){if(this instanceof p)throw TypeError("Symbol is not a constructor");return t(l(e))},a(p.prototype,"toString",function(){return this[f]})),i(i.G+i.W,{Symbol:p});var g={"for":function(e){return s(h,e+="")?h[e]:h[e]=p(e)},keyFor:e("./$.partial").call(e("./$.keyof"),h,0),pure:l.safe,set:n.set,useSetter:function(){d=!0},useSimple:function(){d=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(n){var r=e("./$.wks")(n);g[n]=p===c?r:t(r)}),d=!0,i(i.S,"Symbol",g),i(i.S+i.F*(p!=c),"Object",{getOwnPropertyNames:function(e){for(var t,n=o(u(e)),r=[],l=0;n.length>l;)s(m,t=n[l++])||r.push(t);return r},getOwnPropertySymbols:function(e){for(var t,n=o(u(e)),r=[],l=0;n.length>l;)s(m,t=n[l++])&&r.push(m[t]);return r}}),r(p,"Symbol"),r(Math,"Math",!0),r(n.g.JSON,"JSON",!0)},{"./$":223,"./$.cof":214,"./$.def":219,"./$.keyof":224,"./$.partial":226,"./$.uid":232,"./$.wks":234}],280:[function(e){"use strict";var t=e("./$"),n=e("./$.collection-weak"),r=n.leakStore,l=n.ID,i=n.WEAK,s=t.has,a=t.isObject,o=Object.isFrozen||t.core.Object.isFrozen,u={},p=e("./$.collection")("WeakMap",{get:function(e){if(a(e)){if(o(e))return r(this).get(e);if(s(e,i))return e[i][this[l]]}},set:function(e,t){return n.def(this,e,t)}},n,!0,!0);t.FW&&7!=(new p).set((Object.freeze||Object)(u),7).get(u)&&t.each.call(["delete","has","get","set"],function(e){var t=p.prototype[e];p.prototype[e]=function(n,l){if(a(n)&&o(n)){var i=r(this)[e](n,l);return"set"==e?this:i}return t.call(this,n,l)}})},{"./$":223,"./$.collection":217,"./$.collection-weak":216}],281:[function(e){"use strict";var t=e("./$.collection-weak");e("./$.collection")("WeakSet",{add:function(e){return t.def(this,e,!0)}},t,!1,!0)},{"./$.collection":217,"./$.collection-weak":216}],282:[function(e){var t=e("./$.def");t(t.P,"Array",{includes:e("./$.array-includes")(!0)}),e("./$.unscope")("includes")},{"./$.array-includes":210,"./$.def":219,"./$.unscope":233}],283:[function(e){var t=e("./$"),n=e("./$.def"),r=e("./$.own-keys");n(n.S,"Object",{getOwnPropertyDescriptors:function(e){var n=t.toObject(e),l={};return t.each.call(r(n),function(e){t.setDesc(l,e,t.desc(0,t.getDesc(n,e)))}),l}})},{"./$":223,"./$.def":219,"./$.own-keys":225}],284:[function(e){function t(e){return function(t){var r,l=n.toObject(t),i=n.getKeys(t),s=i.length,a=0,o=Array(s);if(e)for(;s>a;)o[a]=[r=i[a++],l[r]];else for(;s>a;)o[a]=l[i[a++]];return o}}var n=e("./$"),r=e("./$.def");r(r.S,"Object",{values:t(!1),entries:t(!0)})},{"./$":223,"./$.def":219}],285:[function(e){var t=e("./$.def");t(t.S,"RegExp",{escape:e("./$.replacer")(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",!0)})},{"./$.def":219,"./$.replacer":227}],286:[function(e){var t=e("./$.def");t(t.P,"String",{at:e("./$.string-at")(!0)})},{"./$.def":219,"./$.string-at":230}],287:[function(e){function t(t,r){n.each.call(t.split(","),function(t){void 0==r&&t in l.Array?i[t]=l.Array[t]:t in[]&&(i[t]=e("./$.ctx")(Function.call,[][t],r))})}var n=e("./$"),r=e("./$.def"),l=n.core,i={};t("pop,reverse,shift,keys,values,entries",1),t("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),t("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill,turn"),r(r.S,"Array",i)},{"./$":223,"./$.ctx":218,"./$.def":219}],288:[function(e){e("./es6.array.iterator");var t=e("./$"),n=e("./$.iter").Iterators,r=e("./$.wks")("iterator"),l=t.g.NodeList;!t.FW||!l||r in l.prototype||t.hide(l.prototype,r,n.Array),n.NodeList=n.Array},{"./$":223,"./$.iter":222,"./$.wks":234,"./es6.array.iterator":254}],289:[function(e){var t=e("./$.def"),n=e("./$.task");t(t.G+t.B,{setImmediate:n.set,clearImmediate:n.clear})},{"./$.def":219,"./$.task":231}],290:[function(e){function t(e){return s?function(t,r){return e(l(i,[].slice.call(arguments,2),n.isFunction(t)?t:Function(t)),r)}:e}var n=e("./$"),r=e("./$.def"),l=e("./$.invoke"),i=e("./$.partial"),s=!!n.g.navigator&&/MSIE .\./.test(navigator.userAgent);r(r.G+r.B+r.F*s,{setTimeout:t(setTimeout),setInterval:t(setInterval)})},{"./$":223,"./$.def":219,"./$.invoke":221,"./$.partial":226}],291:[function(e,t){e("./modules/es5"),e("./modules/es6.symbol"),e("./modules/es6.object.assign"),e("./modules/es6.object.is"),e("./modules/es6.object.set-prototype-of"),e("./modules/es6.object.to-string"),e("./modules/es6.object.statics-accept-primitives"),e("./modules/es6.function.name"),e("./modules/es6.number.constructor"),e("./modules/es6.number.statics"),e("./modules/es6.math"),e("./modules/es6.string.from-code-point"),e("./modules/es6.string.raw"),e("./modules/es6.string.iterator"),e("./modules/es6.string.code-point-at"),e("./modules/es6.string.ends-with"),e("./modules/es6.string.includes"),e("./modules/es6.string.repeat"),e("./modules/es6.string.starts-with"),e("./modules/es6.array.from"),e("./modules/es6.array.of"),e("./modules/es6.array.iterator"),e("./modules/es6.array.species"),e("./modules/es6.array.copy-within"),e("./modules/es6.array.fill"),e("./modules/es6.array.find"),e("./modules/es6.array.find-index"),e("./modules/es6.regexp"),e("./modules/es6.promise"),e("./modules/es6.map"),e("./modules/es6.set"),e("./modules/es6.weak-map"),e("./modules/es6.weak-set"),e("./modules/es6.reflect"),e("./modules/es7.array.includes"),e("./modules/es7.string.at"),e("./modules/es7.regexp.escape"),e("./modules/es7.object.get-own-property-descriptors"),e("./modules/es7.object.to-array"),e("./modules/js.array.statics"),e("./modules/web.timers"),e("./modules/web.immediate"),e("./modules/web.dom.iterable"),t.exports=e("./modules/$").core},{"./modules/$":223,"./modules/es5":248,"./modules/es6.array.copy-within":249,"./modules/es6.array.fill":250,"./modules/es6.array.find":252,"./modules/es6.array.find-index":251,"./modules/es6.array.from":253,"./modules/es6.array.iterator":254,"./modules/es6.array.of":255,"./modules/es6.array.species":256,"./modules/es6.function.name":257,"./modules/es6.map":258,"./modules/es6.math":259,"./modules/es6.number.constructor":260,"./modules/es6.number.statics":261,"./modules/es6.object.assign":262,"./modules/es6.object.is":263,"./modules/es6.object.set-prototype-of":264,"./modules/es6.object.statics-accept-primitives":265,"./modules/es6.object.to-string":266,"./modules/es6.promise":267,"./modules/es6.reflect":268,"./modules/es6.regexp":269,"./modules/es6.set":270,"./modules/es6.string.code-point-at":271,"./modules/es6.string.ends-with":272,"./modules/es6.string.from-code-point":273,"./modules/es6.string.includes":274,"./modules/es6.string.iterator":275,"./modules/es6.string.raw":276,"./modules/es6.string.repeat":277,"./modules/es6.string.starts-with":278,"./modules/es6.symbol":279,"./modules/es6.weak-map":280,"./modules/es6.weak-set":281,"./modules/es7.array.includes":282,"./modules/es7.object.get-own-property-descriptors":283,"./modules/es7.object.to-array":284,"./modules/es7.regexp.escape":285,"./modules/es7.string.at":286,"./modules/js.array.statics":287,"./modules/web.dom.iterable":288,"./modules/web.immediate":289,"./modules/web.timers":290}],292:[function(e,t,n){function r(){return n.colors[p++%n.colors.length]}function l(e){function t(){}function l(){var e=l,t=+new Date,i=t-(u||t);e.diff=i,e.prev=u,e.curr=t,u=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=n.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;a++;var l=n.formatters[r];if("function"==typeof l){var i=s[a];t=l.call(e,i),s.splice(a,1),a--}return t}),"function"==typeof n.formatArgs&&(s=n.formatArgs.apply(e,s));var o=l.log||n.log||console.log.bind(console);o.apply(e,s)}t.enabled=!1,l.enabled=!0;var i=n.enabled(e)?l:t;return i.namespace=e,i}function i(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,l=0;r>l;l++)t[l]&&(e=t[l].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){n.enable("")}function a(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function o(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=l,n.coerce=o,n.disable=s,n.enable=i,n.enabled=a,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var u,p=0},{ms:294}],293:[function(e,t,n){(function(r){function l(){var e=(r.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?p.isatty(d):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function i(){var e=arguments,t=this.useColors,r=this.namespace;if(t){var l=this.color;e[0]=" [9"+l+"m"+r+" "+e[0]+"[3"+l+"m +"+n.humanize(this.diff)+""}else e[0]=(new Date).toUTCString()+" "+r+" "+e[0];return e}function s(){return f.write(c.format.apply(this,arguments)+"\n")}function a(e){null==e?delete r.env.DEBUG:r.env.DEBUG=e}function o(){return r.env.DEBUG}function u(t){var n,l=r.binding("tty_wrap");switch(l.guessHandleType(t)){case"TTY":n=new p.WriteStream(t),n._type="tty",n._handle&&n._handle.unref&&n._handle.unref();break;case"FILE":var i=e("fs");n=new i.SyncWriteStream(t,{autoClose:!1}),n._type="fs";break;case"PIPE":case"TCP":var s=e("net");n=new s.Socket({fd:t,readable:!1,writable:!0}),n.readable=!1,n.read=null,n._type="pipe",n._handle&&n._handle.unref&&n._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return n.fd=t,n._isStdio=!0,n}var p=e("tty"),c=e("util");n=t.exports=e("./debug"),n.log=s,n.formatArgs=i,n.save=a,n.load=o,n.useColors=l,n.colors=[6,2,3,4,5,1];var d=parseInt(r.env.DEBUG_FD,10)||2,f=1===d?r.stdout:2===d?r.stderr:u(d),h=4===c.inspect.length?function(e,t){return c.inspect(e,void 0,void 0,t)}:function(e,t){return c.inspect(e,{colors:t})};n.formatters.o=function(e){return h(e,this.useColors).replace(/\s*\n\s*/g," ")},n.enable(o())}).call(this,e("_process"))},{"./debug":292,_process:183,fs:172,net:172,tty:197,util:199}],294:[function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=o?Math.round(e/o)+"h":e>=a?Math.round(e/a)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function l(e){return i(e,u,"day")||i(e,o,"hour")||i(e,a,"minute")||i(e,s,"second")||e+" ms"}function i(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,a=60*s,o=60*a,u=24*o,p=365.25*u;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?l(e):r(e)}},{}],295:[function(e,t){"use strict";function n(e){var t=0,n=0,r=0;for(var l in e){var i=e[l],s=i[0],a=i[1];(s>n||s===n&&a>r)&&(n=s,r=a,t=+l)}return t}var r=e("repeating"),l=/^(?:( )+|\t+)/;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,i,s=0,a=0,o=0,u={};e.split(/\n/g).forEach(function(e){if(e){var n,r=e.match(l);r?(n=r[0].length,r[1]?a++:s++):n=0;var p=n-o;o=n,p?(i=p>0,t=u[i?p:-p],t?t[0]++:t=u[p]=[1,0]):t&&(t[1]+=+i)}});var p,c,d=n(u);return d?a>=s?(p="space",c=r(" ",d)):(p="tab",c=r(" ",d)):(p=null,c=""),{amount:d,type:p,indent:c}}},{repeating:435}],296:[function(t,n,r){!function(t,n){"use strict";"function"==typeof e&&e.amd?e(["exports"],n):n("undefined"!=typeof r?r:t.estraverse={})}(this,function l(e){"use strict";function t(){}function n(e){var t,r,l={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],l[t]="object"==typeof r&&null!==r?n(r):r);return l}function r(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}function i(e,t){var n,r,l,i;for(r=e.length,l=0;r;)n=r>>>1,i=l+n,t(e[i])?r=n:(l=i+1,r-=n+1);return l}function s(e,t){var n,r,l,i;for(r=e.length,l=0;r;)n=r>>>1,i=l+n,t(e[i])?(l=i+1,r-=n+1):r=n;return l}function a(e,t){var n,r,l,i=_(t);for(r=0,l=i.length;l>r;r+=1)n=i[r],e[n]=t[n];return e}function o(e,t){this.parent=e,this.key=t}function u(e,t,n,r){this.node=e,this.path=t,this.wrap=n,this.ref=r}function p(){}function c(e){return null==e?!1:"object"==typeof e&&"string"==typeof e.type}function d(e,t){return(e===y.ObjectExpression||e===y.ObjectPattern)&&"properties"===t}function f(e,t){var n=new p;return n.traverse(e,t) }function h(e,t){var n=new p;return n.replace(e,t)}function m(e,t){var n;return n=i(t,function(t){return t.range[0]>e.range[0]}),e.extendedRange=[e.range[0],e.range[1]],n!==t.length&&(e.extendedRange[1]=t[n].range[0]),n-=1,n>=0&&(e.extendedRange[0]=t[n].range[1]),e}function g(e,t,r){var l,i,s,a,o=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(s=0,i=t.length;i>s;s+=1)l=n(t[s]),l.extendedRange=[0,e.range[0]],o.push(l);e.leadingComments=o}return e}for(s=0,i=t.length;i>s;s+=1)o.push(m(n(t[s]),r));return a=0,f(e,{enter:function(e){for(var t;a<o.length&&(t=o[a],!(t.extendedRange[1]>e.range[0]));)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),o.splice(a,1)):a+=1;return a===o.length?v.Break:o[a].extendedRange[0]>e.range[1]?v.Skip:void 0}}),a=0,f(e,{leave:function(e){for(var t;a<o.length&&(t=o[a],!(e.range[1]<t.extendedRange[0]));)e.range[1]===t.extendedRange[0]?(e.trailingComments||(e.trailingComments=[]),e.trailingComments.push(t),o.splice(a,1)):a+=1;return a===o.length?v.Break:o[a].extendedRange[0]>e.range[1]?v.Skip:void 0}}),e}var y,b,v,x,E,_,S,I,w;return b=Array.isArray,b||(b=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),t(r),t(s),E=Object.create||function(){function e(){}return function(t){return e.prototype=t,new e}}(),_=Object.keys||function(e){var t,n=[];for(t in e)n.push(t);return n},y={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},x={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},S={},I={},w={},v={Break:S,Skip:I,Remove:w},o.prototype.replace=function(e){this.parent[this.key]=e},o.prototype.remove=function(){return b(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},p.prototype.path=function(){function e(e,t){if(b(t))for(r=0,l=t.length;l>r;++r)e.push(t[r]);else e.push(t)}var t,n,r,l,i,s;if(!this.__current.path)return null;for(i=[],t=2,n=this.__leavelist.length;n>t;++t)s=this.__leavelist[t],e(i,s.path);return e(i,this.__current.path),i},p.prototype.type=function(){var e=this.current();return e.type||this.__current.wrap},p.prototype.parents=function(){var e,t,n;for(n=[],e=1,t=this.__leavelist.length;t>e;++e)n.push(this.__leavelist[e].node);return n},p.prototype.current=function(){return this.__current.node},p.prototype.__execute=function(e,t){var n,r;return r=void 0,n=this.__current,this.__current=t,this.__state=null,e&&(r=e.call(this,t.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=n,r},p.prototype.notify=function(e){this.__state=e},p.prototype.skip=function(){this.notify(I)},p.prototype["break"]=function(){this.notify(S)},p.prototype.remove=function(){this.notify(w)},p.prototype.__initialize=function(e,t){this.visitor=t,this.root=e,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback="iteration"===t.fallback,this.__keys=x,t.keys&&(this.__keys=a(E(this.__keys),t.keys))},p.prototype.traverse=function(e,t){var n,r,l,i,s,a,o,p,f,h,m,g;for(this.__initialize(e,t),g={},n=this.__worklist,r=this.__leavelist,n.push(new u(e,null,null,null)),r.push(new u(null,null,null,null));n.length;)if(l=n.pop(),l!==g){if(l.node){if(a=this.__execute(t.enter,l),this.__state===S||a===S)return;if(n.push(g),r.push(l),this.__state===I||a===I)continue;if(i=l.node,s=l.wrap||i.type,h=this.__keys[s],!h){if(!this.__fallback)throw new Error("Unknown node type "+s+".");h=_(i)}for(p=h.length;(p-=1)>=0;)if(o=h[p],m=i[o])if(b(m)){for(f=m.length;(f-=1)>=0;)if(m[f]){if(d(s,h[p]))l=new u(m[f],[o,f],"Property",null);else{if(!c(m[f]))continue;l=new u(m[f],[o,f],null,null)}n.push(l)}}else c(m)&&n.push(new u(m,o,null,null))}}else if(l=r.pop(),a=this.__execute(t.leave,l),this.__state===S||a===S)return},p.prototype.replace=function(e,t){function n(e){var t,n,l,i;if(e.ref.remove())for(n=e.ref.key,i=e.ref.parent,t=r.length;t--;)if(l=r[t],l.ref&&l.ref.parent===i){if(l.ref.key<n)break;--l.ref.key}}var r,l,i,s,a,p,f,h,m,g,y,v,x;for(this.__initialize(e,t),y={},r=this.__worklist,l=this.__leavelist,v={root:e},p=new u(e,null,null,new o(v,"root")),r.push(p),l.push(p);r.length;)if(p=r.pop(),p!==y){if(a=this.__execute(t.enter,p),void 0!==a&&a!==S&&a!==I&&a!==w&&(p.ref.replace(a),p.node=a),(this.__state===w||a===w)&&(n(p),p.node=null),this.__state===S||a===S)return v.root;if(i=p.node,i&&(r.push(y),l.push(p),this.__state!==I&&a!==I)){if(s=p.wrap||i.type,m=this.__keys[s],!m){if(!this.__fallback)throw new Error("Unknown node type "+s+".");m=_(i)}for(f=m.length;(f-=1)>=0;)if(x=m[f],g=i[x])if(b(g)){for(h=g.length;(h-=1)>=0;)if(g[h]){if(d(s,m[f]))p=new u(g[h],[x,h],"Property",new o(g,h));else{if(!c(g[h]))continue;p=new u(g[h],[x,h],null,new o(g,h))}r.push(p)}}else c(g)&&r.push(new u(g,x,null,new o(i,x)))}}else if(p=l.pop(),a=this.__execute(t.leave,p),void 0!==a&&a!==S&&a!==I&&a!==w&&p.ref.replace(a),(this.__state===w||a===w)&&n(p),this.__state===S||a===S)return v.root;return v.root},e.version="1.8.1-dev",e.Syntax=y,e.traverse=f,e.replace=h,e.attachComments=g,e.VisitorKeys=x,e.VisitorOption=v,e.Controller=p,e.cloneEnvironment=function(){return l({})},e})},{}],297:[function(e,t){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function n(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function r(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function l(e){return r(e)||null!=e&&"FunctionDeclaration"===e.type}function i(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function s(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=i(t)}while(t);return!1}t.exports={isExpression:e,isStatement:r,isIterationStatement:n,isSourceElement:l,isProblematicIfStatement:s,trailingStatement:i}}()},{}],298:[function(e,t){!function(){"use strict";function e(e){return e>=48&&57>=e}function n(t){return e(t)||t>=97&&102>=t||t>=65&&70>=t}function r(e){return e>=48&&55>=e}function l(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&u.indexOf(e)>=0}function i(e){return 10===e||13===e||8232===e||8233===e}function s(e){return e>=97&&122>=e||e>=65&&90>=e||36===e||95===e||92===e||e>=128&&o.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function a(e){return e>=97&&122>=e||e>=65&&90>=e||e>=48&&57>=e||36===e||95===e||92===e||e>=128&&o.NonAsciiIdentifierPart.test(String.fromCharCode(e))}var o,u;o={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},u=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],t.exports={isDecimalDigit:e,isHexDigit:n,isOctalDigit:r,isWhiteSpace:l,isLineTerminator:i,isIdentifierStart:s,isIdentifierPart:a}}()},{}],299:[function(e,t){!function(){"use strict";function n(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function r(e,t){return t||"yield"!==e?l(e,t):!1}function l(e,t){if(t&&n(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function i(e,t){return"null"===e||"true"===e||"false"===e||r(e,t)}function s(e,t){return"null"===e||"true"===e||"false"===e||l(e,t)}function a(e){return"eval"===e||"arguments"===e}function o(e){var t,n,r;if(0===e.length)return!1;if(r=e.charCodeAt(0),!c.isIdentifierStart(r)||92===r)return!1;for(t=1,n=e.length;n>t;++t)if(r=e.charCodeAt(t),!c.isIdentifierPart(r)||92===r)return!1;return!0}function u(e,t){return o(e)&&!i(e,t)}function p(e,t){return o(e)&&!s(e,t)}var c=e("./code");t.exports={isKeywordES5:r,isKeywordES6:l,isReservedWordES5:i,isReservedWordES6:s,isRestrictedWord:a,isIdentifierName:o,isIdentifierES5:u,isIdentifierES6:p}}()},{"./code":298}],300:[function(e,t,n){!function(){"use strict";n.ast=e("./ast"),n.code=e("./code"),n.keyword=e("./keyword")}()},{"./ast":297,"./code":298,"./keyword":299}],301:[function(e,t){t.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},nonstandard:{escape:!1,unescape:!1},browser:{addEventListener:!1,alert:!1,applicationCache:!1,atob:!1,Audio:!1,AudioProcessingEvent:!1,BeforeUnloadEvent:!1,Blob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,crypto:!1,CSS:!1,CustomEvent:!1,DataView:!1,Debug:!1,defaultStatus:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DOMParser:!1,DragEvent:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,history:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,navigator:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProgressEvent:!1,prompt:!1,Range:!1,removeEventListener:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,screen:!1,screenX:!1,screenY:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,self:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,showModalDialog:!1,status:!1,stop:!1,StorageEvent:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,TouchEvent:!1,UIEvent:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},worker:{importScripts:!0,postMessage:!0,self:!0},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,DataView:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1}}},{}],302:[function(e,t){t.exports=e("./globals.json")},{"./globals.json":301}],303:[function(e,t){var n=e("is-nan"),r=e("is-finite");t.exports=Number.isInteger||function(e){return"number"==typeof e&&!n(e)&&r(e)&&parseInt(e,10)===e}},{"is-finite":304,"is-nan":305}],304:[function(e,t){"use strict";t.exports=Number.isFinite||function(e){return"number"!=typeof e||e!==e||1/0===e||e===-1/0?!1:!0}},{}],305:[function(e,t){"use strict";t.exports=function(e){return e!==e}},{}],306:[function(e,t){t.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g,t.exports.matchToToken=function(e){return token={type:"invalid",value:e[0]},e[1]?(token.type="string",token.closed=!(!e[3]&&!e[4])):e[5]?token.type="comment":e[6]?(token.type="comment",token.closed=!!e[7]):e[8]?token.type="regex":e[9]?token.type="number":e[10]?token.type="name":e[11]?token.type="punctuator":e[12]&&(token.type="whitespace"),token}},{}],307:[function(e,t){var n=[],r=[];t.exports=function(e,t){if(e===t)return 0;var l=e.length,i=t.length;if(0===l)return i;if(0===i)return l;for(var s,a,o,u,p=0,c=0;l>p;)r[p]=e.charCodeAt(p),n[p]=++p;for(;i>c;)for(s=t.charCodeAt(c),o=c++,a=c,p=0;l>p;p++)u=s===r[p]?o:o+1,o=n[p],a=n[p]=o>a?u>a?a+1:u:u>o?o+1:u;return a}},{}],308:[function(e,t){function n(e,t,n){return t in e?e[t]:n}function r(e,t){var r=n.bind(null,t||{}),i=r("transform",Function.prototype),s=r("padding"," "),a=r("before"," "),o=r("after"," | "),u=r("start",1),p=Array.isArray(e),c=p?e:e.split("\n"),d=u+c.length-1,f=String(d).length,h=c.map(function(e,t){var n=u+t,r={before:a,number:n,width:f,after:o,line:e};return i(r),r.before+l(r.number,f,s)+r.after+r.line});return p?h:h.join("\n")}var l=e("left-pad");t.exports=r},{"left-pad":309}],309:[function(e,t){function n(e,t,n){e=String(e);var r=-1;for(n||(n=" "),t-=e.length;++r<t;)e=n+e;return e}t.exports=n},{}],310:[function(e,t){function n(e){for(var t=-1,n=e?e.length:0,r=-1,l=[];++t<n;){var i=e[t];i&&(l[++r]=i)}return l}t.exports=n},{}],311:[function(e,t){function n(e,t,n){var i=e?e.length:0;return n&&l(e,t,n)&&(t=!1),i?r(e,t,!1,0):[]}var r=e("../internal/baseFlatten"),l=e("../internal/isIterateeCall");t.exports=n},{"../internal/baseFlatten":338,"../internal/isIterateeCall":379}],312:[function(e,t){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}t.exports=n},{}],313:[function(e,t){function n(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var n=0,l=r,s=e.length;++n<s;)for(var a=0,o=e[n];(a=l(t,o,a))>-1;)i.call(t,a,1);return t}var r=e("../internal/baseIndexOf"),l=Array.prototype,i=l.splice;t.exports=n},{"../internal/baseIndexOf":344}],314:[function(e,t){function n(e,t,n,a){var o=e?e.length:0;return o?(null!=t&&"boolean"!=typeof t&&(a=n,n=i(e,t,a)?null:t,t=!1),n=null==n?n:r(n,a,3),t?s(e,n):l(e,n)):[]}var r=e("../internal/baseCallback"),l=e("../internal/baseUniq"),i=e("../internal/isIterateeCall"),s=e("../internal/sortedUniq");t.exports=n},{"../internal/baseCallback":332,"../internal/baseUniq":360,"../internal/isIterateeCall":379,"../internal/sortedUniq":386}],315:[function(e,t){t.exports=e("./includes")},{"./includes":319}],316:[function(e,t){t.exports=e("./forEach")},{"./forEach":317}],317:[function(e,t){function n(e,t,n){return"function"==typeof t&&"undefined"==typeof n&&s(e)?r(e,t):l(e,i(t,n,3))}var r=e("../internal/arrayEach"),l=e("../internal/baseEach"),i=e("../internal/bindCallback"),s=e("../lang/isArray");t.exports=n},{"../internal/arrayEach":326,"../internal/baseEach":336,"../internal/bindCallback":362,"../lang/isArray":390}],318:[function(e,t){var n=e("../internal/createAggregator"),r=Object.prototype,l=r.hasOwnProperty,i=n(function(e,t,n){l.call(e,n)?e[n].push(t):e[n]=[t]});t.exports=i},{"../internal/createAggregator":367}],319:[function(e,t){function n(e,t,n){var u=e?e.length:0;return i(u)||(e=a(e),u=e.length),u?(n="number"==typeof n?0>n?o(u+n,0):n||0:0,"string"==typeof e||!l(e)&&s(e)?u>n&&e.indexOf(t,n)>-1:r(e,t,n)>-1):!1}var r=e("../internal/baseIndexOf"),l=e("../lang/isArray"),i=e("../internal/isLength"),s=e("../lang/isString"),a=e("../object/values"),o=Math.max;t.exports=n},{"../internal/baseIndexOf":344,"../internal/isLength":380,"../lang/isArray":390,"../lang/isString":399,"../object/values":409}],320:[function(e,t){function n(e,t,n){var a=s(e)?r:i;return t=l(t,n,3),a(e,t)}var r=e("../internal/arrayMap"),l=e("../internal/baseCallback"),i=e("../internal/baseMap"),s=e("../lang/isArray");t.exports=n},{"../internal/arrayMap":327,"../internal/baseCallback":332,"../internal/baseMap":349,"../lang/isArray":390}],321:[function(e,t){function n(e,t,n,o){var u=a(e)?r:s;return u(e,l(t,o,4),n,arguments.length<3,i)}var r=e("../internal/arrayReduceRight"),l=e("../internal/baseCallback"),i=e("../internal/baseEachRight"),s=e("../internal/baseReduce"),a=e("../lang/isArray");t.exports=n},{"../internal/arrayReduceRight":328,"../internal/baseCallback":332,"../internal/baseEachRight":337,"../internal/baseReduce":355,"../lang/isArray":390}],322:[function(e,t){function n(e,t,n){var a=s(e)?r:i; return("function"!=typeof t||"undefined"!=typeof n)&&(t=l(t,n,3)),a(e,t)}var r=e("../internal/arraySome"),l=e("../internal/baseCallback"),i=e("../internal/baseSome"),s=e("../lang/isArray");t.exports=n},{"../internal/arraySome":329,"../internal/baseCallback":332,"../internal/baseSome":357,"../lang/isArray":390}],323:[function(e,t){function n(e,t,n){if(null==e)return[];var u=-1,p=e.length,c=o(p)?Array(p):[];return n&&a(e,t,n)&&(t=null),t=r(t,n,3),l(e,function(e,n,r){c[++u]={criteria:t(e,n,r),index:u,value:e}}),i(c,s)}var r=e("../internal/baseCallback"),l=e("../internal/baseEach"),i=e("../internal/baseSortBy"),s=e("../internal/compareAscending"),a=e("../internal/isIterateeCall"),o=e("../internal/isLength");t.exports=n},{"../internal/baseCallback":332,"../internal/baseEach":336,"../internal/baseSortBy":358,"../internal/compareAscending":366,"../internal/isIterateeCall":379,"../internal/isLength":380}],324:[function(e,t){(function(n){function r(e){var t=e?e.length:0;for(this.data={hash:a(null),set:new s};t--;)this.push(e[t])}var l=e("./cachePush"),i=e("../lang/isNative"),s=i(s=n.Set)&&s,a=i(a=Object.create)&&a;r.prototype.push=l,t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":394,"./cachePush":365}],325:[function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}t.exports=n},{}],326:[function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}t.exports=n},{}],327:[function(e,t){function n(e,t){for(var n=-1,r=e.length,l=Array(r);++n<r;)l[n]=t(e[n],n,e);return l}t.exports=n},{}],328:[function(e,t){function n(e,t,n,r){var l=e.length;for(r&&l&&(n=e[--l]);l--;)n=t(n,e[l],l,e);return n}t.exports=n},{}],329:[function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}t.exports=n},{}],330:[function(e,t){function n(e,t){return"undefined"==typeof e?t:e}t.exports=n},{}],331:[function(e,t){function n(e,t,n){var i=l(t);if(!n)return r(t,e,i);for(var s=-1,a=i.length;++s<a;){var o=i[s],u=e[o],p=n(u,t[o],o,e,t);(p===p?p===u:u!==u)&&("undefined"!=typeof u||o in e)||(e[o]=p)}return e}var r=e("./baseCopy"),l=e("../object/keys");t.exports=n},{"../object/keys":406,"./baseCopy":335}],332:[function(e,t){function n(e,t,n){var u=typeof e;return"function"==u?"undefined"!=typeof t&&o(e)?s(e,t,n):e:null==e?a:"object"==u?r(e):"undefined"==typeof t?i(e+""):l(e+"",t)}var r=e("./baseMatches"),l=e("./baseMatchesProperty"),i=e("./baseProperty"),s=e("./bindCallback"),a=e("../utility/identity"),o=e("./isBindable");t.exports=n},{"../utility/identity":413,"./baseMatches":350,"./baseMatchesProperty":351,"./baseProperty":354,"./bindCallback":362,"./isBindable":377}],333:[function(e,t){function n(e,t,h,m,g,y,v){var x;if(h&&(x=g?h(e,m,g):h(e)),"undefined"!=typeof x)return x;if(!c(e))return e;var _=p(e);if(_){if(x=a(e),!t)return r(e,x)}else{var S=F.call(e),I=S==b;if(S!=E&&S!=f&&(!I||g))return R[S]?o(e,S,t):g?e:{};if(x=u(I?{}:e),!t)return i(e,x,d(e))}y||(y=[]),v||(v=[]);for(var w=y.length;w--;)if(y[w]==e)return v[w];return y.push(e),v.push(x),(_?l:s)(e,function(r,l){x[l]=n(r,t,h,l,e,y,v)}),x}var r=e("./arrayCopy"),l=e("./arrayEach"),i=e("./baseCopy"),s=e("./baseForOwn"),a=e("./initCloneArray"),o=e("./initCloneByTag"),u=e("./initCloneObject"),p=e("../lang/isArray"),c=e("../lang/isObject"),d=e("../object/keys"),f="[object Arguments]",h="[object Array]",m="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",v="[object Map]",x="[object Number]",E="[object Object]",_="[object RegExp]",S="[object Set]",I="[object String]",w="[object WeakMap]",k="[object ArrayBuffer]",A="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",j="[object Int16Array]",M="[object Int32Array]",P="[object Uint8Array]",L="[object Uint8ClampedArray]",O="[object Uint16Array]",D="[object Uint32Array]",R={};R[f]=R[h]=R[k]=R[m]=R[g]=R[A]=R[C]=R[T]=R[j]=R[M]=R[x]=R[E]=R[_]=R[I]=R[P]=R[L]=R[O]=R[D]=!0,R[y]=R[b]=R[v]=R[S]=R[w]=!1;var N=Object.prototype,F=N.toString;t.exports=n},{"../lang/isArray":390,"../lang/isObject":396,"../object/keys":406,"./arrayCopy":325,"./arrayEach":326,"./baseCopy":335,"./baseForOwn":341,"./initCloneArray":374,"./initCloneByTag":375,"./initCloneObject":376}],334:[function(e,t){function n(e,t){if(e!==t){var n=e===e,r=t===t;if(e>t||!n||"undefined"==typeof e&&r)return 1;if(t>e||!r||"undefined"==typeof t&&n)return-1}return 0}t.exports=n},{}],335:[function(e,t){function n(e,t,n){n||(n=t,t={});for(var r=-1,l=n.length;++r<l;){var i=n[r];t[i]=e[i]}return t}t.exports=n},{}],336:[function(e,t){function n(e,t){var n=e?e.length:0;if(!l(n))return r(e,t);for(var s=-1,a=i(e);++s<n&&t(a[s],s,a)!==!1;);return e}var r=e("./baseForOwn"),l=e("./isLength"),i=e("./toObject");t.exports=n},{"./baseForOwn":341,"./isLength":380,"./toObject":387}],337:[function(e,t){function n(e,t){var n=e?e.length:0;if(!l(n))return r(e,t);for(var s=i(e);n--&&t(s[n],n,s)!==!1;);return e}var r=e("./baseForOwnRight"),l=e("./isLength"),i=e("./toObject");t.exports=n},{"./baseForOwnRight":342,"./isLength":380,"./toObject":387}],338:[function(e,t){function n(e,t,a,o){for(var u=o-1,p=e.length,c=-1,d=[];++u<p;){var f=e[u];if(s(f)&&i(f.length)&&(l(f)||r(f))){t&&(f=n(f,t,a,0));var h=-1,m=f.length;for(d.length+=m;++h<m;)d[++c]=f[h]}else a||(d[++c]=f)}return d}var r=e("../lang/isArguments"),l=e("../lang/isArray"),i=e("./isLength"),s=e("./isObjectLike");t.exports=n},{"../lang/isArguments":389,"../lang/isArray":390,"./isLength":380,"./isObjectLike":381}],339:[function(e,t){function n(e,t,n){for(var l=-1,i=r(e),s=n(e),a=s.length;++l<a;){var o=s[l];if(t(i[o],o,i)===!1)break}return e}var r=e("./toObject");t.exports=n},{"./toObject":387}],340:[function(e,t){function n(e,t){return r(e,t,l)}var r=e("./baseFor"),l=e("../object/keysIn");t.exports=n},{"../object/keysIn":407,"./baseFor":339}],341:[function(e,t){function n(e,t){return r(e,t,l)}var r=e("./baseFor"),l=e("../object/keys");t.exports=n},{"../object/keys":406,"./baseFor":339}],342:[function(e,t){function n(e,t){return r(e,t,l)}var r=e("./baseForRight"),l=e("../object/keys");t.exports=n},{"../object/keys":406,"./baseForRight":343}],343:[function(e,t){function n(e,t,n){for(var l=r(e),i=n(e),s=i.length;s--;){var a=i[s];if(t(l[a],a,l)===!1)break}return e}var r=e("./toObject");t.exports=n},{"./toObject":387}],344:[function(e,t){function n(e,t,n){if(t!==t)return r(e,n);for(var l=n-1,i=e.length;++l<i;)if(e[l]===t)return l;return-1}var r=e("./indexOfNaN");t.exports=n},{"./indexOfNaN":373}],345:[function(e,t){function n(e,t,l,i,s,a){if(e===t)return 0!==e||1/e==1/t;var o=typeof e,u=typeof t;return"function"!=o&&"object"!=o&&"function"!=u&&"object"!=u||null==e||null==t?e!==e&&t!==t:r(e,t,n,l,i,s,a)}var r=e("./baseIsEqualDeep");t.exports=n},{"./baseIsEqualDeep":346}],346:[function(e,t){function n(e,t,n,c,h,m,g){var y=s(e),b=s(t),v=u,x=u;y||(v=f.call(e),v==o?v=p:v!=p&&(y=a(e))),b||(x=f.call(t),x==o?x=p:x!=p&&(b=a(t)));var E=v==p,_=x==p,S=v==x;if(S&&!y&&!E)return l(e,t,v);var I=E&&d.call(e,"__wrapped__"),w=_&&d.call(t,"__wrapped__");if(I||w)return n(I?e.value():e,w?t.value():t,c,h,m,g);if(!S)return!1;m||(m=[]),g||(g=[]);for(var k=m.length;k--;)if(m[k]==e)return g[k]==t;m.push(e),g.push(t);var A=(y?r:i)(e,t,n,c,h,m,g);return m.pop(),g.pop(),A}var r=e("./equalArrays"),l=e("./equalByTag"),i=e("./equalObjects"),s=e("../lang/isArray"),a=e("../lang/isTypedArray"),o="[object Arguments]",u="[object Array]",p="[object Object]",c=Object.prototype,d=c.hasOwnProperty,f=c.toString;t.exports=n},{"../lang/isArray":390,"../lang/isTypedArray":400,"./equalArrays":370,"./equalByTag":371,"./equalObjects":372}],347:[function(e,t){function n(e){return"function"==typeof e||!1}t.exports=n},{}],348:[function(e,t){function n(e,t,n,l,s){var a=t.length;if(null==e)return!a;for(var o=-1,u=!s;++o<a;)if(u&&l[o]?n[o]!==e[t[o]]:!i.call(e,t[o]))return!1;for(o=-1;++o<a;){var p=t[o];if(u&&l[o])var c=i.call(e,p);else{var d=e[p],f=n[o];c=s?s(d,f,p):void 0,"undefined"==typeof c&&(c=r(f,d,s,!0))}if(!c)return!1}return!0}var r=e("./baseIsEqual"),l=Object.prototype,i=l.hasOwnProperty;t.exports=n},{"./baseIsEqual":345}],349:[function(e,t){function n(e,t){var n=[];return r(e,function(e,r,l){n.push(t(e,r,l))}),n}var r=e("./baseEach");t.exports=n},{"./baseEach":336}],350:[function(e,t){function n(e){var t=i(e),n=t.length;if(1==n){var s=t[0],o=e[s];if(l(o))return function(e){return null!=e&&e[s]===o&&a.call(e,s)}}for(var u=Array(n),p=Array(n);n--;)o=e[t[n]],u[n]=o,p[n]=l(o);return function(e){return r(e,t,u,p)}}var r=e("./baseIsMatch"),l=e("./isStrictComparable"),i=e("../object/keys"),s=Object.prototype,a=s.hasOwnProperty;t.exports=n},{"../object/keys":406,"./baseIsMatch":348,"./isStrictComparable":382}],351:[function(e,t){function n(e,t){return l(t)?function(n){return null!=n&&n[e]===t}:function(n){return null!=n&&r(t,n[e],null,!0)}}var r=e("./baseIsEqual"),l=e("./isStrictComparable");t.exports=n},{"./baseIsEqual":345,"./isStrictComparable":382}],352:[function(e,t){function n(e,t,c,d,f){if(!o(e))return e;var h=a(t.length)&&(s(t)||p(t));return(h?r:l)(t,function(t,r,l){if(u(t))return d||(d=[]),f||(f=[]),i(e,l,r,n,c,d,f);var s=e[r],a=c?c(s,t,r,e,l):void 0,o="undefined"==typeof a;o&&(a=t),!h&&"undefined"==typeof a||!o&&(a===a?a===s:s!==s)||(e[r]=a)}),e}var r=e("./arrayEach"),l=e("./baseForOwn"),i=e("./baseMergeDeep"),s=e("../lang/isArray"),a=e("./isLength"),o=e("../lang/isObject"),u=e("./isObjectLike"),p=e("../lang/isTypedArray");t.exports=n},{"../lang/isArray":390,"../lang/isObject":396,"../lang/isTypedArray":400,"./arrayEach":326,"./baseForOwn":341,"./baseMergeDeep":353,"./isLength":380,"./isObjectLike":381}],353:[function(e,t){function n(e,t,n,p,c,d,f){for(var h=d.length,m=t[n];h--;)if(d[h]==m)return void(e[n]=f[h]);var g=e[n],y=c?c(g,m,n,e,t):void 0,b="undefined"==typeof y;b&&(y=m,s(m.length)&&(i(m)||o(m))?y=i(g)?g:g?r(g):[]:a(m)||l(m)?y=l(g)?u(g):a(g)?g:{}:b=!1),d.push(m),f.push(y),b?e[n]=p(y,m,c,d,f):(y===y?y!==g:g===g)&&(e[n]=y)}var r=e("./arrayCopy"),l=e("../lang/isArguments"),i=e("../lang/isArray"),s=e("./isLength"),a=e("../lang/isPlainObject"),o=e("../lang/isTypedArray"),u=e("../lang/toPlainObject");t.exports=n},{"../lang/isArguments":389,"../lang/isArray":390,"../lang/isPlainObject":397,"../lang/isTypedArray":400,"../lang/toPlainObject":401,"./arrayCopy":325,"./isLength":380}],354:[function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}t.exports=n},{}],355:[function(e,t){function n(e,t,n,r,l){return l(e,function(e,l,i){n=r?(r=!1,e):t(n,e,l,i)}),n}t.exports=n},{}],356:[function(e,t){var n=e("../utility/identity"),r=e("./metaMap"),l=r?function(e,t){return r.set(e,t),e}:n;t.exports=l},{"../utility/identity":413,"./metaMap":383}],357:[function(e,t){function n(e,t){var n;return r(e,function(e,r,l){return n=t(e,r,l),!n}),!!n}var r=e("./baseEach");t.exports=n},{"./baseEach":336}],358:[function(e,t){function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n},{}],359:[function(e,t){function n(e){return"string"==typeof e?e:null==e?"":e+""}t.exports=n},{}],360:[function(e,t){function n(e,t){var n=-1,s=r,a=e.length,o=!0,u=o&&a>=200,p=u?i():null,c=[];p?(s=l,o=!1):(u=!1,p=t?[]:c);e:for(;++n<a;){var d=e[n],f=t?t(d,n,e):d;if(o&&d===d){for(var h=p.length;h--;)if(p[h]===f)continue e;t&&p.push(f),c.push(d)}else s(p,f,0)<0&&((t||u)&&p.push(f),c.push(d))}return c}var r=e("./baseIndexOf"),l=e("./cacheIndexOf"),i=e("./createCache");t.exports=n},{"./baseIndexOf":344,"./cacheIndexOf":364,"./createCache":369}],361:[function(e,t){function n(e,t){for(var n=-1,r=t.length,l=Array(r);++n<r;)l[n]=e[t[n]];return l}t.exports=n},{}],362:[function(e,t){function n(e,t,n){if("function"!=typeof e)return r;if("undefined"==typeof t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,l){return e.call(t,n,r,l)};case 4:return function(n,r,l,i){return e.call(t,n,r,l,i)};case 5:return function(n,r,l,i,s){return e.call(t,n,r,l,i,s)}}return function(){return e.apply(t,arguments)}}var r=e("../utility/identity");t.exports=n},{"../utility/identity":413}],363:[function(e,t){(function(n){function r(e){return a.call(e,0)}var l=e("../utility/constant"),i=e("../lang/isNative"),s=i(s=n.ArrayBuffer)&&s,a=i(a=s&&new s(0).slice)&&a,o=Math.floor,u=i(u=n.Uint8Array)&&u,p=function(){try{var e=i(e=n.Float64Array)&&e,t=new e(new s(10),0,1)&&e}catch(r){}return t}(),c=p?p.BYTES_PER_ELEMENT:0;a||(r=s&&u?function(e){var t=e.byteLength,n=p?o(t/c):0,r=n*c,l=new s(t);if(n){var i=new p(l,0,n);i.set(new p(e,0,n))}return t!=r&&(i=new u(l,r),i.set(new u(e,r))),l}:l(null)),t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":394,"../utility/constant":412}],364:[function(e,t){function n(e,t){var n=e.data,l="string"==typeof t||r(t)?n.set.has(t):n.hash[t];return l?0:-1}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":396}],365:[function(e,t){function n(e){var t=this.data;"string"==typeof e||r(e)?t.set.add(e):t.hash[e]=!0}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":396}],366:[function(e,t){function n(e,t){return r(e.criteria,t.criteria)||e.index-t.index}var r=e("./baseCompareAscending");t.exports=n},{"./baseCompareAscending":334}],367:[function(e,t){function n(e,t){return function(n,s,a){var o=t?t():{};if(s=r(s,a,3),i(n))for(var u=-1,p=n.length;++u<p;){var c=n[u];e(o,c,s(c,u,n),n)}else l(n,function(t,n,r){e(o,t,s(t,n,r),r)});return o}}var r=e("./baseCallback"),l=e("./baseEach"),i=e("../lang/isArray");t.exports=n},{"../lang/isArray":390,"./baseCallback":332,"./baseEach":336}],368:[function(e,t){function n(e){return function(){var t=arguments,n=t.length,i=t[0];if(2>n||null==i)return i;var s=t[n-2],a=t[n-1],o=t[3];n>3&&"function"==typeof s?(s=r(s,a,5),n-=2):(s=n>2&&"function"==typeof a?a:null,n-=s?1:0),o&&l(t[1],t[2],o)&&(s=3==n?null:s,n=2);for(var u=0;++u<n;){var p=t[u];p&&e(i,p,s)}return i}}var r=e("./bindCallback"),l=e("./isIterateeCall");t.exports=n},{"./bindCallback":362,"./isIterateeCall":379}],369:[function(e,t){(function(n){var r=e("./SetCache"),l=e("../utility/constant"),i=e("../lang/isNative"),s=i(s=n.Set)&&s,a=i(a=Object.create)&&a,o=a&&s?function(e){return new r(e)}:l(null);t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":394,"../utility/constant":412,"./SetCache":324}],370:[function(e,t){function n(e,t,n,r,l,i,s){var a=-1,o=e.length,u=t.length,p=!0;if(o!=u&&!(l&&u>o))return!1;for(;p&&++a<o;){var c=e[a],d=t[a];if(p=void 0,r&&(p=l?r(d,c,a):r(c,d,a)),"undefined"==typeof p)if(l)for(var f=u;f--&&(d=t[f],!(p=c&&c===d||n(c,d,r,l,i,s))););else p=c&&c===d||n(c,d,r,l,i,s)}return!!p}t.exports=n},{}],371:[function(e,t){function n(e,t,n){switch(n){case r:case l:return+e==+t;case i:return e.name==t.name&&e.message==t.message;case s:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case a:case o:return e==t+""}return!1}var r="[object Boolean]",l="[object Date]",i="[object Error]",s="[object Number]",a="[object RegExp]",o="[object String]";t.exports=n},{}],372:[function(e,t){function n(e,t,n,l,s,a,o){var u=r(e),p=u.length,c=r(t),d=c.length;if(p!=d&&!s)return!1;for(var f,h=-1;++h<p;){var m=u[h],g=i.call(t,m);if(g){var y=e[m],b=t[m];g=void 0,l&&(g=s?l(b,y,m):l(y,b,m)),"undefined"==typeof g&&(g=y&&y===b||n(y,b,l,s,a,o))}if(!g)return!1;f||(f="constructor"==m)}if(!f){var v=e.constructor,x=t.constructor;if(v!=x&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof x&&x instanceof x))return!1}return!0}var r=e("../object/keys"),l=Object.prototype,i=l.hasOwnProperty;t.exports=n},{"../object/keys":406}],373:[function(e,t){function n(e,t,n){for(var r=e.length,l=t+(n?0:-1);n?l--:++l<r;){var i=e[l];if(i!==i)return l}return-1}t.exports=n},{}],374:[function(e,t){function n(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&l.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var r=Object.prototype,l=r.hasOwnProperty;t.exports=n},{}],375:[function(e,t){function n(e,t,n){var x=e.constructor;switch(t){case u:return r(e);case l:case i:return new x(+e);case p:case c:case d:case f:case h:case m:case g:case y:case b:var E=e.buffer;return new x(n?r(E):E,e.byteOffset,e.length);case s:case o:return new x(e);case a:var _=new x(e.source,v.exec(e));_.lastIndex=e.lastIndex}return _}var r=e("./bufferClone"),l="[object Boolean]",i="[object Date]",s="[object Number]",a="[object RegExp]",o="[object String]",u="[object ArrayBuffer]",p="[object Float32Array]",c="[object Float64Array]",d="[object Int8Array]",f="[object Int16Array]",h="[object Int32Array]",m="[object Uint8Array]",g="[object Uint8ClampedArray]",y="[object Uint16Array]",b="[object Uint32Array]",v=/\w*$/;t.exports=n},{"./bufferClone":363}],376:[function(e,t){function n(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}t.exports=n},{}],377:[function(e,t){function n(e){var t=!(i.funcNames?e.name:i.funcDecomp);if(!t){var n=o.call(e);i.funcNames||(t=!s.test(n)),t||(t=a.test(n)||l(e),r(e,t))}return t}var r=e("./baseSetData"),l=e("../lang/isNative"),i=e("../support"),s=/^\s*function[ \n\r\t]+\w/,a=/\bthis\b/,o=Function.prototype.toString;t.exports=n},{"../lang/isNative":394,"../support":411,"./baseSetData":356}],378:[function(e,t){function n(e,t){return e=+e,t=null==t?r:t,e>-1&&e%1==0&&t>e}var r=Math.pow(2,53)-1;t.exports=n},{}],379:[function(e,t){function n(e,t,n){if(!i(n))return!1;var s=typeof t;if("number"==s)var a=n.length,o=l(a)&&r(t,a);else o="string"==s&&t in n;if(o){var u=n[t];return e===e?e===u:u!==u}return!1}var r=e("./isIndex"),l=e("./isLength"),i=e("../lang/isObject");t.exports=n},{"../lang/isObject":396,"./isIndex":378,"./isLength":380}],380:[function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=Math.pow(2,53)-1;t.exports=n},{}],381:[function(e,t){function n(e){return e&&"object"==typeof e||!1}t.exports=n},{}],382:[function(e,t){function n(e){return e===e&&(0===e?1/e>0:!r(e))}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":396}],383:[function(e,t){(function(n){var r=e("../lang/isNative"),l=r(l=n.WeakMap)&&l,i=l&&new l;t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lang/isNative":394}],384:[function(e,t){function n(e){var t;if(!l(e)||o.call(e)!=i||!a.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return r(e,function(e,t){n=t}),"undefined"==typeof n||a.call(e,n)}var r=e("./baseForIn"),l=e("./isObjectLike"),i="[object Object]",s=Object.prototype,a=s.hasOwnProperty,o=s.toString;t.exports=n},{"./baseForIn":340,"./isObjectLike":381}],385:[function(e,t){function n(e){for(var t=a(e),n=t.length,u=n&&e.length,c=u&&s(u)&&(l(e)||o.nonEnumArgs&&r(e)),d=-1,f=[];++d<n;){var h=t[d];(c&&i(h,u)||p.call(e,h))&&f.push(h)}return f}var r=e("../lang/isArguments"),l=e("../lang/isArray"),i=e("./isIndex"),s=e("./isLength"),a=e("../object/keysIn"),o=e("../support"),u=Object.prototype,p=u.hasOwnProperty;t.exports=n},{"../lang/isArguments":389,"../lang/isArray":390,"../object/keysIn":407,"../support":411,"./isIndex":378,"./isLength":380}],386:[function(e,t){function n(e,t){for(var n,r=-1,l=e.length,i=-1,s=[];++r<l;){var a=e[r],o=t?t(a,r,e):a;r&&n===o||(n=o,s[++i]=a)}return s}t.exports=n},{}],387:[function(e,t){function n(e){return r(e)?e:Object(e)}var r=e("../lang/isObject");t.exports=n},{"../lang/isObject":396}],388:[function(e,t){function n(e,t,n){return t="function"==typeof t&&l(t,n,1),r(e,!0,t)}var r=e("../internal/baseClone"),l=e("../internal/bindCallback");t.exports=n},{"../internal/baseClone":333,"../internal/bindCallback":362}],389:[function(e,t){function n(e){var t=l(e)?e.length:void 0;return r(t)&&a.call(e)==i||!1}var r=e("../internal/isLength"),l=e("../internal/isObjectLike"),i="[object Arguments]",s=Object.prototype,a=s.toString;t.exports=n},{"../internal/isLength":380,"../internal/isObjectLike":381}],390:[function(e,t){var n=e("../internal/isLength"),r=e("./isNative"),l=e("../internal/isObjectLike"),i="[object Array]",s=Object.prototype,a=s.toString,o=r(o=Array.isArray)&&o,u=o||function(e){return l(e)&&n(e.length)&&a.call(e)==i||!1};t.exports=u},{"../internal/isLength":380,"../internal/isObjectLike":381,"./isNative":394}],391:[function(e,t){function n(e){return e===!0||e===!1||r(e)&&s.call(e)==l||!1}var r=e("../internal/isObjectLike"),l="[object Boolean]",i=Object.prototype,s=i.toString;t.exports=n},{"../internal/isObjectLike":381}],392:[function(e,t){function n(e){if(null==e)return!0;var t=e.length;return s(t)&&(l(e)||o(e)||r(e)||a(e)&&i(e.splice))?!t:!u(e).length}var r=e("./isArguments"),l=e("./isArray"),i=e("./isFunction"),s=e("../internal/isLength"),a=e("../internal/isObjectLike"),o=e("./isString"),u=e("../object/keys");t.exports=n},{"../internal/isLength":380,"../internal/isObjectLike":381,"../object/keys":406,"./isArguments":389,"./isArray":390,"./isFunction":393,"./isString":399}],393:[function(e,t){(function(n){var r=e("../internal/baseIsFunction"),l=e("./isNative"),i="[object Function]",s=Object.prototype,a=s.toString,o=l(o=n.Uint8Array)&&o,u=r(/x/)||o&&!r(o)?function(e){return a.call(e)==i}:r;t.exports=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../internal/baseIsFunction":347,"./isNative":394}],394:[function(e,t){function n(e){return null==e?!1:u.call(e)==i?p.test(o.call(e)):l(e)&&s.test(e)||!1}var r=e("../string/escapeRegExp"),l=e("../internal/isObjectLike"),i="[object Function]",s=/^\[object .+?Constructor\]$/,a=Object.prototype,o=Function.prototype.toString,u=a.toString,p=RegExp("^"+r(u).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},{"../internal/isObjectLike":381,"../string/escapeRegExp":410}],395:[function(e,t){function n(e){return"number"==typeof e||r(e)&&s.call(e)==l||!1}var r=e("../internal/isObjectLike"),l="[object Number]",i=Object.prototype,s=i.toString;t.exports=n},{"../internal/isObjectLike":381}],396:[function(e,t){function n(e){var t=typeof e;return"function"==t||e&&"object"==t||!1}t.exports=n},{}],397:[function(e,t){var n=e("./isNative"),r=e("../internal/shimIsPlainObject"),l="[object Object]",i=Object.prototype,s=i.toString,a=n(a=Object.getPrototypeOf)&&a,o=a?function(e){if(!e||s.call(e)!=l)return!1;var t=e.valueOf,i=n(t)&&(i=a(t))&&a(i);return i?e==i||a(e)==i:r(e)}:r;t.exports=o},{"../internal/shimIsPlainObject":384,"./isNative":394}],398:[function(e,t){function n(e){return r(e)&&s.call(e)==l||!1}var r=e("../internal/isObjectLike"),l="[object RegExp]",i=Object.prototype,s=i.toString;t.exports=n},{"../internal/isObjectLike":381}],399:[function(e,t){function n(e){return"string"==typeof e||r(e)&&s.call(e)==l||!1}var r=e("../internal/isObjectLike"),l="[object String]",i=Object.prototype,s=i.toString;t.exports=n},{"../internal/isObjectLike":381}],400:[function(e,t){function n(e){return l(e)&&r(e.length)&&C[j.call(e)]||!1}var r=e("../internal/isLength"),l=e("../internal/isObjectLike"),i="[object Arguments]",s="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",p="[object Function]",c="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",m="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",v="[object Float32Array]",x="[object Float64Array]",E="[object Int8Array]",_="[object Int16Array]",S="[object Int32Array]",I="[object Uint8Array]",w="[object Uint8ClampedArray]",k="[object Uint16Array]",A="[object Uint32Array]",C={};C[v]=C[x]=C[E]=C[_]=C[S]=C[I]=C[w]=C[k]=C[A]=!0,C[i]=C[s]=C[b]=C[a]=C[o]=C[u]=C[p]=C[c]=C[d]=C[f]=C[h]=C[m]=C[g]=C[y]=!1;var T=Object.prototype,j=T.toString;t.exports=n},{"../internal/isLength":380,"../internal/isObjectLike":381}],401:[function(e,t){function n(e){return r(e,l(e))}var r=e("../internal/baseCopy"),l=e("../object/keysIn");t.exports=n},{"../internal/baseCopy":335,"../object/keysIn":407}],402:[function(e,t){var n=e("../internal/baseAssign"),r=e("../internal/createAssigner"),l=r(n);t.exports=l},{"../internal/baseAssign":331,"../internal/createAssigner":368}],403:[function(e,t){function n(e){if(null==e)return e;var t=r(arguments);return t.push(i),l.apply(void 0,t)}var r=e("../internal/arrayCopy"),l=e("./assign"),i=e("../internal/assignDefaults");t.exports=n},{"../internal/arrayCopy":325,"../internal/assignDefaults":330,"./assign":402}],404:[function(e,t){t.exports=e("./assign")},{"./assign":402}],405:[function(e,t){function n(e,t){return e?l.call(e,t):!1}var r=Object.prototype,l=r.hasOwnProperty;t.exports=n},{}],406:[function(e,t){var n=e("../internal/isLength"),r=e("../lang/isNative"),l=e("../lang/isObject"),i=e("../internal/shimKeys"),s=r(s=Object.keys)&&s,a=s?function(e){if(e)var t=e.constructor,r=e.length;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&r&&n(r)?i(e):l(e)?s(e):[]}:i;t.exports=a},{"../internal/isLength":380,"../internal/shimKeys":385,"../lang/isNative":394,"../lang/isObject":396}],407:[function(e,t){function n(e){if(null==e)return[];a(e)||(e=Object(e));var t=e.length;t=t&&s(t)&&(l(e)||o.nonEnumArgs&&r(e))&&t||0;for(var n=e.constructor,u=-1,c="function"==typeof n&&n.prototype===e,d=Array(t),f=t>0;++u<t;)d[u]=u+"";for(var h in e)f&&i(h,t)||"constructor"==h&&(c||!p.call(e,h))||d.push(h);return d}var r=e("../lang/isArguments"),l=e("../lang/isArray"),i=e("../internal/isIndex"),s=e("../internal/isLength"),a=e("../lang/isObject"),o=e("../support"),u=Object.prototype,p=u.hasOwnProperty;t.exports=n},{"../internal/isIndex":378,"../internal/isLength":380,"../lang/isArguments":389,"../lang/isArray":390,"../lang/isObject":396,"../support":411}],408:[function(e,t){var n=e("../internal/baseMerge"),r=e("../internal/createAssigner"),l=r(n);t.exports=l},{"../internal/baseMerge":352,"../internal/createAssigner":368}],409:[function(e,t){function n(e){return r(e,l(e))}var r=e("../internal/baseValues"),l=e("./keys");t.exports=n},{"../internal/baseValues":361,"./keys":406}],410:[function(e,t){function n(e){return e=r(e),e&&i.test(e)?e.replace(l,"\\$&"):e}var r=e("../internal/baseToString"),l=/[.*+?^${}()|[\]\/\\]/g,i=RegExp(l.source);t.exports=n},{"../internal/baseToString":359}],411:[function(e,t){(function(n){var r=e("./lang/isNative"),l=/\bthis\b/,i=Object.prototype,s=(s=n.window)&&s.document,a=i.propertyIsEnumerable,o={};!function(){o.funcDecomp=!r(n.WinRTError)&&l.test(function(){return this}),o.funcNames="string"==typeof Function.name;try{o.dom=11===s.createDocumentFragment().nodeType}catch(e){o.dom=!1}try{o.nonEnumArgs=!a.call(arguments,1)}catch(e){o.nonEnumArgs=!0}}(0,0),t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lang/isNative":394}],412:[function(e,t){function n(e){return function(){return e}}t.exports=n},{}],413:[function(e,t){function n(e){return e}t.exports=n},{}],414:[function(e,t){(function(n){function r(e){return e.split("").reduce(function(e,t){return e[t]=!0,e},{})}function l(e,t){return t=t||{},function(n){return s(n,e,t)}}function i(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach(function(e){n[e]=t[e]}),Object.keys(e).forEach(function(t){n[t]=e[t]}),n}function s(e,t,n){if("string"!=typeof t)throw new TypeError("glob pattern string required");return n||(n={}),n.nocomment||"#"!==t.charAt(0)?""===t.trim()?""===e:new a(t,n).match(e):!1}function a(e,t){if(!(this instanceof a))return new a(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),g&&(e=e.split("\\").join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function o(){if(!this._made){var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(I)}),this.debug(this.pattern,n),n=n.map(function(e){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,n),this.set=n}}function u(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var l=0,i=e.length;i>l&&"!"===e.charAt(l);l++)t=!t,r++;r&&(this.pattern=e.substr(r)),this.negate=t}}function p(e,t){if(t||(t=this instanceof a?this.options:{}),e="undefined"==typeof e?this.pattern:e,"undefined"==typeof e)throw new Error("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:b(e)}function c(e,t){function n(){if(i){switch(i){case"*":a+=x,o=!0;break;case"?":a+=v,o=!0;break;default:a+="\\"+i}g.debug("clearStateChar %j %j",i,a),i=!1}}var r=this.options;if(!r.noglobstar&&"**"===e)return y;if(""===e)return"";for(var l,i,s,a="",o=!!r.nocase,u=!1,p=[],c=!1,d=-1,f=-1,m="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,b=0,E=e.length;E>b&&(s=e.charAt(b));b++)if(this.debug("%s %s %s %j",e,b,a,s),u&&S[s])a+="\\"+s,u=!1;else switch(s){case"/":return!1;case"\\":n(),u=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,b,a,s),c){this.debug(" in class"),"!"===s&&b===f+1&&(s="^"),a+=s;continue}g.debug("call clearStateChar %j",i),n(),i=s,r.noext&&n();continue;case"(":if(c){a+="(";continue}if(!i){a+="\\(";continue}l=i,p.push({type:l,start:b-1,reStart:a.length}),a+="!"===i?"(?:(?!":"(?:",this.debug("plType %j %j",i,a),i=!1;continue;case")":if(c||!p.length){a+="\\)";continue}switch(n(),o=!0,a+=")",l=p.pop().type){case"!":a+="[^/]*?)";break;case"?":case"+":case"*":a+=l;case"@":}continue;case"|":if(c||!p.length||u){a+="\\|",u=!1;continue}n(),a+="|";continue;case"[":if(n(),c){a+="\\"+s;continue}c=!0,f=b,d=a.length,a+=s;continue;case"]":if(b===f+1||!c){a+="\\"+s,u=!1;continue}if(c){var _=e.substring(f+1,b);try{new RegExp("["+_+"]")}catch(I){var k=this.parse(_,w);a=a.substr(0,d)+"\\["+k[0]+"\\]",o=o||k[1],c=!1;continue}}o=!0,c=!1,a+=s;continue;default:n(),u?u=!1:!S[s]||"^"===s&&c||(a+="\\"),a+=s}if(c){var _=e.substr(f+1),k=this.parse(_,w);a=a.substr(0,d)+"\\["+k[0],o=o||k[1]}for(var A;A=p.pop();){var C=a.slice(A.reStart+3);C=C.replace(/((?:\\{2})*)(\\?)\|/g,function(e,t,n){return n||(n="\\"),t+t+n+"|"}),this.debug("tail=%j\n %s",C,C);var T="*"===A.type?x:"?"===A.type?v:"\\"+A.type;o=!0,a=a.slice(0,A.reStart)+T+"\\("+C}n(),u&&(a+="\\\\");var j=!1;switch(a.charAt(0)){case".":case"[":case"(":j=!0}if(""!==a&&o&&(a="(?=.)"+a),j&&(a=m+a),t===w)return[a,o];if(!o)return h(e);var M=r.nocase?"i":"",P=new RegExp("^"+a+"$",M);return P._glob=e,P._src=a,P}function d(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1;var t=this.options,n=t.noglobstar?x:t.dot?E:_,r=t.nocase?"i":"",l=e.map(function(e){return e.map(function(e){return e===y?n:"string"==typeof e?m(e):e._src}).join("\\/")}).join("|");l="^(?:"+l+")$",this.negate&&(l="^(?!"+l+").*$");try{return this.regexp=new RegExp(l,r)}catch(i){return this.regexp=!1}}function f(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var n=this.options;g&&(e=e.split("\\").join("/")),e=e.split(I),this.debug(this.pattern,"split",e);var r=this.set;this.debug(this.pattern,"set",r);for(var l,i=e.length-1;i>=0&&!(l=e[i]);i--);for(var i=0,s=r.length;s>i;i++){var a=r[i],o=e;n.matchBase&&1===a.length&&(o=[l]);var u=this.matchOne(o,a,t);if(u)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}function h(e){return e.replace(/\\(.)/g,"$1")}function m(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}t.exports=s,s.Minimatch=a;var g=!1;"undefined"!=typeof n&&"win32"===n.platform&&(g=!0);var y=s.GLOBSTAR=a.GLOBSTAR={},b=e("brace-expansion"),v="[^/]",x=v+"*?",E="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",_="(?:(?!(?:\\/|^)\\.).)*?",S=r("().*{}+?[]^$\\!"),I=/\/+/; s.filter=l,s.defaults=function(e){if(!e||!Object.keys(e).length)return s;var t=s,n=function(n,r,l){return t.minimatch(n,r,i(e,l))};return n.Minimatch=function(n,r){return new t.Minimatch(n,i(e,r))},n},a.defaults=function(e){return e&&Object.keys(e).length?s.defaults(e).Minimatch:a},a.prototype.debug=function(){},a.prototype.make=o,a.prototype.parseNegate=u,s.braceExpand=function(e,t){return p(e,t)},a.prototype.braceExpand=p,a.prototype.parse=c;var w={};s.makeRe=function(e,t){return new a(e,t||{}).makeRe()},a.prototype.makeRe=d,s.match=function(e,t,n){n=n||{};var r=new a(t,n);return e=e.filter(function(e){return r.match(e)}),r.options.nonull&&!e.length&&e.push(t),e},a.prototype.match=f,a.prototype.matchOne=function(e,t,n){var r=this.options;this.debug("matchOne",{"this":this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var l=0,i=0,s=e.length,a=t.length;s>l&&a>i;l++,i++){this.debug("matchOne loop");var o=t[i],u=e[l];if(this.debug(t,o,u),o===!1)return!1;if(o===y){this.debug("GLOBSTAR",[t,o,u]);var p=l,c=i+1;if(c===a){for(this.debug("** at the end");s>l;l++)if("."===e[l]||".."===e[l]||!r.dot&&"."===e[l].charAt(0))return!1;return!0}e:for(;s>p;){var d=e[p];if(this.debug("\nglobstar while",e,p,t,c,d),this.matchOne(e.slice(p),t.slice(c),n))return this.debug("globstar found match!",p,s,d),!0;if("."===d||".."===d||!r.dot&&"."===d.charAt(0)){this.debug("dot detected!",e,p,t,c);break e}this.debug("globstar swallow a segment, and continue"),p++}return n&&(this.debug("\n>>> no match, partial?",e,p,t,c),p===s)?!0:!1}var f;if("string"==typeof o?(f=r.nocase?u.toLowerCase()===o.toLowerCase():u===o,this.debug("string match",o,u,f)):(f=u.match(o),this.debug("pattern match",o,u,f)),!f)return!1}if(l===s&&i===a)return!0;if(l===s)return n;if(i===a){var h=l===s-1&&""===e[l];return h}throw new Error("wtf?")}}).call(this,e("_process"))},{_process:183,"brace-expansion":415}],415:[function(e,t){function n(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function r(e){return e.split("\\\\").join(h).split("\\{").join(m).split("\\}").join(g).split("\\,").join(y).split("\\.").join(b)}function l(e){return e.split(h).join("\\").split(m).join("{").split(g).join("}").split(y).join(",").split(b).join(".")}function i(e){if(!e)return[""];var t=[],n=f("{","}",e);if(!n)return e.split(",");var r=n.pre,l=n.body,s=n.post,a=r.split(",");a[a.length-1]+="{"+l+"}";var o=i(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}function s(e){return e?c(r(e),!0).map(l):[]}function a(e){return"{"+e+"}"}function o(e){return/^-?0\d/.test(e)}function u(e,t){return t>=e}function p(e,t){return e>=t}function c(e,t){var r=[],l=f("{","}",e);if(!l||/\$$/.test(l.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(l.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(l.body),m=s||h,y=/^(.*,)+(.+)?$/.test(l.body);if(!m&&!y)return l.post.match(/,.*}/)?(e=l.pre+"{"+l.body+g+l.post,c(e)):[e];var b;if(m)b=l.body.split(/\.\./);else if(b=i(l.body),1===b.length&&(b=c(b[0],!1).map(a),1===b.length)){var v=l.post.length?c(l.post,!1):[""];return v.map(function(e){return l.pre+b[0]+e})}var x,E=l.pre,v=l.post.length?c(l.post,!1):[""];if(m){var _=n(b[0]),S=n(b[1]),I=Math.max(b[0].length,b[1].length),w=3==b.length?Math.abs(n(b[2])):1,k=u,A=_>S;A&&(w*=-1,k=p);var C=b.some(o);x=[];for(var T=_;k(T,S);T+=w){var j;if(h)j=String.fromCharCode(T),"\\"===j&&(j="");else if(j=String(T),C){var M=I-j.length;if(M>0){var P=new Array(M+1).join("0");j=0>T?"-"+P+j.slice(1):P+j}}x.push(j)}}else x=d(b,function(e){return c(e,!1)});for(var L=0;L<x.length;L++)for(var O=0;O<v.length;O++){var D=E+x[L]+v[O];(!t||m||D)&&r.push(D)}return r}var d=e("concat-map"),f=e("balanced-match");t.exports=s;var h="\x00SLASH"+Math.random()+"\x00",m="\x00OPEN"+Math.random()+"\x00",g="\x00CLOSE"+Math.random()+"\x00",y="\x00COMMA"+Math.random()+"\x00",b="\x00PERIOD"+Math.random()+"\x00"},{"balanced-match":416,"concat-map":417}],416:[function(e,t){function n(e,t,r){for(var l=0,i={},s=!1,a=0;a<r.length;a++)if(e==r.substr(a,e.length))"start"in i||(i.start=a),l++;else if(t==r.substr(a,t.length)&&"start"in i&&(s=!0,l--,!l))return i.end=a,i.pre=r.substr(0,i.start),i.body=i.end-i.start>1?r.substring(i.start+e.length,i.end):"",i.post=r.slice(i.end+t.length),i;if(l&&s){var o=i.start+e.length;return i=n(e,t,r.substr(o)),i&&(i.start+=o,i.end+=o,i.pre=r.slice(0,o)+i.pre),i}}t.exports=n},{}],417:[function(e,t){t.exports=function(e,t){for(var r=[],l=0;l<e.length;l++){var i=t(e[l],l);n(i)?r.push.apply(r,i):r.push(i)}return r};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],418:[function(e,t){(function(e){"use strict";function n(e){return"/"===e.charAt(0)}function r(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,n=t.exec(e),r=n[1]||"",l=!!r&&":"!==r.charAt(1);return!!n[2]||l}t.exports="win32"===e.platform?r:n,t.exports.posix=n,t.exports.win32=r}).call(this,e("_process"))},{_process:183}],419:[function(e,t,n){"use strict";function r(e,t,n){if(c)try{c.call(p,e,t,{value:n})}catch(r){e[t]=n}else e[t]=n}function l(e){return e&&(r(e,"call",e.call),r(e,"apply",e.apply)),e}function i(e){return d?d.call(p,e):(g.prototype=e||null,new g)}function s(){do var e=a(m.call(h.call(y(),36),2));while(f.call(b,e));return b[e]=e}function a(e){var t={};return t[e]=!0,Object.keys(t)[0]}function o(){return i(null)}function u(e){function t(t){function n(n,r){return n===a?r?i=null:i||(i=e(t)):void 0}var i;r(t,l,n)}function n(e){return f.call(e,l)||t(e),e[l](a)}var l=s(),a=i(null);return e=e||o,n.forget=function(e){f.call(e,l)&&e[l](a,!0)},n}var p=Object,c=Object.defineProperty,d=Object.create;l(c),l(d);var f=l(Object.prototype.hasOwnProperty),h=l(Number.prototype.toString),m=l(String.prototype.slice),g=function(){},y=Math.random,b=i(null);r(n,"makeUniqueKey",s);var v=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var t=v(e),n=0,r=0,l=t.length;l>n;++n)f.call(b,t[n])||(n>r&&(t[r]=t[n]),++r);return t.length=r,t},r(n,"makeAccessor",u)},{}],420:[function(e,t,n){function r(e){o.ok(this instanceof r),c.Identifier.assert(e),Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:l()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new d.LeapManager(this)}})}function l(){return p.literal(-1)}function i(e){return c.BreakStatement.check(e)||c.ContinueStatement.check(e)||c.ReturnStatement.check(e)||c.ThrowStatement.check(e)}function s(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function a(e){var t=e.type;return"normal"===t?!m.call(e,"target"):"break"===t||"continue"===t?!m.call(e,"value")&&c.Literal.check(e.target):"return"===t||"throw"===t?m.call(e,"value")&&!m.call(e,"target"):!1}var o=e("assert"),u=e("ast-types"),p=(u.builtInTypes.array,u.builders),c=u.namedTypes,d=e("./leap"),f=e("./meta"),h=e("./util"),m=Object.prototype.hasOwnProperty,g=r.prototype;n.Emitter=r,g.mark=function(e){c.Literal.assert(e);var t=this.listing.length;return-1===e.value?e.value=t:o.strictEqual(e.value,t),this.marked[t]=!0,e},g.emit=function(e){c.Expression.check(e)&&(e=p.expressionStatement(e)),c.Statement.assert(e),this.listing.push(e)},g.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},g.assign=function(e,t){return p.expressionStatement(p.assignmentExpression("=",e,t))},g.contextProperty=function(e,t){return p.memberExpression(this.contextId,t?p.literal(e):p.identifier(e),!!t)};var y={prev:!0,next:!0,sent:!0,rval:!0};g.isVolatileContextProperty=function(e){if(c.MemberExpression.check(e)){if(e.computed)return!0;if(c.Identifier.check(e.object)&&c.Identifier.check(e.property)&&e.object.name===this.contextId.name&&m.call(y,e.property.name))return!0}return!1},g.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},g.setReturnValue=function(e){c.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},g.clearPendingException=function(e,t){c.Literal.assert(e);var n=p.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,n):this.emit(n)},g.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(p.breakStatement())},g.jumpIf=function(e,t){c.Expression.assert(e),c.Literal.assert(t),this.emit(p.ifStatement(e,p.blockStatement([this.assign(this.contextProperty("next"),t),p.breakStatement()])))},g.jumpIfNot=function(e,t){c.Expression.assert(e),c.Literal.assert(t);var n;n=c.UnaryExpression.check(e)&&"!"===e.operator?e.argument:p.unaryExpression("!",e),this.emit(p.ifStatement(n,p.blockStatement([this.assign(this.contextProperty("next"),t),p.breakStatement()])))};var b=0;g.makeTempVar=function(){return this.contextProperty("t"+b++)},g.getContextFunction=function(e){var t=p.functionExpression(e||null,[this.contextId],p.blockStatement([this.getDispatchLoop()]),!1,!1);return t._aliasFunction=!0,t},g.getDispatchLoop=function(){var e,t=this,n=[],r=!1;return t.listing.forEach(function(l,s){t.marked.hasOwnProperty(s)&&(n.push(p.switchCase(p.literal(s),e=[])),r=!1),r||(e.push(l),i(l)&&(r=!0))}),this.finalLoc.value=this.listing.length,n.push(p.switchCase(this.finalLoc,[]),p.switchCase(p.literal("end"),[p.returnStatement(p.callExpression(this.contextProperty("stop"),[]))])),p.whileStatement(p.literal(1),p.switchStatement(p.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),n))},g.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return p.arrayExpression(this.tryEntries.map(function(t){var n=t.firstLoc.value;o.ok(n>=e,"try entries out of order"),e=n;var r=t.catchEntry,l=t.finallyEntry,i=[t.firstLoc,r?r.firstLoc:null];return l&&(i[2]=l.firstLoc,i[3]=l.afterLoc),p.arrayExpression(i)}))},g.explode=function(e,t){o.ok(e instanceof u.NodePath);var n=e.value,r=this;if(c.Node.assert(n),c.Statement.check(n))return r.explodeStatement(e);if(c.Expression.check(n))return r.explodeExpression(e,t);if(c.Declaration.check(n))throw s(n);switch(n.type){case"Program":return e.get("body").map(r.explodeStatement,r);case"VariableDeclarator":throw s(n);case"Property":case"SwitchCase":case"CatchClause":throw new Error(n.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(n.type))}},g.explodeStatement=function(e,t){o.ok(e instanceof u.NodePath);var n=e.value,r=this;if(c.Statement.assert(n),t?c.Identifier.assert(t):t=null,c.BlockStatement.check(n))return e.get("body").each(r.explodeStatement,r);if(!f.containsLeap(n))return void r.emit(n);switch(n.type){case"ExpressionStatement":r.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var i=l();r.leapManager.withEntry(new d.LabeledEntry(i,n.label),function(){r.explodeStatement(e.get("body"),n.label)}),r.mark(i);break;case"WhileStatement":var s=l(),i=l();r.mark(s),r.jumpIfNot(r.explodeExpression(e.get("test")),i),r.leapManager.withEntry(new d.LoopEntry(i,s,t),function(){r.explodeStatement(e.get("body"))}),r.jump(s),r.mark(i);break;case"DoWhileStatement":var a=l(),m=l(),i=l();r.mark(a),r.leapManager.withEntry(new d.LoopEntry(i,m,t),function(){r.explode(e.get("body"))}),r.mark(m),r.jumpIf(r.explodeExpression(e.get("test")),a),r.mark(i);break;case"ForStatement":var g=l(),y=l(),i=l();n.init&&r.explode(e.get("init"),!0),r.mark(g),n.test&&r.jumpIfNot(r.explodeExpression(e.get("test")),i),r.leapManager.withEntry(new d.LoopEntry(i,y,t),function(){r.explodeStatement(e.get("body"))}),r.mark(y),n.update&&r.explode(e.get("update"),!0),r.jump(g),r.mark(i);break;case"ForInStatement":c.Identifier.assert(n.left);var g=l(),i=l(),b=r.makeTempVar();r.emitAssign(b,p.callExpression(h.runtimeProperty("keys"),[r.explodeExpression(e.get("right"))])),r.mark(g);var v=r.makeTempVar();r.jumpIf(p.memberExpression(p.assignmentExpression("=",v,p.callExpression(b,[])),p.identifier("done"),!1),i),r.emitAssign(n.left,p.memberExpression(v,p.identifier("value"),!1)),r.leapManager.withEntry(new d.LoopEntry(i,g,t),function(){r.explodeStatement(e.get("body"))}),r.jump(g),r.mark(i);break;case"BreakStatement":r.emitAbruptCompletion({type:"break",target:r.leapManager.getBreakLoc(n.label)});break;case"ContinueStatement":r.emitAbruptCompletion({type:"continue",target:r.leapManager.getContinueLoc(n.label)});break;case"SwitchStatement":for(var x=r.emitAssign(r.makeTempVar(),r.explodeExpression(e.get("discriminant"))),i=l(),E=l(),_=E,S=[],I=n.cases||[],w=I.length-1;w>=0;--w){var k=I[w];c.SwitchCase.assert(k),k.test?_=p.conditionalExpression(p.binaryExpression("===",x,k.test),S[w]=l(),_):S[w]=E}r.jump(r.explodeExpression(new u.NodePath(_,e,"discriminant"))),r.leapManager.withEntry(new d.SwitchEntry(i),function(){e.get("cases").each(function(e){var t=(e.value,e.name);r.mark(S[t]),e.get("consequent").each(r.explodeStatement,r)})}),r.mark(i),-1===E.value&&(r.mark(E),o.strictEqual(i.value,E.value));break;case"IfStatement":var A=n.alternate&&l(),i=l();r.jumpIfNot(r.explodeExpression(e.get("test")),A||i),r.explodeStatement(e.get("consequent")),A&&(r.jump(i),r.mark(A),r.explodeStatement(e.get("alternate"))),r.mark(i);break;case"ReturnStatement":r.emitAbruptCompletion({type:"return",value:r.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var i=l(),C=n.handler;!C&&n.handlers&&(C=n.handlers[0]||null);var T=C&&l(),j=T&&new d.CatchEntry(T,C.param),M=n.finalizer&&l(),P=M&&new d.FinallyEntry(M,i),L=new d.TryEntry(r.getUnmarkedCurrentLoc(),j,P);r.tryEntries.push(L),r.updateContextPrevLoc(L.firstLoc),r.leapManager.withEntry(L,function(){if(r.explodeStatement(e.get("block")),T){r.jump(M?M:i),r.updateContextPrevLoc(r.mark(T));var t=e.get("handler","body"),n=r.makeTempVar();r.clearPendingException(L.firstLoc,n);var l=t.scope,s=C.param.name;c.CatchClause.assert(l.node),o.strictEqual(l.lookup(s),l),u.visit(t,{visitIdentifier:function(e){return h.isReference(e,s)&&e.scope.lookup(s)===l?n:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(s)?!1:void this.traverse(e)}}),r.leapManager.withEntry(j,function(){r.explodeStatement(t)})}M&&(r.updateContextPrevLoc(r.mark(M)),r.leapManager.withEntry(P,function(){r.explodeStatement(e.get("finalizer"))}),r.emit(p.returnStatement(p.callExpression(r.contextProperty("finish"),[P.firstLoc]))))}),r.mark(i);break;case"ThrowStatement":r.emit(p.throwStatement(r.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(n.type))}},g.emitAbruptCompletion=function(e){a(e)||o.ok(!1,"invalid completion record: "+JSON.stringify(e)),o.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=[p.literal(e.type)];"break"===e.type||"continue"===e.type?(c.Literal.assert(e.target),t[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(c.Expression.assert(e.value),t[1]=e.value),this.emit(p.returnStatement(p.callExpression(this.contextProperty("abrupt"),t)))},g.getUnmarkedCurrentLoc=function(){return p.literal(this.listing.length)},g.updateContextPrevLoc=function(e){e?(c.Literal.assert(e),-1===e.value?e.value=this.listing.length:o.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},g.explodeExpression=function(e,t){function n(e){return c.Expression.assert(e),t?void a.emit(e):e}function r(e,t,n){o.ok(t instanceof u.NodePath),o.ok(!n||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var r=a.explodeExpression(t,n);return n||(e||d&&(a.isVolatileContextProperty(r)||f.hasSideEffects(r)))&&(r=a.emitAssign(e||a.makeTempVar(),r)),r}o.ok(e instanceof u.NodePath);var i=e.value;if(!i)return i;c.Expression.assert(i);var s,a=this;if(!f.containsLeap(i))return n(i);var d=f.containsLeap.onlyChildren(i);switch(i.type){case"MemberExpression":return n(p.memberExpression(a.explodeExpression(e.get("object")),i.computed?r(null,e.get("property")):i.property,i.computed));case"CallExpression":var h=e.get("callee"),m=a.explodeExpression(h);return!c.MemberExpression.check(h.node)&&c.MemberExpression.check(m)&&(m=p.sequenceExpression([p.literal(0),m])),n(p.callExpression(m,e.get("arguments").map(function(e){return r(null,e)})));case"NewExpression":return n(p.newExpression(r(null,e.get("callee")),e.get("arguments").map(function(e){return r(null,e)})));case"ObjectExpression":return n(p.objectExpression(e.get("properties").map(function(e){return p.property(e.value.kind,e.value.key,r(null,e.get("value")))})));case"ArrayExpression":return n(p.arrayExpression(e.get("elements").map(function(e){return r(null,e)})));case"SequenceExpression":var g=i.expressions.length-1;return e.get("expressions").each(function(e){e.name===g?s=a.explodeExpression(e,t):a.explodeExpression(e,!0)}),s;case"LogicalExpression":var y=l();t||(s=a.makeTempVar());var b=r(s,e.get("left"));return"&&"===i.operator?a.jumpIfNot(b,y):(o.strictEqual(i.operator,"||"),a.jumpIf(b,y)),r(s,e.get("right"),t),a.mark(y),s;case"ConditionalExpression":var v=l(),y=l(),x=a.explodeExpression(e.get("test"));return a.jumpIfNot(x,v),t||(s=a.makeTempVar()),r(s,e.get("consequent"),t),a.jump(y),a.mark(v),r(s,e.get("alternate"),t),a.mark(y),s;case"UnaryExpression":return n(p.unaryExpression(i.operator,a.explodeExpression(e.get("argument")),!!i.prefix));case"BinaryExpression":return n(p.binaryExpression(i.operator,r(null,e.get("left")),r(null,e.get("right"))));case"AssignmentExpression":return n(p.assignmentExpression(i.operator,a.explodeExpression(e.get("left")),a.explodeExpression(e.get("right"))));case"UpdateExpression":return n(p.updateExpression(i.operator,a.explodeExpression(e.get("argument")),i.prefix));case"YieldExpression":var y=l(),E=i.argument&&a.explodeExpression(e.get("argument"));if(E&&i.delegate){var s=a.makeTempVar();return a.emit(p.returnStatement(p.callExpression(a.contextProperty("delegateYield"),[E,p.literal(s.property.name),y]))),a.mark(y),s}return a.emitAssign(a.contextProperty("next"),y),a.emit(p.returnStatement(E||null)),a.mark(y),a.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(i.type))}}},{"./leap":422,"./meta":423,"./util":424,assert:173,"ast-types":171}],421:[function(e,t,n){var r=e("assert"),l=e("ast-types"),i=l.namedTypes,s=l.builders,a=Object.prototype.hasOwnProperty;n.hoist=function(e){function t(e,t){i.VariableDeclaration.assert(e);var r=[];return e.declarations.forEach(function(e){n[e.id.name]=e.id,e.init?r.push(s.assignmentExpression("=",e.id,e.init)):t&&r.push(e.id)}),0===r.length?null:1===r.length?r[0]:s.sequenceExpression(r)}r.ok(e instanceof l.NodePath),i.Function.assert(e.value);var n={};l.visit(e.get("body"),{visitVariableDeclaration:function(e){var n=t(e.value,!1);return null!==n?s.expressionStatement(n):(e.replace(),!1)},visitForStatement:function(e){var n=e.value.init;i.VariableDeclaration.check(n)&&e.get("init").replace(t(n,!1)),this.traverse(e)},visitForInStatement:function(e){var n=e.value.left;i.VariableDeclaration.check(n)&&e.get("left").replace(t(n,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var t=e.value;n[t.id.name]=t.id;var r=(e.parent.node,s.expressionStatement(s.assignmentExpression("=",t.id,s.functionExpression(t.id,t.params,t.body,t.generator,t.expression))));return i.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(r),e.replace()):e.replace(r),!1},visitFunctionExpression:function(){return!1}});var o={};e.get("params").each(function(e){var t=e.value;i.Identifier.check(t)&&(o[t.name]=t)});var u=[];return Object.keys(n).forEach(function(e){a.call(o,e)||u.push(s.variableDeclarator(n[e],null))}),0===u.length?null:s.variableDeclaration("var",u)}},{assert:173,"ast-types":171}],422:[function(e,t,n){function r(){d.ok(this instanceof r)}function l(e){r.call(this),h.Literal.assert(e),this.returnLoc=e}function i(e,t,n){r.call(this),h.Literal.assert(e),h.Literal.assert(t),n?h.Identifier.assert(n):n=null,this.breakLoc=e,this.continueLoc=t,this.label=n}function s(e){r.call(this),h.Literal.assert(e),this.breakLoc=e}function a(e,t,n){r.call(this),h.Literal.assert(e),t?d.ok(t instanceof o):t=null,n?d.ok(n instanceof u):n=null,d.ok(t||n),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=n}function o(e,t){r.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.firstLoc=e,this.paramId=t}function u(e,t){r.call(this),h.Literal.assert(e),h.Literal.assert(t),this.firstLoc=e,this.afterLoc=t}function p(e,t){r.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.breakLoc=e,this.label=t}function c(t){d.ok(this instanceof c);var n=e("./emit").Emitter;d.ok(t instanceof n),this.emitter=t,this.entryStack=[new l(t.finalLoc)]}{var d=e("assert"),f=e("ast-types"),h=f.namedTypes,m=(f.builders,e("util").inherits);Object.prototype.hasOwnProperty}m(l,r),n.FunctionEntry=l,m(i,r),n.LoopEntry=i,m(s,r),n.SwitchEntry=s,m(a,r),n.TryEntry=a,m(o,r),n.CatchEntry=o,m(u,r),n.FinallyEntry=u,m(p,r),n.LabeledEntry=p;var g=c.prototype;n.LeapManager=c,g.withEntry=function(e,t){d.ok(e instanceof r),this.entryStack.push(e);try{t.call(this.emitter)}finally{var n=this.entryStack.pop();d.strictEqual(n,e)}},g._findLeapLocation=function(e,t){for(var n=this.entryStack.length-1;n>=0;--n){var r=this.entryStack[n],l=r[e];if(l)if(t){if(r.label&&r.label.name===t.name)return l}else if(!(r instanceof p))return l}return null},g.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},g.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":420,assert:173,"ast-types":171,util:199}],423:[function(e,t,n){function r(e,t){function n(e){function t(e){return n||(a.check(e)?e.some(t):o.Node.check(e)&&(l.strictEqual(n,!1),n=r(e))),n}o.Node.assert(e);var n=!1;return s.eachField(e,function(e,n){t(n)}),n}function r(r){o.Node.assert(r);var l=i(r);return u.call(l,e)?l[e]:l[e]=u.call(p,r.type)?!1:u.call(t,r.type)?!0:n(r)}return r.onlyChildren=n,r}var l=e("assert"),i=e("private").makeAccessor(),s=e("ast-types"),a=s.builtInTypes.array,o=s.namedTypes,u=Object.prototype.hasOwnProperty,p={FunctionExpression:!0},c={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},d={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var f in d)u.call(d,f)&&(c[f]=d[f]);n.hasSideEffects=r("hasSideEffects",c),n.containsLeap=r("containsLeap",d)},{assert:173,"ast-types":171,"private":419}],424:[function(e,t,n){var r=(e("assert"),e("ast-types")),l=r.namedTypes,i=r.builders,s=Object.prototype.hasOwnProperty;n.defaults=function(e){for(var t,n=arguments.length,r=1;n>r;++r)if(t=arguments[r])for(var l in t)s.call(t,l)&&!s.call(e,l)&&(e[l]=t[l]);return e},n.runtimeProperty=function(e){return i.memberExpression(i.identifier("regeneratorRuntime"),i.identifier(e),!1)},n.isReference=function(e,t){var n=e.value;if(!l.Identifier.check(n))return!1;if(t&&n.name!==t)return!1;var r=e.parent.value;switch(r.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||r.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:r.params===e.parentPath&&r.params[e.name]===n?!1:!0;case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{assert:173,"ast-types":171}],425:[function(e,t,n){var r=(e("assert"),e("fs"),e("ast-types")),l=r.namedTypes,i=r.builders,s=(r.builtInTypes.array,r.builtInTypes.object,r.NodePath),a=e("./hoist").hoist,o=e("./emit").Emitter,u=e("./util").runtimeProperty;n.transform=function(e,t){t=t||{};var n=e instanceof s?e:new s(e);return p.visit(n,t),e=n.value,t.madeChanges=p.wasChangeReported(),e};var p=r.PathVisitor.fromMethodsObject({reset:function(e,t){this.options=t},visitFunction:function(e){this.traverse(e);var t=e.value,n=t.async&&!this.options.disableAsync;if(t.generator||n){this.reportChanged(),t.generator=!1,t.expression&&(t.expression=!1,t.body=i.blockStatement([i.returnStatement(t.body)])),n&&c.visit(e.get("body"));var r=t.id||(t.id=e.scope.parent.declareTemporary("callee$")),s=[],p=e.value.body;p.body=p.body.filter(function(e){return e&&null!=e._blockHoist?(s.push(e),!1):!0});var d=i.identifier(t.id.name+"$"),f=e.scope.declareTemporary("context$"),h=a(e),m=new o(f);m.explode(e.get("body")),h&&h.declarations.length>0&&s.push(h);var g=[m.getContextFunction(d),n?i.literal(null):r,i.thisExpression()],y=m.getTryLocsList();y&&g.push(y);var b=i.callExpression(u(n?"async":"wrap"),g);if(s.push(i.returnStatement(b)),t.body=i.blockStatement(s),t.body._declarations=p._declarations,n)return void(t.async=!1);if(!l.FunctionDeclaration.check(t))return l.FunctionExpression.assert(t),i.callExpression(u("mark"),[t]);for(var v=e.parent;v&&!l.BlockStatement.check(v.value)&&!l.Program.check(v.value);)v=v.parent;if(v){e.replace(),t.type="FunctionExpression";var x=i.variableDeclaration("var",[i.variableDeclarator(t.id,i.callExpression(u("mark"),[t]))]);t.comments&&(x.leadingComments=t.leadingComments,x.trailingComments=t.trailingComments,t.leadingComments=null,t.trailingComments=null),x._blockHoist=3;{var E=v.get("body");E.value.length}E.push(x)}}}}),c=r.PathVisitor.fromMethodsObject({visitFunction:function(){return!1},visitAwaitExpression:function(e){var t=e.value.argument;return e.value.all&&(t=i.callExpression(i.memberExpression(i.identifier("Promise"),i.identifier("all"),!1),[t])),i.yieldExpression(t,!1)}})},{"./emit":420,"./hoist":421,"./util":424,assert:173,"ast-types":171,fs:172}],426:[function(e,t){(function(n){function r(e,t){function n(e){l.push(e)}function r(){this.queue(compile(l.join(""),t).code),this.queue(null)}var l=[];return s(n,r)}function l(){e("./runtime")}{var i=(e("assert"),e("path")),s=(e("fs"),e("through")),a=e("./lib/visit").transform;e("./lib/util"),e("ast-types")}t.exports=r,r.runtime=l,l.path=i.join(n,"runtime.js"),r.transform=a}).call(this,"/node_modules/regenerator-babel")},{"./lib/util":424,"./lib/visit":425,"./runtime":428,assert:173,"ast-types":171,fs:172,path:182,through:427}],427:[function(e,t,n){(function(r){function l(e,t,n){function l(){for(;u.length&&!c.paused;){var e=u.shift();if(null===e)return c.emit("end");c.emit("data",e)}}function s(){c.writable=!1,t.call(c),!c.readable&&c.autoDestroy&&c.destroy()}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,u=[],p=!1,c=new i;return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(n&&n.autoDestroy===!1),c.write=function(t){return e.call(this,t),!c.paused},c.queue=c.push=function(e){return p?c:(null==e&&(p=!0),u.push(e),l(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&r.nextTick(function(){c.destroy()})}),c.end=function(e){return a?void 0:(a=!0,arguments.length&&c.write(e),s(),c)},c.destroy=function(){return o?void 0:(o=!0,a=!0,u.length=0,c.writable=c.readable=!1,c.emit("close"),c)},c.pause=function(){return c.paused?void 0:(c.paused=!0,c)},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),l(),c.paused||c.emit("drain"),c},c}var i=e("stream");n=t.exports=l,l.through=l}).call(this,e("_process"))},{_process:183,stream:195}],428:[function(e,t){(function(e){!function(e){"use strict";function n(e,t,n,r){return new s(e,t,n||null,r||[])}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(r){return{type:"throw",arg:r}}}function l(){}function i(){}function s(e,t,n,l){function i(t,l){if(o===v)throw new Error("Generator is already running");if(o===x)return c();for(;;){var i=a.delegate;if(i){var s=r(i.iterator[t],i.iterator,l);if("throw"===s.type){a.delegate=null,t="throw",l=s.arg;continue}t="next",l=d;var u=s.arg;if(!u.done)return o=b,u;a[i.resultName]=u.value,a.next=i.nextLoc,a.delegate=null}if("next"===t){if(o===y&&"undefined"!=typeof l)throw new TypeError("attempt to send "+JSON.stringify(l)+" to newborn generator");o===b?a.sent=l:delete a.sent}else if("throw"===t){if(o===y)throw o=x,l;a.dispatchException(l)&&(t="next",l=d)}else"return"===t&&a.abrupt("return",l);o=v;var s=r(e,n,a);if("normal"===s.type){o=a.done?x:b;var u={value:s.arg,done:a.done};if(s.arg!==E)return u;a.delegate&&"next"===t&&(l=d)}else"throw"===s.type&&(o=x,"next"===t?a.dispatchException(s.arg):l=s.arg)}}var s=t?Object.create(t.prototype):this,a=new u(l),o=y;return s.next=i.bind(s,"next"),s["throw"]=i.bind(s,"throw"),s["return"]=i.bind(s,"return"),s}function a(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function o(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function u(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(a,this),this.reset()}function p(e){if(e){var t=e[h];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function l(){for(;++n<e.length;)if(f.call(e,n))return l.value=e[n],l.done=!1,l;return l.value=d,l.done=!0,l};return r.next=r}}return{next:c}}function c(){return{value:d,done:!0}}var d,f=Object.prototype.hasOwnProperty,h="function"==typeof Symbol&&Symbol.iterator||"@@iterator",m="object"==typeof t,g=e.regeneratorRuntime;if(g)return void(m&&(t.exports=g));g=e.regeneratorRuntime=m?t.exports:{},g.wrap=n;var y="suspendedStart",b="suspendedYield",v="executing",x="completed",E={},_=i.prototype=s.prototype;l.prototype=_.constructor=i,i.constructor=l,l.displayName="GeneratorFunction",g.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===l||"GeneratorFunction"===(t.displayName||t.name):!1},g.mark=function(e){return e.__proto__=i,e.prototype=Object.create(_),e},g.async=function(e,t,l,i){return new Promise(function(s,a){function o(e){var t=r(this,null,e);if("throw"===t.type)return void a(t.arg);var n=t.arg;n.done?s(n.value):Promise.resolve(n.value).then(p,c)}var u=n(e,t,l,i),p=o.bind(u.next),c=o.bind(u["throw"]);p()})},_[h]=function(){return this},_.toString=function(){return"[object Generator]"},g.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},g.values=p,u.prototype={constructor:u,reset:function(){this.prev=0,this.next=0,this.sent=d,this.done=!1,this.delegate=null,this.tryEntries.forEach(o);for(var e,t=0;f.call(this,e="t"+t)||20>t;++t)this[e]=null},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return i.type="throw",i.arg=e,n.next=t,!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var l=this.tryEntries[r],i=l.completion;if("root"===l.tryLoc)return t("end");if(l.tryLoc<=this.prev){var s=f.call(l,"catchLoc"),a=f.call(l,"finallyLoc");if(s&&a){if(this.prev<l.catchLoc)return t(l.catchLoc,!0);if(this.prev<l.finallyLoc)return t(l.finallyLoc)}else if(s){if(this.prev<l.catchLoc)return t(l.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return t(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&f.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var l=r;break}}l&&("break"===e||"continue"===e)&&l.tryLoc<=t&&t<l.finallyLoc&&(l=null);var i=l?l.completion:{};return i.type=e,i.arg=t,l?this.next=l.finallyLoc:this.complete(i),E},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t),E},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t]; if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc)}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var l=r.arg;o(n)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:p(e),resultName:t,nextLoc:n},E}}}("object"==typeof e?e:"object"==typeof window?window:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],429:[function(e,t,n){var r=e("regenerate");n.REGULAR={d:r().addRange(48,57),D:r().addRange(0,47).addRange(58,65535),s:r(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:r().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:r(95).addRange(48,57).addRange(65,90).addRange(97,122),W:r(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},n.UNICODE={d:r().addRange(48,57),D:r().addRange(0,47).addRange(58,1114111),s:r(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:r().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:r(95).addRange(48,57).addRange(65,90).addRange(97,122),W:r(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},n.UNICODE_IGNORE_CASE={d:r().addRange(48,57),D:r().addRange(0,47).addRange(58,1114111),s:r(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:r().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:r(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:r(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:431}],430:[function(e,t){t.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],431:[function(t,n,r){(function(t){!function(l){var i="object"==typeof r&&r,s="object"==typeof n&&n&&n.exports==i&&n,a="object"==typeof t&&t;(a.global===a||a.window===a)&&(l=a);var o={rangeOrder:"A range’s `stop` value must be greater than or equal to the `start` value.",codePointRange:"Invalid code point value. Code points range from U+000000 to U+10FFFF."},u=55296,p=56319,c=56320,d=57343,f=/\\x00([^0123456789]|$)/g,h={},m=h.hasOwnProperty,g=function(e,t){var n;for(n in t)m.call(t,n)&&(e[n]=t[n]);return e},y=function(e,t){for(var n=-1,r=e.length;++n<r;)t(e[n],n)},b=h.toString,v=function(e){return"[object Array]"==b.call(e)},x=function(e){return"number"==typeof e||"[object Number]"==b.call(e)},E="0000",_=function(e,t){var n=String(e);return n.length<t?(E+n).slice(-t):n},S=function(e){return Number(e).toString(16).toUpperCase()},I=[].slice,w=function(e){for(var t,n=-1,r=e.length,l=r-1,i=[],s=!0,a=0;++n<r;)if(t=e[n],s)i.push(t),a=t,s=!1;else if(t==a+1){if(n!=l){a=t;continue}s=!0,i.push(t+1)}else i.push(a+1,t),a=t;return s||i.push(t+1),i},k=function(e,t){for(var n,r,l=0,i=e.length;i>l;){if(n=e[l],r=e[l+1],t>=n&&r>t)return t==n?r==n+1?(e.splice(l,2),e):(e[l]=t+1,e):t==r-1?(e[l+1]=t,e):(e.splice(l,2,n,t,t+1,r),e);l+=2}return e},A=function(e,t,n){if(t>n)throw Error(o.rangeOrder);for(var r,l,i=0;i<e.length;){if(r=e[i],l=e[i+1]-1,r>n)return e;if(r>=t&&n>=l)e.splice(i,2);else{if(t>=r&&l>n)return t==r?(e[i]=n+1,e[i+1]=l+1,e):(e.splice(i,2,r,t,n+1,l+1),e);if(t>=r&&l>=t)e[i+1]=t;else if(n>=r&&l>=n)return e[i]=n+1,e;i+=2}}return e},C=function(e,t){var n,r,l=0,i=null,s=e.length;if(0>t||t>1114111)throw RangeError(o.codePointRange);for(;s>l;){if(n=e[l],r=e[l+1],t>=n&&r>t)return e;if(t==n-1)return e[l]=t,e;if(n>t)return e.splice(null!=i?i+2:0,0,t,t+1),e;if(t==r)return t+1==e[l+2]?(e.splice(l,4,n,e[l+3]),e):(e[l+1]=t+1,e);i=l,l+=2}return e.push(t,t+1),e},T=function(e,t){for(var n,r,l=0,i=e.slice(),s=t.length;s>l;)n=t[l],r=t[l+1]-1,i=n==r?C(i,n):M(i,n,r),l+=2;return i},j=function(e,t){for(var n,r,l=0,i=e.slice(),s=t.length;s>l;)n=t[l],r=t[l+1]-1,i=n==r?k(i,n):A(i,n,r),l+=2;return i},M=function(e,t,n){if(t>n)throw Error(o.rangeOrder);if(0>t||t>1114111||0>n||n>1114111)throw RangeError(o.codePointRange);for(var r,l,i=0,s=!1,a=e.length;a>i;){if(r=e[i],l=e[i+1],s){if(r==n+1)return e.splice(i-1,2),e;if(r>n)return e;r>=t&&n>=r&&(l>t&&n>=l-1?(e.splice(i,2),i-=2):(e.splice(i-1,2),i-=2))}else{if(r==n+1)return e[i]=t,e;if(r>n)return e.splice(i,0,t,n+1),e;if(t>=r&&l>t&&l>=n+1)return e;t>=r&&l>t||l==t?(e[i+1]=n+1,s=!0):r>=t&&n+1>=l&&(e[i]=t,e[i+1]=n+1,s=!0)}i+=2}return s||e.push(t,n+1),e},P=function(e,t){var n=0,r=e.length,l=e[n],i=e[r-1];if(r>=2&&(l>t||t>i))return!1;for(;r>n;){if(l=e[n],i=e[n+1],t>=l&&i>t)return!0;n+=2}return!1},L=function(e,t){for(var n,r=0,l=t.length,i=[];l>r;)n=t[r],P(e,n)&&i.push(n),++r;return w(i)},O=function(e){return!e.length},D=function(e){return 2==e.length&&e[0]+1==e[1]},R=function(e){for(var t,n,r=0,l=[],i=e.length;i>r;){for(t=e[r],n=e[r+1];n>t;)l.push(t),++t;r+=2}return l},N=Math.floor,F=function(e){return parseInt(N((e-65536)/1024)+u,10)},B=function(e){return parseInt((e-65536)%1024+c,10)},$=String.fromCharCode,V=function(e){var t;return t=9==e?"\\t":10==e?"\\n":12==e?"\\f":13==e?"\\r":92==e?"\\\\":36==e||e>=40&&43>=e||45==e||46==e||63==e||e>=91&&94>=e||e>=123&&125>=e?"\\"+$(e):e>=32&&126>=e?$(e):255>=e?"\\x"+_(S(e),2):"\\u"+_(S(e),4)},U=function(e){var t,n=e.length,r=e.charCodeAt(0);return r>=u&&p>=r&&n>1?(t=e.charCodeAt(1),1024*(r-u)+t-c+65536):r},q=function(e){var t,n,r="",l=0,i=e.length;if(D(e))return V(e[0]);for(;i>l;)t=e[l],n=e[l+1]-1,r+=t==n?V(t):t+1==n?V(t)+V(n):V(t)+"-"+V(n),l+=2;return"["+r+"]"},G=function(e){for(var t,n,r=[],l=[],i=[],s=[],a=0,o=e.length;o>a;)t=e[a],n=e[a+1]-1,u>t?(u>n&&i.push(t,n+1),n>=u&&p>=n&&(i.push(t,u),r.push(u,n+1)),n>=c&&d>=n&&(i.push(t,u),r.push(u,p+1),l.push(c,n+1)),n>d&&(i.push(t,u),r.push(u,p+1),l.push(c,d+1),65535>=n?i.push(d+1,n+1):(i.push(d+1,65536),s.push(65536,n+1)))):t>=u&&p>=t?(n>=u&&p>=n&&r.push(t,n+1),n>=c&&d>=n&&(r.push(t,p+1),l.push(c,n+1)),n>d&&(r.push(t,p+1),l.push(c,d+1),65535>=n?i.push(d+1,n+1):(i.push(d+1,65536),s.push(65536,n+1)))):t>=c&&d>=t?(n>=c&&d>=n&&l.push(t,n+1),n>d&&(l.push(t,d+1),65535>=n?i.push(d+1,n+1):(i.push(d+1,65536),s.push(65536,n+1)))):t>d&&65535>=t?65535>=n?i.push(t,n+1):(i.push(t,65536),s.push(65536,n+1)):s.push(t,n+1),a+=2;return{loneHighSurrogates:r,loneLowSurrogates:l,bmp:i,astral:s}},W=function(e){for(var t,n,r,l,i,s,a=[],o=[],u=!1,p=-1,c=e.length;++p<c;)if(t=e[p],n=e[p+1]){for(r=t[0],l=t[1],i=n[0],s=n[1],o=l;i&&r[0]==i[0]&&r[1]==i[1];)o=D(s)?C(o,s[0]):M(o,s[0],s[1]-1),++p,t=e[p],r=t[0],l=t[1],n=e[p+1],i=n&&n[0],s=n&&n[1],u=!0;a.push([r,u?o:l]),u=!1}else a.push(t);return z(a)},z=function(e){if(1==e.length)return e;for(var t=-1,n=-1;++t<e.length;){var r=e[t],l=r[1],i=l[0],s=l[1];for(n=t;++n<e.length;){var a=e[n],o=a[1],u=o[0],p=o[1];i==u&&s==p&&(r[0]=D(a[0])?C(r[0],a[0][0]):M(r[0],a[0][0],a[0][1]-1),e.splice(n,1),--n)}}return e},H=function(e){if(!e.length)return[];for(var t,n,r,l,i,s,a=0,o=0,u=0,p=[],f=e.length;f>a;){t=e[a],n=e[a+1]-1,r=F(t),l=B(t),i=F(n),s=B(n);var h=l==c,m=s==d,g=!1;r==i||h&&m?(p.push([[r,i+1],[l,s+1]]),g=!0):p.push([[r,r+1],[l,d+1]]),!g&&i>r+1&&(m?(p.push([[r+1,i+1],[c,s+1]]),g=!0):p.push([[r+1,i],[c,d+1]])),g||p.push([[i,i+1],[c,s+1]]),o=r,u=i,a+=2}return W(p)},J=function(e){var t=[];return y(e,function(e){var n=e[0],r=e[1];t.push(q(n)+q(r))}),t.join("|")},X=function(e,t){var n=[],r=G(e),l=r.loneHighSurrogates,i=r.loneLowSurrogates,s=r.bmp,a=r.astral,o=(!O(r.astral),!O(l)),u=!O(i),p=H(a);return t&&(s=T(s,l),o=!1,s=T(s,i),u=!1),O(s)||n.push(q(s)),p.length&&n.push(J(p)),o&&n.push(q(l)+"(?![\\uDC00-\\uDFFF])"),u&&n.push("(?:[^\\uD800-\\uDBFF]|^)"+q(i)),n.join("|")},Y=function(e){return arguments.length>1&&(e=I.call(arguments)),this instanceof Y?(this.data=[],e?this.add(e):this):(new Y).add(e)};Y.version="1.2.0";var K=Y.prototype;g(K,{add:function(e){var t=this;return null==e?t:e instanceof Y?(t.data=T(t.data,e.data),t):(arguments.length>1&&(e=I.call(arguments)),v(e)?(y(e,function(e){t.add(e)}),t):(t.data=C(t.data,x(e)?e:U(e)),t))},remove:function(e){var t=this;return null==e?t:e instanceof Y?(t.data=j(t.data,e.data),t):(arguments.length>1&&(e=I.call(arguments)),v(e)?(y(e,function(e){t.remove(e)}),t):(t.data=k(t.data,x(e)?e:U(e)),t))},addRange:function(e,t){var n=this;return n.data=M(n.data,x(e)?e:U(e),x(t)?t:U(t)),n},removeRange:function(e,t){var n=this,r=x(e)?e:U(e),l=x(t)?t:U(t);return n.data=A(n.data,r,l),n},intersection:function(e){var t=this,n=e instanceof Y?R(e.data):e;return t.data=L(t.data,n),t},contains:function(e){return P(this.data,x(e)?e:U(e))},clone:function(){var e=new Y;return e.data=this.data.slice(0),e},toString:function(e){var t=X(this.data,e?e.bmpOnly:!1);return t.replace(f,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return R(this.data)}}),K.toArray=K.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return Y}):i&&!i.nodeType?s?s.exports=Y:i.regenerate=Y:l.regenerate=Y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],432:[function(t,n,r){(function(t){(function(){"use strict";function l(){var e,t,n=16384,r=[],l=-1,i=arguments.length;if(!i)return"";for(var s="";++l<i;){var a=Number(arguments[l]);if(!isFinite(a)||0>a||a>1114111||A(a)!=a)throw RangeError("Invalid code point: "+a);65535>=a?r.push(a):(a-=65536,e=(a>>10)+55296,t=a%1024+56320,r.push(e,t)),(l+1==i||r.length>n)&&(s+=k.apply(null,r),r.length=0)}return s}function i(e,t){if(-1==t.indexOf("|")){if(e==t)return;throw Error("Invalid node type: "+e)}if(t=i.hasOwnProperty(t)?i[t]:i[t]=RegExp("^(?:"+t+")$"),!t.test(e))throw Error("Invalid node type: "+e)}function s(e){var t=e.type;if(s.hasOwnProperty(t)&&"function"==typeof s[t])return s[t](e);throw Error("Invalid node type: "+t)}function a(e){i(e.type,"alternative");var t=e.body,n=t?t.length:0;if(1==n)return v(t[0]);for(var r=-1,l="";++r<n;)l+=v(t[r]);return l}function o(e){switch(i(e.type,"anchor"),e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function u(e){return i(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),s(e)}function p(e){i(e.type,"characterClass");var t=e.body,n=t?t.length:0,r=-1,l="[";for(e.negative&&(l+="^");++r<n;)l+=f(t[r]);return l+="]"}function c(e){return i(e.type,"characterClassEscape"),"\\"+e.value}function d(e){i(e.type,"characterClassRange");var t=e.min,n=e.max;if("characterClassRange"==t.type||"characterClassRange"==n.type)throw Error("Invalid character class range");return f(t)+"-"+f(n)}function f(e){return i(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),s(e)}function h(e){i(e.type,"disjunction");var t=e.body,n=t?t.length:0;if(0==n)throw Error("No body");if(1==n)return s(t[0]);for(var r=-1,l="";++r<n;)0!=r&&(l+="|"),l+=s(t[r]);return l}function m(e){return i(e.type,"dot"),"."}function g(e){i(e.type,"group");var t="(";switch(e.behavior){case"normal":break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var n=e.body,r=n?n.length:0;if(1==r)t+=s(n[0]);else for(var l=-1;++l<r;)t+=s(n[l]);return t+=")"}function y(e){i(e.type,"quantifier");var t="",n=e.min,r=e.max;switch(r){case void 0:case null:switch(n){case 0:t="*";break;case 1:t="+";break;default:t="{"+n+",}"}break;default:t=n==r?"{"+n+"}":0==n&&1==r?"?":"{"+n+","+r+"}"}return e.greedy||(t+="?"),u(e.body[0])+t}function b(e){return i(e.type,"reference"),"\\"+e.matchIndex}function v(e){return i(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),s(e)}function x(e){i(e.type,"value");var t=e.kind,n=e.codePoint;switch(t){case"controlLetter":return"\\c"+l(n+64);case"hexadecimalEscape":return"\\x"+("00"+n.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+l(n);case"null":return"\\"+n;case"octal":return"\\"+n.toString(8);case"singleEscape":switch(n){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+n)}case"symbol":return l(n);case"unicodeEscape":return"\\u"+("0000"+n.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+n.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var E={"function":!0,object:!0},_=E[typeof window]&&window||this,S=E[typeof r]&&r,I=E[typeof n]&&n&&!n.nodeType&&n,w=S&&I&&"object"==typeof t&&t;!w||w.global!==w&&w.window!==w&&w.self!==w||(_=w);var k=String.fromCharCode,A=Math.floor;s.alternative=a,s.anchor=o,s.characterClass=p,s.characterClassEscape=c,s.characterClassRange=d,s.disjunction=h,s.dot=m,s.group=g,s.quantifier=y,s.reference=b,s.value=x,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:s}}):S&&I?S.generate=s:_.regjsgen={generate:s}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],433:[function(e,t){!function(){function e(e,t){function n(t){return t.raw=e.substring(t.range[0],t.range[1]),t}function r(e,t){return e.range[0]=t,n(e)}function l(e,t){return n({type:"anchor",kind:e,range:[Y-t,Y]})}function i(e,t,r,l){return n({type:"value",kind:e,codePoint:t,range:[r,l]})}function s(e,t,n,r){return r=r||0,i(e,t,Y-(n.length+r),Y)}function a(e){var t=e[0],n=t.charCodeAt(0);if(X){var r;if(1===t.length&&n>=55296&&56319>=n&&(r=E().charCodeAt(0),r>=56320&&57343>=r))return Y++,i("symbol",1024*(n-55296)+r-56320+65536,Y-2,Y)}return i("symbol",n,Y-1,Y)}function o(e,t,r){return n({type:"disjunction",body:e,range:[t,r]})}function u(){return n({type:"dot",range:[Y-1,Y]})}function p(e){return n({type:"characterClassEscape",value:e,range:[Y-2,Y]})}function c(e){return n({type:"reference",matchIndex:parseInt(e,10),range:[Y-1-e.length,Y]})}function d(e,t,r,l){return n({type:"group",behavior:e,body:t,range:[r,l]})}function f(e,t,r,l){return null==l&&(r=Y-1,l=Y),n({type:"quantifier",min:e,max:t,greedy:!0,body:null,range:[r,l]})}function h(e,t,r){return n({type:"alternative",body:e,range:[t,r]})}function m(e,t,r,l){return n({type:"characterClass",body:e,negative:t,range:[r,l]})}function g(e,t,r,l){if(e.codePoint>t.codePoint)throw SyntaxError("invalid range in character class");return n({type:"characterClassRange",min:e,max:t,range:[r,l]})}function y(e){return"alternative"===e.type?e.body:[e]}function b(t){t=t||1;var n=e.substring(Y,Y+t);return Y+=t||1,n}function v(e){if(!x(e))throw SyntaxError("character: "+e)}function x(t){return e.indexOf(t,Y)===Y?b(t.length):void 0}function E(){return e[Y]}function _(t){return e.indexOf(t,Y)===Y}function S(t){return e[Y+1]===t}function I(t){var n=e.substring(Y),r=n.match(t);return r&&(r.range=[],r.range[0]=Y,b(r[0].length),r.range[1]=Y),r}function w(){var e=[],t=Y;for(e.push(k());x("|");)e.push(k());return 1===e.length?e[0]:o(e,t,Y)}function k(){for(var e,t=[],n=Y;e=A();)t.push(e);return 1===t.length?t[0]:h(t,n,Y)}function A(){if(Y>=e.length||_("|")||_(")"))return null;var t=T();if(t)return t;var n=M();if(!n)throw SyntaxError("Expected atom");var l=j()||!1;return l?(l.body=y(n),r(l,n.range[0]),l):n}function C(e,t,n,r){var l=null,i=Y;if(x(e))l=t;else{if(!x(n))return!1;l=r}var s=w();if(!s)throw SyntaxError("Expected disjunction");v(")");var a=d(l,y(s),i,Y);return"normal"==l&&J&&H++,a}function T(){return x("^")?l("start",1):x("$")?l("end",1):x("\\b")?l("boundary",2):x("\\B")?l("not-boundary",2):C("(?=","lookahead","(?!","negativeLookahead")}function j(){var e,t,n,r;if(x("*"))t=f(0);else if(x("+"))t=f(1);else if(x("?"))t=f(0,1);else if(e=I(/^\{([0-9]+)\}/))n=parseInt(e[1],10),t=f(n,n,e.range[0],e.range[1]);else if(e=I(/^\{([0-9]+),\}/))n=parseInt(e[1],10),t=f(n,void 0,e.range[0],e.range[1]);else if(e=I(/^\{([0-9]+),([0-9]+)\}/)){if(n=parseInt(e[1],10),r=parseInt(e[2],10),n>r)throw SyntaxError("numbers out of order in {} quantifier");t=f(n,r,e.range[0],e.range[1])}return t&&x("?")&&(t.greedy=!1,t.range[1]+=1),t}function M(){var e;if(e=I(/^[^^$\\.*+?(){[|]/))return a(e);if(x("."))return u();if(x("\\")){if(e=O(),!e)throw SyntaxError("atomEscape");return e}return(e=B())?e:C("(?:","ignore","(","normal")}function P(e){if(X){var t,r;if("unicodeEscape"==e.kind&&(t=e.codePoint)>=55296&&56319>=t&&_("\\")&&S("u")){var l=Y;Y++;var i=L();"unicodeEscape"==i.kind&&(r=i.codePoint)>=56320&&57343>=r?(e.range[1]=i.range[1],e.codePoint=1024*(t-55296)+r-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",n(e)):Y=l}}return e}function L(){return O(!0)}function O(e){var t;if(t=D())return t;if(e){if(x("b"))return s("singleEscape",8,"\\b");if(x("B"))throw SyntaxError("\\B not possible inside of CharacterClass")}return t=R()}function D(){var e,t;if(e=I(/^(?!0)\d+/)){t=e[0];var n=parseInt(e[0],10);return H>=n?c(e[0]):(z.push(n),b(-e[0].length),(e=I(/^[0-7]{1,3}/))?s("octal",parseInt(e[0],8),e[0],1):(e=a(I(/^[89]/)),r(e,e.range[0]-1)))}return(e=I(/^[0-7]{1,3}/))?(t=e[0],/^0{1,3}$/.test(t)?s("null",0,"0",t.length+1):s("octal",parseInt(t,8),t,1)):(e=I(/^[dDsSwW]/))?p(e[0]):!1}function R(){var e;if(e=I(/^[fnrtv]/)){var t=0;switch(e[0]){case"t":t=9;break;case"n":t=10;break;case"v":t=11;break;case"f":t=12;break;case"r":t=13}return s("singleEscape",t,"\\"+e[0])}return(e=I(/^c([a-zA-Z])/))?s("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=I(/^x([0-9a-fA-F]{2})/))?s("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=I(/^u([0-9a-fA-F]{4})/))?P(s("unicodeEscape",parseInt(e[1],16),e[1],2)):X&&(e=I(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):F()}function N(e){var t=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&t.test(String.fromCharCode(e))}function F(){var e,t="‌",n="‍";return N(E())?x(t)?s("identifier",8204,t):x(n)?s("identifier",8205,n):null:(e=b(),s("identifier",e.charCodeAt(0),e,1))}function B(){var e,t=Y;return(e=I(/^\[\^/))?(e=$(),v("]"),m(e,!0,t,Y)):x("[")?(e=$(),v("]"),m(e,!1,t,Y)):null}function $(){var e;if(_("]"))return[];if(e=U(),!e)throw SyntaxError("nonEmptyClassRanges");return e}function V(e){var t,n,r;if(_("-")&&!S("]")){if(v("-"),r=G(),!r)throw SyntaxError("classAtom");n=Y;var l=$();if(!l)throw SyntaxError("classRanges");return t=e.range[0],"empty"===l.type?[g(e,r,t,n)]:[g(e,r,t,n)].concat(l)}if(r=q(),!r)throw SyntaxError("nonEmptyClassRangesNoDash");return[e].concat(r)}function U(){var e=G();if(!e)throw SyntaxError("classAtom");return _("]")?[e]:V(e)}function q(){var e=G();if(!e)throw SyntaxError("classAtom");return _("]")?e:V(e)}function G(){return x("-")?a("-"):W()}function W(){var e;if(e=I(/^[^\\\]-]/))return a(e[0]);if(x("\\")){if(e=L(),!e)throw SyntaxError("classEscape");return P(e)}}var z=[],H=0,J=!0,X=-1!==(t||"").indexOf("u"),Y=0;e=String(e),""===e&&(e="(?:)");var K=w();if(K.range[1]!==e.length)throw SyntaxError("Could not parse entire input - got stuck: "+e);for(var Q=0;Q<z.length;Q++)if(z[Q]<=H)return Y=0,J=!1,w();return K}var n={parse:e};"undefined"!=typeof t&&t.exports?t.exports=n:window.regjsparser=n}()},{}],434:[function(e,t){function n(e){return _?E?h.UNICODE_IGNORE_CASE[e]:h.UNICODE[e]:h.REGULAR[e]}function r(e,t){return g.call(e,t)}function l(e,t){for(var n in t)e[n]=t[n]}function i(e,t){if(t){var n=c(t,"");switch(n.type){case"characterClass":case"group":case"value":break;default:n=s(n,t)}l(e,n)}}function s(e,t){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+t+")"}}function a(e){return r(f,e)?f[e]:!1}function o(e){{var t=d();e.body.forEach(function(e){switch(e.type){case"value":if(t.add(e.codePoint),E&&_){var r=a(e.codePoint);r&&t.add(r)}break;case"characterClassRange":var l=e.min.codePoint,i=e.max.codePoint;t.addRange(l,i),E&&_&&t.iuAddRange(l,i);break;case"characterClassEscape":t.add(n(e.value));break;default:throw Error("Unknown term type: "+e.type)}})}return e.negative&&(t=(_?y:b).clone().remove(t)),i(e,t.toString()),e}function u(e){switch(e.type){case"dot":i(e,(_?v:x).toString());break;case"characterClass":e=o(e);break;case"characterClassEscape":i(e,n(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(u);break;case"value":var t=e.codePoint,r=d(t);if(E&&_){var l=a(t);l&&r.add(l)}i(e,r.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var p=e("regjsgen").generate,c=e("regjsparser").parse,d=e("regenerate"),f=e("./data/iu-mappings.json"),h=e("./data/character-class-escape-sets.js"),m={},g=m.hasOwnProperty,y=d().addRange(0,1114111),b=d().addRange(0,65535),v=y.clone().remove(10,13,8232,8233),x=v.clone().intersection(b);d.prototype.iuAddRange=function(e,t){var n=this;do{var r=a(e);r&&n.add(r)}while(++e<=t);return n};var E=!1,_=!1;t.exports=function(e,t){var n=c(e,t);return E=t?t.indexOf("i")>-1:!1,_=t?t.indexOf("u")>-1:!1,l(n,u(n)),p(n)}},{"./data/character-class-escape-sets.js":429,"./data/iu-mappings.json":430,regenerate:431,regjsgen:432,regjsparser:433}],435:[function(e,t){"use strict";var n=e("is-finite");t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>t||!n(t))throw new TypeError("Expected a finite positive number");var r="";do 1&t&&(r+=e),e+=e;while(t>>=1);return r}},{"is-finite":436}],436:[function(e,t,n){arguments[4][304][0].apply(n,arguments)},{dup:304}],437:[function(e,t){"use strict";t.exports=/^#!.*/},{}],438:[function(e,t){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),n=/[^\x00-\x80]+/.test(e);return t||n?e:e.replace(/\\/g,"/")}},{}],439:[function(e,t,n){n.SourceMapGenerator=e("./source-map/source-map-generator").SourceMapGenerator,n.SourceMapConsumer=e("./source-map/source-map-consumer").SourceMapConsumer,n.SourceNode=e("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":445,"./source-map/source-map-generator":446,"./source-map/source-node":447}],440:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(){this._array=[],this._set={}}var r=e("./util");n.fromArray=function(e,t){for(var r=new n,l=0,i=e.length;i>l;l++)r.add(e[l],t);return r},n.prototype.add=function(e,t){var n=this.has(e),l=this._array.length;(!n||t)&&this._array.push(e),n||(this._set[r.toSetString(e)]=l)},n.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this._set,r.toSetString(e))},n.prototype.indexOf=function(e){if(this.has(e))return this._set[r.toSetString(e)];throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},n.prototype.toArray=function(){return this._array.slice()},t.ArraySet=n})},{"./util":448,amdefine:449}],441:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e){return 0>e?(-e<<1)+1:(e<<1)+0}function r(e){var t=1===(1&e),n=e>>1;return t?-n:n}var l=e("./base64"),i=5,s=1<<i,a=s-1,o=s;t.encode=function(e){var t,r="",s=n(e);do t=s&a,s>>>=i,s>0&&(t|=o),r+=l.encode(t);while(s>0);return r},t.decode=function(e,t,n){var s,u,p=e.length,c=0,d=0;do{if(t>=p)throw new Error("Expected more digits in base 64 VLQ value.");u=l.decode(e.charAt(t++)),s=!!(u&o),u&=a,c+=u<<d,d+=i}while(s);n.value=r(c),n.rest=t}})},{"./base64":442,amdefine:449}],442:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){var n={},r={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(e,t){n[e]=t,r[t]=e}),t.encode=function(e){if(e in r)return r[e];throw new TypeError("Must be between 0 and 63: "+e)},t.decode=function(e){if(e in n)return n[e];throw new TypeError("Not a valid base 64 digit: "+e)}})},{amdefine:449}],443:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e,r,l,i,s,a){var o=Math.floor((r-e)/2)+e,u=s(l,i[o],!0);return 0===u?o:u>0?r-o>1?n(o,r,l,i,s,a):a==t.LEAST_UPPER_BOUND?r<i.length?r:-1:o:o-e>1?n(e,o,l,i,s,a):a==t.LEAST_UPPER_BOUND?o:0>e?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,r,l,i){return 0===r.length?-1:n(-1,r.length,e,r,l,i||t.GREATEST_LOWER_BOUND)}})},{amdefine:449}],444:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e,t){var n=e.generatedLine,r=t.generatedLine,i=e.generatedColumn,s=t.generatedColumn;return r>n||r==n&&s>=i||l.compareByGeneratedPositions(e,t)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var l=e("./util");r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(l.compareByGeneratedPositions),this._sorted=!0),this._array},t.MappingList=r})},{"./util":448,amdefine:449}],445:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new l(t):new r(t)}function r(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=i.getArg(t,"version"),r=i.getArg(t,"sources"),l=i.getArg(t,"names",[]),s=i.getArg(t,"sourceRoot",null),o=i.getArg(t,"sourcesContent",null),u=i.getArg(t,"mappings"),p=i.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(i.normalize),this._names=a.fromArray(l,!0),this._sources=a.fromArray(r,!0),this.sourceRoot=s,this.sourcesContent=o,this._mappings=u,this.file=p}function l(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=i.getArg(t,"version"),l=i.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);var s={line:-1,column:0};this._sections=l.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=i.getArg(e,"offset"),r=i.getArg(t,"line"),l=i.getArg(t,"column");if(r<s.line||r===s.line&&l<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=t,{generatedOffset:{generatedLine:r+1,generatedColumn:l+1},consumer:new n(i.getArg(e,"map"))}})}var i=e("./util"),s=e("./binary-search"),a=e("./array-set").ArraySet,o=e("./base64-vlq");n.fromSourceMap=function(e){return r.fromSourceMap(e)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{get:function(){return this.__originalMappings||(this.__generatedMappings=[],this.__originalMappings=[],this._parseMappings(this._mappings,this.sourceRoot)),this.__originalMappings}}),n.prototype._nextCharIsMappingSeparator=function(e,t){var n=e.charAt(t);return";"===n||","===n},n.prototype._parseMappings=function(){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(e,t,r){var l,s=t||null,a=r||n.GENERATED_ORDER;switch(a){case n.GENERATED_ORDER:l=this._generatedMappings;break;case n.ORIGINAL_ORDER:l=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;l.map(function(e){var t=e.source;return null!=t&&null!=o&&(t=i.join(o,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name}}).forEach(e,s)},n.prototype.allGeneratedPositionsFor=function(e){var t={source:i.getArg(e,"source"),originalLine:i.getArg(e,"line"),originalColumn:0};null!=this.sourceRoot&&(t.source=i.relative(this.sourceRoot,t.source));var n=[],r=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,s.LEAST_UPPER_BOUND);if(r>=0)for(var l=this._originalMappings[r];l&&l.originalLine===t.originalLine;)n.push({line:i.getArg(l,"generatedLine",null),column:i.getArg(l,"generatedColumn",null),lastColumn:i.getArg(l,"lastGeneratedColumn",null)}),l=this._originalMappings[++r]; return n},t.SourceMapConsumer=n,r.prototype=Object.create(n.prototype),r.prototype.consumer=n,r.fromSourceMap=function(e){var t=Object.create(r.prototype);return t._names=a.fromArray(e._names.toArray(),!0),t._sources=a.fromArray(e._sources.toArray(),!0),t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file,t.__generatedMappings=e._mappings.toArray().slice(),t.__originalMappings=e._mappings.toArray().slice().sort(i.compareByOriginalPositions),t},r.prototype._version=3,Object.defineProperty(r.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?i.join(this.sourceRoot,e):e},this)}}),r.prototype._parseMappings=function(e){for(var t,n,r,l,s=1,a=0,u=0,p=0,c=0,d=0,f=e.length,h=0,m={},g={};f>h;)if(";"===e.charAt(h))s++,++h,a=0;else if(","===e.charAt(h))++h;else{for(t={},t.generatedLine=s,l=h;f>l&&!this._nextCharIsMappingSeparator(e,l);++l);if(n=e.slice(h,l),r=m[n])h+=n.length;else{for(r=[];l>h;)o.decode(e,h,g),value=g.value,h=g.rest,r.push(value);m[n]=r}if(t.generatedColumn=a+r[0],a=t.generatedColumn,r.length>1){if(t.source=this._sources.at(c+r[1]),c+=r[1],2===r.length)throw new Error("Found a source, but no line and column");if(t.originalLine=u+r[2],u=t.originalLine,t.originalLine+=1,3===r.length)throw new Error("Found a source and line, but no column");t.originalColumn=p+r[3],p=t.originalColumn,r.length>4&&(t.name=this._names.at(d+r[4]),d+=r[4])}this.__generatedMappings.push(t),"number"==typeof t.originalLine&&this.__originalMappings.push(t)}this.__generatedMappings.sort(i.compareByGeneratedPositions),this.__originalMappings.sort(i.compareByOriginalPositions)},r.prototype._findMapping=function(e,t,n,r,l,i){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return s.search(e,t,l,i)},r.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},r.prototype.originalPositionFor=function(e){var t={generatedLine:i.getArg(e,"line"),generatedColumn:i.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",i.compareByGeneratedPositions,i.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var l=this._generatedMappings[r];if(l.generatedLine===t.generatedLine){var s=i.getArg(l,"source",null);return null!=s&&null!=this.sourceRoot&&(s=i.join(this.sourceRoot,s)),{source:s,line:i.getArg(l,"originalLine",null),column:i.getArg(l,"originalColumn",null),name:i.getArg(l,"name",null)}}}return{source:null,line:null,column:null,name:null}},r.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=i.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=i.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},r.prototype.generatedPositionFor=function(e){var t={source:i.getArg(e,"source"),originalLine:i.getArg(e,"line"),originalColumn:i.getArg(e,"column")};null!=this.sourceRoot&&(t.source=i.relative(this.sourceRoot,t.source));var r=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var l=this._originalMappings[r];return{line:i.getArg(l,"generatedLine",null),column:i.getArg(l,"generatedColumn",null),lastColumn:i.getArg(l,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},t.BasicSourceMapConsumer=r,l.prototype=Object.create(n.prototype),l.prototype.constructor=n,l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),l.prototype.originalPositionFor=function(e){var t={generatedLine:i.getArg(e,"line"),generatedColumn:i.getArg(e,"column")},n=s.search(t,this._sections,function(e,t){var n=e.generatedLine-t.generatedOffset.generatedLine;return n?n:e.generatedColumn-t.generatedOffset.generatedColumn}),r=this._sections[n];return r?r.consumer.originalPositionFor({line:t.generatedLine-(r.generatedOffset.generatedLine-1),column:t.generatedColumn-(r.generatedOffset.generatedLine===t.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},l.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n],l=r.consumer.sourceContentFor(e,!0);if(l)return l}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var n=this._sections[t];if(-1!==n.consumer.sources.indexOf(i.getArg(e,"source"))){var r=n.consumer.generatedPositionFor(e);if(r){var l={line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)};return l}}}return{line:null,column:null}},l.prototype._parseMappings=function(){this.__generatedMappings=[],this.__originalMappings=[];for(var e=0;e<this._sections.length;e++)for(var t=this._sections[e],n=t.consumer._generatedMappings,r=0;r<n.length;r++){var l=n[e],s=l.source,a=t.consumer.sourceRoot;null!=s&&null!=a&&(s=i.join(a,s));var o={source:s,generatedLine:l.generatedLine+(t.generatedOffset.generatedLine-1),generatedColumn:l.column+(t.generatedOffset.generatedLine===l.generatedLine)?t.generatedOffset.generatedColumn-1:0,originalLine:l.originalLine,originalColumn:l.originalColumn,name:l.name};this.__generatedMappings.push(o),"number"==typeof o.originalLine&&this.__originalMappings.push(o)}this.__generatedMappings.sort(i.compareByGeneratedPositions),this.__originalMappings.sort(i.compareByOriginalPositions)},t.IndexedSourceMapConsumer=l})},{"./array-set":440,"./base64-vlq":441,"./binary-search":443,"./util":448,amdefine:449}],446:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e){e||(e={}),this._file=l.getArg(e,"file",null),this._sourceRoot=l.getArg(e,"sourceRoot",null),this._skipValidation=l.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}var r=e("./base64-vlq"),l=e("./util"),i=e("./array-set").ArraySet,s=e("./mapping-list").MappingList;n.prototype._version=3,n.fromSourceMap=function(e){var t=e.sourceRoot,r=new n({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=l.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)}),e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&r.setSourceContent(t,n)}),r},n.prototype.addMapping=function(e){var t=l.getArg(e,"generated"),n=l.getArg(e,"original",null),r=l.getArg(e,"source",null),i=l.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,i),null==r||this._sources.has(r)||this._sources.add(r),null==i||this._names.has(i)||this._names.add(i),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:r,name:i})},n.prototype.setSourceContent=function(e,t){var n=e;null!=this._sourceRoot&&(n=l.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[l.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[l.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,t,n){var r=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}var s=this._sourceRoot;null!=s&&(r=l.relative(s,r));var a=new i,o=new i;this._mappings.unsortedForEach(function(t){if(t.source===r&&null!=t.originalLine){var i=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=i.source&&(t.source=i.source,null!=n&&(t.source=l.join(n,t.source)),null!=s&&(t.source=l.relative(s,t.source)),t.originalLine=i.line,t.originalColumn=i.column,null!=i.name&&(t.name=i.name))}var u=t.source;null==u||a.has(u)||a.add(u);var p=t.name;null==p||o.has(p)||o.add(p)},this),this._sources=a,this._names=o,e.sources.forEach(function(t){var r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=l.join(n,t)),null!=s&&(t=l.relative(s,t)),this.setSourceContent(t,r))},this)},n.prototype._validateMapping=function(e,t,n,r){if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!r||e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},n.prototype._serializeMappings=function(){for(var e,t=0,n=1,i=0,s=0,a=0,o=0,u="",p=this._mappings.toArray(),c=0,d=p.length;d>c;c++){if(e=p[c],e.generatedLine!==n)for(t=0;e.generatedLine!==n;)u+=";",n++;else if(c>0){if(!l.compareByGeneratedPositions(e,p[c-1]))continue;u+=","}u+=r.encode(e.generatedColumn-t),t=e.generatedColumn,null!=e.source&&(u+=r.encode(this._sources.indexOf(e.source)-o),o=this._sources.indexOf(e.source),u+=r.encode(e.originalLine-1-s),s=e.originalLine-1,u+=r.encode(e.originalColumn-i),i=e.originalColumn,null!=e.name&&(u+=r.encode(this._names.indexOf(e.name)-a),a=this._names.indexOf(e.name)))}return u},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=l.relative(t,e));var n=l.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=n})},{"./array-set":440,"./base64-vlq":441,"./mapping-list":444,"./util":448,amdefine:449}],447:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e,t,n,r,l){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==l?null:l,this[a]=!0,null!=r&&this.add(r)}var r=e("./source-map-generator").SourceMapGenerator,l=e("./util"),i=/(\r?\n)/,s=10,a="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function s(e,t){if(null===e||void 0===e.source)a.add(t);else{var i=r?l.join(r,e.source):e.source;a.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var a=new n,o=e.split(i),u=function(){var e=o.shift(),t=o.shift()||"";return e+t},p=1,c=0,d=null;return t.eachMapping(function(e){if(null!==d){if(!(p<e.generatedLine)){var t=o[0],n=t.substr(0,e.generatedColumn-c);return o[0]=t.substr(e.generatedColumn-c),c=e.generatedColumn,s(d,n),void(d=e)}var n="";s(d,u()),p++,c=0}for(;p<e.generatedLine;)a.add(u()),p++;if(c<e.generatedColumn){var t=o[0];a.add(t.substr(0,e.generatedColumn)),o[0]=t.substr(e.generatedColumn),c=e.generatedColumn}d=e},this),o.length>0&&(d&&s(d,u()),a.add(o.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=l.join(r,e)),a.setSourceContent(e,n))}),a},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,n=0,r=this.children.length;r>n;n++)t=this.children[n],t[a]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;r-1>n;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[a]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[l.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,n=this.children.length;n>t;t++)this.children[t][a]&&this.children[t].walkSourceContents(e);for(var r=Object.keys(this.sourceContents),t=0,n=r.length;n>t;t++)e(l.fromSetString(r[t]),this.sourceContents[r[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},n=new r(e),l=!1,i=null,a=null,o=null,u=null;return this.walk(function(e,r){t.code+=e,null!==r.source&&null!==r.line&&null!==r.column?((i!==r.source||a!==r.line||o!==r.column||u!==r.name)&&n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name}),i=r.source,a=r.line,o=r.column,u=r.name,l=!0):l&&(n.addMapping({generated:{line:t.line,column:t.column}}),i=null,l=!1);for(var p=0,c=e.length;c>p;p++)e.charCodeAt(p)===s?(t.line++,t.column=0,p+1===c?(i=null,l=!1):l&&n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name})):t.column++}),this.walkSourceContents(function(e,t){n.setSourceContent(e,t)}),{code:t.code,map:n}},t.SourceNode=n})},{"./source-map-generator":446,"./util":448,amdefine:449}],448:[function(e,t){if("function"!=typeof n)var n=e("amdefine")(t,e);n(function(e,t){function n(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')}function r(e){var t=e.match(f);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function l(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function i(e){var t=e,n=r(e);if(n){if(!n.path)return e;t=n.path}for(var i,s="/"===t.charAt(0),a=t.split(/\/+/),o=0,u=a.length-1;u>=0;u--)i=a[u],"."===i?a.splice(u,1):".."===i?o++:o>0&&(""===i?(a.splice(u+1,o),o=0):(a.splice(u,2),o--));return t=a.join("/"),""===t&&(t=s?"/":"."),n?(n.path=t,l(n)):t}function s(e,t){""===e&&(e="."),""===t&&(t=".");var n=r(t),s=r(e);if(s&&(e=s.path||"/"),n&&!n.scheme)return s&&(n.scheme=s.scheme),l(n);if(n||t.match(h))return t;if(s&&!s.host&&!s.path)return s.host=t,l(s);var a="/"===t.charAt(0)?t:i(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=a,l(s)):a}function a(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");var n=r(e);return"/"==t.charAt(0)&&n&&"/"==n.path?t.slice(1):0===t.indexOf(e+"/")?t.substr(e.length+1):t}function o(e){return"$"+e}function u(e){return e.substr(1)}function p(e,t){var n=e||"",r=t||"";return(n>r)-(r>n)}function c(e,t,n){var r;return(r=p(e.source,t.source))?r:(r=e.originalLine-t.originalLine)?r:(r=e.originalColumn-t.originalColumn,r||n?r:(r=p(e.name,t.name))?r:(r=e.generatedLine-t.generatedLine,r?r:e.generatedColumn-t.generatedColumn))}function d(e,t,n){var r;return(r=e.generatedLine-t.generatedLine)?r:(r=e.generatedColumn-t.generatedColumn,r||n?r:(r=p(e.source,t.source))?r:(r=e.originalLine-t.originalLine)?r:(r=e.originalColumn-t.originalColumn,r?r:p(e.name,t.name)))}t.getArg=n;var f=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,h=/^data:.+\,.+$/;t.urlParse=r,t.urlGenerate=l,t.normalize=i,t.join=s,t.relative=a,t.toSetString=o,t.fromSetString=u,t.compareByOriginalPositions=c,t.compareByGeneratedPositions=d})},{amdefine:449}],449:[function(e,t){(function(n,r){"use strict";function l(t,l){function i(e){var t,n;for(t=0;e[t];t+=1)if(n=e[t],"."===n)e.splice(t,1),t-=1;else if(".."===n){if(1===t&&(".."===e[2]||".."===e[0]))break;t>0&&(e.splice(t-1,2),t-=2)}}function s(e,t){var n;return e&&"."===e.charAt(0)&&t&&(n=t.split("/"),n=n.slice(0,n.length-1),n=n.concat(e.split("/")),i(n),e=n.join("/")),e}function a(e){return function(t){return s(t,e)}}function o(e){function t(t){h[e]=t}return t.fromText=function(){throw new Error("amdefine does not implement load.fromText")},t}function u(e,n,i){var s,a,o,u;if(e)a=h[e]={},o={id:e,uri:r,exports:a},s=c(l,a,o,e);else{if(m)throw new Error("amdefine with no module ID cannot be called more than once per file.");m=!0,a=t.exports,o=t,s=c(l,a,o,t.id)}n&&(n=n.map(function(e){return s(e)})),u="function"==typeof i?i.apply(o.exports,n):i,void 0!==u&&(o.exports=u,e&&(h[e]=o.exports))}function p(e,t,n){Array.isArray(e)?(n=t,t=e,e=void 0):"string"!=typeof e&&(n=e,e=t=void 0),t&&!Array.isArray(t)&&(n=t,t=void 0),t||(t=["require","exports","module"]),e?f[e]=[e,t,n]:u(e,t,n)}var c,d,f={},h={},m=!1,g=e("path");return c=function(e,t,r,l){function i(i,s){return"string"==typeof i?d(e,t,r,i,l):(i=i.map(function(n){return d(e,t,r,n,l)}),void n.nextTick(function(){s.apply(null,i)}))}return i.toUrl=function(e){return 0===e.indexOf(".")?s(e,g.dirname(r.filename)):e},i},l=l||function(){return t.require.apply(t,arguments)},d=function(e,t,n,r,l){var i,p,m=r.indexOf("!"),g=r;if(-1===m){if(r=s(r,l),"require"===r)return c(e,t,n,l);if("exports"===r)return t;if("module"===r)return n;if(h.hasOwnProperty(r))return h[r];if(f[r])return u.apply(null,f[r]),h[r];if(e)return e(g);throw new Error("No module with ID: "+r)}return i=r.substring(0,m),r=r.substring(m+1,r.length),p=d(e,t,n,i,l),r=p.normalize?p.normalize(r,a(l)):s(r,l),h[r]?h[r]:(p.load(r,c(e,t,n,l),o(r),{}),h[r])},p.require=function(e){return h[e]?h[e]:f[e]?(u.apply(null,f[e]),h[e]):void 0},p.amd={},p}t.exports=l}).call(this,e("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:183,path:182}],450:[function(e,t,n){"use strict";t.exports=function r(e){function t(){}t.prototype=e,new t}},{}],451:[function(e,t){"use strict";t.exports=function(e){return e.replace(/[\s\uFEFF\xA0]+$/g,"")}},{}],452:[function(e,t){t.exports={name:"babel-core",description:"Turn ES6 code into readable vanilla ES5 with source maps",version:"5.0.3",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",repository:"babel/babel",main:"lib/babel/api/node.js",browser:{"./lib/babel/api/register/node.js":"./lib/babel/api/register/browser.js"},keywords:["harmony","classes","modules","let","const","var","es6","transpile","transpiler","6to5","babel"],scripts:{bench:"make bench",test:"make test"},dependencies:{"ast-types":"~0.7.0",chalk:"^1.0.0","convert-source-map":"^0.5.0","core-js":"^0.8.0",debug:"^2.1.1","detect-indent":"^3.0.0",estraverse:"^1.9.1",esutils:"^1.1.6","fs-readdir-recursive":"^0.1.0",globals:"^6.2.0","is-integer":"^1.0.4","js-tokens":"1.0.0",leven:"^1.0.1","line-numbers":"0.2.0",lodash:"^3.2.0",minimatch:"^2.0.3","output-file-sync":"^1.1.0","path-is-absolute":"^1.0.0","private":"^0.1.6","regenerator-babel":"0.8.13-2",regexpu:"^1.1.2",repeating:"^1.1.2","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.4.0","source-map-support":"^0.2.9","to-fast-properties":"^1.0.0","trim-right":"^1.0.0"},devDependencies:{babel:"4.7.13",browserify:"^9.0.3",chai:"^2.0.0",eslint:"^0.15.1","babel-eslint":"^1.0.1",esvalid:"^1.1.0",istanbul:"^0.3.5",matcha:"^0.6.0",mocha:"^2.1.0",rimraf:"^2.2.8","uglify-js":"^2.4.16"}}},{}],453:[function(e,t){t.exports={"abstract-expression-call":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"PROPERTY",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"referenceGet",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"abstract-expression-delete":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"PROPERTY",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"referenceDelete",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"abstract-expression-get":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"PROPERTY",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"referenceGet",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"abstract-expression-set":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"PROPERTY",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"referenceSet",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"array-comprehension-container":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},init:{start:null,loc:null,range:null,elements:[],type:"ArrayExpression",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"array-from":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"from",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"array-push":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"push",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"STATEMENT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"call-instance-decorator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,type:"ThisExpression",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"INITIALIZERS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null}],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"call-static-decorator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"CONSTRUCTOR",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"INITIALIZERS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"CONSTRUCTOR",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},call:{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"CONTEXT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"class-decorator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"CLASS_REF",type:"Identifier",end:null},right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"DECORATOR",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"CLASS_REF",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},operator:"||",right:{start:null,loc:null,range:null,name:"CLASS_REF",type:"Identifier",end:null},type:"LogicalExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"class-super-constructor-call-loose":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"SUPER_NAME",type:"Identifier",end:null},operator:"!=",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"SUPER_NAME",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"apply",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null},{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"Program",end:null},"class-super-constructor-call":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"SUPER_NAME",type:"Identifier",end:null},operator:"!=",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"SUPER_NAME",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"apply",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null},{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"Program",end:null},"corejs-is-iterator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"CORE_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isIterable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"corejs-iterator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"CORE_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getIterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"default-parameter":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"VARIABLE_NAME",type:"Identifier",end:null},init:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARGUMENTS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"ARGUMENT_KEY",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,name:"DEFAULT_VALUE",type:"Identifier",end:null},alternate:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARGUMENTS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"ARGUMENT_KEY",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"ConditionalExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"let",type:"VariableDeclaration",end:null}],type:"Program",end:null},"exports-assign":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"exports-default-assign":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"module",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"VALUE",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"exports-from-assign":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"ID",type:"Identifier",end:null},{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"get",type:"Identifier",end:null},value:{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"get",type:"Identifier",end:null},generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"INIT",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"exports-module-declaration-loose":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"__esModule",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"exports-module-declaration":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},{start:null,loc:null,range:null,value:"__esModule",raw:null,type:"Literal",end:null},{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"for-of-array":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARR",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,name:"BODY",type:"Identifier",end:null},type:"ExpressionStatement",end:null,_paths:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"Program",end:null},"for-of-loose":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},init:{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"IS_ARRAY",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isArray",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},init:{loc:null,start:null,range:null,test:{start:null,loc:null,range:null,name:"IS_ARRAY",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},alternate:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ConditionalExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:null,update:null,body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ID",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"IS_ARRAY",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},operator:">=",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"BreakStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ID",type:"Identifier",end:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},property:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"LOOP_OBJECT",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"next",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"done",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"BreakStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ID",type:"Identifier",end:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"INDEX",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"Program",end:null},"for-of":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ITERATOR_COMPLETION",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:!1,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",type:"Identifier",end:null},init:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,block:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ITERATOR_KEY",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"OBJECT",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"STEP_KEY",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ITERATOR_COMPLETION",type:"Identifier",end:null},right:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"STEP_KEY",type:"Identifier",end:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ITERATOR_KEY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"next",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,parenthesizedExpression:!0,_paths:null},property:{start:null,loc:null,range:null,name:"done",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,parenthesizedExpression:!0,_paths:null},type:"UnaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ITERATOR_COMPLETION",type:"Identifier",end:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},handler:{start:null,loc:null,range:null,param:{start:null,loc:null,range:null,name:"err",type:"Identifier",end:null},guard:null,body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",type:"Identifier",end:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",type:"Identifier",end:null},right:{start:null,loc:null,range:null,name:"err",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"CatchClause",end:null,_scopeInfo:null,_paths:null},guardedHandlers:[],finalizer:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,block:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{start:null,loc:null,range:null,name:"ITERATOR_COMPLETION",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ITERATOR_KEY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"return",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ITERATOR_KEY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"return",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},handler:null,guardedHandlers:[],finalizer:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"ITERATOR_HAD_ERROR_KEY",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"ITERATOR_ERROR_KEY",type:"Identifier",end:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"TryStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"TryStatement",end:null,_paths:null}],type:"Program",end:null},"helper-async-to-generator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"fn",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"gen",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"fn",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"apply",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null},{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"Promise",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"resolve",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"reject",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"callNext",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"step",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"bind",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},{start:null,loc:null,range:null,value:"next",raw:null,type:"Literal",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"callThrow",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"step",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"bind",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},{start:null,loc:null,range:null,value:"throw",raw:null,type:"Literal",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"step",type:"Identifier",end:null},generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"arg",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,block:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"info",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"gen",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arg",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"info",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null}],type:"BlockStatement",end:null,_scopeInfo:null},handler:{start:null,loc:null,range:null,param:{start:null,loc:null,range:null,name:"error",type:"Identifier",end:null},guard:null,body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"reject",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"error",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:null,type:"ReturnStatement",end:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"CatchClause",end:null,_scopeInfo:null,_paths:null},guardedHandlers:[],finalizer:null,type:"TryStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"info",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"done",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"resolve",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Promise",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"resolve",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"then",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"callNext",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"callThrow",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"callNext",type:"Identifier",end:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null}],type:"NewExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-bind":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Function",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"bind",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-class-call-check":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"instance",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"instance",type:"Identifier",end:null},operator:"instanceof",right:{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},type:"BinaryExpression",end:null,parenthesizedExpression:!0,_paths:null},type:"UnaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,value:"Cannot call a class as a function",raw:null,type:"Literal",end:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-create-class":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"||",right:{start:null,loc:null,range:null,value:!1,raw:null,type:"Literal",end:null},type:"LogicalExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"configurable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"writable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-create-decorated-class":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"descriptors",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"initializers",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptors",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptors",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,operator:"delete",prefix:!0,argument:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"UnaryExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,leadingComments:null,_paths:null},{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,operator:"delete",prefix:!0,argument:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"UnaryExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"||",right:{start:null,loc:null,range:null,value:!1,raw:null,type:"Literal",end:null},type:"LogicalExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"configurable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,value:"value",raw:null,type:"Literal",end:null},operator:"in",right:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"||",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"initializer",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"writable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"f",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"f",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"f",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"decorator",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"decorators",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"f",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"decorator",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"function",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"decorator",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},operator:"||",right:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},type:"LogicalExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,value:"The decorator for method ",raw:null,type:"Literal",end:null},operator:"+",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},operator:"+",right:{start:null,loc:null,range:null,value:" is of the invalid type ",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"+",right:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"decorator",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"initializers",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"initializers",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"initializer",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"descriptor",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"protoInitializers",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticInitializers",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},{start:null,loc:null,range:null,name:"protoProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"protoInitializers",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"staticInitializers",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"Constructor",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-default-props":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"defaultProps",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"defaultProps",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,left:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"propName",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},right:{start:null,loc:null,range:null,name:"defaultProps",type:"Identifier",end:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"propName",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"undefined",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"propName",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"defaultProps",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"propName",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForInStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"props",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-defaults":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"defaults",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"keys",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getOwnPropertyNames",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"defaults",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"keys",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"keys",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getOwnPropertyDescriptor",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"defaults",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"configurable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-define-property":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},value:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},value:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},operator:"==",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"||",right:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"==",right:{start:null,loc:null,range:null,value:"undefined",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},operator:"||",right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"constructor",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"!==",right:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"configurable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"writable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-extends":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"assign",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"||",right:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:1,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"source",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,left:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},right:{start:null,loc:null,range:null,name:"source",type:"Identifier",end:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"hasOwnProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"source",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"source",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"key",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForInStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-get":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"get",type:"Identifier",end:null},generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getOwnPropertyDescriptor",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},operator:"===",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getPrototypeOf",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},operator:"===",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"get",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,value:"value",raw:null,type:"Literal",end:null},operator:"in",right:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"getter",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"get",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"getter",type:"Identifier",end:null},operator:"===",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"getter",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-has-own":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"hasOwnProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-inherits":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"subClass",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"!==",right:{start:null,loc:null,range:null,value:"function",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},operator:"!==",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,value:"Super expression must either be null or a function, not ",raw:null,type:"Literal",end:null},operator:"+",right:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"subClass",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"create",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"constructor",type:"Identifier",end:null},value:{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},value:{start:null,loc:null,range:null,name:"subClass",type:"Identifier",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"enumerable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!1,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"writable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"configurable",type:"Identifier",end:null},value:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null}],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"subClass",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"__proto__",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"superClass",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-interop-require-wildcard":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"__esModule",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},alternate:{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,value:"default",raw:null,type:"Literal",end:null},value:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null},type:"ConditionalExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-interop-require":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"__esModule",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"default",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},alternate:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},type:"ConditionalExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-object-destructuring-empty":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},operator:"==",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,value:"Cannot destructure undefined",raw:null,type:"Literal",end:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-object-without-properties":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"keys",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},init:{start:null,loc:null,range:null,properties:[],type:"ObjectExpression",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,left:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},right:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"keys",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"indexOf",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},operator:">=",right:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"ContinueStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"hasOwnProperty",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"UnaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"ContinueStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForInStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"target",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-self-global":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"global",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"undefined",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,name:"self",type:"Identifier",end:null},alternate:{start:null,loc:null,range:null,name:"global",type:"Identifier",end:null},type:"ConditionalExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-set":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"set",type:"Identifier",end:null},generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getOwnPropertyDescriptor",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},operator:"===",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"getPrototypeOf",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"object",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},operator:"!==",right:{start:null,loc:null,range:null,value:null,raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"set",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"parent",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"property",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,value:"value",raw:null,type:"Literal",end:null},operator:"in",right:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"writable",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"setter",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"desc",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"set",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"setter",type:"Identifier",end:null},operator:"!==",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"setter",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"call",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"receiver",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-slice":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"slice",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-sliced-to-array-loose":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isArray",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"in",right:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},init:{start:null,loc:null,range:null,elements:[],type:"ArrayExpression",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_iterator",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_step",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_step",type:"Identifier",end:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_iterator",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"next",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,parenthesizedExpression:!0,_paths:null},property:{start:null,loc:null,range:null,name:"done",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"UnaryExpression",end:null,_paths:null},update:null,body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"push",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_step",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"BreakStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,value:"Invalid attempt to destructure non-iterable instance",raw:null,type:"Literal",end:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-sliced-to-array":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isArray",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"in",right:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},init:{start:null,loc:null,range:null,elements:[],type:"ArrayExpression",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null,leadingComments:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_n",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_d",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:!1,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_e",type:"Identifier",end:null},init:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,block:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_i",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},property:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"iterator",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"_s",type:"Identifier",end:null},init:null,type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_n",type:"Identifier",end:null},right:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_s",type:"Identifier",end:null},right:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_i",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"next",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,parenthesizedExpression:!0,_paths:null},property:{start:null,loc:null,range:null,name:"done",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,parenthesizedExpression:!0,_paths:null},type:"UnaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_n",type:"Identifier",end:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"push",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_s",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,label:null,type:"BreakStatement",end:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},handler:{start:null,loc:null,range:null,param:{start:null,loc:null,range:null,name:"err",type:"Identifier",end:null},guard:null,body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_d",type:"Identifier",end:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{start:null,loc:null,range:null,name:"_e",type:"Identifier",end:null},right:{start:null,loc:null,range:null,name:"err",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"CatchClause",end:null,_scopeInfo:null,_paths:null},guardedHandlers:[],finalizer:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,block:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"!",prefix:!0,argument:{start:null,loc:null,range:null,name:"_n",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_i",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"return",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"_i",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"return",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},handler:null,guardedHandlers:[],finalizer:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"_d",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"_e",type:"Identifier",end:null},type:"ThrowStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"TryStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"TryStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"_arr",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"TypeError",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,value:"Invalid attempt to destructure non-iterable instance",raw:null,type:"Literal",end:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-tagged-template-literal-loose":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"strings",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"strings",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"strings",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-tagged-template-literal":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"strings",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"freeze",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"defineProperties",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"strings",type:"Identifier",end:null},{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null},value:{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"value",type:"Identifier",end:null},value:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"freeze",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"raw",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null}],type:"CallExpression",end:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-temporal-assert-defined":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"val",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"name",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"undef",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"val",type:"Identifier",end:null},operator:"===",right:{start:null,loc:null,range:null,name:"undef",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,callee:{start:null,loc:null,range:null,name:"ReferenceError",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"name",type:"Identifier",end:null},operator:"+",right:{start:null,loc:null,range:null,value:" is not defined - temporal dead zone",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null}],type:"NewExpression",end:null,_paths:null},type:"ThrowStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:null,type:"IfStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-temporal-undefined":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,properties:[],type:"ObjectExpression",end:null,parenthesizedExpression:!0},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-to-array":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isArray",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},alternate:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"from",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ConditionalExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-to-consumable-array":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"isArray",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"arr2",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},arguments:[{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},operator:"<",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr2",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"i",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"arr2",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"from",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"arr",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"helper-typeof":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},operator:"&&",right:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"constructor",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,name:"Symbol",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,value:"symbol",raw:null,type:"Literal",end:null},alternate:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"obj",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},type:"ConditionalExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"let-scoping-return":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"RETURN",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"object",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"RETURN",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"v",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null},alternate:null,type:"IfStatement",end:null,_paths:null}],type:"Program",end:null},"ludicrous-in":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"Object",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"RIGHT",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"LEFT",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},operator:"!==",right:{start:null,loc:null,range:null,name:"undefined",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"named-function":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"GET_OUTER_ID",type:"Identifier",end:null},generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"FUNCTION",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"property-method-assignment-wrapper-generator":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"FUNCTION_KEY",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},generator:!0,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,delegate:!0,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"apply",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null},{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"YieldExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"toString",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"toString",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"FUNCTION",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"property-method-assignment-wrapper":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"FUNCTION_KEY",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_KEY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"apply",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,type:"ThisExpression",end:null},{start:null,loc:null,range:null,name:"arguments",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionDeclaration",end:null,_scopeInfo:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"toString",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"toString",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[],type:"CallExpression",end:null,_paths:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"FUNCTION",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"prototype-identifier":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"CLASS_NAME",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"prototype",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"require-assign-key":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"VARIABLE_NAME",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"require",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"MODULE_NAME",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null}],type:"Program",end:null},require:{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"require",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"MODULE_NAME",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},rest:{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,init:{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"LEN",type:"Identifier",end:null},init:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARGUMENTS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"length",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"ARRAY",type:"Identifier",end:null},init:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"Array",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"ARRAY_LEN",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"VariableDeclarator",end:null,_paths:null},{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},init:{start:null,loc:null,range:null,name:"START",type:"Identifier",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},operator:"<",right:{start:null,loc:null,range:null,name:"LEN",type:"Identifier",end:null},type:"BinaryExpression",end:null,_paths:null},update:{loc:null,start:null,range:null,operator:"++",prefix:!1,argument:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},type:"UpdateExpression",end:null,_paths:null},body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARRAY",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"ARRAY_KEY",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"ARGUMENTS",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"KEY",type:"Identifier",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"ForStatement",end:null,_scopeInfo:null,_paths:null}],type:"Program",end:null},"self-contained-helpers-head":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},property:{start:null,loc:null,range:null,value:"default",raw:null,type:"Literal",end:null},computed:!0,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,name:"HELPER",type:"Identifier",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"__esModule",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},system:{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"System",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"register",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"MODULE_NAME",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"MODULE_DEPENDENCIES",type:"Identifier",end:null},{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"EXPORT_IDENTIFIER",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,argument:{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"setters",type:"Identifier",end:null},value:{start:null,loc:null,range:null,name:"SETTERS",type:"Identifier",end:null},kind:"init",type:"Property",end:null,_paths:null},{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"execute",type:"Identifier",end:null},value:{start:null,loc:null,range:null,name:"EXECUTE",type:"Identifier",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null},type:"ReturnStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"tail-call-body":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"AGAIN_ID",type:"Identifier",end:null},init:{start:null,loc:null,range:null,value:!0,raw:null,type:"Literal",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,body:{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"AGAIN_ID",type:"Identifier",end:null},body:{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,name:"BLOCK",type:"Identifier",end:null},type:"ExpressionStatement",end:null,_paths:null},type:"WhileStatement",end:null,_scopeInfo:null,_paths:null},label:{start:null,loc:null,range:null,name:"FUNCTION_ID",type:"Identifier",end:null},type:"LabeledStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null}],type:"Program",end:null},"test-exports":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"!==",right:{start:null,loc:null,range:null,value:"undefined",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"test-module":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"module",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"!==",right:{start:null,loc:null,range:null,value:"undefined",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"umd-commonjs-strict":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"root",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"function",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"amd",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"AMD_ARGUMENTS",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"object",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"COMMON_ARGUMENTS",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"BROWSER_ARGUMENTS",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},arguments:[{start:null,loc:null,range:null,name:"UMD_ROOT",type:"Identifier",end:null},{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"FACTORY_PARAMETERS",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,name:"FACTORY_BODY",type:"Identifier",end:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,_scopeInfo:null,_paths:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null},"umd-runner-body":{loc:null,start:null,range:null,body:[{start:null,loc:null,range:null,expression:{start:null,loc:null,range:null,id:null,generator:!1,expression:!1,params:[{start:null,loc:null,range:null,name:"global",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null}],body:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,test:{loc:null,start:null,range:null,left:{loc:null,start:null,range:null,left:{start:null,loc:null,range:null,operator:"typeof",prefix:!0,argument:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},type:"UnaryExpression",end:null,_paths:null},operator:"===",right:{start:null,loc:null,range:null,value:"function",raw:null,type:"Literal",end:null},type:"BinaryExpression",end:null,_paths:null},operator:"&&",right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"amd",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"LogicalExpression",end:null,_paths:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"define",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"AMD_ARGUMENTS",type:"Identifier",end:null},{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,test:{start:null,loc:null,range:null,name:"COMMON_TEST",type:"Identifier",end:null},consequent:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"COMMON_ARGUMENTS",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},alternate:{start:null,loc:null,range:null,body:[{start:null,loc:null,range:null,declarations:[{start:null,loc:null,range:null,id:{start:null,loc:null,range:null,name:"module",type:"Identifier",end:null},init:{start:null,loc:null,range:null,properties:[{start:null,loc:null,range:null,method:!1,shorthand:!1,computed:!1,key:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},value:{start:null,loc:null,range:null,properties:[],type:"ObjectExpression",end:null},kind:"init",type:"Property",end:null,_paths:null}],type:"ObjectExpression",end:null},type:"VariableDeclarator",end:null,_paths:null}],kind:"var",type:"VariableDeclaration",end:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,callee:{start:null,loc:null,range:null,name:"factory",type:"Identifier",end:null},arguments:[{start:null,loc:null,range:null,name:"BROWSER_ARGUMENTS",type:"Identifier",end:null}],type:"CallExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null},{start:null,loc:null,range:null,expression:{loc:null,start:null,range:null,operator:"=",left:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"global",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"GLOBAL_ARG",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},right:{loc:null,start:null,range:null,object:{start:null,loc:null,range:null,name:"module",type:"Identifier",end:null},property:{start:null,loc:null,range:null,name:"exports",type:"Identifier",end:null},computed:!1,type:"MemberExpression",end:null,_paths:null},type:"AssignmentExpression",end:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"BlockStatement",end:null,_scopeInfo:null},type:"IfStatement",end:null,_paths:null},type:"IfStatement",end:null,_paths:null}],type:"BlockStatement",end:null},type:"FunctionExpression",end:null,parenthesizedExpression:!0,_scopeInfo:null,_paths:null},type:"ExpressionStatement",end:null,_paths:null}],type:"Program",end:null}} },{}]},{},[19])(19)});
node_modules/redux-form/es/__tests__/FormSection.spec.js
tausifmuzaffar/bisApp
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint react/no-multi-comp:0 */ import React, { Component } from 'react'; import { createSpy } from 'expect'; import { Provider } from 'react-redux'; import { combineReducers as plainCombineReducers, createStore } from 'redux'; import { combineReducers as immutableCombineReducers } from 'redux-immutablejs'; import TestUtils from 'react-addons-test-utils'; import createReduxForm from '../reduxForm'; import createReducer from '../reducer'; import createField from '../Field'; import createFields from '../Fields'; import createFieldArray from '../FieldArray'; import FormSection from '../FormSection'; import plain from '../structure/plain'; import plainExpectations from '../structure/plain/expectations'; import immutable from '../structure/immutable'; import immutableExpectations from '../structure/immutable/expectations'; import addExpectations from './addExpectations'; var describeFormSection = function describeFormSection(name, structure, combineReducers, expect) { var reduxForm = createReduxForm(structure); var Field = createField(structure); var Fields = createFields(structure); var FieldArray = createFieldArray(structure); var reducer = createReducer(structure); var fromJS = structure.fromJS; var makeStore = function makeStore(initial) { return createStore(combineReducers({ form: reducer }), fromJS({ form: initial })); }; describe(name, function () { it('should throw an error if not in ReduxForm', function () { expect(function () { TestUtils.renderIntoDocument(React.createElement( 'div', null, React.createElement(FormSection, { name: 'foo' }) )); }).toThrow(/must be inside a component decorated with reduxForm/); }); it('should not wrap in unnecessary div', function () { var store = makeStore({ testForm: { values: { foo: { bar: '42' } } } }); var Form = function (_Component) { _inherits(Form, _Component); function Form() { _classCallCheck(this, Form); return _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).apply(this, arguments)); } _createClass(Form, [{ key: 'render', value: function render() { return React.createElement( FormSection, { name: 'foo' }, React.createElement(Field, { name: 'bar', component: 'input' }) ); } }]); return Form; }(Component); var TestForm = reduxForm({ form: 'testForm' })(Form); var dom = TestUtils.renderIntoDocument(React.createElement( Provider, { store: store }, React.createElement(TestForm, null) )); var divTags = TestUtils.scryRenderedDOMComponentsWithTag(dom, 'div'); expect(divTags.length).toEqual(0); }); it('should pass along unused props to div', function () { var store = makeStore({ testForm: { values: { foo: { bar: '42' } } } }); var Form = function (_Component2) { _inherits(Form, _Component2); function Form() { _classCallCheck(this, Form); return _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).apply(this, arguments)); } _createClass(Form, [{ key: 'render', value: function render() { return React.createElement( FormSection, { name: 'foo', component: 'section', className: 'form-section', style: { fontWeight: 'bold' } }, React.createElement(Field, { name: 'bar', component: 'input' }), React.createElement(Field, { name: 'baz', component: 'input' }) ); } }]); return Form; }(Component); var TestForm = reduxForm({ form: 'testForm' })(Form); var dom = TestUtils.renderIntoDocument(React.createElement( Provider, { store: store }, React.createElement(TestForm, null) )); var section = TestUtils.findRenderedDOMComponentWithTag(dom, 'section'); // 🤢 This line is DISGUSTING!! Is there a better way to get the props on the <section> ?? var props = section[Object.keys(section)[0]]._currentElement.props; expect(props.name).toNotExist(); expect(props.component).toNotExist(); expect(props.className).toBe('form-section'); expect(props.style).toExist(); expect(props.style.fontWeight).toBe('bold'); }); it('should update Field values at the right depth', function () { var store = makeStore({ testForm: { values: { foo: { bar: '42' } } } }); var input = createSpy(function (props) { return React.createElement('input', props.input); }).andCallThrough(); var Form = function (_Component3) { _inherits(Form, _Component3); function Form() { _classCallCheck(this, Form); return _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).apply(this, arguments)); } _createClass(Form, [{ key: 'render', value: function render() { return React.createElement( FormSection, { name: 'foo' }, React.createElement(Field, { name: 'bar', component: input }) ); } }]); return Form; }(Component); var TestForm = reduxForm({ form: 'testForm' })(Form); TestUtils.renderIntoDocument(React.createElement( Provider, { store: store }, React.createElement(TestForm, null) )); // input displaying string value expect(input.calls.length).toBe(1); expect(input.calls[0].arguments[0].input.value).toBe('42'); // update value input.calls[0].arguments[0].input.onChange('15'); // input displaying updated string value expect(input.calls.length).toBe(2); expect(input.calls[1].arguments[0].input.value).toBe('15'); expect(store.getState()).toEqualMap({ form: { testForm: { values: { foo: { bar: '15' } }, registeredFields: { 'foo.bar': { name: 'foo.bar', type: 'Field', count: 1 } } } } }); }); it('should update Fields values at the right depth', function () { var store = makeStore({ testForm: { values: { foo: { bar: '42', baz: '100' } } } }); var input = createSpy(function (props) { return React.createElement('input', props.bar.input); }).andCallThrough(); var Form = function (_Component4) { _inherits(Form, _Component4); function Form() { _classCallCheck(this, Form); return _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).apply(this, arguments)); } _createClass(Form, [{ key: 'render', value: function render() { return React.createElement( FormSection, { name: 'foo' }, React.createElement(Fields, { names: ['bar', 'baz'], component: input }) ); } }]); return Form; }(Component); var TestForm = reduxForm({ form: 'testForm' })(Form); TestUtils.renderIntoDocument(React.createElement( Provider, { store: store }, React.createElement(TestForm, null) )); // input displaying string value expect(input.calls.length).toBe(1); expect(input.calls[0].arguments[0].bar.input.value).toBe('42'); expect(input.calls[0].arguments[0].baz.input.value).toBe('100'); // update value input.calls[0].arguments[0].bar.input.onChange('15'); // input displaying updated string value expect(input.calls.length).toBe(2); expect(input.calls[1].arguments[0].bar.input.value).toBe('15'); expect(store.getState()).toEqualMap({ form: { testForm: { values: { foo: { bar: '15', baz: '100' } }, registeredFields: { 'foo.bar': { name: 'foo.bar', type: 'Field', count: 1 }, 'foo.baz': { name: 'foo.baz', type: 'Field', count: 1 } } } } }); }); it('should update FieldArray values at the right depth', function () { var store = makeStore({ testForm: { values: { foo: { bar: ['dog', 'cat'] } } } }); var renderField = createSpy(function (props) { return React.createElement('input', props.input); }).andCallThrough(); var renderFieldArray = createSpy(function (_ref) { var fields = _ref.fields; return React.createElement( 'div', null, fields.map(function (field) { return React.createElement(Field, { name: field, component: renderField, key: field }); }), React.createElement( 'button', { className: 'add', onClick: function onClick() { return fields.push('fish'); } }, 'Add Dog' ), React.createElement( 'button', { className: 'remove', onClick: function onClick() { return fields.pop(); } }, 'Remove Dog' ) ); }).andCallThrough(); var Form = function (_Component5) { _inherits(Form, _Component5); function Form() { _classCallCheck(this, Form); return _possibleConstructorReturn(this, (Form.__proto__ || Object.getPrototypeOf(Form)).apply(this, arguments)); } _createClass(Form, [{ key: 'render', value: function render() { return React.createElement( FormSection, { name: 'foo' }, React.createElement(FieldArray, { name: 'bar', component: renderFieldArray }) ); } }]); return Form; }(Component); var TestForm = reduxForm({ form: 'testForm' })(Form); var dom = TestUtils.renderIntoDocument(React.createElement( Provider, { store: store }, React.createElement(TestForm, null) )); var addButton = TestUtils.findRenderedDOMComponentWithClass(dom, 'add'); var removeButton = TestUtils.findRenderedDOMComponentWithClass(dom, 'remove'); TestUtils.Simulate.click(addButton); expect(store.getState()).toEqualMap({ form: { testForm: { values: { foo: { bar: ['dog', 'cat', 'fish'] } }, registeredFields: { 'foo.bar': { name: 'foo.bar', type: 'FieldArray', count: 1 }, 'foo.bar[0]': { name: 'foo.bar[0]', type: 'Field', count: 1 }, 'foo.bar[1]': { name: 'foo.bar[1]', type: 'Field', count: 1 }, 'foo.bar[2]': { name: 'foo.bar[2]', type: 'Field', count: 1 } } } } }); TestUtils.Simulate.click(removeButton); expect(store.getState()).toEqualMap({ form: { testForm: { values: { foo: { bar: ['dog', 'cat'] } }, registeredFields: { 'foo.bar': { name: 'foo.bar', type: 'FieldArray', count: 1 }, 'foo.bar[0]': { name: 'foo.bar[0]', type: 'Field', count: 1 }, 'foo.bar[1]': { name: 'foo.bar[1]', type: 'Field', count: 1 } } } } }); }); }); }; describeFormSection('FormSection.plain', plain, plainCombineReducers, addExpectations(plainExpectations)); describeFormSection('FormSection.immutable', immutable, immutableCombineReducers, addExpectations(immutableExpectations));
assets/js/libs/tablesort/jquery-latest.js
househippo/couchbase-admin-plus
/*! * jQuery JavaScript Library v1.4.2 * http://jquery.com/ * * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2010, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Sat Feb 13 22:33:48 2010 -0500 */ (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, "&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, "isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& !c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", " ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, "events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= {setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& !a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- 1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| !h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); (function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= {},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)? a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&& this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]|| u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length=== 1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay"); this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a], "olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)}, animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing= j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]); this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length|| c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement? function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b= this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle; k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&& f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
vgdb-frontend/src/components/grid/GridLayout.js
mattruston/idb
import React, { Component } from 'react'; import GridItem from './GridItem'; import './GridLayout.css'; /* Multiline flexible column layout for griditems */ class GridLayout extends Component { static defaultProps = { aspect: "cover" }; constructor(props) { super(props); } render() { return ( <div className="grid-layout"> <div className="grid-layout-container"> <div className="grid"> { this.props.items.map(item => <GridItem details={item.details} name={item.name} img={item.img} url={item.url} aspect={this.props.aspect}/> ) } </div> </div> </div> ); } } export default GridLayout;
src/components/molecules/extra-course-form.js
raulfdm/cv
import React from 'react'; import { Field } from 'react-final-form'; import styled from 'styled-components'; import PropTypes from 'prop-types'; import FieldSet from 'molecules/fieldset'; import DeleteButton from 'organisms/delete-button'; const ActionControl = styled.p` display: flex; `; const InputField = styled.div` &&& { flex-grow: ${props => (props.noGrow ? 0 : 1)}; } `; const NewFieldWrapper = styled.div` display: flex; justify-content: flex-end; align-items: center; `; const ExtraCourseForm = ({ platform_name, prefix, onNewCourse, courses, onDeleteCourseFromPlatform, onPlatformRename, }) => { return ( <FieldSet label={platform_name} editable onConfirm={onPlatformRename}> <div className="columns is-multiline"> {courses && courses.length > 0 && courses.map((_, index) => { const getFieldName = name => `${prefix}.courses[${index}].${name}`; return ( <div className="column is-12" key={index}> <div className="field is-horizontal"> <div className="field-body"> <Field type="text" className="input" placeholder="Course name" name={getFieldName('name')} render={({ input }) => { return ( <InputField className="field"> <div className="control is-expanded"> <input className="input" {...input} /> </div> </InputField> ); }} /> <Field type="number" className="input" placeholder="10" name={getFieldName('hours')} render={({ input }) => { return ( <InputField noGrow className="field has-addons"> <p className="control"> <input className="input" type="text" {...input} /> </p> <p className="control"> <a className="button is-static">hours</a> </p> </InputField> ); }} /> </div> <ActionControl className="control"> <DeleteButton onClick={() => onDeleteCourseFromPlatform(index)} /> </ActionControl> </div> </div> ); })} <NewFieldWrapper className="column is-12"> <button className="button is-text" onClick={onNewCourse}> New course for {platform_name} </button> </NewFieldWrapper> </div> </FieldSet> ); }; ExtraCourseForm.propTypes = { platform_name: PropTypes.string, prefix: PropTypes.string, onNewCourse: PropTypes.func, courses: PropTypes.array, onDeleteCourseFromPlatform: PropTypes.func, onPlatformRename: PropTypes.func, }; export default ExtraCourseForm;
ajax/libs/js-data/0.3.0/js-data.js
abbychau/cdnjs
/** * @author Jason Dobry <jason.dobry@gmail.com> * @file js-data.js * @version 0.2.0 - Homepage <http://www.js-data.io/> * @copyright (c) 2014 Jason Dobry * @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE> * * @overview Data store. */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSData=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ // Copyright 2012 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Modifications // Copyright 2014 Jason Dobry // // Summary of modifications: // Removed all code related to: // - ArrayObserver // - ArraySplice // - PathObserver // - CompoundObserver // - Path // - ObserverTransform (function(global) { 'use strict'; // Detect and do basic sanity checking on Object/Array.observe. function detectObjectObserve() { if (typeof Object.observe !== 'function' || typeof Array.observe !== 'function') { return false; } var records = []; function callback(recs) { records = recs; } var test = {}; var arr = []; Object.observe(test, callback); Array.observe(arr, callback); test.id = 1; test.id = 2; delete test.id; arr.push(1, 2); arr.length = 0; Object.deliverChangeRecords(callback); if (records.length !== 5) return false; if (records[0].type != 'add' || records[1].type != 'update' || records[2].type != 'delete' || records[3].type != 'splice' || records[4].type != 'splice') { return false; } Object.unobserve(test, callback); Array.unobserve(arr, callback); return true; } var hasObserve = detectObjectObserve(); function detectEval() { // Don't test for eval if we're running in a Chrome App environment. // We check for APIs set that only exist in a Chrome App context. if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) { return false; } try { var f = new Function('', 'return true;'); return f(); } catch (ex) { return false; } } var hasEval = detectEval(); var createObject = ('__proto__' in {}) ? function(obj) { return obj; } : function(obj) { var proto = obj.__proto__; if (!proto) return obj; var newObject = Object.create(proto); Object.getOwnPropertyNames(obj).forEach(function(name) { Object.defineProperty(newObject, name, Object.getOwnPropertyDescriptor(obj, name)); }); return newObject; }; var MAX_DIRTY_CHECK_CYCLES = 1000; function dirtyCheck(observer) { var cycles = 0; while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) { cycles++; } if (global.testingExposeCycleCount) global.dirtyCheckCycleCount = cycles; return cycles > 0; } function objectIsEmpty(object) { for (var prop in object) return false; return true; } function diffIsEmpty(diff) { return objectIsEmpty(diff.added) && objectIsEmpty(diff.removed) && objectIsEmpty(diff.changed); } function diffObjectFromOldObject(object, oldObject) { var added = {}; var removed = {}; var changed = {}; for (var prop in oldObject) { var newValue = object[prop]; if (newValue !== undefined && newValue === oldObject[prop]) continue; if (!(prop in object)) { removed[prop] = undefined; continue; } if (newValue !== oldObject[prop]) changed[prop] = newValue; } for (var prop in object) { if (prop in oldObject) continue; added[prop] = object[prop]; } if (Array.isArray(object) && object.length !== oldObject.length) changed.length = object.length; return { added: added, removed: removed, changed: changed }; } var eomTasks = []; function runEOMTasks() { if (!eomTasks.length) return false; for (var i = 0; i < eomTasks.length; i++) { eomTasks[i](); } eomTasks.length = 0; return true; } var runEOM = hasObserve ? (function(){ var eomObj = { pingPong: true }; var eomRunScheduled = false; Object.observe(eomObj, function() { runEOMTasks(); eomRunScheduled = false; }); return function(fn) { eomTasks.push(fn); if (!eomRunScheduled) { eomRunScheduled = true; eomObj.pingPong = !eomObj.pingPong; } }; })() : (function() { return function(fn) { eomTasks.push(fn); }; })(); var observedObjectCache = []; function newObservedObject() { var observer; var object; var discardRecords = false; var first = true; function callback(records) { if (observer && observer.state_ === OPENED && !discardRecords) observer.check_(records); } return { open: function(obs) { if (observer) throw Error('ObservedObject in use'); if (!first) Object.deliverChangeRecords(callback); observer = obs; first = false; }, observe: function(obj, arrayObserve) { object = obj; if (arrayObserve) Array.observe(object, callback); else Object.observe(object, callback); }, deliver: function(discard) { discardRecords = discard; Object.deliverChangeRecords(callback); discardRecords = false; }, close: function() { observer = undefined; Object.unobserve(object, callback); observedObjectCache.push(this); } }; } /* * The observedSet abstraction is a perf optimization which reduces the total * number of Object.observe observations of a set of objects. The idea is that * groups of Observers will have some object dependencies in common and this * observed set ensures that each object in the transitive closure of * dependencies is only observed once. The observedSet acts as a write barrier * such that whenever any change comes through, all Observers are checked for * changed values. * * Note that this optimization is explicitly moving work from setup-time to * change-time. * * TODO(rafaelw): Implement "garbage collection". In order to move work off * the critical path, when Observers are closed, their observed objects are * not Object.unobserve(d). As a result, it's possible that if the observedSet * is kept open, but some Observers have been closed, it could cause "leaks" * (prevent otherwise collectable objects from being collected). At some * point, we should implement incremental "gc" which keeps a list of * observedSets which may need clean-up and does small amounts of cleanup on a * timeout until all is clean. */ function getObservedObject(observer, object, arrayObserve) { var dir = observedObjectCache.pop() || newObservedObject(); dir.open(observer); dir.observe(object, arrayObserve); return dir; } var UNOPENED = 0; var OPENED = 1; var CLOSED = 2; var nextObserverId = 1; function Observer() { this.state_ = UNOPENED; this.callback_ = undefined; this.target_ = undefined; // TODO(rafaelw): Should be WeakRef this.directObserver_ = undefined; this.value_ = undefined; this.id_ = nextObserverId++; } Observer.prototype = { open: function(callback, target) { if (this.state_ != UNOPENED) throw Error('Observer has already been opened.'); addToAll(this); this.callback_ = callback; this.target_ = target; this.connect_(); this.state_ = OPENED; return this.value_; }, close: function() { if (this.state_ != OPENED) return; removeFromAll(this); this.disconnect_(); this.value_ = undefined; this.callback_ = undefined; this.target_ = undefined; this.state_ = CLOSED; }, deliver: function() { if (this.state_ != OPENED) return; dirtyCheck(this); }, report_: function(changes) { try { this.callback_.apply(this.target_, changes); } catch (ex) { Observer._errorThrownDuringCallback = true; console.error('Exception caught during observer callback: ' + (ex.stack || ex)); } }, discardChanges: function() { this.check_(undefined, true); return this.value_; } } var collectObservers = !hasObserve; var allObservers; Observer._allObserversCount = 0; if (collectObservers) { allObservers = []; } function addToAll(observer) { Observer._allObserversCount++; if (!collectObservers) return; allObservers.push(observer); } function removeFromAll(observer) { Observer._allObserversCount--; } var runningMicrotaskCheckpoint = false; var hasDebugForceFullDelivery = hasObserve && hasEval && (function() { try { eval('%RunMicrotasks()'); return true; } catch (ex) { return false; } })(); global.Platform = global.Platform || {}; global.Platform.performMicrotaskCheckpoint = function() { if (runningMicrotaskCheckpoint) return; if (hasDebugForceFullDelivery) { eval('%RunMicrotasks()'); return; } if (!collectObservers) return; runningMicrotaskCheckpoint = true; var cycles = 0; var anyChanged, toCheck; do { cycles++; toCheck = allObservers; allObservers = []; anyChanged = false; for (var i = 0; i < toCheck.length; i++) { var observer = toCheck[i]; if (observer.state_ != OPENED) continue; if (observer.check_()) anyChanged = true; allObservers.push(observer); } if (runEOMTasks()) anyChanged = true; } while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged); if (global.testingExposeCycleCount) global.dirtyCheckCycleCount = cycles; runningMicrotaskCheckpoint = false; }; if (collectObservers) { global.Platform.clearObservers = function() { allObservers = []; }; } function ObjectObserver(object) { Observer.call(this); this.value_ = object; this.oldObject_ = undefined; } ObjectObserver.prototype = createObject({ __proto__: Observer.prototype, arrayObserve: false, connect_: function(callback, target) { if (hasObserve) { this.directObserver_ = getObservedObject(this, this.value_, this.arrayObserve); } else { this.oldObject_ = this.copyObject(this.value_); } }, copyObject: function(object) { var copy = Array.isArray(object) ? [] : {}; for (var prop in object) { copy[prop] = object[prop]; }; if (Array.isArray(object)) copy.length = object.length; return copy; }, check_: function(changeRecords, skipChanges) { var diff; var oldValues; if (hasObserve) { if (!changeRecords) return false; oldValues = {}; diff = diffObjectFromChangeRecords(this.value_, changeRecords, oldValues); } else { oldValues = this.oldObject_; diff = diffObjectFromOldObject(this.value_, this.oldObject_); } if (diffIsEmpty(diff)) return false; if (!hasObserve) this.oldObject_ = this.copyObject(this.value_); this.report_([ diff.added || {}, diff.removed || {}, diff.changed || {}, function(property) { return oldValues[property]; } ]); return true; }, disconnect_: function() { if (hasObserve) { this.directObserver_.close(); this.directObserver_ = undefined; } else { this.oldObject_ = undefined; } }, deliver: function() { if (this.state_ != OPENED) return; if (hasObserve) this.directObserver_.deliver(false); else dirtyCheck(this); }, discardChanges: function() { if (this.directObserver_) this.directObserver_.deliver(true); else this.oldObject_ = this.copyObject(this.value_); return this.value_; } }); var observerSentinel = {}; var expectedRecordTypes = { add: true, update: true, delete: true }; function diffObjectFromChangeRecords(object, changeRecords, oldValues) { var added = {}; var removed = {}; for (var i = 0; i < changeRecords.length; i++) { var record = changeRecords[i]; if (!expectedRecordTypes[record.type]) { console.error('Unknown changeRecord type: ' + record.type); console.error(record); continue; } if (!(record.name in oldValues)) oldValues[record.name] = record.oldValue; if (record.type == 'update') continue; if (record.type == 'add') { if (record.name in removed) delete removed[record.name]; else added[record.name] = true; continue; } // type = 'delete' if (record.name in added) { delete added[record.name]; delete oldValues[record.name]; } else { removed[record.name] = true; } } for (var prop in added) added[prop] = object[prop]; for (var prop in removed) removed[prop] = undefined; var changed = {}; for (var prop in oldValues) { if (prop in added || prop in removed) continue; var newValue = object[prop]; if (oldValues[prop] !== newValue) changed[prop] = newValue; } return { added: added, removed: removed, changed: changed }; } global.Observer = Observer; global.Observer.runEOM_ = runEOM; global.Observer.observerSentinel_ = observerSentinel; // for testing. global.Observer.hasObjectObserve = hasObserve; global.ObjectObserver = ObjectObserver; })((exports.Number = { isNaN: window.isNaN }) ? exports : exports); },{}],2:[function(require,module,exports){ "use strict"; var Promise = require("./promise/promise").Promise; var polyfill = require("./promise/polyfill").polyfill; exports.Promise = Promise; exports.polyfill = polyfill; },{"./promise/polyfill":6,"./promise/promise":7}],3:[function(require,module,exports){ "use strict"; /* global toString */ var isArray = require("./utils").isArray; var isFunction = require("./utils").isFunction; /** Returns a promise that is fulfilled when all the given promises have been fulfilled, or rejected if any of them become rejected. The return promise is fulfilled with an array that gives all the values in the order they were passed in the `promises` array argument. Example: ```javascript var promise1 = RSVP.resolve(1); var promise2 = RSVP.resolve(2); var promise3 = RSVP.resolve(3); var promises = [ promise1, promise2, promise3 ]; RSVP.all(promises).then(function(array){ // The array here would be [ 1, 2, 3 ]; }); ``` If any of the `promises` given to `RSVP.all` are rejected, the first promise that is rejected will be given as an argument to the returned promises's rejection handler. For example: Example: ```javascript var promise1 = RSVP.resolve(1); var promise2 = RSVP.reject(new Error("2")); var promise3 = RSVP.reject(new Error("3")); var promises = [ promise1, promise2, promise3 ]; RSVP.all(promises).then(function(array){ // Code here never runs because there are rejected promises! }, function(error) { // error.message === "2" }); ``` @method all @for RSVP @param {Array} promises @param {String} label @return {Promise} promise that is fulfilled when all `promises` have been fulfilled, or rejected if any of them become rejected. */ function all(promises) { /*jshint validthis:true */ var Promise = this; if (!isArray(promises)) { throw new TypeError('You must pass an array to all.'); } return new Promise(function(resolve, reject) { var results = [], remaining = promises.length, promise; if (remaining === 0) { resolve([]); } function resolver(index) { return function(value) { resolveAll(index, value); }; } function resolveAll(index, value) { results[index] = value; if (--remaining === 0) { resolve(results); } } for (var i = 0; i < promises.length; i++) { promise = promises[i]; if (promise && isFunction(promise.then)) { promise.then(resolver(i), reject); } else { resolveAll(i, promise); } } }); } exports.all = all; },{"./utils":11}],4:[function(require,module,exports){ (function (process,global){ "use strict"; var browserGlobal = (typeof window !== 'undefined') ? window : {}; var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this); // node function useNextTick() { return function() { process.nextTick(flush); }; } function useMutationObserver() { var iterations = 0; var observer = new BrowserMutationObserver(flush); var node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function() { node.data = (iterations = ++iterations % 2); }; } function useSetTimeout() { return function() { local.setTimeout(flush, 1); }; } var queue = []; function flush() { for (var i = 0; i < queue.length; i++) { var tuple = queue[i]; var callback = tuple[0], arg = tuple[1]; callback(arg); } queue = []; } var scheduleFlush; // Decide what async method to use to triggering processing of queued callbacks: if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { scheduleFlush = useNextTick(); } else if (BrowserMutationObserver) { scheduleFlush = useMutationObserver(); } else { scheduleFlush = useSetTimeout(); } function asap(callback, arg) { var length = queue.push([callback, arg]); if (length === 1) { // If length is 1, that means that we need to schedule an async flush. // If additional callbacks are queued before the queue is flushed, they // will be processed by this flush that we are scheduling. scheduleFlush(); } } exports.asap = asap; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":12}],5:[function(require,module,exports){ "use strict"; var config = { instrument: false }; function configure(name, value) { if (arguments.length === 2) { config[name] = value; } else { return config[name]; } } exports.config = config; exports.configure = configure; },{}],6:[function(require,module,exports){ (function (global){ "use strict"; /*global self*/ var RSVPPromise = require("./promise").Promise; var isFunction = require("./utils").isFunction; function polyfill() { var local; if (typeof global !== 'undefined') { local = global; } else if (typeof window !== 'undefined' && window.document) { local = window; } else { local = self; } var es6PromiseSupport = "Promise" in local && // Some of these methods are missing from // Firefox/Chrome experimental implementations "resolve" in local.Promise && "reject" in local.Promise && "all" in local.Promise && "race" in local.Promise && // Older version of the spec had a resolver object // as the arg rather than a function (function() { var resolve; new local.Promise(function(r) { resolve = r; }); return isFunction(resolve); }()); if (!es6PromiseSupport) { local.Promise = RSVPPromise; } } exports.polyfill = polyfill; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./promise":7,"./utils":11}],7:[function(require,module,exports){ "use strict"; var config = require("./config").config; var configure = require("./config").configure; var objectOrFunction = require("./utils").objectOrFunction; var isFunction = require("./utils").isFunction; var now = require("./utils").now; var all = require("./all").all; var race = require("./race").race; var staticResolve = require("./resolve").resolve; var staticReject = require("./reject").reject; var asap = require("./asap").asap; var counter = 0; config.async = asap; // default async is asap; function Promise(resolver) { if (!isFunction(resolver)) { throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); } if (!(this instanceof Promise)) { throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); } this._subscribers = []; invokeResolver(resolver, this); } function invokeResolver(resolver, promise) { function resolvePromise(value) { resolve(promise, value); } function rejectPromise(reason) { reject(promise, reason); } try { resolver(resolvePromise, rejectPromise); } catch(e) { rejectPromise(e); } } function invokeCallback(settled, promise, callback, detail) { var hasCallback = isFunction(callback), value, error, succeeded, failed; if (hasCallback) { try { value = callback(detail); succeeded = true; } catch(e) { failed = true; error = e; } } else { value = detail; succeeded = true; } if (handleThenable(promise, value)) { return; } else if (hasCallback && succeeded) { resolve(promise, value); } else if (failed) { reject(promise, error); } else if (settled === FULFILLED) { resolve(promise, value); } else if (settled === REJECTED) { reject(promise, value); } } var PENDING = void 0; var SEALED = 0; var FULFILLED = 1; var REJECTED = 2; function subscribe(parent, child, onFulfillment, onRejection) { var subscribers = parent._subscribers; var length = subscribers.length; subscribers[length] = child; subscribers[length + FULFILLED] = onFulfillment; subscribers[length + REJECTED] = onRejection; } function publish(promise, settled) { var child, callback, subscribers = promise._subscribers, detail = promise._detail; for (var i = 0; i < subscribers.length; i += 3) { child = subscribers[i]; callback = subscribers[i + settled]; invokeCallback(settled, child, callback, detail); } promise._subscribers = null; } Promise.prototype = { constructor: Promise, _state: undefined, _detail: undefined, _subscribers: undefined, then: function(onFulfillment, onRejection) { var promise = this; var thenPromise = new this.constructor(function() {}); if (this._state) { var callbacks = arguments; config.async(function invokePromiseCallback() { invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail); }); } else { subscribe(this, thenPromise, onFulfillment, onRejection); } return thenPromise; }, 'catch': function(onRejection) { return this.then(null, onRejection); } }; Promise.all = all; Promise.race = race; Promise.resolve = staticResolve; Promise.reject = staticReject; function handleThenable(promise, value) { var then = null, resolved; try { if (promise === value) { throw new TypeError("A promises callback cannot return that same promise."); } if (objectOrFunction(value)) { then = value.then; if (isFunction(then)) { then.call(value, function(val) { if (resolved) { return true; } resolved = true; if (value !== val) { resolve(promise, val); } else { fulfill(promise, val); } }, function(val) { if (resolved) { return true; } resolved = true; reject(promise, val); }); return true; } } } catch (error) { if (resolved) { return true; } reject(promise, error); return true; } return false; } function resolve(promise, value) { if (promise === value) { fulfill(promise, value); } else if (!handleThenable(promise, value)) { fulfill(promise, value); } } function fulfill(promise, value) { if (promise._state !== PENDING) { return; } promise._state = SEALED; promise._detail = value; config.async(publishFulfillment, promise); } function reject(promise, reason) { if (promise._state !== PENDING) { return; } promise._state = SEALED; promise._detail = reason; config.async(publishRejection, promise); } function publishFulfillment(promise) { publish(promise, promise._state = FULFILLED); } function publishRejection(promise) { publish(promise, promise._state = REJECTED); } exports.Promise = Promise; },{"./all":3,"./asap":4,"./config":5,"./race":8,"./reject":9,"./resolve":10,"./utils":11}],8:[function(require,module,exports){ "use strict"; /* global toString */ var isArray = require("./utils").isArray; /** `RSVP.race` allows you to watch a series of promises and act as soon as the first promise given to the `promises` argument fulfills or rejects. Example: ```javascript var promise1 = new RSVP.Promise(function(resolve, reject){ setTimeout(function(){ resolve("promise 1"); }, 200); }); var promise2 = new RSVP.Promise(function(resolve, reject){ setTimeout(function(){ resolve("promise 2"); }, 100); }); RSVP.race([promise1, promise2]).then(function(result){ // result === "promise 2" because it was resolved before promise1 // was resolved. }); ``` `RSVP.race` is deterministic in that only the state of the first completed promise matters. For example, even if other promises given to the `promises` array argument are resolved, but the first completed promise has become rejected before the other promises became fulfilled, the returned promise will become rejected: ```javascript var promise1 = new RSVP.Promise(function(resolve, reject){ setTimeout(function(){ resolve("promise 1"); }, 200); }); var promise2 = new RSVP.Promise(function(resolve, reject){ setTimeout(function(){ reject(new Error("promise 2")); }, 100); }); RSVP.race([promise1, promise2]).then(function(result){ // Code here never runs because there are rejected promises! }, function(reason){ // reason.message === "promise2" because promise 2 became rejected before // promise 1 became fulfilled }); ``` @method race @for RSVP @param {Array} promises array of promises to observe @param {String} label optional string for describing the promise returned. Useful for tooling. @return {Promise} a promise that becomes fulfilled with the value the first completed promises is resolved with if the first completed promise was fulfilled, or rejected with the reason that the first completed promise was rejected with. */ function race(promises) { /*jshint validthis:true */ var Promise = this; if (!isArray(promises)) { throw new TypeError('You must pass an array to race.'); } return new Promise(function(resolve, reject) { var results = [], promise; for (var i = 0; i < promises.length; i++) { promise = promises[i]; if (promise && typeof promise.then === 'function') { promise.then(resolve, reject); } else { resolve(promise); } } }); } exports.race = race; },{"./utils":11}],9:[function(require,module,exports){ "use strict"; /** `RSVP.reject` returns a promise that will become rejected with the passed `reason`. `RSVP.reject` is essentially shorthand for the following: ```javascript var promise = new RSVP.Promise(function(resolve, reject){ reject(new Error('WHOOPS')); }); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` Instead of writing the above, your code now simply becomes the following: ```javascript var promise = RSVP.reject(new Error('WHOOPS')); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` @method reject @for RSVP @param {Any} reason value that the returned promise will be rejected with. @param {String} label optional string for identifying the returned promise. Useful for tooling. @return {Promise} a promise that will become rejected with the given `reason`. */ function reject(reason) { /*jshint validthis:true */ var Promise = this; return new Promise(function (resolve, reject) { reject(reason); }); } exports.reject = reject; },{}],10:[function(require,module,exports){ "use strict"; function resolve(value) { /*jshint validthis:true */ if (value && typeof value === 'object' && value.constructor === this) { return value; } var Promise = this; return new Promise(function(resolve) { resolve(value); }); } exports.resolve = resolve; },{}],11:[function(require,module,exports){ "use strict"; function objectOrFunction(x) { return isFunction(x) || (typeof x === "object" && x !== null); } function isFunction(x) { return typeof x === "function"; } function isArray(x) { return Object.prototype.toString.call(x) === "[object Array]"; } // Date.now is not available in browsers < IE9 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility var now = Date.now || function() { return new Date().getTime(); }; exports.objectOrFunction = objectOrFunction; exports.isFunction = isFunction; exports.isArray = isArray; exports.now = now; },{}],12:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; process.nextTick = (function () { var canSetImmediate = typeof window !== 'undefined' && window.setImmediate; var canPost = typeof window !== 'undefined' && window.postMessage && window.addEventListener ; if (canSetImmediate) { return function (f) { return window.setImmediate(f) }; } if (canPost) { var queue = []; window.addEventListener('message', function (ev) { var source = ev.source; if ((source === window || source === null) && ev.data === 'process-tick') { ev.stopPropagation(); if (queue.length > 0) { var fn = queue.shift(); fn(); } } }, true); return function nextTick(fn) { queue.push(fn); window.postMessage('process-tick', '*'); }; } return function nextTick(fn) { setTimeout(fn, 0); }; })(); process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); } // TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; },{}],13:[function(require,module,exports){ var indexOf = require('./indexOf'); /** * If array contains values. */ function contains(arr, val) { return indexOf(arr, val) !== -1; } module.exports = contains; },{"./indexOf":16}],14:[function(require,module,exports){ var makeIterator = require('../function/makeIterator_'); /** * Array filter */ function filter(arr, callback, thisObj) { callback = makeIterator(callback, thisObj); var results = []; if (arr == null) { return results; } var i = -1, len = arr.length, value; while (++i < len) { value = arr[i]; if (callback(value, i, arr)) { results.push(value); } } return results; } module.exports = filter; },{"../function/makeIterator_":23}],15:[function(require,module,exports){ /** * Array forEach */ function forEach(arr, callback, thisObj) { if (arr == null) { return; } var i = -1, len = arr.length; while (++i < len) { // we iterate over sparse items since there is no way to make it // work properly on IE 7-8. see #64 if ( callback.call(thisObj, arr[i], i, arr) === false ) { break; } } } module.exports = forEach; },{}],16:[function(require,module,exports){ /** * Array.indexOf */ function indexOf(arr, item, fromIndex) { fromIndex = fromIndex || 0; if (arr == null) { return -1; } var len = arr.length, i = fromIndex < 0 ? len + fromIndex : fromIndex; while (i < len) { // we iterate over sparse items since there is no way to make it // work properly on IE 7-8. see #64 if (arr[i] === item) { return i; } i++; } return -1; } module.exports = indexOf; },{}],17:[function(require,module,exports){ var filter = require('./filter'); function isValidString(val) { return (val != null && val !== ''); } /** * Joins strings with the specified separator inserted between each value. * Null values and empty strings will be excluded. */ function join(items, separator) { separator = separator || ''; return filter(items, isValidString).join(separator); } module.exports = join; },{"./filter":14}],18:[function(require,module,exports){ var indexOf = require('./indexOf'); /** * Remove a single item from the array. * (it won't remove duplicates, just a single item) */ function remove(arr, item){ var idx = indexOf(arr, item); if (idx !== -1) arr.splice(idx, 1); } module.exports = remove; },{"./indexOf":16}],19:[function(require,module,exports){ /** * Create slice of source array or array-like object */ function slice(arr, start, end){ var len = arr.length; if (start == null) { start = 0; } else if (start < 0) { start = Math.max(len + start, 0); } else { start = Math.min(start, len); } if (end == null) { end = len; } else if (end < 0) { end = Math.max(len + end, 0); } else { end = Math.min(end, len); } var result = []; while (start < end) { result.push(arr[start++]); } return result; } module.exports = slice; },{}],20:[function(require,module,exports){ /** * Merge sort (http://en.wikipedia.org/wiki/Merge_sort) */ function mergeSort(arr, compareFn) { if (arr == null) { return []; } else if (arr.length < 2) { return arr; } if (compareFn == null) { compareFn = defaultCompare; } var mid, left, right; mid = ~~(arr.length / 2); left = mergeSort( arr.slice(0, mid), compareFn ); right = mergeSort( arr.slice(mid, arr.length), compareFn ); return merge(left, right, compareFn); } function defaultCompare(a, b) { return a < b ? -1 : (a > b? 1 : 0); } function merge(left, right, compareFn) { var result = []; while (left.length && right.length) { if (compareFn(left[0], right[0]) <= 0) { // if 0 it should preserve same order (stable) result.push(left.shift()); } else { result.push(right.shift()); } } if (left.length) { result.push.apply(result, left); } if (right.length) { result.push.apply(result, right); } return result; } module.exports = mergeSort; },{}],21:[function(require,module,exports){ var isFunction = require('../lang/isFunction'); /** * Creates an object that holds a lookup for the objects in the array. */ function toLookup(arr, key) { var result = {}; if (arr == null) { return result; } var i = -1, len = arr.length, value; if (isFunction(key)) { while (++i < len) { value = arr[i]; result[key(value)] = value; } } else { while (++i < len) { value = arr[i]; result[value[key]] = value; } } return result; } module.exports = toLookup; },{"../lang/isFunction":30}],22:[function(require,module,exports){ /** * Returns the first argument provided to it. */ function identity(val){ return val; } module.exports = identity; },{}],23:[function(require,module,exports){ var identity = require('./identity'); var prop = require('./prop'); var deepMatches = require('../object/deepMatches'); /** * Converts argument into a valid iterator. * Used internally on most array/object/collection methods that receives a * callback/iterator providing a shortcut syntax. */ function makeIterator(src, thisObj){ if (src == null) { return identity; } switch(typeof src) { case 'function': // function is the first to improve perf (most common case) // also avoid using `Function#call` if not needed, which boosts // perf a lot in some cases return (typeof thisObj !== 'undefined')? function(val, i, arr){ return src.call(thisObj, val, i, arr); } : src; case 'object': return function(val){ return deepMatches(val, src); }; case 'string': case 'number': return prop(src); } } module.exports = makeIterator; },{"../object/deepMatches":38,"./identity":22,"./prop":24}],24:[function(require,module,exports){ /** * Returns a function that gets a property of the passed object */ function prop(name){ return function(obj){ return obj[name]; }; } module.exports = prop; },{}],25:[function(require,module,exports){ var kindOf = require('./kindOf'); var isPlainObject = require('./isPlainObject'); var mixIn = require('../object/mixIn'); /** * Clone native types. */ function clone(val){ switch (kindOf(val)) { case 'Object': return cloneObject(val); case 'Array': return cloneArray(val); case 'RegExp': return cloneRegExp(val); case 'Date': return cloneDate(val); default: return val; } } function cloneObject(source) { if (isPlainObject(source)) { return mixIn({}, source); } else { return source; } } function cloneRegExp(r) { var flags = ''; flags += r.multiline ? 'm' : ''; flags += r.global ? 'g' : ''; flags += r.ignorecase ? 'i' : ''; return new RegExp(r.source, flags); } function cloneDate(date) { return new Date(+date); } function cloneArray(arr) { return arr.slice(); } module.exports = clone; },{"../object/mixIn":44,"./isPlainObject":34,"./kindOf":36}],26:[function(require,module,exports){ var clone = require('./clone'); var forOwn = require('../object/forOwn'); var kindOf = require('./kindOf'); var isPlainObject = require('./isPlainObject'); /** * Recursively clone native types. */ function deepClone(val, instanceClone) { switch ( kindOf(val) ) { case 'Object': return cloneObject(val, instanceClone); case 'Array': return cloneArray(val, instanceClone); default: return clone(val); } } function cloneObject(source, instanceClone) { if (isPlainObject(source)) { var out = {}; forOwn(source, function(val, key) { this[key] = deepClone(val, instanceClone); }, out); return out; } else if (instanceClone) { return instanceClone(source); } else { return source; } } function cloneArray(arr, instanceClone) { var out = [], i = -1, n = arr.length, val; while (++i < n) { out[i] = deepClone(arr[i], instanceClone); } return out; } module.exports = deepClone; },{"../object/forOwn":41,"./clone":25,"./isPlainObject":34,"./kindOf":36}],27:[function(require,module,exports){ var isKind = require('./isKind'); /** */ var isArray = Array.isArray || function (val) { return isKind(val, 'Array'); }; module.exports = isArray; },{"./isKind":31}],28:[function(require,module,exports){ var isKind = require('./isKind'); /** */ function isBoolean(val) { return isKind(val, 'Boolean'); } module.exports = isBoolean; },{"./isKind":31}],29:[function(require,module,exports){ var forOwn = require('../object/forOwn'); var isArray = require('./isArray'); function isEmpty(val){ if (val == null) { // typeof null == 'object' so we check it first return true; } else if ( typeof val === 'string' || isArray(val) ) { return !val.length; } else if ( typeof val === 'object' ) { var result = true; forOwn(val, function(){ result = false; return false; // break loop }); return result; } else { return true; } } module.exports = isEmpty; },{"../object/forOwn":41,"./isArray":27}],30:[function(require,module,exports){ var isKind = require('./isKind'); /** */ function isFunction(val) { return isKind(val, 'Function'); } module.exports = isFunction; },{"./isKind":31}],31:[function(require,module,exports){ var kindOf = require('./kindOf'); /** * Check if value is from a specific "kind". */ function isKind(val, kind){ return kindOf(val) === kind; } module.exports = isKind; },{"./kindOf":36}],32:[function(require,module,exports){ var isKind = require('./isKind'); /** */ function isNumber(val) { return isKind(val, 'Number'); } module.exports = isNumber; },{"./isKind":31}],33:[function(require,module,exports){ var isKind = require('./isKind'); /** */ function isObject(val) { return isKind(val, 'Object'); } module.exports = isObject; },{"./isKind":31}],34:[function(require,module,exports){ /** * Checks if the value is created by the `Object` constructor. */ function isPlainObject(value) { return (!!value && typeof value === 'object' && value.constructor === Object); } module.exports = isPlainObject; },{}],35:[function(require,module,exports){ var isKind = require('./isKind'); /** */ function isString(val) { return isKind(val, 'String'); } module.exports = isString; },{"./isKind":31}],36:[function(require,module,exports){ var _rKind = /^\[object (.*)\]$/, _toString = Object.prototype.toString, UNDEF; /** * Gets the "kind" of value. (e.g. "String", "Number", etc) */ function kindOf(val) { if (val === null) { return 'Null'; } else if (val === UNDEF) { return 'Undefined'; } else { return _rKind.exec( _toString.call(val) )[1]; } } module.exports = kindOf; },{}],37:[function(require,module,exports){ /** * Typecast a value to a String, using an empty string value for null or * undefined. */ function toString(val){ return val == null ? '' : val.toString(); } module.exports = toString; },{}],38:[function(require,module,exports){ var forOwn = require('./forOwn'); var isArray = require('../lang/isArray'); function containsMatch(array, pattern) { var i = -1, length = array.length; while (++i < length) { if (deepMatches(array[i], pattern)) { return true; } } return false; } function matchArray(target, pattern) { var i = -1, patternLength = pattern.length; while (++i < patternLength) { if (!containsMatch(target, pattern[i])) { return false; } } return true; } function matchObject(target, pattern) { var result = true; forOwn(pattern, function(val, key) { if (!deepMatches(target[key], val)) { // Return false to break out of forOwn early return (result = false); } }); return result; } /** * Recursively check if the objects match. */ function deepMatches(target, pattern){ if (target && typeof target === 'object') { if (isArray(target) && isArray(pattern)) { return matchArray(target, pattern); } else { return matchObject(target, pattern); } } else { return target === pattern; } } module.exports = deepMatches; },{"../lang/isArray":27,"./forOwn":41}],39:[function(require,module,exports){ var forOwn = require('./forOwn'); var isPlainObject = require('../lang/isPlainObject'); /** * Mixes objects into the target object, recursively mixing existing child * objects. */ function deepMixIn(target, objects) { var i = 0, n = arguments.length, obj; while(++i < n){ obj = arguments[i]; if (obj) { forOwn(obj, copyProp, target); } } return target; } function copyProp(val, key) { var existing = this[key]; if (isPlainObject(val) && isPlainObject(existing)) { deepMixIn(existing, val); } else { this[key] = val; } } module.exports = deepMixIn; },{"../lang/isPlainObject":34,"./forOwn":41}],40:[function(require,module,exports){ var hasOwn = require('./hasOwn'); var _hasDontEnumBug, _dontEnums; function checkDontEnum(){ _dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ]; _hasDontEnumBug = true; for (var key in {'toString': null}) { _hasDontEnumBug = false; } } /** * Similar to Array/forEach but works over object properties and fixes Don't * Enum bug on IE. * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation */ function forIn(obj, fn, thisObj){ var key, i = 0; // no need to check if argument is a real object that way we can use // it for arrays, functions, date, etc. //post-pone check till needed if (_hasDontEnumBug == null) checkDontEnum(); for (key in obj) { if (exec(fn, obj, key, thisObj) === false) { break; } } if (_hasDontEnumBug) { var ctor = obj.constructor, isProto = !!ctor && obj === ctor.prototype; while (key = _dontEnums[i++]) { // For constructor, if it is a prototype object the constructor // is always non-enumerable unless defined otherwise (and // enumerated above). For non-prototype objects, it will have // to be defined on this object, since it cannot be defined on // any prototype objects. // // For other [[DontEnum]] properties, check if the value is // different than Object prototype value. if ( (key !== 'constructor' || (!isProto && hasOwn(obj, key))) && obj[key] !== Object.prototype[key] ) { if (exec(fn, obj, key, thisObj) === false) { break; } } } } } function exec(fn, obj, key, thisObj){ return fn.call(thisObj, obj[key], key, obj); } module.exports = forIn; },{"./hasOwn":42}],41:[function(require,module,exports){ var hasOwn = require('./hasOwn'); var forIn = require('./forIn'); /** * Similar to Array/forEach but works over object properties and fixes Don't * Enum bug on IE. * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation */ function forOwn(obj, fn, thisObj){ forIn(obj, function(val, key){ if (hasOwn(obj, key)) { return fn.call(thisObj, obj[key], key, obj); } }); } module.exports = forOwn; },{"./forIn":40,"./hasOwn":42}],42:[function(require,module,exports){ /** * Safer Object.hasOwnProperty */ function hasOwn(obj, prop){ return Object.prototype.hasOwnProperty.call(obj, prop); } module.exports = hasOwn; },{}],43:[function(require,module,exports){ var hasOwn = require('./hasOwn'); var deepClone = require('../lang/deepClone'); var isObject = require('../lang/isObject'); /** * Deep merge objects. */ function merge() { var i = 1, key, val, obj, target; // make sure we don't modify source element and it's properties // objects are passed by reference target = deepClone( arguments[0] ); while (obj = arguments[i++]) { for (key in obj) { if ( ! hasOwn(obj, key) ) { continue; } val = obj[key]; if ( isObject(val) && isObject(target[key]) ){ // inception, deep merge objects target[key] = merge(target[key], val); } else { // make sure arrays, regexp, date, objects are cloned target[key] = deepClone(val); } } } return target; } module.exports = merge; },{"../lang/deepClone":26,"../lang/isObject":33,"./hasOwn":42}],44:[function(require,module,exports){ var forOwn = require('./forOwn'); /** * Combine properties from all the objects into first one. * - This method affects target object in place, if you want to create a new Object pass an empty object as first param. * @param {object} target Target Object * @param {...object} objects Objects to be combined (0...n objects). * @return {object} Target Object. */ function mixIn(target, objects){ var i = 0, n = arguments.length, obj; while(++i < n){ obj = arguments[i]; if (obj != null) { forOwn(obj, copyProp, target); } } return target; } function copyProp(val, key){ this[key] = val; } module.exports = mixIn; },{"./forOwn":41}],45:[function(require,module,exports){ var forEach = require('../array/forEach'); /** * Create nested object if non-existent */ function namespace(obj, path){ if (!path) return obj; forEach(path.split('.'), function(key){ if (!obj[key]) { obj[key] = {}; } obj = obj[key]; }); return obj; } module.exports = namespace; },{"../array/forEach":15}],46:[function(require,module,exports){ var slice = require('../array/slice'); /** * Return a copy of the object, filtered to only have values for the whitelisted keys. */ function pick(obj, var_keys){ var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1), out = {}, i = 0, key; while (key = keys[i++]) { out[key] = obj[key]; } return out; } module.exports = pick; },{"../array/slice":19}],47:[function(require,module,exports){ var namespace = require('./namespace'); /** * set "nested" object property */ function set(obj, prop, val){ var parts = (/^(.+)\.(.+)$/).exec(prop); if (parts){ namespace(obj, parts[1])[parts[2]] = val; } else { obj[prop] = val; } } module.exports = set; },{"./namespace":45}],48:[function(require,module,exports){ var toString = require('../lang/toString'); var replaceAccents = require('./replaceAccents'); var removeNonWord = require('./removeNonWord'); var upperCase = require('./upperCase'); var lowerCase = require('./lowerCase'); /** * Convert string to camelCase text. */ function camelCase(str){ str = toString(str); str = replaceAccents(str); str = removeNonWord(str) .replace(/[\-_]/g, ' ') //convert all hyphens and underscores to spaces .replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE .replace(/\s+/g, '') //remove spaces .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase return str; } module.exports = camelCase; },{"../lang/toString":37,"./lowerCase":49,"./removeNonWord":52,"./replaceAccents":53,"./upperCase":54}],49:[function(require,module,exports){ var toString = require('../lang/toString'); /** * "Safer" String.toLowerCase() */ function lowerCase(str){ str = toString(str); return str.toLowerCase(); } module.exports = lowerCase; },{"../lang/toString":37}],50:[function(require,module,exports){ var join = require('../array/join'); var slice = require('../array/slice'); /** * Group arguments as path segments, if any of the args is `null` or an * empty string it will be ignored from resulting path. */ function makePath(var_args){ var result = join(slice(arguments), '/'); // need to disconsider duplicate '/' after protocol (eg: 'http://') return result.replace(/([^:\/]|^)\/{2,}/g, '$1/'); } module.exports = makePath; },{"../array/join":17,"../array/slice":19}],51:[function(require,module,exports){ var toString = require('../lang/toString'); var camelCase = require('./camelCase'); var upperCase = require('./upperCase'); /** * camelCase + UPPERCASE first char */ function pascalCase(str){ str = toString(str); return camelCase(str).replace(/^[a-z]/, upperCase); } module.exports = pascalCase; },{"../lang/toString":37,"./camelCase":48,"./upperCase":54}],52:[function(require,module,exports){ var toString = require('../lang/toString'); // This pattern is generated by the _build/pattern-removeNonWord.js script var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g; /** * Remove non-word chars. */ function removeNonWord(str){ str = toString(str); return str.replace(PATTERN, ''); } module.exports = removeNonWord; },{"../lang/toString":37}],53:[function(require,module,exports){ var toString = require('../lang/toString'); /** * Replaces all accented chars with regular ones */ function replaceAccents(str){ str = toString(str); // verifies if the String has accents and replace them if (str.search(/[\xC0-\xFF]/g) > -1) { str = str .replace(/[\xC0-\xC5]/g, "A") .replace(/[\xC6]/g, "AE") .replace(/[\xC7]/g, "C") .replace(/[\xC8-\xCB]/g, "E") .replace(/[\xCC-\xCF]/g, "I") .replace(/[\xD0]/g, "D") .replace(/[\xD1]/g, "N") .replace(/[\xD2-\xD6\xD8]/g, "O") .replace(/[\xD9-\xDC]/g, "U") .replace(/[\xDD]/g, "Y") .replace(/[\xDE]/g, "P") .replace(/[\xE0-\xE5]/g, "a") .replace(/[\xE6]/g, "ae") .replace(/[\xE7]/g, "c") .replace(/[\xE8-\xEB]/g, "e") .replace(/[\xEC-\xEF]/g, "i") .replace(/[\xF1]/g, "n") .replace(/[\xF2-\xF6\xF8]/g, "o") .replace(/[\xF9-\xFC]/g, "u") .replace(/[\xFE]/g, "p") .replace(/[\xFD\xFF]/g, "y"); } return str; } module.exports = replaceAccents; },{"../lang/toString":37}],54:[function(require,module,exports){ var toString = require('../lang/toString'); /** * "Safer" String.toUpperCase() */ function upperCase(str){ str = toString(str); return str.toUpperCase(); } module.exports = upperCase; },{"../lang/toString":37}],55:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var promisify = DSUtils.promisify; function create(resourceName, attrs, options) { var _this = this; var definition = _this.definitions[resourceName]; var promise = new DSUtils.Promise(function (resolve, reject) { options = options || {}; if (!definition) { reject(new DSErrors.NER(resourceName)); } else { if (!('cacheResponse' in options)) { options.cacheResponse = true; } if (!('upsert' in options)) { options.upsert = true; } resolve(attrs); } }); if (options.upsert && attrs[definition.idAttribute]) { return _this.update(resourceName, attrs[definition.idAttribute], attrs, options); } else { return promise .then(function (attrs) { var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.validate ? promisify(options.validate) : definition.validate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.beforeCreate ? promisify(options.beforeCreate) : definition.beforeCreate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { _this.notify(definition, 'beforeCreate', DSUtils.merge({}, attrs)); return _this.getAdapter(definition, options).create(definition, attrs, options); }) .then(function (data) { var func = options.afterCreate ? promisify(options.afterCreate) : definition.afterCreate; return func.call(data, resourceName, data); }) .then(function (attrs) { _this.notify(definition, 'afterCreate', DSUtils.merge({}, attrs)); if (options.cacheResponse) { var resource = _this.store[resourceName]; var created = _this.inject(definition.name, attrs, options); var id = created[definition.idAttribute]; resource.completedQueries[id] = new Date().getTime(); resource.previousAttributes[id] = DSUtils.deepMixIn({}, created); resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]); return _this.get(definition.name, id); } else { return _this.createInstance(resourceName, attrs, options); } }); } } module.exports = create; },{"../../errors":76,"../../utils":78}],56:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var promisify = DSUtils.promisify; function destroy(resourceName, id, options) { var _this = this; var definition = _this.definitions[resourceName]; var item; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; id = DSUtils.resolveId(definition, id); if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { reject(new DSErrors.IA('"id" must be a string or a number!')); } else if (!_this.get(resourceName, id)) { reject(new DSErrors.R('id "' + id + '" not found in cache!')); } else { item = _this.get(resourceName, id); if (!('notify' in options)) { options.notify = true; } resolve(item); } }) .then(function (attrs) { if (options.notify) { var func = options.beforeDestroy ? promisify(options.beforeDestroy) : definition.beforeDestroy; return func.call(attrs, resourceName, attrs); } else { return attrs; } }) .then(function (attrs) { if (options.notify) { _this.notify(definition, 'beforeDestroy', DSUtils.merge({}, attrs)); } if (options.eagerEject) { _this.eject(resourceName, id); } return _this.getAdapter(definition, options).destroy(definition, id, options); }) .then(function () { if (options.notify) { var func = options.afterDestroy ? promisify(options.afterDestroy) : definition.afterDestroy; return func.call(item, resourceName, item); } else { return item; } }) .then(function (item) { if (options.notify) { _this.notify(definition, 'afterDestroy', DSUtils.merge({}, item)); } _this.eject(resourceName, id); return id; }).catch(function (err) { if (options.eagerEject && item) { _this.inject(resourceName, item, { notify: false }); } throw err; }); } module.exports = destroy; },{"../../errors":76,"../../utils":78}],57:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function destroyAll(resourceName, params, options) { var _this = this; var definition = _this.definitions[resourceName]; var ejected, toEject; return new DSUtils.Promise(function (resolve, reject) { if (!definition) { reject(new DSErrors.NER(resourceName)); } else { options = options || {}; resolve(); } }).then(function () { var func = options.beforeDestroy ? promisify(options.beforeDestroy) : definition.beforeDestroy; toEject = _this.defaults.defaultFilter.call(_this, resourceName, params); return func(resourceName, toEject); }).then(function () { if (options.notify) { _this.notify(definition, 'beforeDestroy', toEject); } if (options.eagerEject) { ejected = _this.ejectAll(resourceName, params); } return _this.getAdapter(definition, options).destroyAll(definition, params, options); }).then(function () { var func = options.afterDestroy ? promisify(options.afterDestroy) : definition.afterDestroy; return func(resourceName, toEject); }).then(function () { if (options.notify) { _this.notify(definition, 'afterDestroy', toEject); } return ejected || _this.ejectAll(resourceName, params); }).catch(function (err) { if (options.eagerEject && ejected) { _this.inject(resourceName, ejected, { notify: false }); } throw err; }); } module.exports = destroyAll; },{"../../errors":76,"../../utils":78}],58:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function find(resourceName, id, options) { var _this = this; var definition = _this.definitions[resourceName]; var resource = _this.store[resourceName]; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { reject(new DSErrors.IA('"id" must be a string or a number!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { if (!('cacheResponse' in options)) { options.cacheResponse = true; } if (options.bypassCache || !options.cacheResponse) { delete resource.completedQueries[id]; } if (id in resource.completedQueries) { resolve(_this.get(resourceName, id)); } else { resolve(); } } }).then(function (item) { if (!(id in resource.completedQueries)) { if (!(id in resource.pendingQueries)) { resource.pendingQueries[id] = _this.getAdapter(definition, options).find(definition, id, options) .then(function (data) { if (options.cacheResponse) { // Query is no longer pending delete resource.pendingQueries[id]; resource.completedQueries[id] = new Date().getTime(); return _this.inject(resourceName, data, options); } else { return _this.createInstance(resourceName, data, options); } }); } return resource.pendingQueries[id]; } else { return item; } }).catch(function (err) { delete resource.pendingQueries[id]; throw err; }); } module.exports = find; },{"../../errors":76,"../../utils":78}],59:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function processResults(data, resourceName, queryHash, options) { var _this = this; var resource = _this.store[resourceName]; var idAttribute = _this.definitions[resourceName].idAttribute; var date = new Date().getTime(); data = data || []; // Query is no longer pending delete resource.pendingQueries[queryHash]; resource.completedQueries[queryHash] = date; // Update modified timestamp of collection resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified); // Merge the new values into the cache var injected = _this.inject(resourceName, data, options); // Make sure each object is added to completedQueries if (DSUtils.isArray(injected)) { DSUtils.forEach(injected, function (item) { if (item && item[idAttribute]) { resource.completedQueries[item[idAttribute]] = date; } }); } else { console.warn(errorPrefix(resourceName) + 'response is expected to be an array!'); resource.completedQueries[injected[idAttribute]] = date; } return injected; } function findAll(resourceName, params, options) { var _this = this; var definition = _this.definitions[resourceName]; var resource = _this.store[resourceName]; var queryHash; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; params = params || {}; if (!_this.definitions[resourceName]) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isObject(params)) { reject(new DSErrors.IA('"params" must be an object!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { if (!('cacheResponse' in options)) { options.cacheResponse = true; } queryHash = DSUtils.toJson(params); if (options.bypassCache || !options.cacheResponse) { delete resource.completedQueries[queryHash]; } if (queryHash in resource.completedQueries) { resolve(_this.filter(resourceName, params, options)); } else { resolve(); } } }).then(function (items) { if (!(queryHash in resource.completedQueries)) { if (!(queryHash in resource.pendingQueries)) { resource.pendingQueries[queryHash] = _this.getAdapter(definition, options).findAll(definition, params, options) .then(function (data) { delete resource.pendingQueries[queryHash]; if (options.cacheResponse) { return processResults.call(_this, data, resourceName, queryHash, options); } else { DSUtils.forEach(data, function (item, i) { data[i] = _this.createInstance(resourceName, item, options); }); return data; } }); } return resource.pendingQueries[queryHash]; } else { return items; } }).catch(function (err) { delete resource.pendingQueries[queryHash]; throw err; }); } module.exports = findAll; },{"../../errors":76,"../../utils":78}],60:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function refresh(resourceName, id, options) { var _this = this; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; id = DSUtils.resolveId(_this.definitions[resourceName], id); if (!_this.definitions[resourceName]) { reject(new _this.errors.NER(resourceName)); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { reject(new DSErrors.IA('"id" must be a string or a number!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { options.bypassCache = true; resolve(_this.get(resourceName, id)); } }).then(function (item) { if (item) { return _this.find(resourceName, id, options); } else { return item; } }); } module.exports = { create: require('./create'), destroy: require('./destroy'), destroyAll: require('./destroyAll'), find: require('./find'), findAll: require('./findAll'), loadRelations: require('./loadRelations'), refresh: refresh, save: require('./save'), update: require('./update'), updateAll: require('./updateAll') }; },{"../../errors":76,"../../utils":78,"./create":55,"./destroy":56,"./destroyAll":57,"./find":58,"./findAll":59,"./loadRelations":61,"./save":62,"./update":63,"./updateAll":64}],61:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function loadRelations(resourceName, instance, relations, options) { var _this = this; var definition = _this.definitions[resourceName]; var fields = []; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; if (DSUtils.isString(instance) || DSUtils.isNumber(instance)) { instance = _this.get(resourceName, instance); } if (DSUtils.isString(relations)) { relations = [relations]; } if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isObject(instance)) { reject(new DSErrors.IA('"instance(id)" must be a string, number or object!')); } else if (!DSUtils.isArray(relations)) { reject(new DSErrors.IA('"relations" must be a string or an array!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { if (!('findBelongsTo' in options)) { options.findBelongsTo = true; } if (!('findHasMany' in options)) { options.findHasMany = true; } var tasks = []; DSUtils.forEach(definition.relationList, function (def) { var relationName = def.relation; if (DSUtils.contains(relations, relationName)) { var task; var params = {}; params[def.foreignKey] = instance[definition.idAttribute]; if (def.type === 'hasMany' && params[def.foreignKey]) { task = _this.findAll(relationName, params, options); } else if (def.type === 'hasOne') { if (def.localKey && instance[def.localKey]) { task = _this.find(relationName, instance[def.localKey], options); } else if (def.foreignKey && params[def.foreignKey]) { task = _this.findAll(relationName, params, options).then(function (hasOnes) { return hasOnes.length ? hasOnes[0] : null; }); } } else if (instance[def.localKey]) { task = _this.find(relationName, instance[def.localKey], options); } if (task) { tasks.push(task); fields.push(def.localField); } } }); resolve(tasks); } }) .then(function (tasks) { return DSUtils.Promise.all(tasks); }) .then(function (loadedRelations) { DSUtils.forEach(fields, function (field, index) { instance[field] = loadedRelations[index]; }); return instance; }); } module.exports = loadRelations; },{"../../errors":76,"../../utils":78}],62:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var promisify = DSUtils.promisify; function save(resourceName, id, options) { var _this = this; var definition = _this.definitions[resourceName]; var item; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; id = DSUtils.resolveId(definition, id); if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { reject(new DSErrors.IA('"id" must be a string or a number!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else if (!_this.get(resourceName, id)) { reject(new DSErrors.R('id "' + id + '" not found in cache!')); } else { item = _this.get(resourceName, id); if (!('cacheResponse' in options)) { options.cacheResponse = true; } resolve(item); } }).then(function (attrs) { var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.validate ? promisify(options.validate) : definition.validate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { _this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs)); if (options.changesOnly) { var resource = _this.store[resourceName]; resource.observers[id].deliver(); var toKeep = []; var changes = _this.changes(resourceName, id); for (var key in changes.added) { toKeep.push(key); } for (key in changes.changed) { toKeep.push(key); } changes = DSUtils.pick(attrs, toKeep); if (DSUtils.isEmpty(changes)) { // no changes, return return attrs; } else { attrs = changes; } } return _this.getAdapter(definition, options).update(definition, id, attrs, options); }) .then(function (data) { var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate; return func.call(data, resourceName, data); }) .then(function (attrs) { _this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs)); if (options.cacheResponse) { var resource = _this.store[resourceName]; var saved = _this.inject(definition.name, attrs, options); resource.previousAttributes[id] = DSUtils.deepMixIn({}, saved); resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]); resource.observers[id].discardChanges(); return _this.get(resourceName, id); } else { return attrs; } }); } module.exports = save; },{"../../errors":76,"../../utils":78}],63:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var promisify = DSUtils.promisify; function update(resourceName, id, attrs, options) { var _this = this; var definition = _this.definitions[resourceName]; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; id = DSUtils.resolveId(definition, id); if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { reject(new DSErrors.IA('"id" must be a string or a number!')); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { if (!('cacheResponse' in options)) { options.cacheResponse = true; } resolve(attrs); } }).then(function (attrs) { var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.validate ? promisify(options.validate) : definition.validate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { _this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs)); return _this.getAdapter(definition, options).update(definition, id, attrs, options); }) .then(function (data) { var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate; return func.call(data, resourceName, data); }) .then(function (attrs) { _this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs)); if (options.cacheResponse) { var resource = _this.store[resourceName]; var updated = _this.inject(definition.name, attrs, options); var id = updated[definition.idAttribute]; resource.previousAttributes[id] = DSUtils.deepMixIn({}, updated); resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]); resource.observers[id].discardChanges(); return _this.get(definition.name, id); } else { return attrs; } }); } module.exports = update; },{"../../errors":76,"../../utils":78}],64:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var promisify = DSUtils.promisify; function updateAll(resourceName, attrs, params, options) { var _this = this; var definition = _this.definitions[resourceName]; return new DSUtils.Promise(function (resolve, reject) { options = options || {}; if (!definition) { reject(new DSErrors.NER(resourceName)); } else if (!DSUtils.isObject(options)) { reject(new DSErrors.IA('"options" must be an object!')); } else { if (!('cacheResponse' in options)) { options.cacheResponse = true; } resolve(attrs); } }).then(function (attrs) { var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.validate ? promisify(options.validate) : definition.validate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate; return func.call(attrs, resourceName, attrs); }) .then(function (attrs) { _this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs)); return _this.getAdapter(definition, options).updateAll(definition, attrs, params, options); }) .then(function (data) { var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate; return func.call(data, resourceName, data); }) .then(function (data) { _this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs)); if (options.cacheResponse) { return _this.inject(definition.name, data, options); } else { return data; } }); } module.exports = updateAll; },{"../../errors":76,"../../utils":78}],65:[function(require,module,exports){ var DSUtils = require('../utils'); var DSErrors = require('../errors'); var syncMethods = require('./sync_methods'); var asyncMethods = require('./async_methods'); DSUtils.deepFreeze(syncMethods); DSUtils.deepFreeze(asyncMethods); DSUtils.deepFreeze(DSErrors); DSUtils.deepFreeze(DSUtils); function lifecycleNoopCb(resourceName, attrs, cb) { cb(null, attrs); } function lifecycleNoop(resourceName, attrs) { return attrs; } function Defaults() { } var defaultsPrototype = Defaults.prototype; defaultsPrototype.idAttribute = 'id'; defaultsPrototype.defaultAdapter = 'DSHttpAdapter'; defaultsPrototype.defaultFilter = function (collection, resourceName, params, options) { var _this = this; var filtered = collection; var where = null; var reserved = { skip: '', offset: '', where: '', limit: '', orderBy: '', sort: '' }; params = params || {}; options = options || {}; if (DSUtils.isObject(params.where)) { where = params.where; } else { where = {}; } if (options.allowSimpleWhere) { DSUtils.forOwn(params, function (value, key) { if (!(key in reserved) && !(key in where)) { where[key] = { '==': value }; } }); } if (DSUtils.isEmpty(where)) { where = null; } if (where) { filtered = DSUtils.filter(filtered, function (attrs) { var first = true; var keep = true; DSUtils.forOwn(where, function (clause, field) { if (DSUtils.isString(clause)) { clause = { '===': clause }; } else if (DSUtils.isNumber(clause) || DSUtils.isBoolean(clause)) { clause = { '==': clause }; } if (DSUtils.isObject(clause)) { DSUtils.forOwn(clause, function (val, op) { if (op === '==') { keep = first ? (attrs[field] == val) : keep && (attrs[field] == val); } else if (op === '===') { keep = first ? (attrs[field] === val) : keep && (attrs[field] === val); } else if (op === '!=') { keep = first ? (attrs[field] != val) : keep && (attrs[field] != val); } else if (op === '!==') { keep = first ? (attrs[field] !== val) : keep && (attrs[field] !== val); } else if (op === '>') { keep = first ? (attrs[field] > val) : keep && (attrs[field] > val); } else if (op === '>=') { keep = first ? (attrs[field] >= val) : keep && (attrs[field] >= val); } else if (op === '<') { keep = first ? (attrs[field] < val) : keep && (attrs[field] < val); } else if (op === '<=') { keep = first ? (attrs[field] <= val) : keep && (attrs[field] <= val); } else if (op === 'in') { keep = first ? DSUtils.contains(val, attrs[field]) : keep && DSUtils.contains(val, attrs[field]); } else if (op === 'notIn') { keep = first ? !DSUtils.contains(val, attrs[field]) : keep && !DSUtils.contains(val, attrs[field]); } else if (op === '|==') { keep = first ? (attrs[field] == val) : keep || (attrs[field] == val); } else if (op === '|===') { keep = first ? (attrs[field] === val) : keep || (attrs[field] === val); } else if (op === '|!=') { keep = first ? (attrs[field] != val) : keep || (attrs[field] != val); } else if (op === '|!==') { keep = first ? (attrs[field] !== val) : keep || (attrs[field] !== val); } else if (op === '|>') { keep = first ? (attrs[field] > val) : keep || (attrs[field] > val); } else if (op === '|>=') { keep = first ? (attrs[field] >= val) : keep || (attrs[field] >= val); } else if (op === '|<') { keep = first ? (attrs[field] < val) : keep || (attrs[field] < val); } else if (op === '|<=') { keep = first ? (attrs[field] <= val) : keep || (attrs[field] <= val); } else if (op === '|in') { keep = first ? DSUtils.contains(val, attrs[field]) : keep || DSUtils.contains(val, attrs[field]); } else if (op === '|notIn') { keep = first ? !DSUtils.contains(val, attrs[field]) : keep || !DSUtils.contains(val, attrs[field]); } first = false; }); } }); return keep; }); } var orderBy = null; if (DSUtils.isString(params.orderBy)) { orderBy = [ [params.orderBy, 'ASC'] ]; } else if (DSUtils.isArray(params.orderBy)) { orderBy = params.orderBy; } if (!orderBy && DSUtils.isString(params.sort)) { orderBy = [ [params.sort, 'ASC'] ]; } else if (!orderBy && DSUtils.isArray(params.sort)) { orderBy = params.sort; } // Apply 'orderBy' if (orderBy) { DSUtils.forEach(orderBy, function (def) { if (DSUtils.isString(def)) { def = [def, 'ASC']; } else if (!DSUtils.isArray(def)) { throw new _this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): ' + DSUtils.toJson(def) + ': Must be a string or an array!', { params: { 'orderBy[i]': { actual: typeof def, expected: 'string|array' } } }); } filtered = DSUtils.sort(filtered, function (a, b) { var cA = a[def[0]], cB = b[def[0]]; if (DSUtils.isString(cA)) { cA = DSUtils.upperCase(cA); } if (DSUtils.isString(cB)) { cB = DSUtils.upperCase(cB); } if (def[1] === 'DESC') { if (cB < cA) { return -1; } else if (cB > cA) { return 1; } else { return 0; } } else { if (cA < cB) { return -1; } else if (cA > cB) { return 1; } else { return 0; } } }); }); } var limit = DSUtils.isNumber(params.limit) ? params.limit : null; var skip = null; if (DSUtils.isNumber(params.skip)) { skip = params.skip; } else if (DSUtils.isNumber(params.offset)) { skip = params.offset; } // Apply 'limit' and 'skip' if (limit && skip) { filtered = DSUtils.slice(filtered, skip, Math.min(filtered.length, skip + limit)); } else if (DSUtils.isNumber(limit)) { filtered = DSUtils.slice(filtered, 0, Math.min(filtered.length, limit)); } else if (DSUtils.isNumber(skip)) { if (skip < filtered.length) { filtered = DSUtils.slice(filtered, skip); } else { filtered = []; } } return filtered; }; defaultsPrototype.baseUrl = ''; defaultsPrototype.endpoint = ''; defaultsPrototype.useClass = true; defaultsPrototype.keepChangeHistory = false; defaultsPrototype.resetHistoryOnInject = true; defaultsPrototype.beforeValidate = lifecycleNoopCb; defaultsPrototype.validate = lifecycleNoopCb; defaultsPrototype.afterValidate = lifecycleNoopCb; defaultsPrototype.beforeCreate = lifecycleNoopCb; defaultsPrototype.afterCreate = lifecycleNoopCb; defaultsPrototype.beforeUpdate = lifecycleNoopCb; defaultsPrototype.afterUpdate = lifecycleNoopCb; defaultsPrototype.beforeDestroy = lifecycleNoopCb; defaultsPrototype.afterDestroy = lifecycleNoopCb; defaultsPrototype.beforeInject = lifecycleNoop; defaultsPrototype.afterInject = lifecycleNoop; defaultsPrototype.beforeEject = lifecycleNoop; defaultsPrototype.afterEject = lifecycleNoop; function DS(options) { this.store = {}; this.definitions = {}; this.adapters = {}; this.defaults = new Defaults(); DSUtils.deepMixIn(this.defaults, options); } var dsPrototype = DS.prototype; dsPrototype.getAdapter = function (def, options) { options = options || {}; return this.adapters[options.adapter] || this.adapters[def.defaultAdapter]; }; dsPrototype.notify = function (definition, event) { var args = Array.prototype.slice.call(arguments, 2); args.unshift(definition.name); args.unshift('DS.' + event); definition.emit.apply(definition, args); }; dsPrototype.errors = require('../errors'); dsPrototype.utils = DSUtils; DSUtils.deepMixIn(dsPrototype, syncMethods); DSUtils.deepMixIn(dsPrototype, asyncMethods); module.exports = DS; },{"../errors":76,"../utils":78,"./async_methods":60,"./sync_methods":70}],66:[function(require,module,exports){ /*jshint evil:true*/ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function Resource(options) { DSUtils.deepMixIn(this, options); if ('endpoint' in options) { this.endpoint = options.endpoint; } else { this.endpoint = this.name; } } var methodsToProxy = [ 'changes', 'changeHistory', 'create', 'createInstance', 'destroy', 'destroyAll', 'eject', 'ejectAll', 'filter', 'find', 'findAll', 'get', 'hasChanges', 'inject', 'lastModified', 'lastSaved', 'link', 'linkAll', 'linkInverse', 'loadRelations', 'previous', 'refresh', 'save', 'unlinkInverse', 'update', 'updateAll' ]; function defineResource(definition) { var _this = this; var definitions = _this.definitions; if (DSUtils.isString(definition)) { definition = { name: definition.replace(/\s/gi, '') }; } if (!DSUtils.isObject(definition)) { throw new DSErrors.IA('"definition" must be an object!'); } else if (!DSUtils.isString(definition.name)) { throw new DSErrors.IA('"name" must be a string!'); } else if (_this.store[definition.name]) { throw new DSErrors.R(definition.name + ' is already registered!'); } try { // Inherit from global defaults Resource.prototype = _this.defaults; definitions[definition.name] = new Resource(definition); var def = definitions[definition.name]; if (!DSUtils.isString(def.idAttribute)) { throw new DSErrors.IA('"idAttribute" must be a string!'); } // Setup nested parent configuration if (def.relations) { def.relationList = []; def.relationFields = []; DSUtils.forOwn(def.relations, function (relatedModels, type) { DSUtils.forOwn(relatedModels, function (defs, relationName) { if (!DSUtils.isArray(defs)) { relatedModels[relationName] = [defs]; } DSUtils.forEach(relatedModels[relationName], function (d) { d.type = type; d.relation = relationName; d.name = def.name; def.relationList.push(d); def.relationFields.push(d.localField); }); }); }); if (def.relations.belongsTo) { DSUtils.forOwn(def.relations.belongsTo, function (relatedModel, modelName) { DSUtils.forEach(relatedModel, function (relation) { if (relation.parent) { def.parent = modelName; def.parentKey = relation.localKey; } }); }); } DSUtils.deepFreeze(def.relations); DSUtils.deepFreeze(def.relationList); } def.getEndpoint = function (attrs, options) { var parent = this.parent; var parentKey = this.parentKey; var item; var endpoint; var thisEndpoint = options.endpoint || this.endpoint; var parentDef = definitions[parent]; delete options.endpoint; options = options || {}; options.params = options.params || {}; if (parent && parentKey && parentDef && options.params[parentKey] !== false) { if (DSUtils.isNumber(attrs) || DSUtils.isString(attrs)) { item = _this.get(this.name, attrs); } if (DSUtils.isObject(attrs) && parentKey in attrs) { delete options.params[parentKey]; endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), attrs[parentKey], thisEndpoint); } else if (item && parentKey in item) { delete options.params[parentKey]; endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), item[parentKey], thisEndpoint); } else if (options && options.params[parentKey]) { endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), options.params[parentKey], thisEndpoint); delete options.params[parentKey]; } } if (options.params[parentKey] === false) { delete options.params[parentKey]; } return endpoint || thisEndpoint; }; // Remove this in v0.11.0 and make a breaking change notice // the the `filter` option has been renamed to `defaultFilter` if (def.filter) { def.defaultFilter = def.filter; delete def.filter; } // Create the wrapper class for the new resource def.class = DSUtils.pascalCase(definition.name); eval('function ' + def.class + '() {}'); def[def.class] = eval(def.class); // Apply developer-defined methods if (def.methods) { DSUtils.deepMixIn(def[def.class].prototype, def.methods); } // Prepare for computed properties if (def.computed) { DSUtils.forOwn(def.computed, function (fn, field) { if (DSUtils.isFunction(fn)) { def.computed[field] = [fn]; fn = def.computed[field]; } if (def.methods && field in def.methods) { console.warn('Computed property "' + field + '" conflicts with previously defined prototype method!'); } var deps; if (fn.length === 1) { var match = fn[0].toString().match(/function.*?\(([\s\S]*?)\)/); deps = match[1].split(','); def.computed[field] = deps.concat(fn); fn = def.computed[field]; if (deps.length) { console.warn('Use the computed property array syntax for compatibility with minified code!'); } } deps = fn.slice(0, fn.length - 1); DSUtils.forEach(deps, function (val, index) { deps[index] = val.trim(); }); fn.deps = DSUtils.filter(deps, function (dep) { return !!dep; }); }); def[def.class].prototype.DSCompute = function () { return _this.compute(def.name, this); }; } // Initialize store data for the new resource _this.store[def.name] = { collection: [], completedQueries: {}, pendingQueries: {}, index: {}, modified: {}, saved: {}, previousAttributes: {}, observers: {}, changeHistories: {}, changeHistory: [], collectionModified: 0 }; // Proxy DS methods with shorthand ones DSUtils.forEach(methodsToProxy, function (name) { def[name] = function () { var args = Array.prototype.slice.call(arguments); args.unshift(def.name); return _this[name].apply(_this, args); }; }); def.beforeValidate = DSUtils.promisify(def.beforeValidate); def.validate = DSUtils.promisify(def.validate); def.afterValidate = DSUtils.promisify(def.afterValidate); def.beforeCreate = DSUtils.promisify(def.beforeCreate); def.afterCreate = DSUtils.promisify(def.afterCreate); def.beforeUpdate = DSUtils.promisify(def.beforeUpdate); def.afterUpdate = DSUtils.promisify(def.afterUpdate); def.beforeDestroy = DSUtils.promisify(def.beforeDestroy); def.afterDestroy = DSUtils.promisify(def.afterDestroy); // Mix-in events DSUtils.Events(def); return def; } catch (err) { console.error(err); delete definitions[definition.name]; delete _this.store[definition.name]; throw err; } } module.exports = defineResource; },{"../../errors":76,"../../utils":78}],67:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function eject(resourceName, id, options) { var _this = this; var definition = _this.definitions[resourceName]; var resource = _this.store[resourceName]; var item; var found = false; options = options || {}; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } else if (!DSUtils.isObject(options)) { throw new DSErrors.IA('"options" must be an object!'); } for (var i = 0; i < resource.collection.length; i++) { if (resource.collection[i][definition.idAttribute] == id) { item = resource.collection[i]; found = true; break; } } if (found) { if (!('notify' in options)) { options.notify = true; } if (options.notify) { definition.beforeEject(definition.name, item); } _this.unlinkInverse(definition.name, id); resource.collection.splice(i, 1); resource.observers[id].close(); delete resource.observers[id]; delete resource.index[id]; delete resource.previousAttributes[id]; delete resource.completedQueries[id]; delete resource.pendingQueries[id]; DSUtils.forEach(resource.changeHistories[id], function (changeRecord) { DSUtils.remove(resource.changeHistory, changeRecord); }); delete resource.changeHistories[id]; delete resource.modified[id]; delete resource.saved[id]; resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified); if (options.notify) { definition.afterEject(definition.name, item); _this.notify(definition, 'eject', item); } return item; } } module.exports = eject; },{"../../errors":76,"../../utils":78}],68:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function ejectAll(resourceName, params, options) { var _this = this; var definition = _this.definitions[resourceName]; params = params || {}; if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isObject(params)) { throw new DSErrors.IA('"params" must be an object!'); } var resource = _this.store[resourceName]; if (DSUtils.isEmpty(params)) { resource.completedQueries = {}; } var queryHash = DSUtils.toJson(params); var items = _this.filter(definition.name, params); var ids = DSUtils.toLookup(items, definition.idAttribute); DSUtils.forOwn(ids, function (item, id) { _this.eject(definition.name, id, options); }); delete resource.completedQueries[queryHash]; resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified); return items; } module.exports = ejectAll; },{"../../errors":76,"../../utils":78}],69:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function filter(resourceName, params, options) { var _this = this; var definition = _this.definitions[resourceName]; options = options || {}; if (!definition) { throw new DSErrors.NER(resourceName); } else if (params && !DSUtils.isObject(params)) { throw new DSErrors.IA('"params" must be an object!'); } else if (!DSUtils.isObject(options)) { throw new DSErrors.IA('"options" must be an object!'); } var resource = _this.store[resourceName]; // Protect against null params = params || {}; if (!('allowSimpleWhere' in options)) { options.allowSimpleWhere = true; } var queryHash = DSUtils.toJson(params); if (!(queryHash in resource.completedQueries) && options.loadFromServer) { // This particular query has never been completed if (!resource.pendingQueries[queryHash]) { // This particular query has never even been started _this.findAll(resourceName, params, options); } } return definition.defaultFilter.call(_this, resource.collection, resourceName, params, options); } module.exports = filter; },{"../../errors":76,"../../utils":78}],70:[function(require,module,exports){ var observe = require('../../../lib/observe-js/observe-js'); var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function changes(resourceName, id) { var _this = this; var definition = _this.definitions[resourceName]; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } var item = _this.get(resourceName, id); if (item) { _this.store[resourceName].observers[id].deliver(); var diff = DSUtils.diffObjectFromOldObject(item, _this.store[resourceName].previousAttributes[id]); DSUtils.forOwn(diff, function (changeset, name) { var toKeep = []; DSUtils.forOwn(changeset, function (value, field) { if (!DSUtils.isFunction(value)) { toKeep.push(field); } }); diff[name] = DSUtils.pick(diff[name], toKeep); }); DSUtils.forEach(definition.relationFields, function (field) { delete diff.added[field]; delete diff.removed[field]; delete diff.changed[field]; }); return diff; } } function changeHistory(resourceName, id) { var _this = this; var definition = _this.definitions[resourceName]; var resource = _this.store[resourceName]; id = DSUtils.resolveId(definition, id); if (resourceName && !_this.definitions[resourceName]) { throw new DSErrors.NER(resourceName); } else if (id && !DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } if (!definition.keepChangeHistory) { console.warn('changeHistory is disabled for this resource!'); } else { if (resourceName) { var item = _this.get(resourceName, id); if (item) { return resource.changeHistories[id]; } } else { return resource.changeHistory; } } } function createInstance(resourceName, attrs, options) { var definition = this.definitions[resourceName]; attrs = attrs || {}; options = options || {}; if (!definition) { throw new DSErrors.NER(resourceName); } else if (attrs && !DSUtils.isObject(attrs)) { throw new DSErrors.IA('"attrs" must be an object!'); } else if (!DSUtils.isObject(options)) { throw new DSErrors.IA('"options" must be an object!'); } if (!('useClass' in options)) { options.useClass = definition.useClass; } var item; if (options.useClass) { var Constructor = definition[definition.class]; item = new Constructor(); } else { item = {}; } return DSUtils.deepMixIn(item, attrs); } function diffIsEmpty(diff) { return !(DSUtils.isEmpty(diff.added) && DSUtils.isEmpty(diff.removed) && DSUtils.isEmpty(diff.changed)); } function digest() { observe.Platform.performMicrotaskCheckpoint(); } function compute(resourceName, instance) { var _this = this; var definition = _this.definitions[resourceName]; instance = DSUtils.resolveItem(_this.store[resourceName], instance); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isObject(instance) && !DSUtils.isString(instance) && !DSUtils.isNumber(instance)) { throw new DSErrors.IA('"instance" must be an object, string or number!'); } if (DSUtils.isString(instance) || DSUtils.isNumber(instance)) { instance = _this.get(resourceName, instance); } DSUtils.forOwn(definition.computed, function (fn, field) { DSUtils.compute.call(instance, fn, field, DSUtils); }); return instance; } function get(resourceName, id, options) { var _this = this; options = options || {}; if (!_this.definitions[resourceName]) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } else if (!DSUtils.isObject(options)) { throw new DSErrors.IA('"options" must be an object!'); } // cache miss, request resource from server var item = _this.store[resourceName].index[id]; if (!item && options.loadFromServer) { _this.find(resourceName, id, options); } // return resource from cache return item; } function hasChanges(resourceName, id) { var _this = this; id = DSUtils.resolveId(_this.definitions[resourceName], id); if (!_this.definitions[resourceName]) { throw new DSErrors.NER(resourceName); } // return resource from cache if (_this.get(resourceName, id)) { return diffIsEmpty(_this.changes(resourceName, id)); } else { return false; } } function lastModified(resourceName, id) { var definition = this.definitions[resourceName]; var resource = this.store[resourceName]; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } if (id) { if (!(id in resource.modified)) { resource.modified[id] = 0; } return resource.modified[id]; } return resource.collectionModified; } function lastSaved(resourceName, id) { var definition = this.definitions[resourceName]; var resource = this.store[resourceName]; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } if (!(id in resource.saved)) { resource.saved[id] = 0; } return resource.saved[id]; } function previous(resourceName, id) { var _this = this; var definition = _this.definitions[resourceName]; var resource = _this.store[resourceName]; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } // return resource from cache return resource.previousAttributes[id] ? DSUtils.merge({}, resource.previousAttributes[id]) : undefined; } module.exports = { changes: changes, changeHistory: changeHistory, compute: compute, createInstance: createInstance, defineResource: require('./defineResource'), digest: digest, eject: require('./eject'), ejectAll: require('./ejectAll'), filter: require('./filter'), get: get, hasChanges: hasChanges, inject: require('./inject'), lastModified: lastModified, lastSaved: lastSaved, link: require('./link'), linkAll: require('./linkAll'), linkInverse: require('./linkInverse'), previous: previous, unlinkInverse: require('./unlinkInverse') }; },{"../../../lib/observe-js/observe-js":1,"../../errors":76,"../../utils":78,"./defineResource":66,"./eject":67,"./ejectAll":68,"./filter":69,"./inject":71,"./link":72,"./linkAll":73,"./linkInverse":74,"./unlinkInverse":75}],71:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); var observe = require('../../../lib/observe-js/observe-js'); var stack = 0; var data = { injectedSoFar: {} }; function _getReactFunction(DS, definition, resource) { return function _react(added, removed, changed, oldValueFn, firstTime) { var target = this; var item; var innerId = (oldValueFn && oldValueFn(definition.idAttribute)) ? oldValueFn(definition.idAttribute) : target[definition.idAttribute]; DSUtils.forEach(definition.relationFields, function (field) { delete added[field]; delete removed[field]; delete changed[field]; }); if (!DSUtils.isEmpty(added) || !DSUtils.isEmpty(removed) || !DSUtils.isEmpty(changed) || firstTime) { item = DS.get(definition.name, innerId); resource.modified[innerId] = DSUtils.updateTimestamp(resource.modified[innerId]); resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified); if (definition.keepChangeHistory) { var changeRecord = { resourceName: definition.name, target: item, added: added, removed: removed, changed: changed, timestamp: resource.modified[innerId] }; resource.changeHistories[innerId].push(changeRecord); resource.changeHistory.push(changeRecord); } } if (definition.computed) { item = item || DS.get(definition.name, innerId); DSUtils.forOwn(definition.computed, function (fn, field) { var compute = false; // check if required fields changed DSUtils.forEach(fn.deps, function (dep) { if (dep in added || dep in removed || dep in changed || !(field in item)) { compute = true; } }); compute = compute || !fn.deps.length; if (compute) { DSUtils.compute.call(item, fn, field, DSUtils); } }); } if (definition.relations) { item = item || DS.get(definition.name, innerId); DSUtils.forEach(definition.relationList, function (def) { if (item[def.localField] && (def.localKey in added || def.localKey in removed || def.localKey in changed)) { DS.link(definition.name, item[definition.idAttribute], [def.relation]); } }); } if (definition.idAttribute in changed) { console.error('Doh! You just changed the primary key of an object! ' + 'I don\'t know how to handle this yet, so your data for the "' + definition.name + '" resource is now in an undefined (probably broken) state.'); } }; } function _inject(definition, resource, attrs, options) { var _this = this; var _react = _getReactFunction(_this, definition, resource, attrs, options); var injected; if (DSUtils.isArray(attrs)) { injected = []; for (var i = 0; i < attrs.length; i++) { injected.push(_inject.call(_this, definition, resource, attrs[i], options)); } } else { // check if "idAttribute" is a computed property var c = definition.computed; var idA = definition.idAttribute; if (c && c[idA]) { var args = []; DSUtils.forEach(c[idA].deps, function (dep) { args.push(attrs[dep]); }); attrs[idA] = c[idA][c[idA].length - 1].apply(attrs, args); } if (!(idA in attrs)) { var error = new DSErrors.R(definition.name + '.inject: "attrs" must contain the property specified by `idAttribute`!'); console.error(error); throw error; } else { try { var id = attrs[idA]; var item = _this.get(definition.name, id); if (!item) { if (options.useClass) { if (attrs instanceof definition[definition.class]) { item = attrs; } else { item = new definition[definition.class](); } } else { item = {}; } resource.previousAttributes[id] = {}; DSUtils.deepMixIn(item, attrs); DSUtils.deepMixIn(resource.previousAttributes[id], attrs); resource.collection.push(item); resource.changeHistories[id] = []; resource.observers[id] = new observe.ObjectObserver(item); resource.observers[id].open(_react, item); resource.index[id] = item; _react.call(item, {}, {}, {}, null, true); } else { DSUtils.deepMixIn(item, attrs); if (definition.resetHistoryOnInject) { resource.previousAttributes[id] = {}; DSUtils.deepMixIn(resource.previousAttributes[id], attrs); if (resource.changeHistories[id].length) { DSUtils.forEach(resource.changeHistories[id], function (changeRecord) { DSUtils.remove(resource.changeHistory, changeRecord); }); resource.changeHistories[id].splice(0, resource.changeHistories[id].length); } } resource.observers[id].deliver(); } resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]); injected = item; } catch (err) { console.error(err); console.error('inject failed!', definition.name, attrs); } } } return injected; } function _injectRelations(definition, injected, options) { var _this = this; function _process(def, relationName, injected) { var relationDef = _this.definitions[relationName]; if (relationDef && injected[def.localField] && !data.injectedSoFar[relationName + injected[def.localField][relationDef.idAttribute]]) { try { data.injectedSoFar[relationName + injected[def.localField][relationDef.idAttribute]] = 1; injected[def.localField] = _this.inject(relationName, injected[def.localField], options); } catch (err) { console.error(definition.name + ': Failed to inject ' + def.type + ' relation: "' + relationName + '"!', err); } } else if (options.findBelongsTo && def.type === 'belongsTo') { if (DSUtils.isArray(injected)) { DSUtils.forEach(injected, function (injectedItem) { _this.link(definition.name, injectedItem[definition.idAttribute], [relationName]); }); } else { _this.link(definition.name, injected[definition.idAttribute], [relationName]); } } else if ((options.findHasMany && def.type === 'hasMany') || (options.findHasOne && def.type === 'hasOne')) { if (DSUtils.isArray(injected)) { DSUtils.forEach(injected, function (injectedItem) { _this.link(definition.name, injectedItem[definition.idAttribute], [relationName]); }); } else { _this.link(definition.name, injected[definition.idAttribute], [relationName]); } } } DSUtils.forEach(definition.relationList, function (def) { if (DSUtils.isArray(injected)) { DSUtils.forEach(injected, function (injectedI) { _process(def, def.relation, injectedI); }); } else { _process(def, def.relation, injected); } }); } function inject(resourceName, attrs, options) { var _this = this; var definition = _this.definitions[resourceName]; options = options || {}; if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isObject(attrs) && !DSUtils.isArray(attrs)) { throw new DSErrors.IA(resourceName + '.inject: "attrs" must be an object or an array!'); } else if (!DSUtils.isObject(options)) { throw new DSErrors.IA('"options" must be an object!'); } var injected; stack++; try { if (!('useClass' in options)) { options.useClass = definition.useClass; } if (!('notify' in options)) { options.notify = true; } if (options.notify) { definition.beforeInject(definition.name, attrs); } injected = _inject.call(_this, definition, _this.store[resourceName], attrs, options); if (definition.relations) { _injectRelations.call(_this, definition, injected, options); } if (options.linkInverse) { if (DSUtils.isArray(injected) && injected.length) { _this.linkInverse(definition.name, injected[0][definition.idAttribute]); } else { _this.linkInverse(definition.name, injected[definition.idAttribute]); } } if (options.notify) { definition.afterInject(definition.name, injected); _this.notify(definition, 'inject', injected); } stack--; } catch (err) { stack--; throw err; } if (!stack) { data.injectedSoFar = {}; } return injected; } module.exports = inject; },{"../../../lib/observe-js/observe-js":1,"../../errors":76,"../../utils":78}],72:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function link(resourceName, id, relations) { var _this = this; var definition = _this.definitions[resourceName]; relations = relations || []; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } else if (!DSUtils.isArray(relations)) { throw new DSErrors.IA('"relations" must be an array!'); } var linked = _this.get(resourceName, id); if (linked) { DSUtils.forEach(definition.relationList, function (def) { var relationName = def.relation; if (relations.length && !DSUtils.contains(relations, relationName)) { return; } var params = {}; if (def.type === 'belongsTo') { var parent = linked[def.localKey] ? _this.get(relationName, linked[def.localKey]) : null; if (parent) { linked[def.localField] = parent; } } else if (def.type === 'hasMany') { params[def.foreignKey] = linked[definition.idAttribute]; linked[def.localField] = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true }); } else if (def.type === 'hasOne') { params[def.foreignKey] = linked[definition.idAttribute]; var children = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true }); if (children.length) { linked[def.localField] = children[0]; } } }); } return linked; } module.exports = link; },{"../../errors":76,"../../utils":78}],73:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function linkAll(resourceName, params, relations) { var _this = this; var definition = _this.definitions[resourceName]; relations = relations || []; if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isArray(relations)) { throw new DSErrors.IA('"relations" must be an array!'); } var linked = _this.filter(resourceName, params); if (linked) { DSUtils.forEach(definition.relationList, function (def) { var relationName = def.relation; if (relations.length && !DSUtils.contains(relations, relationName)) { return; } if (def.type === 'belongsTo') { DSUtils.forEach(linked, function (injectedItem) { var parent = injectedItem[def.localKey] ? _this.get(relationName, injectedItem[def.localKey]) : null; if (parent) { injectedItem[def.localField] = parent; } }); } else if (def.type === 'hasMany') { DSUtils.forEach(linked, function (injectedItem) { var params = {}; params[def.foreignKey] = injectedItem[definition.idAttribute]; injectedItem[def.localField] = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true }); }); } else if (def.type === 'hasOne') { DSUtils.forEach(linked, function (injectedItem) { var params = {}; params[def.foreignKey] = injectedItem[definition.idAttribute]; var children = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true }); if (children.length) { injectedItem[def.localField] = children[0]; } }); } }); } return linked; } module.exports = linkAll; },{"../../errors":76,"../../utils":78}],74:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); function linkInverse(resourceName, id, relations) { var _this = this; var definition = _this.definitions[resourceName]; relations = relations || []; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } else if (!DSUtils.isArray(relations)) { throw new DSErrors.IA('"relations" must be an array!'); } var linked = _this.get(resourceName, id); if (linked) { DSUtils.forOwn(_this.definitions, function (d) { DSUtils.forOwn(d.relations, function (relatedModels) { DSUtils.forOwn(relatedModels, function (defs, relationName) { if (relations.length && !DSUtils.contains(relations, d.name)) { return; } if (definition.name === relationName) { _this.linkAll(d.name, {}, [definition.name]); } }); }); }); } return linked; } module.exports = linkInverse; },{"../../errors":76,"../../utils":78}],75:[function(require,module,exports){ var DSUtils = require('../../utils'); var DSErrors = require('../../errors'); /** * @doc method * @id DS.sync methods:unlinkInverse * @name unlinkInverse * @description * Find relations of the item with the given primary key that are already in the data store and _unlink_ this item from those * relations. This unlinks links that would be created by `DS.linkInverse`. * * ## Signature: * ```js * DS.unlinkInverse(resourceName, id[, relations]) * ``` * * ## Examples: * * Assume `organization` has `hasMany` relationship to `user` and `post` has a `belongsTo` relationship to `user`. * ```js * DS.get('organization', 5); // { id: 5, users: [{ organizationId: 5, id: 1 }] } * * // unlink user 1 from its relations * DS.unlinkInverse('user', 1, ['organization']); * * DS.get('organization', 5); // { id: 5, users: [] } * ``` * * ## Throws * * - `{IllegalArgumentError}` * - `{NonexistentResourceError}` * * @param {string} resourceName The resource type, e.g. 'user', 'comment', etc. * @param {string|number} id The primary key of the item for which to unlink relations. * @param {array=} relations The relations to be unlinked. If not provided then all relations will be unlinked. Default: `[]`. * @returns {object|array} A reference to the item that has been unlinked. */ function unlinkInverse(resourceName, id, relations) { var _this = this; var definition = _this.definitions[resourceName]; relations = relations || []; id = DSUtils.resolveId(definition, id); if (!definition) { throw new DSErrors.NER(resourceName); } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) { throw new DSErrors.IA('"id" must be a string or a number!'); } else if (!DSUtils.isArray(relations)) { throw new DSErrors.IA('"relations" must be an array!'); } var linked = _this.get(resourceName, id); if (linked) { DSUtils.forOwn(_this.definitions, function (d) { DSUtils.forOwn(d.relations, function (relatedModels) { DSUtils.forOwn(relatedModels, function (defs, relationName) { if (definition.name === relationName) { DSUtils.forEach(defs, function (def) { DSUtils.forEach(_this.store[def.name].collection, function (item) { if (def.type === 'hasMany' && item[def.localField]) { var index; DSUtils.forEach(item[def.localField], function (subItem, i) { if (subItem === linked) { index = i; } }); item[def.localField].splice(index, 1); } else if (item[def.localField] === linked) { delete item[def.localField]; } }); }); } }); }); }); } return linked; } module.exports = unlinkInverse; },{"../../errors":76,"../../utils":78}],76:[function(require,module,exports){ function IllegalArgumentError(message) { Error.call(this); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, this.constructor); } this.type = this.constructor.name; this.message = message || 'Illegal Argument!'; } IllegalArgumentError.prototype = Object.create(Error.prototype); IllegalArgumentError.prototype.constructor = IllegalArgumentError; function RuntimeError(message) { Error.call(this); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, this.constructor); } this.type = this.constructor.name; this.message = message || 'RuntimeError Error!'; } RuntimeError.prototype = Object.create(Error.prototype); RuntimeError.prototype.constructor = RuntimeError; function NonexistentResourceError(resourceName) { Error.call(this); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, this.constructor); } this.type = this.constructor.name; this.message = (resourceName || '') + ' is not a registered resource!'; } NonexistentResourceError.prototype = Object.create(Error.prototype); NonexistentResourceError.prototype.constructor = NonexistentResourceError; module.exports = { IllegalArgumentError: IllegalArgumentError, IA: IllegalArgumentError, RuntimeError: RuntimeError, R: RuntimeError, NonexistentResourceError: NonexistentResourceError, NER: NonexistentResourceError }; },{}],77:[function(require,module,exports){ var DS = require('./datastore'); /** * @doc overview * @id js-data * @name js-data * @description * __Version:__ 0.0.1 * * ## Install * * `bower install --save js-data` or `npm install --save js-data` * * #### Manual download * Download js-data from the [Releases](https://github.com/js-data/js-data/releases) section of the js-data GitHub project. * * - `DS` * - `DSHttpAdapter` * - `DSLocalStorageAdapter` * - `DSUtils` * - `DSErrors` * * [DS](/documentation/api/api/DS) is the Data Store itself, which you will inject often. * [DSHttpAdapter](/documentation/api/api/DSHttpAdapter) is useful as a wrapper for `http` and is configurable. * [DSLocalStorageAdapter](/documentation/api/api/DSLocalStorageAdapter) is useful as a wrapper for `localStorage` and is configurable. * [DSUtils](/documentation/api/api/DSUtils) has some useful utility methods. * [DSErrors](/documentation/api/api/DSErrors) provides references to the various errors thrown by the data store. */ module.exports = { DS: DS, createStore: function () { return new DS(); }, DSUtils: require('./utils'), DSErrors: require('./errors') }; },{"./datastore":65,"./errors":76,"./utils":78}],78:[function(require,module,exports){ function Events(target) { var events = {}; target = target || this; target.on = function (type, func, ctx) { events[type] = events[type] || []; events[type].push({ f: func, c: ctx }); }; target.off = function (type, func) { var listeners = events[type]; if (!listeners) { events = {}; } else if (func) { for (var i = 0; i < listeners.length; i++) { if (listeners[i] === func) { listeners.splice(i, 1); break; } } } else { listeners.splice(0, listeners.length); } }; target.emit = function () { var args = Array.prototype.slice.call(arguments); var listeners = events[args.shift()] || []; if (listeners) { for (var i = 0; i < listeners.length; i++) { listeners[i].f.apply(listeners[i].c, args); } } }; } module.exports = { isBoolean: require('mout/lang/isBoolean'), isString: require('mout/lang/isString'), isArray: require('mout/lang/isArray'), isObject: require('mout/lang/isObject'), isNumber: require('mout/lang/isNumber'), isFunction: require('mout/lang/isFunction'), isEmpty: require('mout/lang/isEmpty'), toJson: JSON.stringify, fromJson: JSON.parse, makePath: require('mout/string/makePath'), upperCase: require('mout/string/upperCase'), pascalCase: require('mout/string/pascalCase'), deepMixIn: require('mout/object/deepMixIn'), forOwn: require('mout/object/forOwn'), forEach: require('mout/array/forEach'), pick: require('mout/object/pick'), set: require('mout/object/set'), merge: require('mout/object/merge'), contains: require('mout/array/contains'), filter: require('mout/array/filter'), toLookup: require('mout/array/toLookup'), remove: require('mout/array/remove'), slice: require('mout/array/slice'), sort: require('mout/array/sort'), resolveItem: function (resource, idOrInstance) { if (resource && (this.isString(idOrInstance) || this.isNumber(idOrInstance))) { return resource.index[idOrInstance] || idOrInstance; } else { return idOrInstance; } }, resolveId: function (definition, idOrInstance) { if (this.isString(idOrInstance) || this.isNumber(idOrInstance)) { return idOrInstance; } else if (idOrInstance && definition) { return idOrInstance[definition.idAttribute] || idOrInstance; } else { return idOrInstance; } }, updateTimestamp: function (timestamp) { var newTimestamp = typeof Date.now === 'function' ? Date.now() : new Date().getTime(); if (timestamp && newTimestamp <= timestamp) { return timestamp + 1; } else { return newTimestamp; } }, Promise: require('es6-promise').Promise, deepFreeze: function deepFreeze(o) { if (typeof Object.freeze === 'function') { var prop, propKey; Object.freeze(o); // First freeze the object. for (propKey in o) { prop = o[propKey]; if (!o.hasOwnProperty(propKey) || typeof prop !== 'object' || Object.isFrozen(prop)) { // If the object is on the prototype, not an object, or is already frozen, // skip it. Note that this might leave an unfrozen reference somewhere in the // object if there is an already frozen object containing an unfrozen object. continue; } deepFreeze(prop); // Recursively call deepFreeze. } } }, compute: function (fn, field, DSUtils) { var _this = this; var args = []; DSUtils.forEach(fn.deps, function (dep) { args.push(_this[dep]); }); // compute property this[field] = fn[fn.length - 1].apply(this, args); }, diffObjectFromOldObject: function (object, oldObject) { var added = {}; var removed = {}; var changed = {}; for (var prop in oldObject) { var newValue = object[prop]; if (newValue !== undefined && newValue === oldObject[prop]) continue; if (!(prop in object)) { removed[prop] = undefined; continue; } if (newValue !== oldObject[prop]) changed[prop] = newValue; } for (var prop2 in object) { if (prop2 in oldObject) continue; added[prop2] = object[prop2]; } return { added: added, removed: removed, changed: changed }; }, promisify: function (fn, target) { var Promise = this.Promise; if (!fn) { return; } else if (typeof fn !== 'function') { throw new Error('Can only promisify functions!'); } return function () { var args = Array.prototype.slice.apply(arguments); return new Promise(function (resolve, reject) { args.push(function (err, result) { if (err) { reject(err); } else { resolve(result); } }); try { var promise = fn.apply(target || this, args); if (promise && promise.then) { promise.then(resolve, reject); } } catch (err) { reject(err); } }); }; }, Events: Events }; },{"es6-promise":2,"mout/array/contains":13,"mout/array/filter":14,"mout/array/forEach":15,"mout/array/remove":18,"mout/array/slice":19,"mout/array/sort":20,"mout/array/toLookup":21,"mout/lang/isArray":27,"mout/lang/isBoolean":28,"mout/lang/isEmpty":29,"mout/lang/isFunction":30,"mout/lang/isNumber":32,"mout/lang/isObject":33,"mout/lang/isString":35,"mout/object/deepMixIn":39,"mout/object/forOwn":41,"mout/object/merge":43,"mout/object/pick":46,"mout/object/set":47,"mout/string/makePath":50,"mout/string/pascalCase":51,"mout/string/upperCase":54}]},{},[77])(77) });
api/controllers/utils/dbutil.js
molgenis/gene-network
const _ = require('lodash'); const fs = require('fs'); const level = require('level'); const genedesc = require('./genedesc'); const genstats = require('genstats'); const descriptives = genstats.descriptives; const probability = genstats.probability; const wilcoxon = genstats.wilcoxon; const quicksort = require('./quicksort'); const quicksortobj = require('./quicksortobj'); const sortby = require('./sort').sortby; const lookup = function (value) { return (value - 32768) / 1000 }; var exp = module.exports; //////////// var genedb = level(sails.config.geneDBPath, { valueEncoding: 'binary' }); var pathwaydb = level(sails.config.pathwayDBPath, { valueEncoding: 'binary' }); var celltypedb = level(sails.config.celltypeDBPath, { valueEncoding: 'binary' }); var transcriptbardb = level(sails.config.transcriptBarsDBpath, { valueEncoding: 'binary' }); //var pathwayrankdb = level(sails.config.pathwayRankDBPath, {valueEncoding: 'binary'}) // var pcdb = level(sails.config.pcDBPath, { // valueEncoding: 'binary' // }) var correlationdb = level(sails.config.correlationDBPath, { valueEncoding: 'binary' }); var tissuecorrelationdb = level(sails.config.tissuecorrelationDBPath, { valueEncoding: 'binary' }); var transcriptdb = level(sails.config.transcriptDBpath, { valueEncoding: 'binary' }); var hpocorrelationdb = level(sails.config.hpocorrelationDB, { valueEncoding: 'binary' }); //TODO this data to the database var getPathwayDatabasesFromDB = function(db, callback) { var databases = [ {id: 'REACTOME', name: 'Reactome', fullName: 'Reactome', description: 'A curated pathway database', url: 'http://www.reactome.org/', inMemory: true}, {id: 'HPO', name: 'Human Phenotype Ontology', fullName: 'Human Phenotype Ontology', description: 'A human phenotype database and tool', url: 'http://www.human-phenotype-ontology.org/', inMemory: true}, {id: 'GO_P', name: 'GO biological process', fullName: 'Gene Ontology - Biological process', description: 'Consistent description of gene products', url: 'http://geneontology.org/', inMemory: true}, {id: 'GO_F', name: 'GO molecular function', fullName: 'Gene Ontology - Molecular function', description: 'Consistent description of gene products', url: 'http://geneontology.org/', inMemory: true}, {id: 'GO_C', name: 'GO cellular component', fullName: 'Gene Ontology - Cellular component', description: 'Consistent description of gene products', url: 'http://geneontology.org/', inMemory: true}, {id: 'KEGG', name: 'KEGG pathway', fullName: 'Kyoto Encyclopedia of Genes and Genomes', description: 'A reference database for Pathway Mapping.', url: 'https://www.genome.jp/kegg/pathway.html', inMemory: true} ]; callback(null, databases) }; //TODO genes also to db var getPathwaysFromDB = function(db, callback) { sails.log.debug('Getting available external databases'); var dbArray = []; var pathways = {}; db.createReadStream({ start: '!RNASEQ!', end: '!RNASEQ!~', valueEncoding: 'json' }) .on('data', function(data) { sails.log.debug(data.key); var dbname = data.key.substring(data.key.lastIndexOf('!') + 1); dbArray.push(dbname); if (data.value[0].index_ === undefined) { sails.log.info('No index_ field set for terms in ' + data.key + ', setting it now'); _.forEach(data.value, function(term, i) { term.index_ = i }) } pathways[dbname] = data.value }) .on('end', function() { if (dbArray.length === 0) { throw {name: 'DatabaseError', message: 'No gene set databases found from db!'} } sails.log.info('Databases: ' + dbArray); callback(null, dbArray, pathways) }) .on('error', function(err) { callback(err) }) }; var DBUTIL = { pathways: null, dbIds: null }; exp.DBUTIL = DBUTIL; getPathwaysFromDB(pathwaydb, function(err, dbs, pathways) { if (err) sails.log.error(err); else { DBUTIL.pathways = pathways; DBUTIL.dbIds = dbs } }); getPathwayDatabasesFromDB(pathwaydb, function(err, databases) { if (err) sails.log.error(err); else { DBUTIL.databases = databases } }); /////////////// var handleDBError = function(err, callback) { sails.log.debug(err); if (err.name === 'NotFoundError') { callback({ status: 404, message: 'Not found' }) } else { sails.log.error(err); callback({ status: 500, message: 'Database error' }) } }; var getAnnotations = function(buffer, pathway, dbname, options) { var result = []; var numAnnotations = buffer.length / 2; if (dbname) { // pathway annotations sails.log.debug('getting annotations for ' + dbname); if (!DBUTIL.pathways[dbname]) { throw {name: 'ArgumentError', message: 'Not in pathway database: ' + dbname} } for (var a = 0; a < numAnnotations; a++) { var pwIndex = buffer.readUInt16BE(a * 2); // TODO fix verbose, now term is subsequently deleted if (options && (options.verbose === '' || options.verbose === 'true')) { result.push({ href: sails.config.version.apiUrl + '/pathway/' + DBUTIL.pathways[dbname][pwIndex].id, term: DBUTIL.pathways[dbname][pwIndex] }) } else { result.push({ href: sails.config.version.apiUrl + '/pathway/' + DBUTIL.pathways[dbname][pwIndex].id, term: DBUTIL.pathways[dbname][pwIndex] }) } if (options && (options.verbose === '' || options.verbose === 'true')) { //TODO sort.. //quicksortobj(result, 'term.auc') } } sails.log.debug(result.length + ' pathway annotations read (' + dbname + ')') } else { // gene annotations //GET P-VALUES FOR ANNOTATIONS // solve this in a neat way // var predictions = [] // pathwaydb.get('RNASEQ!PREDICTIONS!' + pathway.database.toUpperCase() + '!' + pathway.id, function(err, data) { // if (err) { // handleDBError(err) // } else { // for (var i = 1; i < data.length / 2; i++){ // var z = lookup(data.readUInt16BE(i * 2)) // predictions.push(z) // } // } ////////// for (var a = 0; a < numAnnotations; a++) { var geneIndex = buffer.readUInt16BE(a * 2); var gene = genedesc.get(geneIndex); // var z = predictions[geneIndex] // // var p = probability.zToP(z) // if (options && (options.verbose === '' || options.verbose === 'true')) { result.push({ href: sails.config.version.apiUrl + '/gene/' + gene.id, gene: gene, // zScore: z, // // pValue: p // }) } else { result.push({ href: sails.config.version.apiUrl + '/gene/' + gene.id, //zScore: z, // // pValue: p // }) } } sails.log.debug(result.length + ' gene annotations read') // }) } return result }; // TODO significant pws/genes var getPredictions = function(buffer, dbname, options) { // if (!DBUTIL.pathways[dbname]) { // throw {name: 'ArgumentError', message: 'dbutil.getPredictions: Unknown gene set database: ' + dbname} // } options = options || {}; var result = []; var numSignificant = buffer.readUInt16BE(0); sails.log.debug('Will prepare ' + (dbname ? dbname : 'gene') + ' Z-scores (buffer length / 2 ' + buffer.length / 2 + ', numSignificant ' + numSignificant + ', start ' + options.start + ', stop ' + options.stop + ')') if (dbname) { // pathway z scores for (var i = 1; i < buffer.length / 2; i++) { var z; // TODO if ('OMIM' === dbname) { z = buffer.readUInt16BE(i * 2) / 65535 } else { z = (buffer.readUInt16BE(i * 2) - 32768) / 1000 } if (options.verbose === '' || options.verbose === 'true') { result.push({ href: sails.config.version.apiUrl + '/pathway/' + DBUTIL.pathways[dbname][i - 1].id, term: DBUTIL.pathways[dbname][i - 1], zScore: z, }) } else { result.push({ href: sails.config.version.apiUrl + '/pathway/' + DBUTIL.pathways[dbname][i - 1].id, zScore: z, }) } } if (options.annotations) { // add Z-scores for annotated genes, as they might not be included in the sliced list of predicted genes _.forEach(options.annotations, function(obj) { if (obj.term.database === dbname) { if (result[obj.term.index_]) { obj.zScore = result[obj.term.index_].zScore; } if (options.pvalue) { obj.pValue = probability.zToP(obj.zScore) } } }) } //sails.log.debug((new Date() - ts) + ' ms reading ' + result.length + ' ' + dbname + ' z-scores') } else { // gene z scores for (var i = 1; i < buffer.length / 2; i++) { var z = lookup(buffer.readUInt16BE(i * 2)); var gene = genedesc.get(i - 1); if (options.array) { result.push(z) } else { if (options.verbose === '' || options.verbose === 'true') { result.push({ gene: gene, href: sails.config.version.apiUrl + '/gene/' + gene.id, zScore: z, }) } else { result.push({ gene: gene, href: sails.config.version.apiUrl + '/gene/' + gene.id, zScore: z, }) } } } //sails.log.debug((new Date() - ts) + ' ms preparing ' + result.length + ' gene z-scores') } ts = new Date(); if (options.sort === true) { if (options.array) { quicksort(result); result.reverse() } else { quicksortobj(result, 'zScore', Math.abs); result.reverse(); sails.log.debug((new Date() - ts) + ' ms sorting'); ts = new Date() } } if (options.start != undefined) { var start = options.start; var stop = options.stop || start + sails.config.api.maxNumEntries; result = result.slice(start, Math.min(Number(stop), start + sails.config.api.maxNumEntries)) } else if (!options.array && !options.all) { // don't slice if array is returned result = result.slice(0, sails.config.api.maxNumEntries) } if (!options.array) { for (var i = 0; i < result.length; i++) { result[i].zScore = Number(result[i].zScore.toPrecision(4)); if (options.pvalue) { if (dbname && dbname == 'OMIM') { result[i].pValue = result[i].zScore } else { result[i].pValue = probability.zToP(result[i].zScore) //Number(Number(probability.zToP(result[i].zScore).toPrecision(2)).toExponential()) } } } } // sails.log.debug((new Date() - ts) + ' ms slicing and all the rest') return result }; /////////////// exp.getPathways = function(db) { return DBUTIL.pathways[db.toUpperCase()] }; // TODO better search exp.pathwayObject = function(pwname) { pwname = pwname.trim().toUpperCase(); var pathway = null; for (var db in DBUTIL.pathways) { for (var i = 0; i < DBUTIL.pathways[db].length; i++) { if (DBUTIL.pathways[db][i].id === pwname) { pathway = DBUTIL.pathways[db][i]; break } } if (pathway) break } return pathway }; exp.getPC = function(pc, callback) { pcdb.get('RNASEQ!PC' + pc, function(err, data) { if (err) { handleDBError(err, callback) } else { // var arr = [] // for (var i = 0; i < data.length / 4; i++) { // arr.push(data.readFloatBE(i * 4)) // } callback(null, data) } }) }; exp.getGeneJSON = function(gene, db, req, callback) { var r = { comment: sails.config.version.comment(), version: sails.config.version.version, gene: gene, databases: DBUTIL.databases, pathways: { annotated: [], predicted: [] }, celltypes: { fixed: { header: [], indices: {}, }, values: { avg: [], stdev: [], z: [], auc: [], }, transcriptBars: {} } }; if (db) { // pathway database given, get all its pathways sails.log('getting ' + db + ' annotations and predictions for ' + gene.id); db = db.toUpperCase(); async.series([ function(cb) { genedb.get('RNASEQ!ANNOTATIONS!' + gene.id + '!' + db, function(err, data) { if (err) { if (err.name != 'NotFoundError') { // not all genes have annotations, omit not founds handleDBError(err, cb) } } else { r.pathways.annotated = getAnnotations(data, null, db, { verbose: req.query.verbose }) } cb() }) }, function(cb) { genedb.get('RNASEQ!PREDICTIONS!' + gene.id + '!' + db, function(err, data) { if (err) { handleDBError(err, cb) } else { sails.log.debug(data.length / 2 + ' ' + db + ' predictions read for ' + gene.id); r.pathways.predicted = getPredictions(data, db, { verbose: req.query.verbose, start: req.query.start, stop: req.query.stop, sort: true, pvalue: true, array: req.query.array }); //TODO fix if (req.query.verbose !== '' && req.query.verbose !== 'true') { _.forEach(r.pathways.annotated, function(obj) { delete obj.term }) } } cb() }) } ], function(err) { callback(err, r) }) } else { // no pathway database given, get a limited number of pathways for each database sails.log.debug('getting annotations and predictions in all databases for ' + gene.id); async.series([ function(cb) { genedb.createReadStream({ start: 'RNASEQ!ANNOTATIONS!' + gene.id + '!', end: 'RNASEQ!ANNOTATIONS!' + gene.id + '!~' }) .on('data', function(data) { var db = data.key.substring(data.key.lastIndexOf('!') + 1, data.key.length); var annotationsThisDB = getAnnotations(data.value, null, db, { verbose: req.query.verbose }); r.pathways.annotated.push.apply( r.pathways.annotated, annotationsThisDB); sails.log.debug('got ' + db + ' annotations for ' + gene.id) }) .on('end', function() { cb(null) }) }, function(cb) { genedb.createReadStream({ start: 'RNASEQ!PREDICTIONS!' + gene.id + '!', end: 'RNASEQ!PREDICTIONS!' + gene.id + '!~' }) .on('data', function(data) { var db = data.key.substring(data.key.lastIndexOf('!') + 1, data.key.length); sails.log.debug('got ' + db + ' predictions for ' + gene.id); var zScoresThisDB = getPredictions(data.value, db, { verbose: req.query.verbose, start: 0, stop: sails.config.api.numPathwaysLimit || 10, sort: true, pvalue: true, annotations: r.pathways.annotated }); r.pathways.predicted.push.apply(r.pathways.predicted, zScoresThisDB) // r.pathways.predicted.push.apply( // r.pathways.predicted, // zScoresThisDB.splice(0, pwLimit)) }) .on('end', function() { if (req.query.verbose !== '' && req.query.verbose !== 'true') { _.forEach(r.pathways.annotated, function(obj) { delete obj.term }) } cb(null) }) }, function(cb) { celltypedb.get('!RNASEQ!CELLTYPE', {valueEncoding: 'json'}, function(err, data) { if (err) sails.log.error(err); else { r.celltypes.fixed['header'] = JSON.parse(data.toString()); var i = 0; _.forEach(r.celltypes.fixed['header'], function(item){ r.celltypes.fixed['indices'][item.name] = i; i ++; if (item.children) { _.forEach(item.children, function(child){ r.celltypes.fixed['indices'][child.name] = i; i++ }); } }) } }); celltypedb.createReadStream({ start: 'RNASEQ!' + gene.id + '!CELLTYPE!', end: 'RNASEQ!' + gene.id + '!CELLTYPE!~' }) .on('data', function(buffer) { if (_.endsWith(buffer.key, 'AVG')){ for (var i = 0; i < buffer.value.length; i += 2) { r.celltypes.values['avg'].push(Math.round((buffer.value.readUInt16BE(i) - 32768) / 10) / 100) } } else if (_.endsWith(buffer.key, 'STDEV')){ for (var i = 0; i < buffer.value.length; i += 2) { r.celltypes.values['stdev'].push(Math.round((buffer.value.readUInt16BE(i)) / 10) / 100) } } else if (_.endsWith(buffer.key, 'AUC')){ for (var i = 0; i < buffer.value.length; i += 2) { r.celltypes.values['auc'].push(Math.round((buffer.value.readUInt16BE(i)) / 10) / 100) } } else if (_.endsWith(buffer.key, 'Z')){ for (var i = 0; i < buffer.value.length; i += 2) { r.celltypes.values['z'].push(Math.round((buffer.value.readUInt16BE(i) - 32768) / 10) / 100) } } }) .on('end', function() { cb(null) }) }, function(cb) { // get transcript bars if gene has transcripts //TODO if (gene.transcripts){ var tissues; var transcripts = gene.transcripts.length <= 10 ? gene.transcripts : gene.transcripts.slice(0,10); transcriptbardb.get('!RNASEQ!TISSUES', [{valueEncoding: 'json'}], function(err, data) { if (err){ sails.log.error(err) } else { tissues = JSON.parse(data); for (var i = 0; i < tissues.length; i++){ r.celltypes.transcriptBars[tissues[i]] = Array(transcripts.length) } } }); transcriptbardb.createReadStream({ start: 'RNASEQ!' + gene.id + '!TRANSCRIPTBARS!', end: 'RNASEQ!' + gene.id + '!TRANSCRIPTBARS!~' }) .on('data', function(buffer) { if (_.includes(transcripts, buffer.key.split('!')[3])){ for (var i = 0; i < buffer.value.length; i += 2) { r.celltypes.transcriptBars[tissues[i/2]][transcripts.indexOf(buffer.key.split('!')[3])] = ((buffer.value.readUInt16BE(i) - 32768) / 1000) + 0.1 } } }) .on('end', function(){ cb(null) }) } else { cb(null) } } ], function(err) { var ann = {}; for (var i = 0; i < r.pathways.annotated.length; i++) { if (r.pathways.annotated[i].term) { ann[r.pathways.annotated[i].term.id] = true } } for (var i = 0; i < r.pathways.predicted.length; i++) { if (r.pathways.predicted[i].term) { if (ann[r.pathways.predicted[i].term.id] === true) { r.pathways.predicted[i].annotated = true } else { r.pathways.predicted[i].annotated = false } } } callback(err, r) }) } }; exp.getTranscriptJSON = function(transcript, callback) { var transcripts = { name: transcript, avg: [], stdev: [], auc: [], z: [] }; sails.log.debug('getting expression per tissue for ' + transcript); async.series([ function(cb) { transcriptdb.createReadStream({ start: 'RNASEQ!' + transcript + '!CELLTYPE!', end: 'RNASEQ!' + transcript + '!CELLTYPE!~' }) .on('data', function(buffer) { if (_.endsWith(buffer.key, 'AVG')){ for (var i = 0; i < buffer.value.length; i += 2) { transcripts['avg'].push((buffer.value.readUInt16BE(i) - 32768) / 1000); //remove when database is up to date transcripts['stdev'].push('-'); transcripts['auc'].push('-'); transcripts['z'].push('-') } } else if (_.endsWith(buffer.key, 'STDEV')){ for (var i = 0; i < buffer.value.length; i += 2) { transcripts['stdev'].push((buffer.value.readUInt16BE(i)) / 1000) } } else if (_.endsWith(buffer.key, 'AUC')){ for (var i = 0; i < buffer.value.length; i += 2) { transcripts['auc'].push((buffer.value.readUInt16BE(i) - 32768) / 1000) } } else if (_.endsWith(buffer.key, 'Z')){ for (var i = 0; i < buffer.value.length; i += 2) { transcripts['z'].push((buffer.value.readUInt16BE(i) - 32768) / 1000) } } }) .on('end', function() { cb(null) }) } ], function(err) { callback(err, transcripts) }) }; exp.getNewTranscriptBars = function(transcripts, callback) { var transcriptBars = {transcripts: Array(transcripts.length)}; gene = transcripts.split(',')[0]; transcripts = transcripts.split(',').slice(1); sails.log.debug('getting new transcript bars for gene ' + gene + ' for transcripts ' + transcripts); async.series([ function(cb) { var tissues; transcriptbardb.get('!RNASEQ!TISSUES', [{valueEncoding: 'json'}], function(err, data) { if (err) sails.log.error(err); else { tissues = JSON.parse(data); for (var i = 0; i < tissues.length; i++){ transcriptBars[tissues[i]] = Array(transcripts.length) } } }); transcriptbardb.createReadStream({ start: 'RNASEQ!' + gene + '!TRANSCRIPTBARS!', end: 'RNASEQ!' + gene + '!TRANSCRIPTBARS!~' }) .on('data', function(buffer) { if (_.contains(transcripts, buffer.key.split('!')[3])){ for (var i = 0; i < buffer.value.length; i += 2) { transcriptBars[tissues[i/2]][transcripts.indexOf(buffer.key.split('!')[3])] = ((buffer.value.readUInt16BE(i) - 32768) / 1000) + 0.1 } } }) .on('end', function() { cb(null) }) } ], function(err) { callback(err, transcriptBars) }) }; exp.getGivenGenesCoregArrayForGene = function(gene, geneIndices, callback) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) return callback(err); var arr = _.map(geneIndices, function(index) { return lookup(data.readUInt16BE((index + 1) * 2)) }); return callback(null, arr) }) }; exp.getGivenGenesAnnotationArrayForTerm = function(termObj, geneIndices, callback) { if (!termObj || !termObj.database || !termObj.id) { return callback({name: 'ArgumentError', message: 'dbutil.getGivenGenesAnnotationArrayForTerm requires a term object'}) } if (!_.isArray(geneIndices) || geneIndices.length == 0) { return callback({name: 'ArgumentError', message: 'dbutil.getGivenGenesAnnotationArrayForTerm requires an array of gene indices'}) } pathwaydb.get('RNASEQ!ANNOTATIONS!' + termObj.database + '!' + termObj.id, function(err, buffer) { if (err) { handleDBError(err, callback) } else { var termAnnotations = []; for (var i = 0; i < buffer.length / 2; i++) { termAnnotations.push(buffer.readUInt16BE(i * 2)) } var annotations = _.map(geneIndices, function(geneIndex) { return _.includes(termAnnotations, +geneIndex) }); callback(null, annotations) } }) }; exp.getGivenGenesZScoreArrayForTerm = function(termObj, geneIndices, callback) { if (!termObj || !termObj.database || !termObj.id) { return callback({name: 'ArgumentError', message: 'dbutil.getGivenGenesZScoreArrayForTerm requires a term object'}) } if (!_.isArray(geneIndices) || geneIndices.length == 0) { return callback({name: 'ArgumentError', message: 'dbutil.getGivenGenesZScoreArrayForTerm requires an array of gene indices'}) } pathwaydb.get('RNASEQ!PREDICTIONS!' + termObj.database + '!' + termObj.id, function(err, buffer) { if (err) { handleDBError(err, callback) } else { var arr = _.map(geneIndices, function(index) { index = +index; var z = lookup(buffer.readUInt16BE((index + 1) * 2)); return z}); callback(null, arr) } }) }; exp.getGeneZScoresForTerm = function(term, options, callback) { pathwaydb.get('RNASEQ!PREDICTIONS!' + term.database + '!' + term.id, function(err, buffer) { if (err) { if (err.name == 'NotFoundError') { callback(null, null) } else { handleDBError(err, callback) } } else { callback(null, getPredictions(buffer, null, options)) } }) }; exp.getAnnotatedPathwayIDsForGene = function(gene, dbname, callback) { if (dbname) { sails.log.info('TODO getAnnotatedPathwayIDsForGene with given dbname'); callback({ status: 404, message: 'TODO' }) } var result = []; genedb.createReadStream({ start: 'RNASEQ!ANNOTATIONS!' + gene.id + '!', end: 'RNASEQ!ANNOTATIONS!' + gene.id + '!~' }) .on('data', function(data) { var db = data.key.substring(data.key.lastIndexOf('!') + 1); var numAnnotations = data.value.length / 2; for (var a = 0; a < numAnnotations; a++) { var pwIndex = data.value.readUInt16BE(a * 2); result.push(DBUTIL.pathways[db][pwIndex].id) } }) .on('end', function() { callback(null, result) }) }; exp.getAnnotatedGenes = function(pathway, callback) { pathwaydb.get('RNASEQ!ANNOTATIONS!' + pathway.database.toUpperCase() + '!' + pathway.id, function(err, buffer) { if (err) { handleDBError(err, callback) } else { var numAnnotations = buffer.length / 2; var genes = []; for (var a = 0; a < numAnnotations; a++) { var geneIndex = buffer.readUInt16BE(a * 2); var gene = genedesc.get(geneIndex); genes.push(gene) } sails.log.debug('annotations read from db for ' + pathway.name); callback(null, genes) } }) }; exp.getPathwayPredictionsJSON = function(pathway, cb) { pathwaydb.get('RNASEQ!PREDICTIONS!' + pathway.database.toUpperCase() + '!' + pathway.id, function(err, data) { if (err) { handleDBError(err, cb) } else { cb(null, getPredictions(data, null, { all: true, pvalue: true, sort: true, verbose: true } )); } }) }; exp.getPathwayJSON = function(pathway, req, callback) { var r = { comment: sails.config.version.comment(), version: sails.config.version.version, pathway: pathway, genes: { annotated: [], predicted: [] } }; async.waterfall([ function(cb) { sails.log.debug('reading annotations for ' + pathway.id); pathwaydb.get('RNASEQ!ANNOTATIONS!' + pathway.database.toUpperCase() + '!' + pathway.id, function(err, data) { if (err) { if (err.name != 'NotFoundError') { // omit not founds, TODO should we? handleDBError(err, cb) } else { cb() } } else { sails.log.debug('annotations read from db for ' + pathway.name); r.genes.annotated = getAnnotations(data, pathway, null, { // r.genes.annotated = getAnnotations(data, null, { verbose: req.query.verbose, pValue: true }); cb() } }) }, function(cb) { pathwaydb.get('RNASEQ!PREDICTIONS!' + pathway.database.toUpperCase() + '!' + pathway.id, function(err, data) { if (err) { //handleDBError(err, cb) r.genes.predicted = [] cb() } else { r.genes.predicted = getPredictions(data, null, { start: req.query.start, stop: req.query.stop, verbose: req.query.verbose, sort: true, pvalue: true }); cb() } }) } ], function(err) { var ann = {}; for (var i = 0; i < r.genes.annotated.length; i++) { if (r.genes.annotated[i].gene) { ann[r.genes.annotated[i].gene.id] = true } } for (var i = 0; i < r.genes.predicted.length; i++) { if (r.genes.predicted[i].gene) { if (ann[r.genes.predicted[i].gene.id] === true) { r.genes.predicted[i].annotated = true } else { r.genes.predicted[i].annotated = false } } } callback(err, r) }) }; exp.getCorrelationsJSON = function(gene, options, callback) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) { handleDBError(err, callback) } else { var arr = []; for (var i = 0; i < data.length / 2; i++) { arr.push(lookup(data.readUInt16BE(i * 2))) } var r = { comment: sails.config.version.comment(), version: sails.config.version.version, data: [] }; var verbose = (options.verbose === '' || options.verbose === 'true'); for (var i = 0; i < arr.length; i++) { var otherGene = genedesc.get(i); if (otherGene !== gene) { if (verbose) { r.data.push({ gene: otherGene, zScore: arr[i] }) } else { r.data.push({ gene: otherGene.id, zScore: arr[i] }) } } } r.data.sort(sortby('zScore', true, Math.abs)); if (options.limit) { var rnew = {}; rnew.comment = r.comment; rnew.gene = gene; rnew.data = []; for (var i = 0; i < options.limit; i++) { rnew.data[i] = r.data[i] } r = rnew } for (var i = 0; i < r.data.length; i++) { if (r.data[i]) { var p = probability.zToP(r.data[i].zScore); r.data[i].pValue = Number(Number(p.toPrecision(2)).toExponential()) } // var p = probability.zToP(r.data[i].zScore); // r.data[i].pValue = Number(Number(p.toPrecision(2)).toExponential()) // r.data[i].zScore = Number(r.data[i].zScore.toPrecision(4)) } callback(null, r) } }) }; exp.getPairwiseCorrelationsJSON = function(genes, callback) { async.map(genes, function(gene, cb) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) cb(err); var arr = []; for (var i = 0; i < genes.length; i++) { arr.push(lookup(data.readUInt16BE(genes[i].index_ * 2))) } cb(null, arr) }) }, function(err, results) { if (err) { handleDBError(err, callback) } else { var r = { comment: sails.config.version.comment(), version: sails.config.version.version, data: [] }; for (var g1 = 0; g1 < results.length; g1++) { for (var g2 = g1 + 1; g2 < results.length; g2++) { var z = results[g1][g2]; var p = probability.zToP(z); r.data.push({ genes: [genes[g1], genes[g2]], pValue: Number(Number(p.toPrecision(2)).toExponential()), zScore: Number(z.toPrecision(4)) }) } } r.data.sort(sortby('zScore', true, Math.abs)); callback(null, r) } }) }; exp.getPairwiseCofunctionsJSON = function(genes, dbs, callback) { async.map(genes, function(gene, cb) { var arr = []; genedb.createReadStream({ start: 'RNASEQ!PREDICTIONS!' + gene.id + '!', end: 'RNASEQ!PREDICTIONS!' + gene.id + '!~' }) .on('data', function(data) { if (dbs.indexOf(data.key.substring(data.key.lastIndexOf('!') + 1)) > -1) { var numSignificant = data.value.readUInt16BE(0); for (var i = 1; i < data.value.length / 2; i++) { arr.push(lookup(data.value.readUInt16BE(i * 2))) } } }) .on('end', function() { cb(null, arr) }) }, function(err, results) { if (err) { handleDBError(err, callback) } var r = { comment: sails.config.version.comment(), version: sails.config.version.version, data: [] }; for (var g1 = 0; g1 < genes.length; g1++) { for (var g2 = g1 + 1; g2 < genes.length; g2++) { var corr = Number(descriptives.correlation(results[g1], results[g2]).toPrecision(4)); r.data.push({ genes: [genes[g1].id, genes[g2].id], correlation: corr }) } } ts = new Date(); quicksortobj(r.data, 'correlation'); r.data.reverse(); sails.log.debug((new Date() - ts) + ' ms sorting'); callback(null, r) }) }; exp.getCofunctionMatrix = function(genes, dbs, callback) { async.map(genes, function(gene, cb) { var arr = []; genedb.createReadStream({ start: 'RNASEQ!PREDICTIONS!' + gene.id + '!', end: 'RNASEQ!PREDICTIONS!' + gene.id + '!~' }) .on('data', function(data) { if (dbs.indexOf(data.key.substring(data.key.lastIndexOf('!') + 1)) > -1) { var numSignificant = data.value.readUInt16BE(0); for (var i = 1; i < data.value.length / 2; i++) { arr.push(lookup(data.value.readUInt16BE(i * 2))) } } }) .on('end', function() { cb(null, arr) }) }, function(err, results) { var matrix = []; for (var g1 = 0; g1 < genes.length; g1++) { matrix.push([]); for (var g2 = g1 + 1; g2 < genes.length; g2++) { var corr = descriptives.correlation(results[g1], results[g2]); matrix[g1][g2] = corr } // sails.log.debug(genes[g1].name + ' correlations: ' + matrix[g1]) } callback(null, matrix) }) }; exp.getCoregulationMatrixAndGenePValues = function(genes, callback) { quicksortobj(genes, 'index_'); var allGenes = genedesc.getAll(); async.map(genes, function(gene, cb) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) cb(err); var a1 = []; var a2 = []; var curA1 = 0; for (var i = 0; i < data.length / 2; i++) { var value = lookup(data.readUInt16BE(i * 2)); if (curA1 < genes.length && i === genes[curA1].index_) { a1.push(value); curA1++ } else if (allGenes[i].biotype === 'protein_coding') { a2.push(value) } } if (curA1 != genes.length) { console.err('something\'s wrong in getCoregulationMatrixAndGenePValues') } // console.log(gene.name, a1) var p = wilcoxon(a1, a2).p; cb(null, { correlations: a1, p: p }) }) }, function(err, results) { if (err) { handleDBError(err, callback) } else { var matrix = []; var pValues = []; for (var i = 0; i < results.length; i++) { matrix.push(results[i].correlations); pValues.push(results[i].p) } callback(null, { matrix: matrix, pValues: pValues }) } }) }; exp.getCoregulationBuffer = function(genes, groups, tissue, shortURL, callback) { var hash = {}; for (var i = 0; i < genes.length; i++) { hash[genes[i].id] = i } async.map(genes, function(gene, cb) { var db = tissue ? tissuecorrelationdb : correlationdb; var key = tissue ? ('RNASEQ!' + tissue.toUpperCase() + '!') : 'RNASEQ!'; db.get(key + gene.id, function(err, data) { if (err) return cb(err); var hashI = hash[gene.id]; var buffer = new Buffer((genes.length - hashI - 1) * 2); for (var i = hashI + 1; i < genes.length; i++) { buffer.writeUInt16BE(data.readUInt16BE(genes[i].index_ * 2), (i - hashI - 1) * 2) } cb(null, buffer) }) }, function(err, results) { if (err) { handleDBError(err, callback) } else { var totalBuffer = Buffer.concat(results, results.length * (results.length - 1)); callback(null, genes, groups, shortURL, totalBuffer) } }) }; exp.getCoregulationMatrix = function(genes, callback) { async.map(genes, function(gene, cb) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) cb(err); var arr = []; for (var i = 0; i < genes.length; i++) { arr.push(lookup(data.readUInt16BE(genes[i].index_ * 2))) } cb(null, arr) }) }, function(err, results) { if (err) { handleDBError(err, callback) } else { callback(null, results) } }) }; exp.getCoregulationJSON = function(genes, threshold, options, callback) { var edges = []; var nodes = []; var hashGenes = {}; for (var i = 0; i < genes.length; i++) { hashGenes[genes[i].id] = i } // var totalData = _.map(genes, function() { return [] }) var allGenes = genedesc.getAll(); async.map(genes, function(gene, cb) { correlationdb.get('RNASEQ!' + gene.id, function(err, data) { if (err) return cb(err); nodes.push({ data: gene }); if (options && options.zScore === true) { _.last(nodes).data.zScore = geneZScore(data, genes, allGenes).z } // totalData[hashGenes[gene.id]][hashGenes[gene.id]] = 1 for (var i = hashGenes[gene.id] + 1; i < genes.length; i++) { var value = lookup(data.readUInt16BE(genes[i].index_ * 2)); if (Math.abs(value) >= threshold) { //if (value >= threshold) { edges.push({ data: { source: gene.id, target: genes[i].id, weight: value, included: true } }) } } // fs.writeFileSync(genes.length + '.txt', totalData) cb(null, null) }) }, function(err, nullResults) { if (err) { handleDBError(err, callback) } else { callback(null, { nodes: nodes, edges: edges }) } }) }; exp.getHpoCorrelationMatrix = function(terms, callback){ hpocorrelationdb.get('RNASEQ!HPOCORRELATIONS!HEADER', {valueEncoding: 'json'}, function(err, data){ if (err){ handleDBError(err, callback) } else { var indices = [] var termsFound = [] for (var i = 0; i < terms.length; i++){ if (data.indexOf(terms[i]) !== -1){ indices.push(data.indexOf(terms[i])) termsFound.push(terms[i]) } } async.map(termsFound, function(term, cb){ var cormat = [] hpocorrelationdb.get('RNASEQ!HPOCORRELATIONS!' + term, function(err, buffer){ if (err) { handleDBError(err, cb) } else { for (var e = 0; e < indices.length; e++){ // correlation values are stored in the databased scaled between 0 and 50.000 (-1=0, 0=25.000, 1=50.000) cormat.push((buffer.readUInt16BE(indices[e]*2) - 25000)/25000) } cb(null, cormat) } }) }, function(err, cormat){ if (err) { handleDBError(err, callback) } else { var results = {hpoCorrelationMatrix: cormat, termsFound: termsFound} callback(null, results) } }) } }) } exp.getTermCorrelationMatrix = function(terms, options, callback) { async.map(terms, function(term, cb) { var arr = []; pathwaydb.get('RNASEQ!PREDICTIONS!' + term.database + '!' + term.id, function(err, data) { if (err) { handleDBError(err, cb) } else { for (var i = 1; i < data.length / 2; i++) { arr.push(lookup(data.readUInt16BE(i * 2))) } if (options && options.standardnormalize) { descriptives.standardNormalize(arr) } cb(null, arr) } }) }, function(err, results) { var matrix = []; for (var t1 = 0; t1 < terms.length; t1++) { matrix.push([]) } for (var t1 = 0; t1 < terms.length; t1++) { matrix[t1][t1] = 1; for (var t2 = t1 + 1; t2 < terms.length; t2++) { var corr = descriptives.correlation(results[t1], results[t2]); matrix[t1][t2] = corr; matrix[t2][t1] = corr } sails.log.debug(terms[t1].name + ' correlations: ' + matrix[t1]) } callback(null, matrix) }) }; var geneZScore = function(data, genes, allGenes) { var a1 = []; var a2 = []; var curA1 = 0; for (var i = 0; i < data.length / 2; i++) { var value = lookup(data.readUInt16BE(i * 2)); if (curA1 < genes.length && i === genes[curA1].index_) { a1.push(value); curA1++ } else if (allGenes[i].biotype === 'protein_coding') { a2.push(value) } } if (curA1 != genes.length) { sails.log.error('dbutil.geneZScore: array length ' + curA1 + ', expected ' + genes.length) } // console.log(gene.name, a1) var p = wilcoxon(a1, a2).p; var z = probability.pToZ(p); return { correlations: a1, p: p, z: z } };
candle-pwa-demo/src/BluetoothInfo.js
nataliegirard/web-ble
import React from 'react'; const BluetoothInfo = (props) => ( <div> <h3>Web Bluetooth API</h3> <ul className="App-info"> <li>Interact with nearby bluetooth devices with a website.</li> <li>Uses Bluetooth Low Energy (Bluetooth 4) and Generic Attribute Profile (GATT).</li> <li>Request to connect must be triggered by user and must be served over HTTPS.</li> <li>Uses JavaScript promises and the navigator.bluetooth object.</li> <li>Available as of Chrome 56. Enable flag in browser:<br/> chrome://flags/#enable-experimental-web-platform-features </li> </ul> <a href="https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web" target='_blank'>Web Bluetooth API</a> </div> ) export default BluetoothInfo;
examples/huge-apps/routes/Calendar/components/Calendar.js
CivBase/react-router
import React from 'react'; class Calendar extends React.Component { render () { var events = [{ id: 0, title: 'essay due' }]; return ( <div> <h2>Calendar</h2> <ul> {events.map(event => ( <li key={event.id}>{event.title}</li> ))} </ul> </div> ); } } export default Calendar;
node_modules/browser-sync/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
noudilus/hr-wp-theme
import React from 'react'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; React.render(<HelloWorld />, document.getElementById('react-root'));
react-flux-mui/js/material-ui/src/svg-icons/maps/local-convenience-store.js
pbogdan/react-flux-mui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let MapsLocalConvenienceStore = (props) => ( <SvgIcon {...props}> <path d="M19 7V4H5v3H2v13h8v-4h4v4h8V7h-3zm-8 3H9v1h2v1H8V9h2V8H8V7h3v3zm5 2h-1v-2h-2V7h1v2h1V7h1v5z"/> </SvgIcon> ); MapsLocalConvenienceStore = pure(MapsLocalConvenienceStore); MapsLocalConvenienceStore.displayName = 'MapsLocalConvenienceStore'; MapsLocalConvenienceStore.muiName = 'SvgIcon'; export default MapsLocalConvenienceStore;
templates/beez3/javascript/hide.js
angelrmolina12/joomla-cms
// Angie Radtke 2009 - 2012 thanks to daniel // /*global window, localStorage, Cookie, altopen, altclose, big, small, rightopen, rightclose, bildauf, bildzu */ function saveIt(name) { var x = document.getElementById(name).style.display; if (!x) { alert('No cookie available'); } else if (localStorage) { localStorage[name] = x; } } function readIt(name) { if (localStorage) { return localStorage[name]; } } function wrapperwidth(width) { jQuery('#wrapper').css('width', width); } // add Wai-Aria landmark-roles jQuery(function($) { $('#nav').attr('role', 'navigation'); $('#mod-search-searchword').closest('form').attr('role', 'search'); $('#main').attr('role', 'main'); $('#right').attr('role', 'contentinfo'); }); jQuery(function($) { // get ankers var $myankers = $('a.opencloselink'); $myankers.each(function() { var $element = $(this); $element.attr('role', 'tab'); var myid = $element.attr('id'); myid = myid.split('_'); myid = 'module_' + myid[1]; $element.attr('aria-controls', myid); }); var $list = $('div.moduletable_js'); $list.each(function() { var $element = $(this); if ($element.find('div.module_content').length) { var $el = $element.find('div.module_content'); $el.attr('role', 'tabpanel'); var myid = $el.attr('id'); myid = myid.split('_'); myid = 'link_' + myid[1]; $el.attr('aria-labelledby', myid); var myclass = $el.attr('class'); var one = myclass.split(' '); // search for active menu-item var $listelement = $el.find('a.active').first(); var unique = $el.attr('id'); var nocookieset = readIt(unique); if (($listelement.length) || ((one[1] == 'open') && (nocookieset == null))) { $el.show(); var $eltern = $el.parent(); var $elternh = $eltern.find('h3').first(); var $elternbild = $eltern.find('img').first(); $elternbild.attr('alt', altopen).attr('src', bildzu); $elternbild.focus(); } else { $el.hide(); $el.attr('aria-expanded', 'false'); } unique = $el.attr('id'); var cookieset = readIt(unique); if (cookieset === 'block') { $el.show(); $el.attr('aria-expanded', 'true'); } } }); }); jQuery(function($) { var $what = $('#right'); // if rightcolumn if ($what.length) { var whatid = $what.attr('id'); var rightcookie = readIt(whatid); if (rightcookie === 'none') { $what.hide(); $('#nav').addClass('leftbigger'); wrapperwidth(big); var $grafik = $('#bild'); $grafik.html(rightopen); $grafik.focus(); } } }); function auf(key) { var $ = jQuery.noConflict(); var $el = $('#' + key); if (!$el.is(':visible')) { $el.show(); $el.attr('aria-expanded', 'true'); if (key !== 'right') { $el.hide().toggle('slide'); $el.parent().attr('class', 'slide'); $eltern = $el.parent().parent(); $elternh = $eltern.find('h3').first(); $elternh.addClass('high'); $elternbild = $eltern.find('img').first(); $el.focus(); $elternbild.attr('alt', altopen).attr('src', bildzu); } if (key === 'right') { $('#right').show(); wrapperwidth(small); $('#nav').removeClass('leftbigger'); $grafik = $('#bild'); $('#bild').html(rightclose); $grafik.focus(); } } else { $el.hide(); $el.attr('aria-expanded', 'false'); $el.removeClass('open'); if (key !== 'right') { $eltern = $el.parent().parent(); $elternh = $eltern.find('h3').first(); $elternh.removeClass('high'); $elternbild = $eltern.find('img').first(); $elternbild.attr('alt', altclose).attr('src', bildauf); $elternbild.focus(); } if (key === 'right') { $('#right').hide(); wrapperwidth(big); $('#nav').addClass('leftbigger'); $grafik = $('#bild'); $grafik.html(rightopen); $grafik.focus(); } } // write cookie saveIt(key); } // ########### Tabfunctions #################### jQuery(function($) { var $alldivs = $('div.tabcontent'); var $outerdivs = $('div.tabouter'); //outerdivs = outerdivs.getProperty('id'); $outerdivs.each(function() { var $alldivs = $(this).find('div.tabcontent'); var count = 0; var countankers = 0; $alldivs.each(function() { var $el = $(this); count++; $el.attr('role', 'tabpanel'); $el.attr('aria-hidden', 'false'); $el.attr('aria-expanded', 'true'); elid = $el.attr('id'); elid = elid.split('_'); elid = 'link_' + elid[1]; $el.attr('aria-labelledby', elid); if (count !== 1) { $el.addClass('tabclosed').removeClass('tabopen'); $el.attr('aria-hidden', 'true'); $el.attr('aria-expanded', 'false'); } }); $allankers = $(this).find('ul.tabs').first().find('a'); $allankers.each(function() { countankers++; var $el = $(this); $el.attr('aria-selected', 'true'); $el.attr('role', 'tab'); linkid = $el.attr('id'); moduleid = linkid.split('_'); moduleid = 'module_' + moduleid[1]; $el.attr('aria-controls', moduleid); if (countankers != 1) { $el.addClass('linkclosed').removeClass('linkopen'); $el.attr('aria-selected', 'false'); } }); }); }); function tabshow(elid) { var $ = jQuery.noConflict(); var $el = $('#' + elid); var $outerdiv = $el.parent(); var $alldivs = $outerdiv.find('div.tabcontent'); var $liste = $outerdiv.find('ul.tabs').first(); $liste.find('a').attr('aria-selected', 'false'); $alldivs.each(function() { var $element = $(this); $element.addClass('tabclosed').removeClass('tabopen'); $element.attr('aria-hidden', 'true'); $element.attr('aria-expanded', 'false'); }); $el.addClass('tabopen').removeClass('tabclosed'); $el.attr('aria-hidden', 'false'); $el.attr('aria-expanded', 'true'); $el.focus(); var getid = elid.split('_'); var activelink = '#link_' + getid[1]; $(activelink).attr('aria-selected', 'true'); $liste.find('a').addClass('linkclosed').removeClass('linkopen'); $(activelink).addClass('linkopen').removeClass('linkclosed'); } function nexttab(el) { var $ = jQuery.noConflict(); var $outerdiv = $('#' + el).parent(); var $liste = $outerdiv.find('ul.tabs').first(); var getid = el.split('_'); var activelink = '#link_' + getid[1]; var aktiverlink = $(activelink).attr('aria-selected'); var $tablinks = $liste.find('a'); for (var i = 0; i < $tablinks.length; i++) { if ($($tablinks[i]).attr('id') === activelink) { if ($($tablinks[i + 1]).length) { $($tablinks[i + 1]).click(); break; } } } } // mobilemenuheader var mobileMenu = function(){ var $ = jQuery.noConflict(), displayed = false, $mobile, $menu, $menuWrapper; var getX = function() { return $(document).width(); }; var createElements = function () { var Openmenu=Joomla.JText._('TPL_BEEZ3_OPENMENU'); var Closemenu=Joomla.JText._('TPL_BEEZ3_CLOSEMENU'); $menu = $("#header").find('ul.menu').first(); $menuWrapper = $('<div>', {id : 'menuwrapper', role: 'menubar'}); // create the menu opener and assign events $mobile = $('<div>', {id: 'mobile_select'}).html('<h2><a href=#" id="menuopener" onclick="return false;"><span>Openmenu</span></a></h2>').show(); $mobile.on('click', function(){ var state = $menuWrapper.css('display'); $menuWrapper.slideToggle(); if (state === 'none') { $('#menuopener').html(Closemenu); $('#menuwrapper').attr('aria-expanded', 'true').attr('aria-hidden','false'); } else { $('#menuopener').html(Openmenu); $('#menuwrapper').attr('aria-expanded', 'false').attr('aria-hidden', 'true'); } }); // add the menu to the dom $menu.wrap($menuWrapper); // add the menuopener to the dom and hide it $('#header').find('#menuwrapper').first().before($mobile.hide()); $menuWrapper = $('#menuwrapper'); $mobile = $('#mobile_select'); }; var display = function () { $menuWrapper.hide(); $mobile.show(); displayed = true; }; var initialize = function () { // create the elements once createElements(); // show the elements if the browser size is smaller if (getX() <= 461 && !displayed) { display(); } // react on resize events $(window).on('resize', function () { if (getX() >= 461) { if (displayed) { $mobile.hide(); $('#menuwrapper').show(); displayed = false; } } if (getX() < 461) { if (!displayed) { display(); } } }); }; initialize(); }; jQuery(function () { new mobileMenu(); }); //For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/ (function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
pootle/static/js/auth/components/SocialSignInForm.js
Yelp/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ import React from 'react'; import { PureRenderMixin } from 'react/addons'; const SocialSignInForm = React.createClass({ mixins: [PureRenderMixin], propTypes: { socialAuthProviders: React.PropTypes.array.isRequired, }, /* Handlers */ handleClick(url) { let nextURL = window.location.pathname + window.location.hash; window.location = `${url}?next=${encodeURIComponent(nextURL)}`; }, /* Layout */ renderSocialAuthButton(socialAuth, index) { return ( <button className="btn btn-big" key={index} onClick={this.handleClick.bind(null, socialAuth.url)} > {interpolate(gettext('Sign In With %s'), [socialAuth.name])} </button> ); }, render() { let signInWarningMsg = gettext('Signing in with an external service for the first time will automatically create an account for you.'); return ( <div className="actions sign-in-social"> {this.props.socialAuthProviders.map(this.renderSocialAuthButton)} <p>{signInWarningMsg}</p> </div> ); }, }); export default SocialSignInForm;
StudyNotes/ReactNative_/component/scrollimg.js
coderZsq/coderZsq.target.swift
import React, { Component } from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; import Swiper from 'react-native-swiper' var ScrollImg = React.createClass ({ getDefaultProps(){ return { imgData: [] } }, render(){ return ( <Swiper style={styles.wrapper} height={200} horizontal={false} autoplay> {this.renderImg()} </Swiper> ); }, renderImg(){ var itemArr = []; for (var i = 0; i < this.props.imgData.length; i++) { var item = this.props.imgData[i] console.log(item); itemArr.push( <Image key={i} source={{uri: 'https://i1.wp.com/acrosoft.co.uk/wp-content/uploads/jOwfoMVPYQgmaxresdefault.jpg?fit=1280%2C720&ssl=1'}} style={{flex: 1}}/> ); } return itemArr; } }) const styles = StyleSheet.create({ wrapper: { }, }) module.exports = ScrollImg;
ajax/libs/inferno-mobx/4.0.0-2/inferno-mobx.js
jdh8/cdnjs
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('inferno'), require('inferno-create-class'), require('inferno-create-element'), require('hoist-non-inferno-statics')) : typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'inferno', 'inferno-create-class', 'inferno-create-element', 'hoist-non-inferno-statics'], factory) : (factory((global.Inferno = global.Inferno || {}, global.Inferno.Mobx = {}),global.mobx,global.Inferno,global.Inferno.createClass,global.Inferno.createElement,global.hoistStatics)); }(this, (function (exports,mobx,inferno,createClass,infernoCreateElement,hoistStatics) { 'use strict'; createClass = createClass && createClass.hasOwnProperty('default') ? createClass['default'] : createClass; infernoCreateElement = infernoCreateElement && infernoCreateElement.hasOwnProperty('default') ? infernoCreateElement['default'] : infernoCreateElement; hoistStatics = hoistStatics && hoistStatics.hasOwnProperty('default') ? hoistStatics['default'] : hoistStatics; /** * @module Inferno-Shared */ /** TypeDoc Comment */ // This should be boolean and not reference to window.document var isBrowser$1 = !!(typeof window !== "undefined" && window.document); // this is MUCH faster than .constructor === Array and instanceof Array // in Node 7 and the later versions of V8, slower in older versions though var isArray$1 = Array.isArray; function isStringOrNumber(o) { var type = typeof o; return type === "string" || type === "number"; } function isInvalid(o) { return isNull$1(o) || o === false || isTrue(o) || isUndefined$1(o); } function isNull$1(o) { return o === null; } function isTrue(o) { return o === true; } function isUndefined$1(o) { return o === void 0; } function combineFrom(first, second) { var out = {}; if (first) { for (var key in first) { out[key] = first[key]; } } if (second) { for (var key$1 in second) { out[key$1] = second[key$1]; } } return out; } /** * @module Inferno-Clone-VNode */ /** TypeDoc Comment */ /* directClone is preferred over cloneVNode and used internally also. This function makes Inferno backwards compatible. And can be tree-shaked by modern bundlers Would be nice to combine this with directClone but could not do it without breaking change */ /** * Clones given virtual node by creating new instance of it * @param {VNode} vNodeToClone virtual node to be cloned * @param {Props=} props additional props for new virtual node * @param {...*} _children new children for new virtual node * @returns {VNode} new virtual node */ function cloneVNode(vNodeToClone, props) { var arguments$1 = arguments; var _children = [], len$2 = arguments.length - 2; while ( len$2-- > 0 ) { _children[ len$2 ] = arguments$1[ len$2 + 2 ]; } var children = _children; var childrenLen = _children.length; if (childrenLen > 0 && !isUndefined$1(_children[0])) { if (!props) { props = {}; } if (childrenLen === 1) { children = _children[0]; } if (!isUndefined$1(children)) { props.children = children; } } var newVNode; if (isArray$1(vNodeToClone)) { var tmpArray = []; for (var i = 0, len = vNodeToClone.length; i < len; i++) { tmpArray.push(inferno.directClone(vNodeToClone[i])); } newVNode = tmpArray; } else { var flags = vNodeToClone.flags; var className = vNodeToClone.className; var key = vNodeToClone.key; var ref = vNodeToClone.ref; if (props) { if (!isUndefined$1(props.className)) { className = props.className; } if (!isUndefined$1(props.ref)) { ref = props.ref; } if (!isUndefined$1(props.key)) { key = props.key; } } if (flags & 28 /* Component */) { newVNode = inferno.createVNode(flags, vNodeToClone.type, null, null, !vNodeToClone.props && !props ? inferno.EMPTY_OBJ : combineFrom(vNodeToClone.props, props), key, ref, true); var newProps = newVNode.props; if (newProps) { var newChildren = newProps.children; // we need to also clone component children that are in props // as the children may also have been hoisted if (newChildren) { if (isArray$1(newChildren)) { var len$1 = newChildren.length; if (len$1 > 0) { var tmpArray$1 = []; for (var i$1 = 0; i$1 < len$1; i$1++) { var child = newChildren[i$1]; if (isStringOrNumber(child)) { tmpArray$1.push(child); } else if (!isInvalid(child) && (child.flags)) { tmpArray$1.push(inferno.directClone(child)); } } newProps.children = tmpArray$1; } } else if (newChildren.flags) { newProps.children = inferno.directClone(newChildren); } } } newVNode.children = null; } else if (flags & 3970 /* Element */) { children = props && !isUndefined$1(props.children) ? props.children : vNodeToClone.children; newVNode = inferno.createVNode(flags, vNodeToClone.type, className, children, !vNodeToClone.props && !props ? inferno.EMPTY_OBJ : combineFrom(vNodeToClone.props, props), key, ref, false); } else if (flags & 1 /* Text */) { newVNode = inferno.createVNode(1 /* Text */, null, null, vNodeToClone.children, null, key, null, true); } } return newVNode; } /** * @module Inferno-Shared */ /** TypeDoc Comment */ var NO_OP = "$NO_OP"; var ERROR_MSG = "a runtime error occured! Use Inferno in development environment to find the error."; // This should be boolean and not reference to window.document var isBrowser = !!(typeof window !== "undefined" && window.document); // this is MUCH faster than .constructor === Array and instanceof Array // in Node 7 and the later versions of V8, slower in older versions though var isArray = Array.isArray; function isNullOrUndef(o) { return isUndefined(o) || isNull(o); } function isFunction(o) { return typeof o === "function"; } function isString(o) { return typeof o === "string"; } function isNull(o) { return o === null; } function isUndefined(o) { return o === void 0; } function isObject(o) { return typeof o === "object"; } function throwError(message) { if (!message) { message = ERROR_MSG; } throw new Error(("Inferno Error: " + message)); } /** * @module Inferno-Compat */ /** TypeDoc Comment */ function isValidElement(obj) { var isNotANullObject = isObject(obj) && isNull(obj) === false; if (isNotANullObject === false) { return false; } var flags = obj.flags; return (flags & (28 /* Component */ | 3970 /* Element */)) > 0; } /** * @module Inferno-Compat */ /** * Inlined PropTypes, there is propType checking ATM. */ // tslint:disable-next-line:no-empty function proptype() { } proptype.isRequired = proptype; var getProptype = function () { return proptype; }; var PropTypes = { any: getProptype, array: proptype, arrayOf: getProptype, bool: proptype, checkPropTypes: function () { return null; }, element: getProptype, func: proptype, instanceOf: getProptype, node: getProptype, number: proptype, object: proptype, objectOf: getProptype, oneOf: getProptype, oneOfType: getProptype, shape: getProptype, string: proptype, symbol: proptype }; /** * This is a list of all SVG attributes that need special casing, * namespacing, or boolean value assignment. * * When adding attributes to this list, be sure to also add them to * the `possibleStandardNames` module to ensure casing and incorrect * name warnings. * * SVG Attributes List: * https://www.w3.org/TR/SVG/attindex.html * SMIL Spec: * https://www.w3.org/TR/smil */ var ATTRS = [ "accent-height", "alignment-baseline", "arabic-form", "baseline-shift", "cap-height", "clip-path", "clip-rule", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "dominant-baseline", "enable-background", "fill-opacity", "fill-rule", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-constiant", "font-weight", "glyph-name", "glyph-orientation-horizontal", "glyph-orientation-vertical", "horiz-adv-x", "horiz-origin-x", "image-rendering", "letter-spacing", "lighting-color", "marker-end", "marker-mid", "marker-start", "overline-position", "overline-thickness", "paint-order", "panose-1", "pointer-events", "rendering-intent", "shape-rendering", "stop-color", "stop-opacity", "strikethrough-position", "strikethrough-thickness", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-anchor", "text-decoration", "text-rendering", "underline-position", "underline-thickness", "unicode-bidi", "unicode-range", "units-per-em", "v-alphabetic", "v-hanging", "v-ideographic", "v-mathematical", "vector-effect", "vert-adv-y", "vert-origin-x", "vert-origin-y", "word-spacing", "writing-mode", "x-height", "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", "xlink:title", "xlink:type", "xml:base", "xmlns:xlink", "xml:lang", "xml:space" ]; var SVGDOMPropertyConfig = {}; var CAMELIZE = /[\-\:]([a-z])/g; var capitalize = function (token) { return token[1].toUpperCase(); }; ATTRS.forEach(function (original) { var reactName = original.replace(CAMELIZE, capitalize); SVGDOMPropertyConfig[reactName] = original; }); /** * @module Inferno-Compat */ /** TypeDoc Comment */ var componentToDOMNodeMap = new Map(); inferno.options.findDOMNodeEnabled = true; function unmountComponentAtNode(container) { inferno.render(null, container); return true; } var ARR = []; var Children = { map: function map(children, fn, ctx) { if (isNullOrUndef(children)) { return children; } children = Children.toArray(children); if (ctx && ctx !== children) { fn = fn.bind(ctx); } return children.map(fn); }, forEach: function forEach(children, fn, ctx) { if (isNullOrUndef(children)) { return; } children = Children.toArray(children); if (ctx && ctx !== children) { fn = fn.bind(ctx); } for (var i = 0, len = children.length; i < len; i++) { fn(children[i], i, children); } }, count: function count(children) { children = Children.toArray(children); return children.length; }, only: function only(children) { children = Children.toArray(children); if (children.length !== 1) { throw new Error("Children.only() expects only one child."); } return children[0]; }, toArray: function toArray$$1(children) { if (isNullOrUndef(children)) { return []; } return isArray(children) ? children : ARR.concat(children); } }; inferno.Component.prototype.isReactComponent = {}; var currentComponent = null; inferno.options.beforeRender = function (component) { currentComponent = component; }; inferno.options.afterRender = function () { currentComponent = null; }; var nextAfterMount = inferno.options.afterMount; inferno.options.afterMount = function (vNode) { if (inferno.options.findDOMNodeEnabled) { componentToDOMNodeMap.set(vNode.children, vNode.dom); } if (nextAfterMount) { nextAfterMount(vNode); } }; var nextAfterUpdate = inferno.options.afterUpdate; inferno.options.afterUpdate = function (vNode) { if (inferno.options.findDOMNodeEnabled) { componentToDOMNodeMap.set(vNode.children, vNode.dom); } if (nextAfterUpdate) { nextAfterUpdate(vNode); } }; var nextBeforeUnmount = inferno.options.beforeUnmount; inferno.options.beforeUnmount = function (vNode) { if (inferno.options.findDOMNodeEnabled) { componentToDOMNodeMap.delete(vNode.children); } if (nextBeforeUnmount) { nextBeforeUnmount(vNode); } }; var version = "15.4.2"; function normalizeProps(name, props) { if ((name === "input" || name === "textarea") && props.type !== "radio" && props.onChange) { var type = props.type; var eventName; if (type === "checkbox") { eventName = "onclick"; } else if (type === "file") { eventName = "onchange"; } else { eventName = "oninput"; } if (!props[eventName]) { props[eventName] = props.onChange; delete props.onChange; } } for (var prop in props) { if (prop === "onDoubleClick") { props.onDblClick = props[prop]; delete props[prop]; } if (prop === "htmlFor") { props.for = props[prop]; delete props[prop]; } var mappedProp = SVGDOMPropertyConfig[prop]; if (mappedProp && mappedProp !== prop) { props[mappedProp] = props[prop]; delete props[prop]; } } } // we need to add persist() to Event (as React has it for synthetic events) // this is a hack and we really shouldn't be modifying a global object this way, // but there isn't a performant way of doing this apart from trying to proxy // every prop event that starts with "on", i.e. onClick or onKeyPress // but in reality devs use onSomething for many things, not only for // input events if (typeof Event !== "undefined" && !Event.prototype.persist) { // tslint:disable-next-line:no-empty Event.prototype.persist = function () { }; } function iterableToArray(iterable) { var iterStep; var tmpArr = []; do { iterStep = iterable.next(); if (iterStep.value) { tmpArr.push(iterStep.value); } } while (!iterStep.done); return tmpArr; } var hasSymbolSupport = typeof Symbol !== "undefined"; var injectStringRefs = function (originalFunction) { return function (name, _props) { var arguments$1 = arguments; var children = [], len$1 = arguments.length - 2; while ( len$1-- > 0 ) { children[ len$1 ] = arguments$1[ len$1 + 2 ]; } var props = _props || {}; var ref = props.ref; if (typeof ref === "string" && !isNull(currentComponent)) { currentComponent.refs = currentComponent.refs || {}; props.ref = function (val) { this.refs[ref] = val; }.bind(currentComponent); } if (typeof name === "string") { normalizeProps(name, props); } // React supports iterable children, in addition to Array-like if (hasSymbolSupport) { for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (child && !isArray(child) && !isString(child) && isFunction(child[Symbol.iterator])) { children[i] = iterableToArray(child[Symbol.iterator]()); } } } var vnode = originalFunction.apply(void 0, [ name, props ].concat( children )); if (vnode.className) { vnode.props = vnode.props || {}; vnode.props.className = vnode.className; } return vnode; }; }; var createElement = injectStringRefs(infernoCreateElement); var cloneElement = injectStringRefs(cloneVNode); var oldCreateVNode = inferno.options.createVNode; inferno.options.createVNode = function (vNode) { var children = vNode.children; var props = vNode.props; if (isNullOrUndef(props)) { props = vNode.props = {}; } if (!isNullOrUndef(children) && isNullOrUndef(props.children)) { props.children = children; } if (vNode.flags & 28 /* Component */) { if (isString(vNode.type)) { vNode.flags = inferno.getFlagsForElementVnode(vNode.type); if (props && props.children) { vNode.children = props.children; delete props.children; } } } if (oldCreateVNode) { oldCreateVNode(vNode); } }; // Credit: preact-compat - https://github.com/developit/preact-compat :) function shallowDiffers(a, b) { for (var i in a) { if (!(i in b)) { return true; } } for (var i$1 in b) { if (a[i$1] !== b[i$1]) { return true; } } return false; } function PureComponent(props, context) { inferno.Component.call(this, props, context); } PureComponent.prototype = new inferno.Component({}, {}); PureComponent.prototype.shouldComponentUpdate = function (props, state) { return shallowDiffers(this.props, props) || shallowDiffers(this.state, state); }; var WrapperComponent = (function (Component$$1) { function WrapperComponent () { Component$$1.apply(this, arguments); } if ( Component$$1 ) { WrapperComponent.__proto__ = Component$$1; } WrapperComponent.prototype = Object.create( Component$$1 && Component$$1.prototype ); WrapperComponent.prototype.constructor = WrapperComponent; WrapperComponent.prototype.getChildContext = function getChildContext () { // tslint:disable-next-line return this.props["context"]; }; WrapperComponent.prototype.render = function render$$1 (props) { return props.children; }; return WrapperComponent; }(inferno.Component)); function unstable_renderSubtreeIntoContainer(parentComponent, vNode, container, callback) { var wrapperVNode = inferno.createVNode(4, WrapperComponent, null, null, { children: vNode, context: parentComponent.context }); var component = inferno.render(wrapperVNode, container); if (callback) { // callback gets the component as context, no other argument. callback.call(component); } return component; } // Credit: preact-compat - https://github.com/developit/preact-compat var ELEMENTS = "a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr circle clipPath defs ellipse g image line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "); function createFactory(type) { return createElement.bind(null, type); } var DOM = {}; for (var i = ELEMENTS.length; i--;) { DOM[ELEMENTS[i]] = createFactory(ELEMENTS[i]); } function findDOMNode(ref) { if (!inferno.options.findDOMNodeEnabled) { throwError(); } var dom = ref && ref.nodeType ? ref : null; return componentToDOMNodeMap.get(ref) || dom; } // Mask React global in browser enviornments when React is not used. if (isBrowser && typeof window.React === "undefined") { var exports$1 = { Children: Children, Component: inferno.Component, DOM: DOM, EMPTY_OBJ: inferno.EMPTY_OBJ, NO_OP: NO_OP, PropTypes: PropTypes, PureComponent: PureComponent, cloneElement: cloneElement, cloneVNode: cloneVNode, createClass: createClass, createElement: createElement, createFactory: createFactory, createVNode: inferno.createVNode, findDOMNode: findDOMNode, isValidElement: isValidElement, render: inferno.render, unmountComponentAtNode: unmountComponentAtNode, unstable_renderSubtreeIntoContainer: unstable_renderSubtreeIntoContainer, version: version }; window.React = exports$1; window.ReactDOM = exports$1; } /** * @module Inferno-Mobx */ /** TypeDoc Comment */ var EventEmitter = function EventEmitter() { this.listeners = []; }; EventEmitter.prototype.on = function on (cb) { var this$1 = this; this.listeners.push(cb); return function () { var index = this$1.listeners.indexOf(cb); if (index !== -1) { this$1.listeners.splice(index, 1); } }; }; EventEmitter.prototype.emit = function emit (data) { var listeners = this.listeners; for (var i = 0, len = listeners.length; i < len; i++) { listeners[i](data); } }; /** * @module Inferno-Shared */ /** TypeDoc Comment */ // This should be boolean and not reference to window.document var isBrowser$2 = !!(typeof window !== "undefined" && window.document); function warning(message) { // tslint:disable-next-line:no-console console.error(message); } /** * @module Inferno-Mobx */ /** TypeDoc Comment */ function isStateless(component) { return !(component.prototype && component.prototype.render); } /** * @module Inferno-Mobx */ /** TypeDoc Comment */ /** * dev tool support */ var isDevtoolsEnabled = false; var isUsingStaticRendering = false; var warnedAboutObserverInjectDeprecation = false; var componentByNodeRegistery = new WeakMap(); var renderReporter = new EventEmitter(); function findNode(component) { if (inferno.options.findDOMNodeEnabled) { return findDOMNode(component); } return null; } function reportRendering(component) { var node = findNode(component); if (node) { componentByNodeRegistery.set(node, component); } renderReporter.emit({ component: component, event: "render", node: node, renderTime: component.__$mobRenderEnd - component.__$mobRenderStart, totalTime: Date.now() - component.__$mobRenderStart }); } function trackComponents() { if (!isDevtoolsEnabled) { isDevtoolsEnabled = true; inferno.options.findDOMNodeEnabled = true; warning("Do not turn trackComponents on in production, its expensive. For tracking dom nodes you need inferno-compat."); } } function useStaticRendering(useStatic) { isUsingStaticRendering = useStatic; } /** * Errors reporter */ var errorsReporter = new EventEmitter(); /** * Utilities */ function patch(target, funcName, runMixinFirst) { if ( runMixinFirst === void 0 ) runMixinFirst = false; var base = target[funcName]; var mixinFunc = reactiveMixin[funcName]; // MWE: ideally we freeze here to protect against accidental overwrites in component instances, see #195 // ...but that breaks react-hot-loader, see #231... target[funcName] = base ? runMixinFirst === true ? function () { mixinFunc.apply(this, arguments); base.apply(this, arguments); } : function () { base.apply(this, arguments); mixinFunc.apply(this, arguments); } : mixinFunc; } function isObjectShallowModified(prev, next) { if (null == prev || null == next || typeof prev !== "object" || typeof next !== "object") { return prev !== next; } var keys = Object.keys(prev); if (keys.length !== Object.keys(next).length) { return true; } var key; for (var i = keys.length - 1; i >= 0; i--) { key = keys[i]; if (next[key] !== prev[key]) { return true; } } return false; } /** * ReactiveMixin */ var reactiveMixin = { componentWillMount: function componentWillMount() { var this$1 = this; if (isUsingStaticRendering === true) { return; } // Generate friendly name for debugging var initialName = this.displayName || this.name || (this.constructor && (this.constructor.displayName || this.constructor.name)) || "<component>"; var rootNodeID = this._reactInternalInstance && this._reactInternalInstance._rootNodeID; /** * If props are shallowly modified, react will render anyway, * so atom.reportChanged() should not result in yet another re-render */ var skipRender = false; /** * forceUpdate will re-assign this.props. We don't want that to cause a loop, * so detect these changes */ function makePropertyObservableReference(propName) { var valueHolder = this[propName]; var atom = new mobx.Atom("reactive " + propName); Object.defineProperty(this, propName, { configurable: true, enumerable: true, get: function get() { atom.reportObserved(); return valueHolder; }, set: function set(v) { if (isObjectShallowModified(valueHolder, v)) { valueHolder = v; skipRender = true; atom.reportChanged(); skipRender = false; } else { valueHolder = v; } } }); } // make this.props an observable reference, see #124 makePropertyObservableReference.call(this, "props"); // make state an observable reference makePropertyObservableReference.call(this, "state"); // wire up reactive render var me = this; var render$$1 = this.render.bind(this); var baseRender = function () { return render$$1(me.props, me.state, me.context); }; var reaction = null; var isRenderingPending = false; var initialRender = function () { reaction = new mobx.Reaction((initialName + "#" + rootNodeID + ".render()"), function () { if (!isRenderingPending) { // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js) // This unidiomatic React usage but React will correctly warn about this so we continue as usual // See #85 / Pull #44 isRenderingPending = true; if (typeof this$1.componentWillReact === "function") { this$1.componentWillReact(); // TODO: wrap in action? } if (this$1.__$mobxIsUnmounted !== true) { if (!skipRender) { this$1.$UPD = true; this$1.forceUpdate(); this$1.$UPD = false; } } } }); reaction.reactComponent = this$1; reactiveRender.$mobx = reaction; this$1.render = reactiveRender; return reactiveRender(); }; var reactiveRender = function () { isRenderingPending = false; var exception; var rendering = null; reaction.track(function () { if (isDevtoolsEnabled) { this$1.__$mobRenderStart = Date.now(); } try { rendering = mobx.extras.allowStateChanges(false, baseRender); } catch (e) { exception = e; } if (isDevtoolsEnabled) { this$1.__$mobRenderEnd = Date.now(); } }); if (exception) { errorsReporter.emit(exception); throw exception; } return rendering; }; this.render = initialRender; }, componentWillUnmount: function componentWillUnmount() { if (isUsingStaticRendering === true) { return; } if (this.render.$mobx) { this.render.$mobx.dispose(); } this.__$mobxIsUnmounted = true; if (isDevtoolsEnabled) { var node = findDOMNode(this); if (node) { componentByNodeRegistery.delete(node); } renderReporter.emit({ component: this, event: "destroy", node: node }); } }, componentDidMount: function componentDidMount() { if (isDevtoolsEnabled) { reportRendering(this); } }, componentDidUpdate: function componentDidUpdate() { if (isDevtoolsEnabled) { reportRendering(this); } }, shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { if (isUsingStaticRendering) { warning("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."); } // update on any state changes (as is the default) if (this.state !== nextState) { return true; } // update if props are shallowly not equal, inspired by PureRenderMixin // we could return just 'false' here, and avoid the `skipRender` checks etc // however, it is nicer if lifecycle events are triggered like usually, // so we return true here if props are shallowly modified. return isObjectShallowModified(this.props, nextProps); } }; /** * Observer function / decorator */ function observer(arg1, arg2) { if (typeof arg1 === "string") { throw new Error("Store names should be provided as array"); } if (Array.isArray(arg1)) { // component needs stores if (!warnedAboutObserverInjectDeprecation) { warnedAboutObserverInjectDeprecation = true; warning('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`'); } if (!arg2) { // invoked as decorator return function (componentClass) { return observer(arg1, componentClass); }; } else { return inject.apply(null, arg1)(observer(arg2)); } } var component = arg1; if (component.isMobxInjector === true) { warning("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"); } // Stateless function component: // If it is function but doesn't seem to be a react class constructor, // wrap it to a react class automatically if (typeof component === "function" && (!component.prototype || !component.prototype.render)) { return observer((_a = (function (Component$$1) { function _a () { Component$$1.apply(this, arguments); } if ( Component$$1 ) _a.__proto__ = Component$$1; _a.prototype = Object.create( Component$$1 && Component$$1.prototype ); _a.prototype.constructor = _a; _a.prototype.render = function render$$1 (props, state, context) { return component(props, context); }; return _a; }(inferno.Component)), _a.displayName = component.displayName || component.name, _a.defaultProps = component.defaultProps, _a)); } if (!component) { throw new Error("Please pass a valid component to 'observer'"); } var target = component.prototype || component; mixinLifecycleEvents(target); component.isMobXReactObserver = true; return component; var _a; } function mixinLifecycleEvents(target) { patch(target, "componentWillMount", true); ["componentDidMount", "componentWillUnmount", "componentDidUpdate"].forEach(function (funcName) { patch(target, funcName); }); if (!target.shouldComponentUpdate) { target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate; } } // TODO: support injection somehow as well? var Observer = observer(function (ref) { var children = ref.children; return children(); }); var proxiedInjectorProps = { isMobxInjector: { configurable: true, enumerable: true, value: true, writable: true } }; /** * Store Injection */ function createStoreInjector(grabStoresFn, component, injectNames) { var displayName = "inject-" + (component.displayName || component.name || (component.constructor && component.constructor.name) || "Unknown"); if (injectNames) { displayName += "-with-" + injectNames; } var Injector = (function (Component$$1) { function Injector(props, context) { Component$$1.call(this, props, context); this.storeRef = this.storeRef.bind(this); } if ( Component$$1 ) Injector.__proto__ = Component$$1; Injector.prototype = Object.create( Component$$1 && Component$$1.prototype ); Injector.prototype.constructor = Injector; Injector.prototype.storeRef = function storeRef (instance) { this.wrappedInstance = instance; }; Injector.prototype.render = function render$$1 (props, state, context) { // Optimization: it might be more efficient to apply the mapper function *outside* the render method // (if the mapper is a function), that could avoid expensive(?) re-rendering of the injector component // See this test: 'using a custom injector is not too reactive' in inject.js var newProps = {}; var key; for (key in props) { newProps[key] = props[key]; } var additionalProps = grabStoresFn(context.mobxStores || {}, newProps, context) || {}; for (key in additionalProps) { newProps[key] = additionalProps[key]; } return inferno.createVNode(16 /* ComponentUnknown */, component, null, null, newProps, null, isStateless(component) ? null : this.storeRef); }; return Injector; }(inferno.Component)); Injector.displayName = displayName; Injector.isMobxInjector = false; // Static fields from component should be visible on the generated Injector hoistStatics(Injector, component); Injector.wrappedComponent = component; Object.defineProperties(Injector, proxiedInjectorProps); return Injector; } function grabStoresByName(storeNames) { return function (baseStores, nextProps) { for (var i = 0, len = storeNames.length; i < len; i++) { var storeName = storeNames[i]; if (!(storeName in nextProps)) { // Development warning { if (!(storeName in baseStores)) { throw new Error("MobX injector: Store '" + storeName + "' is not available! Make sure it is provided by some Provider"); } } nextProps[storeName] = baseStores[storeName]; } } return nextProps; }; } /** * higher order component that injects stores to a child. * takes either a varargs list of strings, which are stores read from the context, * or a function that manually maps the available stores from the context to props: * storesToProps(mobxStores, props, context) => newProps */ // TODO: Type function inject() { var arguments$1 = arguments; var grabStoresFn; if (typeof arguments[0] === "function") { grabStoresFn = arguments[0]; return function (componentClass) { var injected = createStoreInjector(grabStoresFn, componentClass); injected.isMobxInjector = false; // supress warning // mark the Injector as observer, to make it react to expressions in `grabStoresFn`, // see #111 injected = observer(injected); injected.isMobxInjector = true; // restore warning return injected; }; } else { var storeNames = []; for (var i = 0; i < arguments.length; i++) { storeNames.push(arguments$1[i]); } grabStoresFn = grabStoresByName(storeNames); return function (componentClass) { return createStoreInjector(grabStoresFn, componentClass, storeNames.join("-")); }; } } /** * @module Inferno-Mobx */ /** TypeDoc Comment */ var specialKeys = new Set(); specialKeys.add("children"); specialKeys.add("key"); specialKeys.add("ref"); var Provider = (function (Component$$1) { function Provider () { Component$$1.apply(this, arguments); } if ( Component$$1 ) Provider.__proto__ = Component$$1; Provider.prototype = Object.create( Component$$1 && Component$$1.prototype ); Provider.prototype.constructor = Provider; Provider.prototype.render = function render$$1 (props) { return props.children; }; Provider.prototype.getChildContext = function getChildContext () { var stores = {}; // inherit stores var props = this.props; var baseStores = this.context.mobxStores; if (baseStores) { for (var key in baseStores) { stores[key] = baseStores[key]; } } // add own stores for (var key$1 in props) { if (!specialKeys.has(key$1) && key$1 !== "suppressChangedStoreWarning") { stores[key$1] = props[key$1]; } } return { mobxStores: stores }; }; return Provider; }(inferno.Component)); // Development warning { Provider.prototype.componentWillReceiveProps = function (nextProps) { var this$1 = this; // Maybe this warning is too aggressive? if (Object.keys(nextProps).length !== Object.keys(this.props).length) { warning("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children"); } if (!nextProps.suppressChangedStoreWarning) { for (var key in nextProps) { if (!specialKeys.has(key) && this$1.props[key] !== nextProps[key]) { warning("MobX Provider: Provided store '" + key + "' has changed. Please avoid replacing stores as the change might not propagate to all children"); } } } }; } /** * @module Inferno-Mobx */ /** TypeDoc Comment */ // THIS IS PORT OF AWESOME MOBX-REACT to INFERNO // LAST POINT OF PORT (4.2.2) // https://github.com/mobxjs/mobx-react/commit/acdc338db55b05f256c0ef357c9b71433fbd53d2 var onError = function (fn) { return errorsReporter.on(fn); }; var index = { Observer: Observer, Provider: Provider, componentByNodeRegistery: componentByNodeRegistery, errorsReporter: errorsReporter, inject: inject, observer: observer, onError: onError, renderReporter: renderReporter, trackComponents: trackComponents, useStaticRendering: useStaticRendering }; exports['default'] = index; exports.componentByNodeRegistery = componentByNodeRegistery; exports.errorsReporter = errorsReporter; exports.inject = inject; exports.observer = observer; exports.onError = onError; exports.EventEmitter = EventEmitter; exports.Observer = Observer; exports.Provider = Provider; exports.renderReporter = renderReporter; exports.trackComponents = trackComponents; exports.useStaticRendering = useStaticRendering; Object.defineProperty(exports, '__esModule', { value: true }); })));
node_modules/nyc/node_modules/core-js/client/library.js
Jon12COBass/jontaylorsresume
/** * core-js 2.4.1 * https://github.com/zloirock/core-js * License: http://rock.mit-license.org * © 2016 Denis Pushkarev */ !function(__e, __g, undefined){ 'use strict'; /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(1); __webpack_require__(50); __webpack_require__(51); __webpack_require__(52); __webpack_require__(54); __webpack_require__(55); __webpack_require__(58); __webpack_require__(59); __webpack_require__(60); __webpack_require__(61); __webpack_require__(62); __webpack_require__(63); __webpack_require__(64); __webpack_require__(65); __webpack_require__(66); __webpack_require__(68); __webpack_require__(70); __webpack_require__(72); __webpack_require__(75); __webpack_require__(76); __webpack_require__(79); __webpack_require__(80); __webpack_require__(81); __webpack_require__(82); __webpack_require__(84); __webpack_require__(85); __webpack_require__(86); __webpack_require__(87); __webpack_require__(88); __webpack_require__(92); __webpack_require__(94); __webpack_require__(95); __webpack_require__(96); __webpack_require__(98); __webpack_require__(99); __webpack_require__(100); __webpack_require__(102); __webpack_require__(103); __webpack_require__(104); __webpack_require__(106); __webpack_require__(107); __webpack_require__(108); __webpack_require__(109); __webpack_require__(110); __webpack_require__(111); __webpack_require__(112); __webpack_require__(113); __webpack_require__(114); __webpack_require__(115); __webpack_require__(116); __webpack_require__(117); __webpack_require__(118); __webpack_require__(119); __webpack_require__(121); __webpack_require__(125); __webpack_require__(126); __webpack_require__(127); __webpack_require__(128); __webpack_require__(132); __webpack_require__(134); __webpack_require__(135); __webpack_require__(136); __webpack_require__(137); __webpack_require__(138); __webpack_require__(139); __webpack_require__(140); __webpack_require__(141); __webpack_require__(142); __webpack_require__(143); __webpack_require__(144); __webpack_require__(145); __webpack_require__(146); __webpack_require__(147); __webpack_require__(154); __webpack_require__(155); __webpack_require__(157); __webpack_require__(158); __webpack_require__(159); __webpack_require__(163); __webpack_require__(164); __webpack_require__(165); __webpack_require__(166); __webpack_require__(167); __webpack_require__(169); __webpack_require__(170); __webpack_require__(171); __webpack_require__(172); __webpack_require__(175); __webpack_require__(177); __webpack_require__(178); __webpack_require__(179); __webpack_require__(181); __webpack_require__(183); __webpack_require__(190); __webpack_require__(193); __webpack_require__(194); __webpack_require__(196); __webpack_require__(197); __webpack_require__(198); __webpack_require__(199); __webpack_require__(200); __webpack_require__(201); __webpack_require__(202); __webpack_require__(203); __webpack_require__(204); __webpack_require__(205); __webpack_require__(206); __webpack_require__(207); __webpack_require__(209); __webpack_require__(210); __webpack_require__(211); __webpack_require__(212); __webpack_require__(213); __webpack_require__(214); __webpack_require__(215); __webpack_require__(218); __webpack_require__(219); __webpack_require__(221); __webpack_require__(222); __webpack_require__(223); __webpack_require__(224); __webpack_require__(225); __webpack_require__(226); __webpack_require__(227); __webpack_require__(228); __webpack_require__(229); __webpack_require__(230); __webpack_require__(231); __webpack_require__(233); __webpack_require__(234); __webpack_require__(235); __webpack_require__(236); __webpack_require__(238); __webpack_require__(239); __webpack_require__(240); __webpack_require__(241); __webpack_require__(243); __webpack_require__(244); __webpack_require__(246); __webpack_require__(247); __webpack_require__(248); __webpack_require__(249); __webpack_require__(252); __webpack_require__(253); __webpack_require__(254); __webpack_require__(255); __webpack_require__(256); __webpack_require__(257); __webpack_require__(258); __webpack_require__(259); __webpack_require__(261); __webpack_require__(262); __webpack_require__(263); __webpack_require__(264); __webpack_require__(265); __webpack_require__(266); __webpack_require__(267); __webpack_require__(268); __webpack_require__(269); __webpack_require__(270); __webpack_require__(271); __webpack_require__(272); __webpack_require__(273); __webpack_require__(276); __webpack_require__(151); __webpack_require__(278); __webpack_require__(277); __webpack_require__(279); __webpack_require__(280); __webpack_require__(281); __webpack_require__(282); __webpack_require__(283); __webpack_require__(285); __webpack_require__(286); __webpack_require__(287); __webpack_require__(289); module.exports = __webpack_require__(290); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // ECMAScript 6 symbols shim var global = __webpack_require__(2) , has = __webpack_require__(3) , DESCRIPTORS = __webpack_require__(4) , $export = __webpack_require__(6) , redefine = __webpack_require__(18) , META = __webpack_require__(19).KEY , $fails = __webpack_require__(5) , shared = __webpack_require__(21) , setToStringTag = __webpack_require__(22) , uid = __webpack_require__(20) , wks = __webpack_require__(23) , wksExt = __webpack_require__(24) , wksDefine = __webpack_require__(25) , keyOf = __webpack_require__(27) , enumKeys = __webpack_require__(40) , isArray = __webpack_require__(43) , anObject = __webpack_require__(12) , toIObject = __webpack_require__(30) , toPrimitive = __webpack_require__(16) , createDesc = __webpack_require__(17) , _create = __webpack_require__(44) , gOPNExt = __webpack_require__(47) , $GOPD = __webpack_require__(49) , $DP = __webpack_require__(11) , $keys = __webpack_require__(28) , gOPD = $GOPD.f , dP = $DP.f , gOPN = gOPNExt.f , $Symbol = global.Symbol , $JSON = global.JSON , _stringify = $JSON && $JSON.stringify , PROTOTYPE = 'prototype' , HIDDEN = wks('_hidden') , TO_PRIMITIVE = wks('toPrimitive') , isEnum = {}.propertyIsEnumerable , SymbolRegistry = shared('symbol-registry') , AllSymbols = shared('symbols') , OPSymbols = shared('op-symbols') , ObjectProto = Object[PROTOTYPE] , USE_NATIVE = typeof $Symbol == 'function' , QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = DESCRIPTORS && $fails(function(){ return _create(dP({}, 'a', { get: function(){ return dP(this, 'a', {value: 7}).a; } })).a != 7; }) ? function(it, key, D){ var protoDesc = gOPD(ObjectProto, key); if(protoDesc)delete ObjectProto[key]; dP(it, key, D); if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); } : dP; var wrap = function(tag){ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ return typeof it == 'symbol'; } : function(it){ return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D){ if(it === ObjectProto)$defineProperty(OPSymbols, key, D); anObject(it); key = toPrimitive(key, true); anObject(D); if(has(AllSymbols, key)){ if(!D.enumerable){ if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); it[HIDDEN][key] = true; } else { if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; D = _create(D, {enumerable: createDesc(0, false)}); } return setSymbolDesc(it, key, D); } return dP(it, key, D); }; var $defineProperties = function defineProperties(it, P){ anObject(it); var keys = enumKeys(P = toIObject(P)) , i = 0 , l = keys.length , key; while(l > i)$defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P){ return P === undefined ? _create(it) : $defineProperties(_create(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key){ var E = isEnum.call(this, key = toPrimitive(key, true)); if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ it = toIObject(it); key = toPrimitive(key, true); if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; var D = gOPD(it, key); if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it){ var names = gOPN(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ var IS_OP = it === ObjectProto , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) , result = [] , i = 0 , key; while(names.length > i){ if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); } return result; }; // 19.4.1.1 Symbol([description]) if(!USE_NATIVE){ $Symbol = function Symbol(){ if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); var tag = uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function(value){ if(this === ObjectProto)$set.call(OPSymbols, value); if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; setSymbolDesc(this, tag, createDesc(1, value)); }; if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); return wrap(tag); }; redefine($Symbol[PROTOTYPE], 'toString', function toString(){ return this._k; }); $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; __webpack_require__(48).f = gOPNExt.f = $getOwnPropertyNames; __webpack_require__(42).f = $propertyIsEnumerable; __webpack_require__(41).f = $getOwnPropertySymbols; if(DESCRIPTORS && !__webpack_require__(26)){ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } wksExt.f = function(name){ return wrap(wks(name)); } } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); for(var symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, // 19.4.2.5 Symbol.keyFor(sym) keyFor: function keyFor(key){ if(isSymbol(key))return keyOf(SymbolRegistry, key); throw TypeError(key + ' is not a symbol!'); }, useSetter: function(){ setter = true; }, useSimple: function(){ setter = false; } }); $export($export.S + $export.F * !USE_NATIVE, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) defineProperty: $defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties) defineProperties: $defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: $getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it){ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined var args = [it] , i = 1 , replacer, $replacer; while(arguments.length > i)args.push(arguments[i++]); replacer = args[1]; if(typeof replacer == 'function')$replacer = replacer; if($replacer || !isArray(replacer))replacer = function(key, value){ if($replacer)value = $replacer.call(this, key, value); if(!isSymbol(value))return value; }; args[1] = replacer; return _stringify.apply($JSON, args); } }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(10)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); /***/ }, /* 2 */ /***/ function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }, /* 3 */ /***/ function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(5)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, /* 5 */ /***/ function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , core = __webpack_require__(7) , ctx = __webpack_require__(8) , hide = __webpack_require__(10) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , IS_WRAP = type & $export.W , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] , key, own, out; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && target[key] !== undefined; if(own && key in exports)continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function(C){ var F = function(a, b, c){ if(this instanceof C){ switch(arguments.length){ case 0: return new C; case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if(IS_PROTO){ (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); } } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }, /* 7 */ /***/ function(module, exports) { var core = module.exports = {version: '2.4.0'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(9); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }, /* 9 */ /***/ function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11) , createDesc = __webpack_require__(17); module.exports = __webpack_require__(4) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { var anObject = __webpack_require__(12) , IE8_DOM_DEFINE = __webpack_require__(14) , toPrimitive = __webpack_require__(16) , dP = Object.defineProperty; exports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); if(IE8_DOM_DEFINE)try { return dP(O, P, Attributes); } catch(e){ /* empty */ } if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); if('value' in Attributes)O[P] = Attributes.value; return O; }; /***/ }, /* 12 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }, /* 13 */ /***/ function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(4) && !__webpack_require__(5)(function(){ return Object.defineProperty(__webpack_require__(15)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13) , document = __webpack_require__(2).document // in old IE typeof document.createElement is 'object' , is = isObject(document) && isObject(document.createElement); module.exports = function(it){ return is ? document.createElement(it) : {}; }; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(13); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function(it, S){ if(!isObject(it))return it; var fn, val; if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }, /* 17 */ /***/ function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(10); /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { var META = __webpack_require__(20)('meta') , isObject = __webpack_require__(13) , has = __webpack_require__(3) , setDesc = __webpack_require__(11).f , id = 0; var isExtensible = Object.isExtensible || function(){ return true; }; var FREEZE = !__webpack_require__(5)(function(){ return isExtensible(Object.preventExtensions({})); }); var setMeta = function(it){ setDesc(it, META, {value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs }}); }; var fastKey = function(it, create){ // return primitive with prefix if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if(!has(it, META)){ // can't set metadata to uncaught frozen object if(!isExtensible(it))return 'F'; // not necessary to add metadata if(!create)return 'E'; // add missing metadata setMeta(it); // return object ID } return it[META].i; }; var getWeak = function(it, create){ if(!has(it, META)){ // can't set metadata to uncaught frozen object if(!isExtensible(it))return true; // not necessary to add metadata if(!create)return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function(it){ if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }, /* 20 */ /***/ function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ return store[key] || (store[key] = {}); }; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { var def = __webpack_require__(11).f , has = __webpack_require__(3) , TAG = __webpack_require__(23)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { var store = __webpack_require__(21)('wks') , uid = __webpack_require__(20) , Symbol = __webpack_require__(2).Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { exports.f = __webpack_require__(23); /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , core = __webpack_require__(7) , LIBRARY = __webpack_require__(26) , wksExt = __webpack_require__(24) , defineProperty = __webpack_require__(11).f; module.exports = function(name){ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); }; /***/ }, /* 26 */ /***/ function(module, exports) { module.exports = true; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(28) , toIObject = __webpack_require__(30); module.exports = function(object, el){ var O = toIObject(object) , keys = getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; }; /***/ }, /* 28 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(29) , enumBugKeys = __webpack_require__(39); module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { var has = __webpack_require__(3) , toIObject = __webpack_require__(30) , arrayIndexOf = __webpack_require__(34)(false) , IE_PROTO = __webpack_require__(38)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) , i = 0 , result = [] , key; for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); // Don't enum bug & hidden keys while(names.length > i)if(has(O, key = names[i++])){ ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(31) , defined = __webpack_require__(33); module.exports = function(it){ return IObject(defined(it)); }; /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(32); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }, /* 32 */ /***/ function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }, /* 33 */ /***/ function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(30) , toLength = __webpack_require__(35) , toIndex = __webpack_require__(37); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) , length = toLength(O.length) , index = toIndex(fromIndex, length) , value; // Array#includes uses SameValueZero equality algorithm if(IS_INCLUDES && el != el)while(length > index){ value = O[index++]; if(value != value)return true; // Array#toIndex ignores holes, Array#includes - not } else for(;length > index; index++)if(IS_INCLUDES || index in O){ if(O[index] === el)return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; /***/ }, /* 35 */ /***/ function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(36) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }, /* 36 */ /***/ function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil , floor = Math.floor; module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }, /* 37 */ /***/ function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(36) , max = Math.max , min = Math.min; module.exports = function(index, length){ index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { var shared = __webpack_require__(21)('keys') , uid = __webpack_require__(20); module.exports = function(key){ return shared[key] || (shared[key] = uid(key)); }; /***/ }, /* 39 */ /***/ function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols var getKeys = __webpack_require__(28) , gOPS = __webpack_require__(41) , pIE = __webpack_require__(42); module.exports = function(it){ var result = getKeys(it) , getSymbols = gOPS.f; if(getSymbols){ var symbols = getSymbols(it) , isEnum = pIE.f , i = 0 , key; while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); } return result; }; /***/ }, /* 41 */ /***/ function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }, /* 42 */ /***/ function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }, /* 43 */ /***/ function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__(32); module.exports = Array.isArray || function isArray(arg){ return cof(arg) == 'Array'; }; /***/ }, /* 44 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(12) , dPs = __webpack_require__(45) , enumBugKeys = __webpack_require__(39) , IE_PROTO = __webpack_require__(38)('IE_PROTO') , Empty = function(){ /* empty */ } , PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(15)('iframe') , i = enumBugKeys.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; __webpack_require__(46).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties){ var result; if(O !== null){ Empty[PROTOTYPE] = anObject(O); result = new Empty; Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }, /* 45 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11) , anObject = __webpack_require__(12) , getKeys = __webpack_require__(28); module.exports = __webpack_require__(4) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); var keys = getKeys(Properties) , length = keys.length , i = 0 , P; while(length > i)dP.f(O, P = keys[i++], Properties[P]); return O; }; /***/ }, /* 46 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(2).document && document.documentElement; /***/ }, /* 47 */ /***/ function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __webpack_require__(30) , gOPN = __webpack_require__(48).f , toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function(it){ try { return gOPN(it); } catch(e){ return windowNames.slice(); } }; module.exports.f = function getOwnPropertyNames(it){ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); }; /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = __webpack_require__(29) , hiddenKeys = __webpack_require__(39).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ return $keys(O, hiddenKeys); }; /***/ }, /* 49 */ /***/ function(module, exports, __webpack_require__) { var pIE = __webpack_require__(42) , createDesc = __webpack_require__(17) , toIObject = __webpack_require__(30) , toPrimitive = __webpack_require__(16) , has = __webpack_require__(3) , IE8_DOM_DEFINE = __webpack_require__(14) , gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__(4) ? gOPD : function getOwnPropertyDescriptor(O, P){ O = toIObject(O); P = toPrimitive(P, true); if(IE8_DOM_DEFINE)try { return gOPD(O, P); } catch(e){ /* empty */ } if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }, /* 50 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) $export($export.S + $export.F * !__webpack_require__(4), 'Object', {defineProperty: __webpack_require__(11).f}); /***/ }, /* 51 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) $export($export.S + $export.F * !__webpack_require__(4), 'Object', {defineProperties: __webpack_require__(45)}); /***/ }, /* 52 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) var toIObject = __webpack_require__(30) , $getOwnPropertyDescriptor = __webpack_require__(49).f; __webpack_require__(53)('getOwnPropertyDescriptor', function(){ return function getOwnPropertyDescriptor(it, key){ return $getOwnPropertyDescriptor(toIObject(it), key); }; }); /***/ }, /* 53 */ /***/ function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(6) , core = __webpack_require__(7) , fails = __webpack_require__(5); module.exports = function(KEY, exec){ var fn = (core.Object || {})[KEY] || Object[KEY] , exp = {}; exp[KEY] = exec(fn); $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); }; /***/ }, /* 54 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) $export($export.S, 'Object', {create: __webpack_require__(44)}); /***/ }, /* 55 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.9 Object.getPrototypeOf(O) var toObject = __webpack_require__(56) , $getPrototypeOf = __webpack_require__(57); __webpack_require__(53)('getPrototypeOf', function(){ return function getPrototypeOf(it){ return $getPrototypeOf(toObject(it)); }; }); /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(33); module.exports = function(it){ return Object(defined(it)); }; /***/ }, /* 57 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(3) , toObject = __webpack_require__(56) , IE_PROTO = __webpack_require__(38)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ O = toObject(O); if(has(O, IE_PROTO))return O[IE_PROTO]; if(typeof O.constructor == 'function' && O instanceof O.constructor){ return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }, /* 58 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.14 Object.keys(O) var toObject = __webpack_require__(56) , $keys = __webpack_require__(28); __webpack_require__(53)('keys', function(){ return function keys(it){ return $keys(toObject(it)); }; }); /***/ }, /* 59 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.7 Object.getOwnPropertyNames(O) __webpack_require__(53)('getOwnPropertyNames', function(){ return __webpack_require__(47).f; }); /***/ }, /* 60 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.5 Object.freeze(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(19).onFreeze; __webpack_require__(53)('freeze', function($freeze){ return function freeze(it){ return $freeze && isObject(it) ? $freeze(meta(it)) : it; }; }); /***/ }, /* 61 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(19).onFreeze; __webpack_require__(53)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(meta(it)) : it; }; }); /***/ }, /* 62 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.15 Object.preventExtensions(O) var isObject = __webpack_require__(13) , meta = __webpack_require__(19).onFreeze; __webpack_require__(53)('preventExtensions', function($preventExtensions){ return function preventExtensions(it){ return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; }; }); /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.12 Object.isFrozen(O) var isObject = __webpack_require__(13); __webpack_require__(53)('isFrozen', function($isFrozen){ return function isFrozen(it){ return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; }; }); /***/ }, /* 64 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.13 Object.isSealed(O) var isObject = __webpack_require__(13); __webpack_require__(53)('isSealed', function($isSealed){ return function isSealed(it){ return isObject(it) ? $isSealed ? $isSealed(it) : false : true; }; }); /***/ }, /* 65 */ /***/ function(module, exports, __webpack_require__) { // 19.1.2.11 Object.isExtensible(O) var isObject = __webpack_require__(13); __webpack_require__(53)('isExtensible', function($isExtensible){ return function isExtensible(it){ return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; }; }); /***/ }, /* 66 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(6); $export($export.S + $export.F, 'Object', {assign: __webpack_require__(67)}); /***/ }, /* 67 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(28) , gOPS = __webpack_require__(41) , pIE = __webpack_require__(42) , toObject = __webpack_require__(56) , IObject = __webpack_require__(31) , $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__(5)(function(){ var A = {} , B = {} , S = Symbol() , K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function(k){ B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source){ // eslint-disable-line no-unused-vars var T = toObject(target) , aLen = arguments.length , index = 1 , getSymbols = gOPS.f , isEnum = pIE.f; while(aLen > index){ var S = IObject(arguments[index++]) , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) , length = keys.length , j = 0 , key; while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; } return T; } : $assign; /***/ }, /* 68 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.10 Object.is(value1, value2) var $export = __webpack_require__(6); $export($export.S, 'Object', {is: __webpack_require__(69)}); /***/ }, /* 69 */ /***/ function(module, exports) { // 7.2.9 SameValue(x, y) module.exports = Object.is || function is(x, y){ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; /***/ }, /* 70 */ /***/ function(module, exports, __webpack_require__) { // 19.1.3.19 Object.setPrototypeOf(O, proto) var $export = __webpack_require__(6); $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(71).set}); /***/ }, /* 71 */ /***/ function(module, exports, __webpack_require__) { // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ var isObject = __webpack_require__(13) , anObject = __webpack_require__(12); var check = function(O, proto){ anObject(O); if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); }; module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line function(test, buggy, set){ try { set = __webpack_require__(8)(Function.call, __webpack_require__(49).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch(e){ buggy = true; } return function setPrototypeOf(O, proto){ check(O, proto); if(buggy)O.__proto__ = proto; else set(O, proto); return O; }; }({}, false) : undefined), check: check }; /***/ }, /* 72 */ /***/ function(module, exports, __webpack_require__) { // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) var $export = __webpack_require__(6); $export($export.P, 'Function', {bind: __webpack_require__(73)}); /***/ }, /* 73 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var aFunction = __webpack_require__(9) , isObject = __webpack_require__(13) , invoke = __webpack_require__(74) , arraySlice = [].slice , factories = {}; var construct = function(F, len, args){ if(!(len in factories)){ for(var n = [], i = 0; i < len; i++)n[i] = 'a[' + i + ']'; factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); } return factories[len](F, args); }; module.exports = Function.bind || function bind(that /*, args... */){ var fn = aFunction(this) , partArgs = arraySlice.call(arguments, 1); var bound = function(/* args... */){ var args = partArgs.concat(arraySlice.call(arguments)); return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); }; if(isObject(fn.prototype))bound.prototype = fn.prototype; return bound; }; /***/ }, /* 74 */ /***/ function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 module.exports = function(fn, args, that){ var un = that === undefined; switch(args.length){ case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }, /* 75 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var isObject = __webpack_require__(13) , getPrototypeOf = __webpack_require__(57) , HAS_INSTANCE = __webpack_require__(23)('hasInstance') , FunctionProto = Function.prototype; // 19.2.3.6 Function.prototype[@@hasInstance](V) if(!(HAS_INSTANCE in FunctionProto))__webpack_require__(11).f(FunctionProto, HAS_INSTANCE, {value: function(O){ if(typeof this != 'function' || !isObject(O))return false; if(!isObject(this.prototype))return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while(O = getPrototypeOf(O))if(this.prototype === O)return true; return false; }}); /***/ }, /* 76 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toInteger = __webpack_require__(36) , aNumberValue = __webpack_require__(77) , repeat = __webpack_require__(78) , $toFixed = 1..toFixed , floor = Math.floor , data = [0, 0, 0, 0, 0, 0] , ERROR = 'Number.toFixed: incorrect invocation!' , ZERO = '0'; var multiply = function(n, c){ var i = -1 , c2 = c; while(++i < 6){ c2 += n * data[i]; data[i] = c2 % 1e7; c2 = floor(c2 / 1e7); } }; var divide = function(n){ var i = 6 , c = 0; while(--i >= 0){ c += data[i]; data[i] = floor(c / n); c = (c % n) * 1e7; } }; var numToString = function(){ var i = 6 , s = ''; while(--i >= 0){ if(s !== '' || i === 0 || data[i] !== 0){ var t = String(data[i]); s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; } } return s; }; var pow = function(x, n, acc){ return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); }; var log = function(x){ var n = 0 , x2 = x; while(x2 >= 4096){ n += 12; x2 /= 4096; } while(x2 >= 2){ n += 1; x2 /= 2; } return n; }; $export($export.P + $export.F * (!!$toFixed && ( 0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128..toFixed(0) !== '1000000000000000128' ) || !__webpack_require__(5)(function(){ // V8 ~ Android 4.3- $toFixed.call({}); })), 'Number', { toFixed: function toFixed(fractionDigits){ var x = aNumberValue(this, ERROR) , f = toInteger(fractionDigits) , s = '' , m = ZERO , e, z, j, k; if(f < 0 || f > 20)throw RangeError(ERROR); if(x != x)return 'NaN'; if(x <= -1e21 || x >= 1e21)return String(x); if(x < 0){ s = '-'; x = -x; } if(x > 1e-21){ e = log(x * pow(2, 69, 1)) - 69; z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); z *= 0x10000000000000; e = 52 - e; if(e > 0){ multiply(0, z); j = f; while(j >= 7){ multiply(1e7, 0); j -= 7; } multiply(pow(10, j, 1), 0); j = e - 1; while(j >= 23){ divide(1 << 23); j -= 23; } divide(1 << j); multiply(1, 1); divide(2); m = numToString(); } else { multiply(0, z); multiply(1 << -e, 0); m = numToString() + repeat.call(ZERO, f); } } if(f > 0){ k = m.length; m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); } else { m = s + m; } return m; } }); /***/ }, /* 77 */ /***/ function(module, exports, __webpack_require__) { var cof = __webpack_require__(32); module.exports = function(it, msg){ if(typeof it != 'number' && cof(it) != 'Number')throw TypeError(msg); return +it; }; /***/ }, /* 78 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var toInteger = __webpack_require__(36) , defined = __webpack_require__(33); module.exports = function repeat(count){ var str = String(defined(this)) , res = '' , n = toInteger(count); if(n < 0 || n == Infinity)throw RangeError("Count can't be negative"); for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str; return res; }; /***/ }, /* 79 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $fails = __webpack_require__(5) , aNumberValue = __webpack_require__(77) , $toPrecision = 1..toPrecision; $export($export.P + $export.F * ($fails(function(){ // IE7- return $toPrecision.call(1, undefined) !== '1'; }) || !$fails(function(){ // V8 ~ Android 4.3- $toPrecision.call({}); })), 'Number', { toPrecision: function toPrecision(precision){ var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); } }); /***/ }, /* 80 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.1 Number.EPSILON var $export = __webpack_require__(6); $export($export.S, 'Number', {EPSILON: Math.pow(2, -52)}); /***/ }, /* 81 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.2 Number.isFinite(number) var $export = __webpack_require__(6) , _isFinite = __webpack_require__(2).isFinite; $export($export.S, 'Number', { isFinite: function isFinite(it){ return typeof it == 'number' && _isFinite(it); } }); /***/ }, /* 82 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var $export = __webpack_require__(6); $export($export.S, 'Number', {isInteger: __webpack_require__(83)}); /***/ }, /* 83 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var isObject = __webpack_require__(13) , floor = Math.floor; module.exports = function isInteger(it){ return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }, /* 84 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.4 Number.isNaN(number) var $export = __webpack_require__(6); $export($export.S, 'Number', { isNaN: function isNaN(number){ return number != number; } }); /***/ }, /* 85 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.5 Number.isSafeInteger(number) var $export = __webpack_require__(6) , isInteger = __webpack_require__(83) , abs = Math.abs; $export($export.S, 'Number', { isSafeInteger: function isSafeInteger(number){ return isInteger(number) && abs(number) <= 0x1fffffffffffff; } }); /***/ }, /* 86 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.6 Number.MAX_SAFE_INTEGER var $export = __webpack_require__(6); $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff}); /***/ }, /* 87 */ /***/ function(module, exports, __webpack_require__) { // 20.1.2.10 Number.MIN_SAFE_INTEGER var $export = __webpack_require__(6); $export($export.S, 'Number', {MIN_SAFE_INTEGER: -0x1fffffffffffff}); /***/ }, /* 88 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , $parseFloat = __webpack_require__(89); // 20.1.2.12 Number.parseFloat(string) $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {parseFloat: $parseFloat}); /***/ }, /* 89 */ /***/ function(module, exports, __webpack_require__) { var $parseFloat = __webpack_require__(2).parseFloat , $trim = __webpack_require__(90).trim; module.exports = 1 / $parseFloat(__webpack_require__(91) + '-0') !== -Infinity ? function parseFloat(str){ var string = $trim(String(str), 3) , result = $parseFloat(string); return result === 0 && string.charAt(0) == '-' ? -0 : result; } : $parseFloat; /***/ }, /* 90 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , defined = __webpack_require__(33) , fails = __webpack_require__(5) , spaces = __webpack_require__(91) , space = '[' + spaces + ']' , non = '\u200b\u0085' , ltrim = RegExp('^' + space + space + '*') , rtrim = RegExp(space + space + '*$'); var exporter = function(KEY, exec, ALIAS){ var exp = {}; var FORCE = fails(function(){ return !!spaces[KEY]() || non[KEY]() != non; }); var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; if(ALIAS)exp[ALIAS] = fn; $export($export.P + $export.F * FORCE, 'String', exp); }; // 1 -> String#trimLeft // 2 -> String#trimRight // 3 -> String#trim var trim = exporter.trim = function(string, TYPE){ string = String(defined(string)); if(TYPE & 1)string = string.replace(ltrim, ''); if(TYPE & 2)string = string.replace(rtrim, ''); return string; }; module.exports = exporter; /***/ }, /* 91 */ /***/ function(module, exports) { module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }, /* 92 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , $parseInt = __webpack_require__(93); // 20.1.2.13 Number.parseInt(string, radix) $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {parseInt: $parseInt}); /***/ }, /* 93 */ /***/ function(module, exports, __webpack_require__) { var $parseInt = __webpack_require__(2).parseInt , $trim = __webpack_require__(90).trim , ws = __webpack_require__(91) , hex = /^[\-+]?0[xX]/; module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){ var string = $trim(String(str), 3); return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); } : $parseInt; /***/ }, /* 94 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , $parseInt = __webpack_require__(93); // 18.2.5 parseInt(string, radix) $export($export.G + $export.F * (parseInt != $parseInt), {parseInt: $parseInt}); /***/ }, /* 95 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , $parseFloat = __webpack_require__(89); // 18.2.4 parseFloat(string) $export($export.G + $export.F * (parseFloat != $parseFloat), {parseFloat: $parseFloat}); /***/ }, /* 96 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.3 Math.acosh(x) var $export = __webpack_require__(6) , log1p = __webpack_require__(97) , sqrt = Math.sqrt , $acosh = Math.acosh; $export($export.S + $export.F * !($acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 && Math.floor($acosh(Number.MAX_VALUE)) == 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && $acosh(Infinity) == Infinity ), 'Math', { acosh: function acosh(x){ return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); } }); /***/ }, /* 97 */ /***/ function(module, exports) { // 20.2.2.20 Math.log1p(x) module.exports = Math.log1p || function log1p(x){ return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); }; /***/ }, /* 98 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.5 Math.asinh(x) var $export = __webpack_require__(6) , $asinh = Math.asinh; function asinh(x){ return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); } // Tor Browser bug: Math.asinh(0) -> -0 $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh}); /***/ }, /* 99 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.7 Math.atanh(x) var $export = __webpack_require__(6) , $atanh = Math.atanh; // Tor Browser bug: Math.atanh(-0) -> 0 $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { atanh: function atanh(x){ return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; } }); /***/ }, /* 100 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.9 Math.cbrt(x) var $export = __webpack_require__(6) , sign = __webpack_require__(101); $export($export.S, 'Math', { cbrt: function cbrt(x){ return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); } }); /***/ }, /* 101 */ /***/ function(module, exports) { // 20.2.2.28 Math.sign(x) module.exports = Math.sign || function sign(x){ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; }; /***/ }, /* 102 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.11 Math.clz32(x) var $export = __webpack_require__(6); $export($export.S, 'Math', { clz32: function clz32(x){ return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; } }); /***/ }, /* 103 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.12 Math.cosh(x) var $export = __webpack_require__(6) , exp = Math.exp; $export($export.S, 'Math', { cosh: function cosh(x){ return (exp(x = +x) + exp(-x)) / 2; } }); /***/ }, /* 104 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.14 Math.expm1(x) var $export = __webpack_require__(6) , $expm1 = __webpack_require__(105); $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1}); /***/ }, /* 105 */ /***/ function(module, exports) { // 20.2.2.14 Math.expm1(x) var $expm1 = Math.expm1; module.exports = (!$expm1 // Old FF bug || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x){ return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; } : $expm1; /***/ }, /* 106 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.16 Math.fround(x) var $export = __webpack_require__(6) , sign = __webpack_require__(101) , pow = Math.pow , EPSILON = pow(2, -52) , EPSILON32 = pow(2, -23) , MAX32 = pow(2, 127) * (2 - EPSILON32) , MIN32 = pow(2, -126); var roundTiesToEven = function(n){ return n + 1 / EPSILON - 1 / EPSILON; }; $export($export.S, 'Math', { fround: function fround(x){ var $abs = Math.abs(x) , $sign = sign(x) , a, result; if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; a = (1 + EPSILON32 / EPSILON) * $abs; result = a - (a - $abs); if(result > MAX32 || result != result)return $sign * Infinity; return $sign * result; } }); /***/ }, /* 107 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) var $export = __webpack_require__(6) , abs = Math.abs; $export($export.S, 'Math', { hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars var sum = 0 , i = 0 , aLen = arguments.length , larg = 0 , arg, div; while(i < aLen){ arg = abs(arguments[i++]); if(larg < arg){ div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if(arg > 0){ div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * Math.sqrt(sum); } }); /***/ }, /* 108 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.18 Math.imul(x, y) var $export = __webpack_require__(6) , $imul = Math.imul; // some WebKit versions fails with big numbers, some has wrong arity $export($export.S + $export.F * __webpack_require__(5)(function(){ return $imul(0xffffffff, 5) != -5 || $imul.length != 2; }), 'Math', { imul: function imul(x, y){ var UINT16 = 0xffff , xn = +x , yn = +y , xl = UINT16 & xn , yl = UINT16 & yn; return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); } }); /***/ }, /* 109 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.21 Math.log10(x) var $export = __webpack_require__(6); $export($export.S, 'Math', { log10: function log10(x){ return Math.log(x) / Math.LN10; } }); /***/ }, /* 110 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.20 Math.log1p(x) var $export = __webpack_require__(6); $export($export.S, 'Math', {log1p: __webpack_require__(97)}); /***/ }, /* 111 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.22 Math.log2(x) var $export = __webpack_require__(6); $export($export.S, 'Math', { log2: function log2(x){ return Math.log(x) / Math.LN2; } }); /***/ }, /* 112 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.28 Math.sign(x) var $export = __webpack_require__(6); $export($export.S, 'Math', {sign: __webpack_require__(101)}); /***/ }, /* 113 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.30 Math.sinh(x) var $export = __webpack_require__(6) , expm1 = __webpack_require__(105) , exp = Math.exp; // V8 near Chromium 38 has a problem with very small numbers $export($export.S + $export.F * __webpack_require__(5)(function(){ return !Math.sinh(-2e-17) != -2e-17; }), 'Math', { sinh: function sinh(x){ return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); } }); /***/ }, /* 114 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.33 Math.tanh(x) var $export = __webpack_require__(6) , expm1 = __webpack_require__(105) , exp = Math.exp; $export($export.S, 'Math', { tanh: function tanh(x){ var a = expm1(x = +x) , b = expm1(-x); return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); } }); /***/ }, /* 115 */ /***/ function(module, exports, __webpack_require__) { // 20.2.2.34 Math.trunc(x) var $export = __webpack_require__(6); $export($export.S, 'Math', { trunc: function trunc(it){ return (it > 0 ? Math.floor : Math.ceil)(it); } }); /***/ }, /* 116 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , toIndex = __webpack_require__(37) , fromCharCode = String.fromCharCode , $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars var res = [] , aLen = arguments.length , i = 0 , code; while(aLen > i){ code = +arguments[i++]; if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); } }); /***/ }, /* 117 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , toIObject = __webpack_require__(30) , toLength = __webpack_require__(35); $export($export.S, 'String', { // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function raw(callSite){ var tpl = toIObject(callSite.raw) , len = toLength(tpl.length) , aLen = arguments.length , res = [] , i = 0; while(len > i){ res.push(String(tpl[i++])); if(i < aLen)res.push(String(arguments[i])); } return res.join(''); } }); /***/ }, /* 118 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 21.1.3.25 String.prototype.trim() __webpack_require__(90)('trim', function($trim){ return function trim(){ return $trim(this, 3); }; }); /***/ }, /* 119 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $at = __webpack_require__(120)(false); $export($export.P, 'String', { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: function codePointAt(pos){ return $at(this, pos); } }); /***/ }, /* 120 */ /***/ function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(36) , defined = __webpack_require__(33); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }, /* 121 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) 'use strict'; var $export = __webpack_require__(6) , toLength = __webpack_require__(35) , context = __webpack_require__(122) , ENDS_WITH = 'endsWith' , $endsWith = ''[ENDS_WITH]; $export($export.P + $export.F * __webpack_require__(124)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString /*, endPosition = @length */){ var that = context(this, searchString, ENDS_WITH) , endPosition = arguments.length > 1 ? arguments[1] : undefined , len = toLength(that.length) , end = endPosition === undefined ? len : Math.min(toLength(endPosition), len) , search = String(searchString); return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); /***/ }, /* 122 */ /***/ function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(123) , defined = __webpack_require__(33); module.exports = function(that, searchString, NAME){ if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }, /* 123 */ /***/ function(module, exports, __webpack_require__) { // 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(13) , cof = __webpack_require__(32) , MATCH = __webpack_require__(23)('match'); module.exports = function(it){ var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); }; /***/ }, /* 124 */ /***/ function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(23)('match'); module.exports = function(KEY){ var re = /./; try { '/./'[KEY](re); } catch(e){ try { re[MATCH] = false; return !'/./'[KEY](re); } catch(f){ /* empty */ } } return true; }; /***/ }, /* 125 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.7 String.prototype.includes(searchString, position = 0) 'use strict'; var $export = __webpack_require__(6) , context = __webpack_require__(122) , INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__(124)(INCLUDES), 'String', { includes: function includes(searchString /*, position = 0 */){ return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }, /* 126 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); $export($export.P, 'String', { // 21.1.3.13 String.prototype.repeat(count) repeat: __webpack_require__(78) }); /***/ }, /* 127 */ /***/ function(module, exports, __webpack_require__) { // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) 'use strict'; var $export = __webpack_require__(6) , toLength = __webpack_require__(35) , context = __webpack_require__(122) , STARTS_WITH = 'startsWith' , $startsWith = ''[STARTS_WITH]; $export($export.P + $export.F * __webpack_require__(124)(STARTS_WITH), 'String', { startsWith: function startsWith(searchString /*, position = 0 */){ var that = context(this, searchString, STARTS_WITH) , index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)) , search = String(searchString); return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); /***/ }, /* 128 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $at = __webpack_require__(120)(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__(129)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var O = this._t , index = this._i , point; if(index >= O.length)return {value: undefined, done: true}; point = $at(O, index); this._i += point.length; return {value: point, done: false}; }); /***/ }, /* 129 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var LIBRARY = __webpack_require__(26) , $export = __webpack_require__(6) , redefine = __webpack_require__(18) , hide = __webpack_require__(10) , has = __webpack_require__(3) , Iterators = __webpack_require__(130) , $iterCreate = __webpack_require__(131) , setToStringTag = __webpack_require__(22) , getPrototypeOf = __webpack_require__(57) , ITERATOR = __webpack_require__(23)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' , VALUES = 'values'; var returnThis = function(){ return this; }; module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined , $anyNative = NAME == 'Array' ? proto.entries || $native : $native , methods, key, IteratorPrototype; // Fix native if($anyNative){ IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); if(IteratorPrototype !== Object.prototype){ // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if(FORCED)for(key in methods){ if(!(key in proto))redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }, /* 130 */ /***/ function(module, exports) { module.exports = {}; /***/ }, /* 131 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var create = __webpack_require__(44) , descriptor = __webpack_require__(17) , setToStringTag = __webpack_require__(22) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __webpack_require__(10)(IteratorPrototype, __webpack_require__(23)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }, /* 132 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.2 String.prototype.anchor(name) __webpack_require__(133)('anchor', function(createHTML){ return function anchor(name){ return createHTML(this, 'a', 'name', name); } }); /***/ }, /* 133 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , fails = __webpack_require__(5) , defined = __webpack_require__(33) , quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) var createHTML = function(string, tag, attribute, value) { var S = String(defined(string)) , p1 = '<' + tag; if(attribute !== '')p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"'; return p1 + '>' + S + '</' + tag + '>'; }; module.exports = function(NAME, exec){ var O = {}; O[NAME] = exec(createHTML); $export($export.P + $export.F * fails(function(){ var test = ''[NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }), 'String', O); }; /***/ }, /* 134 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.3 String.prototype.big() __webpack_require__(133)('big', function(createHTML){ return function big(){ return createHTML(this, 'big', '', ''); } }); /***/ }, /* 135 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.4 String.prototype.blink() __webpack_require__(133)('blink', function(createHTML){ return function blink(){ return createHTML(this, 'blink', '', ''); } }); /***/ }, /* 136 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.5 String.prototype.bold() __webpack_require__(133)('bold', function(createHTML){ return function bold(){ return createHTML(this, 'b', '', ''); } }); /***/ }, /* 137 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.6 String.prototype.fixed() __webpack_require__(133)('fixed', function(createHTML){ return function fixed(){ return createHTML(this, 'tt', '', ''); } }); /***/ }, /* 138 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.7 String.prototype.fontcolor(color) __webpack_require__(133)('fontcolor', function(createHTML){ return function fontcolor(color){ return createHTML(this, 'font', 'color', color); } }); /***/ }, /* 139 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.8 String.prototype.fontsize(size) __webpack_require__(133)('fontsize', function(createHTML){ return function fontsize(size){ return createHTML(this, 'font', 'size', size); } }); /***/ }, /* 140 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.9 String.prototype.italics() __webpack_require__(133)('italics', function(createHTML){ return function italics(){ return createHTML(this, 'i', '', ''); } }); /***/ }, /* 141 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.10 String.prototype.link(url) __webpack_require__(133)('link', function(createHTML){ return function link(url){ return createHTML(this, 'a', 'href', url); } }); /***/ }, /* 142 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.11 String.prototype.small() __webpack_require__(133)('small', function(createHTML){ return function small(){ return createHTML(this, 'small', '', ''); } }); /***/ }, /* 143 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.12 String.prototype.strike() __webpack_require__(133)('strike', function(createHTML){ return function strike(){ return createHTML(this, 'strike', '', ''); } }); /***/ }, /* 144 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.13 String.prototype.sub() __webpack_require__(133)('sub', function(createHTML){ return function sub(){ return createHTML(this, 'sub', '', ''); } }); /***/ }, /* 145 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // B.2.3.14 String.prototype.sup() __webpack_require__(133)('sup', function(createHTML){ return function sup(){ return createHTML(this, 'sup', '', ''); } }); /***/ }, /* 146 */ /***/ function(module, exports, __webpack_require__) { // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) var $export = __webpack_require__(6); $export($export.S, 'Array', {isArray: __webpack_require__(43)}); /***/ }, /* 147 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var ctx = __webpack_require__(8) , $export = __webpack_require__(6) , toObject = __webpack_require__(56) , call = __webpack_require__(148) , isArrayIter = __webpack_require__(149) , toLength = __webpack_require__(35) , createProperty = __webpack_require__(150) , getIterFn = __webpack_require__(151); $export($export.S + $export.F * !__webpack_require__(153)(function(iter){ Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = toObject(arrayLike) , C = typeof this == 'function' ? this : Array , aLen = arguments.length , mapfn = aLen > 1 ? arguments[1] : undefined , mapping = mapfn !== undefined , index = 0 , iterFn = getIterFn(O) , length, result, step, iterator; if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); } } else { length = toLength(O.length); for(result = new C(length); length > index; index++){ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); } } result.length = index; return result; } }); /***/ }, /* 148 */ /***/ function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error var anObject = __webpack_require__(12); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined)anObject(ret.call(iterator)); throw e; } }; /***/ }, /* 149 */ /***/ function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(130) , ITERATOR = __webpack_require__(23)('iterator') , ArrayProto = Array.prototype; module.exports = function(it){ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }, /* 150 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $defineProperty = __webpack_require__(11) , createDesc = __webpack_require__(17); module.exports = function(object, index, value){ if(index in object)$defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; /***/ }, /* 151 */ /***/ function(module, exports, __webpack_require__) { var classof = __webpack_require__(152) , ITERATOR = __webpack_require__(23)('iterator') , Iterators = __webpack_require__(130); module.exports = __webpack_require__(7).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }, /* 152 */ /***/ function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(32) , TAG = __webpack_require__(23)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function(it, key){ try { return it[key]; } catch(e){ /* empty */ } }; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }, /* 153 */ /***/ function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(23)('iterator') , SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function(){ SAFE_CLOSING = true; }; Array.from(riter, function(){ throw 2; }); } catch(e){ /* empty */ } module.exports = function(exec, skipClosing){ if(!skipClosing && !SAFE_CLOSING)return false; var safe = false; try { var arr = [7] , iter = arr[ITERATOR](); iter.next = function(){ return {done: safe = true}; }; arr[ITERATOR] = function(){ return iter; }; exec(arr); } catch(e){ /* empty */ } return safe; }; /***/ }, /* 154 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , createProperty = __webpack_require__(150); // WebKit Array.of isn't generic $export($export.S + $export.F * __webpack_require__(5)(function(){ function F(){} return !(Array.of.call(F) instanceof F); }), 'Array', { // 22.1.2.3 Array.of( ...items) of: function of(/* ...args */){ var index = 0 , aLen = arguments.length , result = new (typeof this == 'function' ? this : Array)(aLen); while(aLen > index)createProperty(result, index, arguments[index++]); result.length = aLen; return result; } }); /***/ }, /* 155 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.13 Array.prototype.join(separator) var $export = __webpack_require__(6) , toIObject = __webpack_require__(30) , arrayJoin = [].join; // fallback for not array-like strings $export($export.P + $export.F * (__webpack_require__(31) != Object || !__webpack_require__(156)(arrayJoin)), 'Array', { join: function join(separator){ return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); } }); /***/ }, /* 156 */ /***/ function(module, exports, __webpack_require__) { var fails = __webpack_require__(5); module.exports = function(method, arg){ return !!method && fails(function(){ arg ? method.call(null, function(){}, 1) : method.call(null); }); }; /***/ }, /* 157 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , html = __webpack_require__(46) , cof = __webpack_require__(32) , toIndex = __webpack_require__(37) , toLength = __webpack_require__(35) , arraySlice = [].slice; // fallback for not array-like ES3 strings and DOM objects $export($export.P + $export.F * __webpack_require__(5)(function(){ if(html)arraySlice.call(html); }), 'Array', { slice: function slice(begin, end){ var len = toLength(this.length) , klass = cof(this); end = end === undefined ? len : end; if(klass == 'Array')return arraySlice.call(this, begin, end); var start = toIndex(begin, len) , upTo = toIndex(end, len) , size = toLength(upTo - start) , cloned = Array(size) , i = 0; for(; i < size; i++)cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i]; return cloned; } }); /***/ }, /* 158 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , aFunction = __webpack_require__(9) , toObject = __webpack_require__(56) , fails = __webpack_require__(5) , $sort = [].sort , test = [1, 2, 3]; $export($export.P + $export.F * (fails(function(){ // IE8- test.sort(undefined); }) || !fails(function(){ // V8 bug test.sort(null); // Old WebKit }) || !__webpack_require__(156)($sort)), 'Array', { // 22.1.3.25 Array.prototype.sort(comparefn) sort: function sort(comparefn){ return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn)); } }); /***/ }, /* 159 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $forEach = __webpack_require__(160)(0) , STRICT = __webpack_require__(156)([].forEach, true); $export($export.P + $export.F * !STRICT, 'Array', { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: function forEach(callbackfn /* , thisArg */){ return $forEach(this, callbackfn, arguments[1]); } }); /***/ }, /* 160 */ /***/ function(module, exports, __webpack_require__) { // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__(8) , IObject = __webpack_require__(31) , toObject = __webpack_require__(56) , toLength = __webpack_require__(35) , asc = __webpack_require__(161); module.exports = function(TYPE, $create){ var IS_MAP = TYPE == 1 , IS_FILTER = TYPE == 2 , IS_SOME = TYPE == 3 , IS_EVERY = TYPE == 4 , IS_FIND_INDEX = TYPE == 6 , NO_HOLES = TYPE == 5 || IS_FIND_INDEX , create = $create || asc; return function($this, callbackfn, that){ var O = toObject($this) , self = IObject(O) , f = ctx(callbackfn, that, 3) , length = toLength(self.length) , index = 0 , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined , val, res; for(;length > index; index++)if(NO_HOLES || index in self){ val = self[index]; res = f(val, index, O); if(TYPE){ if(IS_MAP)result[index] = res; // map else if(res)switch(TYPE){ case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if(IS_EVERY)return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }, /* 161 */ /***/ function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var speciesConstructor = __webpack_require__(162); module.exports = function(original, length){ return new (speciesConstructor(original))(length); }; /***/ }, /* 162 */ /***/ function(module, exports, __webpack_require__) { var isObject = __webpack_require__(13) , isArray = __webpack_require__(43) , SPECIES = __webpack_require__(23)('species'); module.exports = function(original){ var C; if(isArray(original)){ C = original.constructor; // cross-realm fallback if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined; if(isObject(C)){ C = C[SPECIES]; if(C === null)C = undefined; } } return C === undefined ? Array : C; }; /***/ }, /* 163 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $map = __webpack_require__(160)(1); $export($export.P + $export.F * !__webpack_require__(156)([].map, true), 'Array', { // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) map: function map(callbackfn /* , thisArg */){ return $map(this, callbackfn, arguments[1]); } }); /***/ }, /* 164 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $filter = __webpack_require__(160)(2); $export($export.P + $export.F * !__webpack_require__(156)([].filter, true), 'Array', { // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) filter: function filter(callbackfn /* , thisArg */){ return $filter(this, callbackfn, arguments[1]); } }); /***/ }, /* 165 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $some = __webpack_require__(160)(3); $export($export.P + $export.F * !__webpack_require__(156)([].some, true), 'Array', { // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) some: function some(callbackfn /* , thisArg */){ return $some(this, callbackfn, arguments[1]); } }); /***/ }, /* 166 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $every = __webpack_require__(160)(4); $export($export.P + $export.F * !__webpack_require__(156)([].every, true), 'Array', { // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) every: function every(callbackfn /* , thisArg */){ return $every(this, callbackfn, arguments[1]); } }); /***/ }, /* 167 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $reduce = __webpack_require__(168); $export($export.P + $export.F * !__webpack_require__(156)([].reduce, true), 'Array', { // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) reduce: function reduce(callbackfn /* , initialValue */){ return $reduce(this, callbackfn, arguments.length, arguments[1], false); } }); /***/ }, /* 168 */ /***/ function(module, exports, __webpack_require__) { var aFunction = __webpack_require__(9) , toObject = __webpack_require__(56) , IObject = __webpack_require__(31) , toLength = __webpack_require__(35); module.exports = function(that, callbackfn, aLen, memo, isRight){ aFunction(callbackfn); var O = toObject(that) , self = IObject(O) , length = toLength(O.length) , index = isRight ? length - 1 : 0 , i = isRight ? -1 : 1; if(aLen < 2)for(;;){ if(index in self){ memo = self[index]; index += i; break; } index += i; if(isRight ? index < 0 : length <= index){ throw TypeError('Reduce of empty array with no initial value'); } } for(;isRight ? index >= 0 : length > index; index += i)if(index in self){ memo = callbackfn(memo, self[index], index, O); } return memo; }; /***/ }, /* 169 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $reduce = __webpack_require__(168); $export($export.P + $export.F * !__webpack_require__(156)([].reduceRight, true), 'Array', { // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: function reduceRight(callbackfn /* , initialValue */){ return $reduce(this, callbackfn, arguments.length, arguments[1], true); } }); /***/ }, /* 170 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $indexOf = __webpack_require__(34)(false) , $native = [].indexOf , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(156)($native)), 'Array', { // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: function indexOf(searchElement /*, fromIndex = 0 */){ return NEGATIVE_ZERO // convert -0 to +0 ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]); } }); /***/ }, /* 171 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toIObject = __webpack_require__(30) , toInteger = __webpack_require__(36) , toLength = __webpack_require__(35) , $native = [].lastIndexOf , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(156)($native)), 'Array', { // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){ // convert -0 to +0 if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0; var O = toIObject(this) , length = toLength(O.length) , index = length - 1; if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1])); if(index < 0)index = length + index; for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0; return -1; } }); /***/ }, /* 172 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var $export = __webpack_require__(6); $export($export.P, 'Array', {copyWithin: __webpack_require__(173)}); __webpack_require__(174)('copyWithin'); /***/ }, /* 173 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) 'use strict'; var toObject = __webpack_require__(56) , toIndex = __webpack_require__(37) , toLength = __webpack_require__(35); module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){ var O = toObject(this) , len = toLength(O.length) , to = toIndex(target, len) , from = toIndex(start, len) , end = arguments.length > 2 ? arguments[2] : undefined , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to) , inc = 1; if(from < to && to < from + count){ inc = -1; from += count - 1; to += count - 1; } while(count-- > 0){ if(from in O)O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }; /***/ }, /* 174 */ /***/ function(module, exports) { module.exports = function(){ /* empty */ }; /***/ }, /* 175 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var $export = __webpack_require__(6); $export($export.P, 'Array', {fill: __webpack_require__(176)}); __webpack_require__(174)('fill'); /***/ }, /* 176 */ /***/ function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) 'use strict'; var toObject = __webpack_require__(56) , toIndex = __webpack_require__(37) , toLength = __webpack_require__(35); module.exports = function fill(value /*, start = 0, end = @length */){ var O = toObject(this) , length = toLength(O.length) , aLen = arguments.length , index = toIndex(aLen > 1 ? arguments[1] : undefined, length) , end = aLen > 2 ? arguments[2] : undefined , endPos = end === undefined ? length : toIndex(end, length); while(endPos > index)O[index++] = value; return O; }; /***/ }, /* 177 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) var $export = __webpack_require__(6) , $find = __webpack_require__(160)(5) , KEY = 'find' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { find: function find(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(174)(KEY); /***/ }, /* 178 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) var $export = __webpack_require__(6) , $find = __webpack_require__(160)(6) , KEY = 'findIndex' , forced = true; // Shouldn't skip holes if(KEY in [])Array(1)[KEY](function(){ forced = false; }); $export($export.P + $export.F * forced, 'Array', { findIndex: function findIndex(callbackfn/*, that = undefined */){ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(174)(KEY); /***/ }, /* 179 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var addToUnscopables = __webpack_require__(174) , step = __webpack_require__(180) , Iterators = __webpack_require__(130) , toIObject = __webpack_require__(30); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() module.exports = __webpack_require__(129)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var O = this._t , kind = this._k , index = this._i++; if(!O || index >= O.length){ this._t = undefined; return step(1); } if(kind == 'keys' )return step(0, index); if(kind == 'values')return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }, /* 180 */ /***/ function(module, exports) { module.exports = function(done, value){ return {value: value, done: !!done}; }; /***/ }, /* 181 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(182)('Array'); /***/ }, /* 182 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(2) , core = __webpack_require__(7) , dP = __webpack_require__(11) , DESCRIPTORS = __webpack_require__(4) , SPECIES = __webpack_require__(23)('species'); module.exports = function(KEY){ var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY]; if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, { configurable: true, get: function(){ return this; } }); }; /***/ }, /* 183 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var LIBRARY = __webpack_require__(26) , global = __webpack_require__(2) , ctx = __webpack_require__(8) , classof = __webpack_require__(152) , $export = __webpack_require__(6) , isObject = __webpack_require__(13) , aFunction = __webpack_require__(9) , anInstance = __webpack_require__(184) , forOf = __webpack_require__(185) , speciesConstructor = __webpack_require__(186) , task = __webpack_require__(187).set , microtask = __webpack_require__(188)() , PROMISE = 'Promise' , TypeError = global.TypeError , process = global.process , $Promise = global[PROMISE] , process = global.process , isNode = classof(process) == 'process' , empty = function(){ /* empty */ } , Internal, GenericPromiseCapability, Wrapper; var USE_NATIVE = !!function(){ try { // correct subclassing with @@species support var promise = $Promise.resolve(1) , FakePromise = (promise.constructor = {})[__webpack_require__(23)('species')] = function(exec){ exec(empty, empty); }; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; } catch(e){ /* empty */ } }(); // helpers var sameConstructor = function(a, b){ // with library wrapper special case return a === b || a === $Promise && b === Wrapper; }; var isThenable = function(it){ var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var newPromiseCapability = function(C){ return sameConstructor($Promise, C) ? new PromiseCapability(C) : new GenericPromiseCapability(C); }; var PromiseCapability = GenericPromiseCapability = function(C){ var resolve, reject; this.promise = new C(function($$resolve, $$reject){ if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); }; var perform = function(exec){ try { exec(); } catch(e){ return {error: e}; } }; var notify = function(promise, isReject){ if(promise._n)return; promise._n = true; var chain = promise._c; microtask(function(){ var value = promise._v , ok = promise._s == 1 , i = 0; var run = function(reaction){ var handler = ok ? reaction.ok : reaction.fail , resolve = reaction.resolve , reject = reaction.reject , domain = reaction.domain , result, then; try { if(handler){ if(!ok){ if(promise._h == 2)onHandleUnhandled(promise); promise._h = 1; } if(handler === true)result = value; else { if(domain)domain.enter(); result = handler(value); if(domain)domain.exit(); } if(result === reaction.promise){ reject(TypeError('Promise-chain cycle')); } else if(then = isThenable(result)){ then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch(e){ reject(e); } }; while(chain.length > i)run(chain[i++]); // variable length - can't use forEach promise._c = []; promise._n = false; if(isReject && !promise._h)onUnhandled(promise); }); }; var onUnhandled = function(promise){ task.call(global, function(){ var value = promise._v , abrupt, handler, console; if(isUnhandled(promise)){ abrupt = perform(function(){ if(isNode){ process.emit('unhandledRejection', value, promise); } else if(handler = global.onunhandledrejection){ handler({promise: promise, reason: value}); } else if((console = global.console) && console.error){ console.error('Unhandled promise rejection', value); } }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if(abrupt)throw abrupt.error; }); }; var isUnhandled = function(promise){ if(promise._h == 1)return false; var chain = promise._a || promise._c , i = 0 , reaction; while(chain.length > i){ reaction = chain[i++]; if(reaction.fail || !isUnhandled(reaction.promise))return false; } return true; }; var onHandleUnhandled = function(promise){ task.call(global, function(){ var handler; if(isNode){ process.emit('rejectionHandled', promise); } else if(handler = global.onrejectionhandled){ handler({promise: promise, reason: promise._v}); } }); }; var $reject = function(value){ var promise = this; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap promise._v = value; promise._s = 2; if(!promise._a)promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function(value){ var promise = this , then; if(promise._d)return; promise._d = true; promise = promise._w || promise; // unwrap try { if(promise === value)throw TypeError("Promise can't be resolved itself"); if(then = isThenable(value)){ microtask(function(){ var wrapper = {_w: promise, _d: false}; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); } catch(e){ $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify(promise, false); } } catch(e){ $reject.call({_w: promise, _d: false}, e); // wrap } }; // constructor polyfill if(!USE_NATIVE){ // 25.4.3.1 Promise(executor) $Promise = function Promise(executor){ anInstance(this, $Promise, PROMISE, '_h'); aFunction(executor); Internal.call(this); try { executor(ctx($resolve, this, 1), ctx($reject, this, 1)); } catch(err){ $reject.call(this, err); } }; Internal = function Promise(executor){ this._c = []; // <- awaiting reactions this._a = undefined; // <- checked in isUnhandled reactions this._s = 0; // <- state this._d = false; // <- done this._v = undefined; // <- value this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; Internal.prototype = __webpack_require__(189)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected){ var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process.domain : undefined; this._c.push(reaction); if(this._a)this._a.push(reaction); if(this._s)notify(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function(onRejected){ return this.then(undefined, onRejected); } }); PromiseCapability = function(){ var promise = new Internal; this.promise = promise; this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); __webpack_require__(22)($Promise, PROMISE); __webpack_require__(182)(PROMISE); Wrapper = __webpack_require__(7)[PROMISE]; // statics $export($export.S + $export.F * !USE_NATIVE, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r){ var capability = newPromiseCapability(this) , $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x){ // instanceof instead of internal slot check because we should fix it without replacement native Promise core if(x instanceof $Promise && sameConstructor(x.constructor, this))return x; var capability = newPromiseCapability(this) , $$resolve = capability.resolve; $$resolve(x); return capability.promise; } }); $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(153)(function(iter){ $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable){ var C = this , capability = newPromiseCapability(C) , resolve = capability.resolve , reject = capability.reject; var abrupt = perform(function(){ var values = [] , index = 0 , remaining = 1; forOf(iterable, false, function(promise){ var $index = index++ , alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function(value){ if(alreadyCalled)return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if(abrupt)reject(abrupt.error); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable){ var C = this , capability = newPromiseCapability(C) , reject = capability.reject; var abrupt = perform(function(){ forOf(iterable, false, function(promise){ C.resolve(promise).then(capability.resolve, reject); }); }); if(abrupt)reject(abrupt.error); return capability.promise; } }); /***/ }, /* 184 */ /***/ function(module, exports) { module.exports = function(it, Constructor, name, forbiddenField){ if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }, /* 185 */ /***/ function(module, exports, __webpack_require__) { var ctx = __webpack_require__(8) , call = __webpack_require__(148) , isArrayIter = __webpack_require__(149) , anObject = __webpack_require__(12) , toLength = __webpack_require__(35) , getIterFn = __webpack_require__(151) , BREAK = {} , RETURN = {}; var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) , f = ctx(fn, that, entries ? 2 : 1) , index = 0 , length, step, iterator, result; if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if(result === BREAK || result === RETURN)return result; } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ result = call(iterator, f, step.value, entries); if(result === BREAK || result === RETURN)return result; } }; exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }, /* 186 */ /***/ function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(12) , aFunction = __webpack_require__(9) , SPECIES = __webpack_require__(23)('species'); module.exports = function(O, D){ var C = anObject(O).constructor, S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }, /* 187 */ /***/ function(module, exports, __webpack_require__) { var ctx = __webpack_require__(8) , invoke = __webpack_require__(74) , html = __webpack_require__(46) , cel = __webpack_require__(15) , global = __webpack_require__(2) , process = global.process , setTask = global.setImmediate , clearTask = global.clearImmediate , MessageChannel = global.MessageChannel , counter = 0 , queue = {} , ONREADYSTATECHANGE = 'onreadystatechange' , defer, channel, port; var run = function(){ var id = +this; if(queue.hasOwnProperty(id)){ var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function(event){ run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if(!setTask || !clearTask){ setTask = function setImmediate(fn){ var args = [], i = 1; while(arguments.length > i)args.push(arguments[i++]); queue[++counter] = function(){ invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id){ delete queue[id]; }; // Node.js 0.8- if(__webpack_require__(32)(process) == 'process'){ defer = function(id){ process.nextTick(ctx(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if(MessageChannel){ channel = new MessageChannel; port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){ defer = function(id){ global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); // IE8- } else if(ONREADYSTATECHANGE in cel('script')){ defer = function(id){ html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){ html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function(id){ setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }, /* 188 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , macrotask = __webpack_require__(187).set , Observer = global.MutationObserver || global.WebKitMutationObserver , process = global.process , Promise = global.Promise , isNode = __webpack_require__(32)(process) == 'process'; module.exports = function(){ var head, last, notify; var flush = function(){ var parent, fn; if(isNode && (parent = process.domain))parent.exit(); while(head){ fn = head.fn; head = head.next; try { fn(); } catch(e){ if(head)notify(); else last = undefined; throw e; } } last = undefined; if(parent)parent.enter(); }; // Node.js if(isNode){ notify = function(){ process.nextTick(flush); }; // browsers with MutationObserver } else if(Observer){ var toggle = true , node = document.createTextNode(''); new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new notify = function(){ node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if(Promise && Promise.resolve){ var promise = Promise.resolve(); notify = function(){ promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function(){ // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } return function(fn){ var task = {fn: fn, next: undefined}; if(last)last.next = task; if(!head){ head = task; notify(); } last = task; }; }; /***/ }, /* 189 */ /***/ function(module, exports, __webpack_require__) { var hide = __webpack_require__(10); module.exports = function(target, src, safe){ for(var key in src){ if(safe && target[key])target[key] = src[key]; else hide(target, key, src[key]); } return target; }; /***/ }, /* 190 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var strong = __webpack_require__(191); // 23.1 Map Objects module.exports = __webpack_require__(192)('Map', function(get){ return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.1.3.6 Map.prototype.get(key) get: function get(key){ var entry = strong.getEntry(this, key); return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function set(key, value){ return strong.def(this, key === 0 ? 0 : key, value); } }, strong, true); /***/ }, /* 191 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var dP = __webpack_require__(11).f , create = __webpack_require__(44) , redefineAll = __webpack_require__(189) , ctx = __webpack_require__(8) , anInstance = __webpack_require__(184) , defined = __webpack_require__(33) , forOf = __webpack_require__(185) , $iterDefine = __webpack_require__(129) , step = __webpack_require__(180) , setSpecies = __webpack_require__(182) , DESCRIPTORS = __webpack_require__(4) , fastKey = __webpack_require__(19).fastKey , SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function(that, key){ // fast case var index = fastKey(key), entry; if(index !== 'F')return that._i[index]; // frozen object case for(entry = that._f; entry; entry = entry.n){ if(entry.k == key)return entry; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = create(null); // index that._f = undefined; // first entry that._l = undefined; // last entry that[SIZE] = 0; // size if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear(){ for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){ entry.r = true; if(entry.p)entry.p = entry.p.n = undefined; delete data[entry.i]; } that._f = that._l = undefined; that[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function(key){ var that = this , entry = getEntry(that, key); if(entry){ var next = entry.n , prev = entry.p; delete that._i[entry.i]; entry.r = true; if(prev)prev.n = next; if(next)next.p = prev; if(that._f == entry)that._f = next; if(that._l == entry)that._l = prev; that[SIZE]--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /*, that = undefined */){ anInstance(this, C, 'forEach'); var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3) , entry; while(entry = entry ? entry.n : this._f){ f(entry.v, entry.k, this); // revert to the last existing entry while(entry && entry.r)entry = entry.p; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key){ return !!getEntry(this, key); } }); if(DESCRIPTORS)dP(C.prototype, 'size', { get: function(){ return defined(this[SIZE]); } }); return C; }, def: function(that, key, value){ var entry = getEntry(that, key) , prev, index; // change existing entry if(entry){ entry.v = value; // create new entry } else { that._l = entry = { i: index = fastKey(key, true), // <- index k: key, // <- key v: value, // <- value p: prev = that._l, // <- previous entry n: undefined, // <- next entry r: false // <- removed }; if(!that._f)that._f = entry; if(prev)prev.n = entry; that[SIZE]++; // add to index if(index !== 'F')that._i[index] = entry; } return that; }, getEntry: getEntry, setStrong: function(C, NAME, IS_MAP){ // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 $iterDefine(C, NAME, function(iterated, kind){ this._t = iterated; // target this._k = kind; // kind this._l = undefined; // previous }, function(){ var that = this , kind = that._k , entry = that._l; // revert to the last existing entry while(entry && entry.r)entry = entry.p; // get next entry if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){ // or finish the iteration that._t = undefined; return step(1); } // return step by kind if(kind == 'keys' )return step(0, entry.k); if(kind == 'values')return step(0, entry.v); return step(0, [entry.k, entry.v]); }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(NAME); } }; /***/ }, /* 192 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(2) , $export = __webpack_require__(6) , meta = __webpack_require__(19) , fails = __webpack_require__(5) , hide = __webpack_require__(10) , redefineAll = __webpack_require__(189) , forOf = __webpack_require__(185) , anInstance = __webpack_require__(184) , isObject = __webpack_require__(13) , setToStringTag = __webpack_require__(22) , dP = __webpack_require__(11).f , each = __webpack_require__(160)(0) , DESCRIPTORS = __webpack_require__(4); module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){ var Base = global[NAME] , C = Base , ADDER = IS_MAP ? 'set' : 'add' , proto = C && C.prototype , O = {}; if(!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){ new C().entries().next(); }))){ // create collection constructor C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { C = wrapper(function(target, iterable){ anInstance(target, C, NAME, '_c'); target._c = new Base; if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target); }); each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','),function(KEY){ var IS_ADDER = KEY == 'add' || KEY == 'set'; if(KEY in proto && !(IS_WEAK && KEY == 'clear'))hide(C.prototype, KEY, function(a, b){ anInstance(this, C, KEY); if(!IS_ADDER && IS_WEAK && !isObject(a))return KEY == 'get' ? undefined : false; var result = this._c[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); }); if('size' in proto)dP(C.prototype, 'size', { get: function(){ return this._c.size; } }); } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F, O); if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }, /* 193 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var strong = __webpack_require__(191); // 23.2 Set Objects module.exports = __webpack_require__(192)('Set', function(get){ return function Set(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.2.3.1 Set.prototype.add(value) add: function add(value){ return strong.def(this, value = value === 0 ? 0 : value, value); } }, strong); /***/ }, /* 194 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var each = __webpack_require__(160)(0) , redefine = __webpack_require__(18) , meta = __webpack_require__(19) , assign = __webpack_require__(67) , weak = __webpack_require__(195) , isObject = __webpack_require__(13) , getWeak = meta.getWeak , isExtensible = Object.isExtensible , uncaughtFrozenStore = weak.ufstore , tmp = {} , InternalMap; var wrapper = function(get){ return function WeakMap(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }; var methods = { // 23.3.3.3 WeakMap.prototype.get(key) get: function get(key){ if(isObject(key)){ var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).get(key); return data ? data[this._i] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function set(key, value){ return weak.def(this, key, value); } }; // 23.3 WeakMap Objects var $WeakMap = module.exports = __webpack_require__(192)('WeakMap', wrapper, methods, weak, true, true); // IE11 WeakMap frozen keys fix if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){ InternalMap = weak.getConstructor(wrapper); assign(InternalMap.prototype, methods); meta.NEED = true; each(['delete', 'has', 'get', 'set'], function(key){ var proto = $WeakMap.prototype , method = proto[key]; redefine(proto, key, function(a, b){ // store frozen objects on internal weakmap shim if(isObject(a) && !isExtensible(a)){ if(!this._f)this._f = new InternalMap; var result = this._f[key](a, b); return key == 'set' ? this : result; // store all the rest on native weakmap } return method.call(this, a, b); }); }); } /***/ }, /* 195 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var redefineAll = __webpack_require__(189) , getWeak = __webpack_require__(19).getWeak , anObject = __webpack_require__(12) , isObject = __webpack_require__(13) , anInstance = __webpack_require__(184) , forOf = __webpack_require__(185) , createArrayMethod = __webpack_require__(160) , $has = __webpack_require__(3) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) , id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function(that){ return that._l || (that._l = new UncaughtFrozenStore); }; var UncaughtFrozenStore = function(){ this.a = []; }; var findUncaughtFrozen = function(store, key){ return arrayFind(store.a, function(it){ return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function(key){ var entry = findUncaughtFrozen(this, key); if(entry)return entry[1]; }, has: function(key){ return !!findUncaughtFrozen(this, key); }, set: function(key, value){ var entry = findUncaughtFrozen(this, key); if(entry)entry[1] = value; else this.a.push([key, value]); }, 'delete': function(key){ var index = arrayFindIndex(this.a, function(it){ return it[0] === key; }); if(~index)this.a.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function(wrapper, NAME, IS_MAP, ADDER){ var C = wrapper(function(that, iterable){ anInstance(that, C, NAME, '_i'); that._i = id++; // collection id that._l = undefined; // leak store for uncaught frozen objects if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this)['delete'](key); return data && $has(data, this._i) && delete data[this._i]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function has(key){ if(!isObject(key))return false; var data = getWeak(key); if(data === true)return uncaughtFrozenStore(this).has(key); return data && $has(data, this._i); } }); return C; }, def: function(that, key, value){ var data = getWeak(anObject(key), true); if(data === true)uncaughtFrozenStore(that).set(key, value); else data[that._i] = value; return that; }, ufstore: uncaughtFrozenStore }; /***/ }, /* 196 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var weak = __webpack_require__(195); // 23.4 WeakSet Objects __webpack_require__(192)('WeakSet', function(get){ return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.4.3.1 WeakSet.prototype.add(value) add: function add(value){ return weak.def(this, value, true); } }, weak, false, true); /***/ }, /* 197 */ /***/ function(module, exports, __webpack_require__) { // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) var $export = __webpack_require__(6) , aFunction = __webpack_require__(9) , anObject = __webpack_require__(12) , rApply = (__webpack_require__(2).Reflect || {}).apply , fApply = Function.apply; // MS Edge argumentsList argument is optional $export($export.S + $export.F * !__webpack_require__(5)(function(){ rApply(function(){}); }), 'Reflect', { apply: function apply(target, thisArgument, argumentsList){ var T = aFunction(target) , L = anObject(argumentsList); return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); } }); /***/ }, /* 198 */ /***/ function(module, exports, __webpack_require__) { // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) var $export = __webpack_require__(6) , create = __webpack_require__(44) , aFunction = __webpack_require__(9) , anObject = __webpack_require__(12) , isObject = __webpack_require__(13) , fails = __webpack_require__(5) , bind = __webpack_require__(73) , rConstruct = (__webpack_require__(2).Reflect || {}).construct; // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function(){ function F(){} return !(rConstruct(function(){}, [], F) instanceof F); }); var ARGS_BUG = !fails(function(){ rConstruct(function(){}); }); $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { construct: function construct(Target, args /*, newTarget*/){ aFunction(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); if(ARGS_BUG && !NEW_TARGET_BUG)return rConstruct(Target, args, newTarget); if(Target == newTarget){ // w/o altered newTarget, optimization for 0-4 arguments switch(args.length){ case 0: return new Target; case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; $args.push.apply($args, args); return new (bind.apply(Target, $args)); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype , instance = create(isObject(proto) ? proto : Object.prototype) , result = Function.apply.call(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }, /* 199 */ /***/ function(module, exports, __webpack_require__) { // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) var dP = __webpack_require__(11) , $export = __webpack_require__(6) , anObject = __webpack_require__(12) , toPrimitive = __webpack_require__(16); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false $export($export.S + $export.F * __webpack_require__(5)(function(){ Reflect.defineProperty(dP.f({}, 1, {value: 1}), 1, {value: 2}); }), 'Reflect', { defineProperty: function defineProperty(target, propertyKey, attributes){ anObject(target); propertyKey = toPrimitive(propertyKey, true); anObject(attributes); try { dP.f(target, propertyKey, attributes); return true; } catch(e){ return false; } } }); /***/ }, /* 200 */ /***/ function(module, exports, __webpack_require__) { // 26.1.4 Reflect.deleteProperty(target, propertyKey) var $export = __webpack_require__(6) , gOPD = __webpack_require__(49).f , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { deleteProperty: function deleteProperty(target, propertyKey){ var desc = gOPD(anObject(target), propertyKey); return desc && !desc.configurable ? false : delete target[propertyKey]; } }); /***/ }, /* 201 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 26.1.5 Reflect.enumerate(target) var $export = __webpack_require__(6) , anObject = __webpack_require__(12); var Enumerate = function(iterated){ this._t = anObject(iterated); // target this._i = 0; // next index var keys = this._k = [] // keys , key; for(key in iterated)keys.push(key); }; __webpack_require__(131)(Enumerate, 'Object', function(){ var that = this , keys = that._k , key; do { if(that._i >= keys.length)return {value: undefined, done: true}; } while(!((key = keys[that._i++]) in that._t)); return {value: key, done: false}; }); $export($export.S, 'Reflect', { enumerate: function enumerate(target){ return new Enumerate(target); } }); /***/ }, /* 202 */ /***/ function(module, exports, __webpack_require__) { // 26.1.6 Reflect.get(target, propertyKey [, receiver]) var gOPD = __webpack_require__(49) , getPrototypeOf = __webpack_require__(57) , has = __webpack_require__(3) , $export = __webpack_require__(6) , isObject = __webpack_require__(13) , anObject = __webpack_require__(12); function get(target, propertyKey/*, receiver*/){ var receiver = arguments.length < 3 ? target : arguments[2] , desc, proto; if(anObject(target) === receiver)return target[propertyKey]; if(desc = gOPD.f(target, propertyKey))return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined; if(isObject(proto = getPrototypeOf(target)))return get(proto, propertyKey, receiver); } $export($export.S, 'Reflect', {get: get}); /***/ }, /* 203 */ /***/ function(module, exports, __webpack_require__) { // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) var gOPD = __webpack_require__(49) , $export = __webpack_require__(6) , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){ return gOPD.f(anObject(target), propertyKey); } }); /***/ }, /* 204 */ /***/ function(module, exports, __webpack_require__) { // 26.1.8 Reflect.getPrototypeOf(target) var $export = __webpack_require__(6) , getProto = __webpack_require__(57) , anObject = __webpack_require__(12); $export($export.S, 'Reflect', { getPrototypeOf: function getPrototypeOf(target){ return getProto(anObject(target)); } }); /***/ }, /* 205 */ /***/ function(module, exports, __webpack_require__) { // 26.1.9 Reflect.has(target, propertyKey) var $export = __webpack_require__(6); $export($export.S, 'Reflect', { has: function has(target, propertyKey){ return propertyKey in target; } }); /***/ }, /* 206 */ /***/ function(module, exports, __webpack_require__) { // 26.1.10 Reflect.isExtensible(target) var $export = __webpack_require__(6) , anObject = __webpack_require__(12) , $isExtensible = Object.isExtensible; $export($export.S, 'Reflect', { isExtensible: function isExtensible(target){ anObject(target); return $isExtensible ? $isExtensible(target) : true; } }); /***/ }, /* 207 */ /***/ function(module, exports, __webpack_require__) { // 26.1.11 Reflect.ownKeys(target) var $export = __webpack_require__(6); $export($export.S, 'Reflect', {ownKeys: __webpack_require__(208)}); /***/ }, /* 208 */ /***/ function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols var gOPN = __webpack_require__(48) , gOPS = __webpack_require__(41) , anObject = __webpack_require__(12) , Reflect = __webpack_require__(2).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it){ var keys = gOPN.f(anObject(it)) , getSymbols = gOPS.f; return getSymbols ? keys.concat(getSymbols(it)) : keys; }; /***/ }, /* 209 */ /***/ function(module, exports, __webpack_require__) { // 26.1.12 Reflect.preventExtensions(target) var $export = __webpack_require__(6) , anObject = __webpack_require__(12) , $preventExtensions = Object.preventExtensions; $export($export.S, 'Reflect', { preventExtensions: function preventExtensions(target){ anObject(target); try { if($preventExtensions)$preventExtensions(target); return true; } catch(e){ return false; } } }); /***/ }, /* 210 */ /***/ function(module, exports, __webpack_require__) { // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) var dP = __webpack_require__(11) , gOPD = __webpack_require__(49) , getPrototypeOf = __webpack_require__(57) , has = __webpack_require__(3) , $export = __webpack_require__(6) , createDesc = __webpack_require__(17) , anObject = __webpack_require__(12) , isObject = __webpack_require__(13); function set(target, propertyKey, V/*, receiver*/){ var receiver = arguments.length < 4 ? target : arguments[3] , ownDesc = gOPD.f(anObject(target), propertyKey) , existingDescriptor, proto; if(!ownDesc){ if(isObject(proto = getPrototypeOf(target))){ return set(proto, propertyKey, V, receiver); } ownDesc = createDesc(0); } if(has(ownDesc, 'value')){ if(ownDesc.writable === false || !isObject(receiver))return false; existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); existingDescriptor.value = V; dP.f(receiver, propertyKey, existingDescriptor); return true; } return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); } $export($export.S, 'Reflect', {set: set}); /***/ }, /* 211 */ /***/ function(module, exports, __webpack_require__) { // 26.1.14 Reflect.setPrototypeOf(target, proto) var $export = __webpack_require__(6) , setProto = __webpack_require__(71); if(setProto)$export($export.S, 'Reflect', { setPrototypeOf: function setPrototypeOf(target, proto){ setProto.check(target, proto); try { setProto.set(target, proto); return true; } catch(e){ return false; } } }); /***/ }, /* 212 */ /***/ function(module, exports, __webpack_require__) { // 20.3.3.1 / 15.9.4.4 Date.now() var $export = __webpack_require__(6); $export($export.S, 'Date', {now: function(){ return new Date().getTime(); }}); /***/ }, /* 213 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toObject = __webpack_require__(56) , toPrimitive = __webpack_require__(16); $export($export.P + $export.F * __webpack_require__(5)(function(){ return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({toISOString: function(){ return 1; }}) !== 1; }), 'Date', { toJSON: function toJSON(key){ var O = toObject(this) , pv = toPrimitive(O); return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); } }); /***/ }, /* 214 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() var $export = __webpack_require__(6) , fails = __webpack_require__(5) , getTime = Date.prototype.getTime; var lz = function(num){ return num > 9 ? num : '0' + num; }; // PhantomJS / old WebKit has a broken implementations $export($export.P + $export.F * (fails(function(){ return new Date(-5e13 - 1).toISOString() != '0385-07-25T07:06:39.999Z'; }) || !fails(function(){ new Date(NaN).toISOString(); })), 'Date', { toISOString: function toISOString(){ if(!isFinite(getTime.call(this)))throw RangeError('Invalid time value'); var d = this , y = d.getUTCFullYear() , m = d.getUTCMilliseconds() , s = y < 0 ? '-' : y > 9999 ? '+' : ''; return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; } }); /***/ }, /* 215 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , $typed = __webpack_require__(216) , buffer = __webpack_require__(217) , anObject = __webpack_require__(12) , toIndex = __webpack_require__(37) , toLength = __webpack_require__(35) , isObject = __webpack_require__(13) , ArrayBuffer = __webpack_require__(2).ArrayBuffer , speciesConstructor = __webpack_require__(186) , $ArrayBuffer = buffer.ArrayBuffer , $DataView = buffer.DataView , $isView = $typed.ABV && ArrayBuffer.isView , $slice = $ArrayBuffer.prototype.slice , VIEW = $typed.VIEW , ARRAY_BUFFER = 'ArrayBuffer'; $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {ArrayBuffer: $ArrayBuffer}); $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { // 24.1.3.1 ArrayBuffer.isView(arg) isView: function isView(it){ return $isView && $isView(it) || isObject(it) && VIEW in it; } }); $export($export.P + $export.U + $export.F * __webpack_require__(5)(function(){ return !new $ArrayBuffer(2).slice(1, undefined).byteLength; }), ARRAY_BUFFER, { // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) slice: function slice(start, end){ if($slice !== undefined && end === undefined)return $slice.call(anObject(this), start); // FF fix var len = anObject(this).byteLength , first = toIndex(start, len) , final = toIndex(end === undefined ? len : end, len) , result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first)) , viewS = new $DataView(this) , viewT = new $DataView(result) , index = 0; while(first < final){ viewT.setUint8(index++, viewS.getUint8(first++)); } return result; } }); __webpack_require__(182)(ARRAY_BUFFER); /***/ }, /* 216 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , hide = __webpack_require__(10) , uid = __webpack_require__(20) , TYPED = uid('typed_array') , VIEW = uid('view') , ABV = !!(global.ArrayBuffer && global.DataView) , CONSTR = ABV , i = 0, l = 9, Typed; var TypedArrayConstructors = ( 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' ).split(','); while(i < l){ if(Typed = global[TypedArrayConstructors[i++]]){ hide(Typed.prototype, TYPED, true); hide(Typed.prototype, VIEW, true); } else CONSTR = false; } module.exports = { ABV: ABV, CONSTR: CONSTR, TYPED: TYPED, VIEW: VIEW }; /***/ }, /* 217 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var global = __webpack_require__(2) , DESCRIPTORS = __webpack_require__(4) , LIBRARY = __webpack_require__(26) , $typed = __webpack_require__(216) , hide = __webpack_require__(10) , redefineAll = __webpack_require__(189) , fails = __webpack_require__(5) , anInstance = __webpack_require__(184) , toInteger = __webpack_require__(36) , toLength = __webpack_require__(35) , gOPN = __webpack_require__(48).f , dP = __webpack_require__(11).f , arrayFill = __webpack_require__(176) , setToStringTag = __webpack_require__(22) , ARRAY_BUFFER = 'ArrayBuffer' , DATA_VIEW = 'DataView' , PROTOTYPE = 'prototype' , WRONG_LENGTH = 'Wrong length!' , WRONG_INDEX = 'Wrong index!' , $ArrayBuffer = global[ARRAY_BUFFER] , $DataView = global[DATA_VIEW] , Math = global.Math , RangeError = global.RangeError , Infinity = global.Infinity , BaseBuffer = $ArrayBuffer , abs = Math.abs , pow = Math.pow , floor = Math.floor , log = Math.log , LN2 = Math.LN2 , BUFFER = 'buffer' , BYTE_LENGTH = 'byteLength' , BYTE_OFFSET = 'byteOffset' , $BUFFER = DESCRIPTORS ? '_b' : BUFFER , $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH , $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; // IEEE754 conversions based on https://github.com/feross/ieee754 var packIEEE754 = function(value, mLen, nBytes){ var buffer = Array(nBytes) , eLen = nBytes * 8 - mLen - 1 , eMax = (1 << eLen) - 1 , eBias = eMax >> 1 , rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0 , i = 0 , s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0 , e, m, c; value = abs(value) if(value != value || value === Infinity){ m = value != value ? 1 : 0; e = eMax; } else { e = floor(log(value) / LN2); if(value * (c = pow(2, -e)) < 1){ e--; c *= 2; } if(e + eBias >= 1){ value += rt / c; } else { value += rt * pow(2, 1 - eBias); } if(value * c >= 2){ e++; c /= 2; } if(e + eBias >= eMax){ m = 0; e = eMax; } else if(e + eBias >= 1){ m = (value * c - 1) * pow(2, mLen); e = e + eBias; } else { m = value * pow(2, eBias - 1) * pow(2, mLen); e = 0; } } for(; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); e = e << mLen | m; eLen += mLen; for(; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); buffer[--i] |= s * 128; return buffer; }; var unpackIEEE754 = function(buffer, mLen, nBytes){ var eLen = nBytes * 8 - mLen - 1 , eMax = (1 << eLen) - 1 , eBias = eMax >> 1 , nBits = eLen - 7 , i = nBytes - 1 , s = buffer[i--] , e = s & 127 , m; s >>= 7; for(; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); m = e & (1 << -nBits) - 1; e >>= -nBits; nBits += mLen; for(; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); if(e === 0){ e = 1 - eBias; } else if(e === eMax){ return m ? NaN : s ? -Infinity : Infinity; } else { m = m + pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * pow(2, e - mLen); }; var unpackI32 = function(bytes){ return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; }; var packI8 = function(it){ return [it & 0xff]; }; var packI16 = function(it){ return [it & 0xff, it >> 8 & 0xff]; }; var packI32 = function(it){ return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; }; var packF64 = function(it){ return packIEEE754(it, 52, 8); }; var packF32 = function(it){ return packIEEE754(it, 23, 4); }; var addGetter = function(C, key, internal){ dP(C[PROTOTYPE], key, {get: function(){ return this[internal]; }}); }; var get = function(view, bytes, index, isLittleEndian){ var numIndex = +index , intIndex = toInteger(numIndex); if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b , start = intIndex + view[$OFFSET] , pack = store.slice(start, start + bytes); return isLittleEndian ? pack : pack.reverse(); }; var set = function(view, bytes, index, conversion, value, isLittleEndian){ var numIndex = +index , intIndex = toInteger(numIndex); if(numIndex != intIndex || intIndex < 0 || intIndex + bytes > view[$LENGTH])throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b , start = intIndex + view[$OFFSET] , pack = conversion(+value); for(var i = 0; i < bytes; i++)store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; }; var validateArrayBufferArguments = function(that, length){ anInstance(that, $ArrayBuffer, ARRAY_BUFFER); var numberLength = +length , byteLength = toLength(numberLength); if(numberLength != byteLength)throw RangeError(WRONG_LENGTH); return byteLength; }; if(!$typed.ABV){ $ArrayBuffer = function ArrayBuffer(length){ var byteLength = validateArrayBufferArguments(this, length); this._b = arrayFill.call(Array(byteLength), 0); this[$LENGTH] = byteLength; }; $DataView = function DataView(buffer, byteOffset, byteLength){ anInstance(this, $DataView, DATA_VIEW); anInstance(buffer, $ArrayBuffer, DATA_VIEW); var bufferLength = buffer[$LENGTH] , offset = toInteger(byteOffset); if(offset < 0 || offset > bufferLength)throw RangeError('Wrong offset!'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if(offset + byteLength > bufferLength)throw RangeError(WRONG_LENGTH); this[$BUFFER] = buffer; this[$OFFSET] = offset; this[$LENGTH] = byteLength; }; if(DESCRIPTORS){ addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); addGetter($DataView, BUFFER, '_b'); addGetter($DataView, BYTE_LENGTH, '_l'); addGetter($DataView, BYTE_OFFSET, '_o'); } redefineAll($DataView[PROTOTYPE], { getInt8: function getInt8(byteOffset){ return get(this, 1, byteOffset)[0] << 24 >> 24; }, getUint8: function getUint8(byteOffset){ return get(this, 1, byteOffset)[0]; }, getInt16: function getInt16(byteOffset /*, littleEndian */){ var bytes = get(this, 2, byteOffset, arguments[1]); return (bytes[1] << 8 | bytes[0]) << 16 >> 16; }, getUint16: function getUint16(byteOffset /*, littleEndian */){ var bytes = get(this, 2, byteOffset, arguments[1]); return bytes[1] << 8 | bytes[0]; }, getInt32: function getInt32(byteOffset /*, littleEndian */){ return unpackI32(get(this, 4, byteOffset, arguments[1])); }, getUint32: function getUint32(byteOffset /*, littleEndian */){ return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; }, getFloat32: function getFloat32(byteOffset /*, littleEndian */){ return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); }, getFloat64: function getFloat64(byteOffset /*, littleEndian */){ return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); }, setInt8: function setInt8(byteOffset, value){ set(this, 1, byteOffset, packI8, value); }, setUint8: function setUint8(byteOffset, value){ set(this, 1, byteOffset, packI8, value); }, setInt16: function setInt16(byteOffset, value /*, littleEndian */){ set(this, 2, byteOffset, packI16, value, arguments[2]); }, setUint16: function setUint16(byteOffset, value /*, littleEndian */){ set(this, 2, byteOffset, packI16, value, arguments[2]); }, setInt32: function setInt32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packI32, value, arguments[2]); }, setUint32: function setUint32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packI32, value, arguments[2]); }, setFloat32: function setFloat32(byteOffset, value /*, littleEndian */){ set(this, 4, byteOffset, packF32, value, arguments[2]); }, setFloat64: function setFloat64(byteOffset, value /*, littleEndian */){ set(this, 8, byteOffset, packF64, value, arguments[2]); } }); } else { if(!fails(function(){ new $ArrayBuffer; // eslint-disable-line no-new }) || !fails(function(){ new $ArrayBuffer(.5); // eslint-disable-line no-new })){ $ArrayBuffer = function ArrayBuffer(length){ return new BaseBuffer(validateArrayBufferArguments(this, length)); }; var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; for(var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j; ){ if(!((key = keys[j++]) in $ArrayBuffer))hide($ArrayBuffer, key, BaseBuffer[key]); }; if(!LIBRARY)ArrayBufferProto.constructor = $ArrayBuffer; } // iOS Safari 7.x bug var view = new $DataView(new $ArrayBuffer(2)) , $setInt8 = $DataView[PROTOTYPE].setInt8; view.setInt8(0, 2147483648); view.setInt8(1, 2147483649); if(view.getInt8(0) || !view.getInt8(1))redefineAll($DataView[PROTOTYPE], { setInt8: function setInt8(byteOffset, value){ $setInt8.call(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value){ $setInt8.call(this, byteOffset, value << 24 >> 24); } }, true); } setToStringTag($ArrayBuffer, ARRAY_BUFFER); setToStringTag($DataView, DATA_VIEW); hide($DataView[PROTOTYPE], $typed.VIEW, true); exports[ARRAY_BUFFER] = $ArrayBuffer; exports[DATA_VIEW] = $DataView; /***/ }, /* 218 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); $export($export.G + $export.W + $export.F * !__webpack_require__(216).ABV, { DataView: __webpack_require__(217).DataView }); /***/ }, /* 219 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Int8', 1, function(init){ return function Int8Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 220 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; if(__webpack_require__(4)){ var LIBRARY = __webpack_require__(26) , global = __webpack_require__(2) , fails = __webpack_require__(5) , $export = __webpack_require__(6) , $typed = __webpack_require__(216) , $buffer = __webpack_require__(217) , ctx = __webpack_require__(8) , anInstance = __webpack_require__(184) , propertyDesc = __webpack_require__(17) , hide = __webpack_require__(10) , redefineAll = __webpack_require__(189) , toInteger = __webpack_require__(36) , toLength = __webpack_require__(35) , toIndex = __webpack_require__(37) , toPrimitive = __webpack_require__(16) , has = __webpack_require__(3) , same = __webpack_require__(69) , classof = __webpack_require__(152) , isObject = __webpack_require__(13) , toObject = __webpack_require__(56) , isArrayIter = __webpack_require__(149) , create = __webpack_require__(44) , getPrototypeOf = __webpack_require__(57) , gOPN = __webpack_require__(48).f , getIterFn = __webpack_require__(151) , uid = __webpack_require__(20) , wks = __webpack_require__(23) , createArrayMethod = __webpack_require__(160) , createArrayIncludes = __webpack_require__(34) , speciesConstructor = __webpack_require__(186) , ArrayIterators = __webpack_require__(179) , Iterators = __webpack_require__(130) , $iterDetect = __webpack_require__(153) , setSpecies = __webpack_require__(182) , arrayFill = __webpack_require__(176) , arrayCopyWithin = __webpack_require__(173) , $DP = __webpack_require__(11) , $GOPD = __webpack_require__(49) , dP = $DP.f , gOPD = $GOPD.f , RangeError = global.RangeError , TypeError = global.TypeError , Uint8Array = global.Uint8Array , ARRAY_BUFFER = 'ArrayBuffer' , SHARED_BUFFER = 'Shared' + ARRAY_BUFFER , BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT' , PROTOTYPE = 'prototype' , ArrayProto = Array[PROTOTYPE] , $ArrayBuffer = $buffer.ArrayBuffer , $DataView = $buffer.DataView , arrayForEach = createArrayMethod(0) , arrayFilter = createArrayMethod(2) , arraySome = createArrayMethod(3) , arrayEvery = createArrayMethod(4) , arrayFind = createArrayMethod(5) , arrayFindIndex = createArrayMethod(6) , arrayIncludes = createArrayIncludes(true) , arrayIndexOf = createArrayIncludes(false) , arrayValues = ArrayIterators.values , arrayKeys = ArrayIterators.keys , arrayEntries = ArrayIterators.entries , arrayLastIndexOf = ArrayProto.lastIndexOf , arrayReduce = ArrayProto.reduce , arrayReduceRight = ArrayProto.reduceRight , arrayJoin = ArrayProto.join , arraySort = ArrayProto.sort , arraySlice = ArrayProto.slice , arrayToString = ArrayProto.toString , arrayToLocaleString = ArrayProto.toLocaleString , ITERATOR = wks('iterator') , TAG = wks('toStringTag') , TYPED_CONSTRUCTOR = uid('typed_constructor') , DEF_CONSTRUCTOR = uid('def_constructor') , ALL_CONSTRUCTORS = $typed.CONSTR , TYPED_ARRAY = $typed.TYPED , VIEW = $typed.VIEW , WRONG_LENGTH = 'Wrong length!'; var $map = createArrayMethod(1, function(O, length){ return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); }); var LITTLE_ENDIAN = fails(function(){ return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; }); var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function(){ new Uint8Array(1).set({}); }); var strictToLength = function(it, SAME){ if(it === undefined)throw TypeError(WRONG_LENGTH); var number = +it , length = toLength(it); if(SAME && !same(number, length))throw RangeError(WRONG_LENGTH); return length; }; var toOffset = function(it, BYTES){ var offset = toInteger(it); if(offset < 0 || offset % BYTES)throw RangeError('Wrong offset!'); return offset; }; var validate = function(it){ if(isObject(it) && TYPED_ARRAY in it)return it; throw TypeError(it + ' is not a typed array!'); }; var allocate = function(C, length){ if(!(isObject(C) && TYPED_CONSTRUCTOR in C)){ throw TypeError('It is not a typed array constructor!'); } return new C(length); }; var speciesFromList = function(O, list){ return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); }; var fromList = function(C, list){ var index = 0 , length = list.length , result = allocate(C, length); while(length > index)result[index] = list[index++]; return result; }; var addGetter = function(it, key, internal){ dP(it, key, {get: function(){ return this._d[internal]; }}); }; var $from = function from(source /*, mapfn, thisArg */){ var O = toObject(source) , aLen = arguments.length , mapfn = aLen > 1 ? arguments[1] : undefined , mapping = mapfn !== undefined , iterFn = getIterFn(O) , i, length, values, result, step, iterator; if(iterFn != undefined && !isArrayIter(iterFn)){ for(iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++){ values.push(step.value); } O = values; } if(mapping && aLen > 2)mapfn = ctx(mapfn, arguments[2], 2); for(i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++){ result[i] = mapping ? mapfn(O[i], i) : O[i]; } return result; }; var $of = function of(/*...items*/){ var index = 0 , length = arguments.length , result = allocate(this, length); while(length > index)result[index] = arguments[index++]; return result; }; // iOS Safari 6.x fails here var TO_LOCALE_BUG = !!Uint8Array && fails(function(){ arrayToLocaleString.call(new Uint8Array(1)); }); var $toLocaleString = function toLocaleString(){ return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); }; var proto = { copyWithin: function copyWithin(target, start /*, end */){ return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }, every: function every(callbackfn /*, thisArg */){ return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, fill: function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars return arrayFill.apply(validate(this), arguments); }, filter: function filter(callbackfn /*, thisArg */){ return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined)); }, find: function find(predicate /*, thisArg */){ return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, findIndex: function findIndex(predicate /*, thisArg */){ return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, forEach: function forEach(callbackfn /*, thisArg */){ arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, indexOf: function indexOf(searchElement /*, fromIndex */){ return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, includes: function includes(searchElement /*, fromIndex */){ return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, join: function join(separator){ // eslint-disable-line no-unused-vars return arrayJoin.apply(validate(this), arguments); }, lastIndexOf: function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars return arrayLastIndexOf.apply(validate(this), arguments); }, map: function map(mapfn /*, thisArg */){ return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); }, reduce: function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars return arrayReduce.apply(validate(this), arguments); }, reduceRight: function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars return arrayReduceRight.apply(validate(this), arguments); }, reverse: function reverse(){ var that = this , length = validate(that).length , middle = Math.floor(length / 2) , index = 0 , value; while(index < middle){ value = that[index]; that[index++] = that[--length]; that[length] = value; } return that; }, some: function some(callbackfn /*, thisArg */){ return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, sort: function sort(comparefn){ return arraySort.call(validate(this), comparefn); }, subarray: function subarray(begin, end){ var O = validate(this) , length = O.length , $begin = toIndex(begin, length); return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toIndex(end, length)) - $begin) ); } }; var $slice = function slice(start, end){ return speciesFromList(this, arraySlice.call(validate(this), start, end)); }; var $set = function set(arrayLike /*, offset */){ validate(this); var offset = toOffset(arguments[1], 1) , length = this.length , src = toObject(arrayLike) , len = toLength(src.length) , index = 0; if(len + offset > length)throw RangeError(WRONG_LENGTH); while(index < len)this[offset + index] = src[index++]; }; var $iterators = { entries: function entries(){ return arrayEntries.call(validate(this)); }, keys: function keys(){ return arrayKeys.call(validate(this)); }, values: function values(){ return arrayValues.call(validate(this)); } }; var isTAIndex = function(target, key){ return isObject(target) && target[TYPED_ARRAY] && typeof key != 'symbol' && key in target && String(+key) == String(key); }; var $getDesc = function getOwnPropertyDescriptor(target, key){ return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key); }; var $setDesc = function defineProperty(target, key, desc){ if(isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set') // TODO: add validation descriptor w/o calling accessors && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable) ){ target[key] = desc.value; return target; } else return dP(target, key, desc); }; if(!ALL_CONSTRUCTORS){ $GOPD.f = $getDesc; $DP.f = $setDesc; } $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { getOwnPropertyDescriptor: $getDesc, defineProperty: $setDesc }); if(fails(function(){ arrayToString.call({}); })){ arrayToString = arrayToLocaleString = function toString(){ return arrayJoin.call(this); } } var $TypedArrayPrototype$ = redefineAll({}, proto); redefineAll($TypedArrayPrototype$, $iterators); hide($TypedArrayPrototype$, ITERATOR, $iterators.values); redefineAll($TypedArrayPrototype$, { slice: $slice, set: $set, constructor: function(){ /* noop */ }, toString: arrayToString, toLocaleString: $toLocaleString }); addGetter($TypedArrayPrototype$, 'buffer', 'b'); addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); addGetter($TypedArrayPrototype$, 'byteLength', 'l'); addGetter($TypedArrayPrototype$, 'length', 'e'); dP($TypedArrayPrototype$, TAG, { get: function(){ return this[TYPED_ARRAY]; } }); module.exports = function(KEY, BYTES, wrapper, CLAMPED){ CLAMPED = !!CLAMPED; var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array' , ISNT_UINT8 = NAME != 'Uint8Array' , GETTER = 'get' + KEY , SETTER = 'set' + KEY , TypedArray = global[NAME] , Base = TypedArray || {} , TAC = TypedArray && getPrototypeOf(TypedArray) , FORCED = !TypedArray || !$typed.ABV , O = {} , TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; var getter = function(that, index){ var data = that._d; return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); }; var setter = function(that, index, value){ var data = that._d; if(CLAMPED)value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); }; var addElement = function(that, index){ dP(that, index, { get: function(){ return getter(this, index); }, set: function(value){ return setter(this, index, value); }, enumerable: true }); }; if(FORCED){ TypedArray = wrapper(function(that, data, $offset, $length){ anInstance(that, TypedArray, NAME, '_d'); var index = 0 , offset = 0 , buffer, byteLength, length, klass; if(!isObject(data)){ length = strictToLength(data, true) byteLength = length * BYTES; buffer = new $ArrayBuffer(byteLength); } else if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ buffer = data; offset = toOffset($offset, BYTES); var $len = data.byteLength; if($length === undefined){ if($len % BYTES)throw RangeError(WRONG_LENGTH); byteLength = $len - offset; if(byteLength < 0)throw RangeError(WRONG_LENGTH); } else { byteLength = toLength($length) * BYTES; if(byteLength + offset > $len)throw RangeError(WRONG_LENGTH); } length = byteLength / BYTES; } else if(TYPED_ARRAY in data){ return fromList(TypedArray, data); } else { return $from.call(TypedArray, data); } hide(that, '_d', { b: buffer, o: offset, l: byteLength, e: length, v: new $DataView(buffer) }); while(index < length)addElement(that, index++); }); TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); hide(TypedArrayPrototype, 'constructor', TypedArray); } else if(!$iterDetect(function(iter){ // V8 works with iterators, but fails in many other cases // https://code.google.com/p/v8/issues/detail?id=4552 new TypedArray(null); // eslint-disable-line no-new new TypedArray(iter); // eslint-disable-line no-new }, true)){ TypedArray = wrapper(function(that, data, $offset, $length){ anInstance(that, TypedArray, NAME); var klass; // `ws` module bug, temporarily remove validation length for Uint8Array // https://github.com/websockets/ws/pull/645 if(!isObject(data))return new Base(strictToLength(data, ISNT_UINT8)); if(data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER){ return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data); } if(TYPED_ARRAY in data)return fromList(TypedArray, data); return $from.call(TypedArray, data); }); arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function(key){ if(!(key in TypedArray))hide(TypedArray, key, Base[key]); }); TypedArray[PROTOTYPE] = TypedArrayPrototype; if(!LIBRARY)TypedArrayPrototype.constructor = TypedArray; } var $nativeIterator = TypedArrayPrototype[ITERATOR] , CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined) , $iterator = $iterators.values; hide(TypedArray, TYPED_CONSTRUCTOR, true); hide(TypedArrayPrototype, TYPED_ARRAY, NAME); hide(TypedArrayPrototype, VIEW, true); hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); if(CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)){ dP(TypedArrayPrototype, TAG, { get: function(){ return NAME; } }); } O[NAME] = TypedArray; $export($export.G + $export.W + $export.F * (TypedArray != Base), O); $export($export.S, NAME, { BYTES_PER_ELEMENT: BYTES, from: $from, of: $of }); if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); $export($export.P, NAME, proto); setSpecies(NAME); $export($export.P + $export.F * FORCED_SET, NAME, {set: $set}); $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString}); $export($export.P + $export.F * fails(function(){ new TypedArray(1).slice(); }), NAME, {slice: $slice}); $export($export.P + $export.F * (fails(function(){ return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString() }) || !fails(function(){ TypedArrayPrototype.toLocaleString.call([1, 2]); })), NAME, {toLocaleString: $toLocaleString}); Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator); }; } else module.exports = function(){ /* empty */ }; /***/ }, /* 221 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Uint8', 1, function(init){ return function Uint8Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 222 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Uint8', 1, function(init){ return function Uint8ClampedArray(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }, true); /***/ }, /* 223 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Int16', 2, function(init){ return function Int16Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 224 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Uint16', 2, function(init){ return function Uint16Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 225 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Int32', 4, function(init){ return function Int32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 226 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Uint32', 4, function(init){ return function Uint32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 227 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Float32', 4, function(init){ return function Float32Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 228 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(220)('Float64', 8, function(init){ return function Float64Array(data, byteOffset, length){ return init(this, data, byteOffset, length); }; }); /***/ }, /* 229 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/Array.prototype.includes var $export = __webpack_require__(6) , $includes = __webpack_require__(34)(true); $export($export.P, 'Array', { includes: function includes(el /*, fromIndex = 0 */){ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(174)('includes'); /***/ }, /* 230 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/mathiasbynens/String.prototype.at var $export = __webpack_require__(6) , $at = __webpack_require__(120)(true); $export($export.P, 'String', { at: function at(pos){ return $at(this, pos); } }); /***/ }, /* 231 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(6) , $pad = __webpack_require__(232); $export($export.P, 'String', { padStart: function padStart(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } }); /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-string-pad-start-end var toLength = __webpack_require__(35) , repeat = __webpack_require__(78) , defined = __webpack_require__(33); module.exports = function(that, maxLength, fillString, left){ var S = String(defined(that)) , stringLength = S.length , fillStr = fillString === undefined ? ' ' : String(fillString) , intMaxLength = toLength(maxLength); if(intMaxLength <= stringLength || fillStr == '')return S; var fillLen = intMaxLength - stringLength , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen); return left ? stringFiller + S : S + stringFiller; }; /***/ }, /* 233 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(6) , $pad = __webpack_require__(232); $export($export.P, 'String', { padEnd: function padEnd(maxLength /*, fillString = ' ' */){ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } }); /***/ }, /* 234 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(90)('trimLeft', function($trim){ return function trimLeft(){ return $trim(this, 1); }; }, 'trimStart'); /***/ }, /* 235 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(90)('trimRight', function($trim){ return function trimRight(){ return $trim(this, 2); }; }, 'trimEnd'); /***/ }, /* 236 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://tc39.github.io/String.prototype.matchAll/ var $export = __webpack_require__(6) , defined = __webpack_require__(33) , toLength = __webpack_require__(35) , isRegExp = __webpack_require__(123) , getFlags = __webpack_require__(237) , RegExpProto = RegExp.prototype; var $RegExpStringIterator = function(regexp, string){ this._r = regexp; this._s = string; }; __webpack_require__(131)($RegExpStringIterator, 'RegExp String', function next(){ var match = this._r.exec(this._s); return {value: match, done: match === null}; }); $export($export.P, 'String', { matchAll: function matchAll(regexp){ defined(this); if(!isRegExp(regexp))throw TypeError(regexp + ' is not a regexp!'); var S = String(this) , flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp) , rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); rx.lastIndex = toLength(regexp.lastIndex); return new $RegExpStringIterator(rx, S); } }); /***/ }, /* 237 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // 21.2.5.3 get RegExp.prototype.flags var anObject = __webpack_require__(12); module.exports = function(){ var that = anObject(this) , result = ''; if(that.global) result += 'g'; if(that.ignoreCase) result += 'i'; if(that.multiline) result += 'm'; if(that.unicode) result += 'u'; if(that.sticky) result += 'y'; return result; }; /***/ }, /* 238 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(25)('asyncIterator'); /***/ }, /* 239 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(25)('observable'); /***/ }, /* 240 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-getownpropertydescriptors var $export = __webpack_require__(6) , ownKeys = __webpack_require__(208) , toIObject = __webpack_require__(30) , gOPD = __webpack_require__(49) , createProperty = __webpack_require__(150); $export($export.S, 'Object', { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){ var O = toIObject(object) , getDesc = gOPD.f , keys = ownKeys(O) , result = {} , i = 0 , key; while(keys.length > i)createProperty(result, key = keys[i++], getDesc(O, key)); return result; } }); /***/ }, /* 241 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(6) , $values = __webpack_require__(242)(false); $export($export.S, 'Object', { values: function values(it){ return $values(it); } }); /***/ }, /* 242 */ /***/ function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(28) , toIObject = __webpack_require__(30) , isEnum = __webpack_require__(42).f; module.exports = function(isEntries){ return function(it){ var O = toIObject(it) , keys = getKeys(O) , length = keys.length , i = 0 , result = [] , key; while(length > i)if(isEnum.call(O, key = keys[i++])){ result.push(isEntries ? [key, O[key]] : O[key]); } return result; }; }; /***/ }, /* 243 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(6) , $entries = __webpack_require__(242)(true); $export($export.S, 'Object', { entries: function entries(it){ return $entries(it); } }); /***/ }, /* 244 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toObject = __webpack_require__(56) , aFunction = __webpack_require__(9) , $defineProperty = __webpack_require__(11); // B.2.2.2 Object.prototype.__defineGetter__(P, getter) __webpack_require__(4) && $export($export.P + __webpack_require__(245), 'Object', { __defineGetter__: function __defineGetter__(P, getter){ $defineProperty.f(toObject(this), P, {get: aFunction(getter), enumerable: true, configurable: true}); } }); /***/ }, /* 245 */ /***/ function(module, exports, __webpack_require__) { // Forced replacement prototype accessors methods module.exports = __webpack_require__(26)|| !__webpack_require__(5)(function(){ var K = Math.random(); // In FF throws only define methods __defineSetter__.call(null, K, function(){ /* empty */}); delete __webpack_require__(2)[K]; }); /***/ }, /* 246 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toObject = __webpack_require__(56) , aFunction = __webpack_require__(9) , $defineProperty = __webpack_require__(11); // B.2.2.3 Object.prototype.__defineSetter__(P, setter) __webpack_require__(4) && $export($export.P + __webpack_require__(245), 'Object', { __defineSetter__: function __defineSetter__(P, setter){ $defineProperty.f(toObject(this), P, {set: aFunction(setter), enumerable: true, configurable: true}); } }); /***/ }, /* 247 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toObject = __webpack_require__(56) , toPrimitive = __webpack_require__(16) , getPrototypeOf = __webpack_require__(57) , getOwnPropertyDescriptor = __webpack_require__(49).f; // B.2.2.4 Object.prototype.__lookupGetter__(P) __webpack_require__(4) && $export($export.P + __webpack_require__(245), 'Object', { __lookupGetter__: function __lookupGetter__(P){ var O = toObject(this) , K = toPrimitive(P, true) , D; do { if(D = getOwnPropertyDescriptor(O, K))return D.get; } while(O = getPrototypeOf(O)); } }); /***/ }, /* 248 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6) , toObject = __webpack_require__(56) , toPrimitive = __webpack_require__(16) , getPrototypeOf = __webpack_require__(57) , getOwnPropertyDescriptor = __webpack_require__(49).f; // B.2.2.5 Object.prototype.__lookupSetter__(P) __webpack_require__(4) && $export($export.P + __webpack_require__(245), 'Object', { __lookupSetter__: function __lookupSetter__(P){ var O = toObject(this) , K = toPrimitive(P, true) , D; do { if(D = getOwnPropertyDescriptor(O, K))return D.set; } while(O = getPrototypeOf(O)); } }); /***/ }, /* 249 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(6); $export($export.P + $export.R, 'Map', {toJSON: __webpack_require__(250)('Map')}); /***/ }, /* 250 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var classof = __webpack_require__(152) , from = __webpack_require__(251); module.exports = function(NAME){ return function toJSON(){ if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic"); return from(this); }; }; /***/ }, /* 251 */ /***/ function(module, exports, __webpack_require__) { var forOf = __webpack_require__(185); module.exports = function(iter, ITERATOR){ var result = []; forOf(iter, false, result.push, result, ITERATOR); return result; }; /***/ }, /* 252 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(6); $export($export.P + $export.R, 'Set', {toJSON: __webpack_require__(250)('Set')}); /***/ }, /* 253 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/ljharb/proposal-global var $export = __webpack_require__(6); $export($export.S, 'System', {global: __webpack_require__(2)}); /***/ }, /* 254 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/ljharb/proposal-is-error var $export = __webpack_require__(6) , cof = __webpack_require__(32); $export($export.S, 'Error', { isError: function isError(it){ return cof(it) === 'Error'; } }); /***/ }, /* 255 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(6); $export($export.S, 'Math', { iaddh: function iaddh(x0, x1, y0, y1){ var $x0 = x0 >>> 0 , $x1 = x1 >>> 0 , $y0 = y0 >>> 0; return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; } }); /***/ }, /* 256 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(6); $export($export.S, 'Math', { isubh: function isubh(x0, x1, y0, y1){ var $x0 = x0 >>> 0 , $x1 = x1 >>> 0 , $y0 = y0 >>> 0; return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; } }); /***/ }, /* 257 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(6); $export($export.S, 'Math', { imulh: function imulh(u, v){ var UINT16 = 0xffff , $u = +u , $v = +v , u0 = $u & UINT16 , v0 = $v & UINT16 , u1 = $u >> 16 , v1 = $v >> 16 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); } }); /***/ }, /* 258 */ /***/ function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(6); $export($export.S, 'Math', { umulh: function umulh(u, v){ var UINT16 = 0xffff , $u = +u , $v = +v , u0 = $u & UINT16 , v0 = $v & UINT16 , u1 = $u >>> 16 , v1 = $v >>> 16 , t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); } }); /***/ }, /* 259 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , toMetaKey = metadata.key , ordinaryDefineOwnMetadata = metadata.set; metadata.exp({defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey){ ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); }}); /***/ }, /* 260 */ /***/ function(module, exports, __webpack_require__) { var Map = __webpack_require__(190) , $export = __webpack_require__(6) , shared = __webpack_require__(21)('metadata') , store = shared.store || (shared.store = new (__webpack_require__(194))); var getOrCreateMetadataMap = function(target, targetKey, create){ var targetMetadata = store.get(target); if(!targetMetadata){ if(!create)return undefined; store.set(target, targetMetadata = new Map); } var keyMetadata = targetMetadata.get(targetKey); if(!keyMetadata){ if(!create)return undefined; targetMetadata.set(targetKey, keyMetadata = new Map); } return keyMetadata; }; var ordinaryHasOwnMetadata = function(MetadataKey, O, P){ var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function(MetadataKey, O, P){ var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function(MetadataKey, MetadataValue, O, P){ getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function(target, targetKey){ var metadataMap = getOrCreateMetadataMap(target, targetKey, false) , keys = []; if(metadataMap)metadataMap.forEach(function(_, key){ keys.push(key); }); return keys; }; var toMetaKey = function(it){ return it === undefined || typeof it == 'symbol' ? it : String(it); }; var exp = function(O){ $export($export.S, 'Reflect', O); }; module.exports = { store: store, map: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, key: toMetaKey, exp: exp }; /***/ }, /* 261 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , toMetaKey = metadata.key , getOrCreateMetadataMap = metadata.map , store = metadata.store; metadata.exp({deleteMetadata: function deleteMetadata(metadataKey, target /*, targetKey */){ var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]) , metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); if(metadataMap === undefined || !metadataMap['delete'](metadataKey))return false; if(metadataMap.size)return true; var targetMetadata = store.get(target); targetMetadata['delete'](targetKey); return !!targetMetadata.size || store['delete'](target); }}); /***/ }, /* 262 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(57) , ordinaryHasOwnMetadata = metadata.has , ordinaryGetOwnMetadata = metadata.get , toMetaKey = metadata.key; var ordinaryGetMetadata = function(MetadataKey, O, P){ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey, O, P); var parent = getPrototypeOf(O); return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; }; metadata.exp({getMetadata: function getMetadata(metadataKey, target /*, targetKey */){ return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 263 */ /***/ function(module, exports, __webpack_require__) { var Set = __webpack_require__(193) , from = __webpack_require__(251) , metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(57) , ordinaryOwnMetadataKeys = metadata.keys , toMetaKey = metadata.key; var ordinaryMetadataKeys = function(O, P){ var oKeys = ordinaryOwnMetadataKeys(O, P) , parent = getPrototypeOf(O); if(parent === null)return oKeys; var pKeys = ordinaryMetadataKeys(parent, P); return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; }; metadata.exp({getMetadataKeys: function getMetadataKeys(target /*, targetKey */){ return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); }}); /***/ }, /* 264 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , ordinaryGetOwnMetadata = metadata.get , toMetaKey = metadata.key; metadata.exp({getOwnMetadata: function getOwnMetadata(metadataKey, target /*, targetKey */){ return ordinaryGetOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 265 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , ordinaryOwnMetadataKeys = metadata.keys , toMetaKey = metadata.key; metadata.exp({getOwnMetadataKeys: function getOwnMetadataKeys(target /*, targetKey */){ return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); }}); /***/ }, /* 266 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , getPrototypeOf = __webpack_require__(57) , ordinaryHasOwnMetadata = metadata.has , toMetaKey = metadata.key; var ordinaryHasMetadata = function(MetadataKey, O, P){ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if(hasOwn)return true; var parent = getPrototypeOf(O); return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; }; metadata.exp({hasMetadata: function hasMetadata(metadataKey, target /*, targetKey */){ return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 267 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , ordinaryHasOwnMetadata = metadata.has , toMetaKey = metadata.key; metadata.exp({hasOwnMetadata: function hasOwnMetadata(metadataKey, target /*, targetKey */){ return ordinaryHasOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); }}); /***/ }, /* 268 */ /***/ function(module, exports, __webpack_require__) { var metadata = __webpack_require__(260) , anObject = __webpack_require__(12) , aFunction = __webpack_require__(9) , toMetaKey = metadata.key , ordinaryDefineOwnMetadata = metadata.set; metadata.exp({metadata: function metadata(metadataKey, metadataValue){ return function decorator(target, targetKey){ ordinaryDefineOwnMetadata( metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey) ); }; }}); /***/ }, /* 269 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask var $export = __webpack_require__(6) , microtask = __webpack_require__(188)() , process = __webpack_require__(2).process , isNode = __webpack_require__(32)(process) == 'process'; $export($export.G, { asap: function asap(fn){ var domain = isNode && process.domain; microtask(domain ? domain.bind(fn) : fn); } }); /***/ }, /* 270 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; // https://github.com/zenparsing/es-observable var $export = __webpack_require__(6) , global = __webpack_require__(2) , core = __webpack_require__(7) , microtask = __webpack_require__(188)() , OBSERVABLE = __webpack_require__(23)('observable') , aFunction = __webpack_require__(9) , anObject = __webpack_require__(12) , anInstance = __webpack_require__(184) , redefineAll = __webpack_require__(189) , hide = __webpack_require__(10) , forOf = __webpack_require__(185) , RETURN = forOf.RETURN; var getMethod = function(fn){ return fn == null ? undefined : aFunction(fn); }; var cleanupSubscription = function(subscription){ var cleanup = subscription._c; if(cleanup){ subscription._c = undefined; cleanup(); } }; var subscriptionClosed = function(subscription){ return subscription._o === undefined; }; var closeSubscription = function(subscription){ if(!subscriptionClosed(subscription)){ subscription._o = undefined; cleanupSubscription(subscription); } }; var Subscription = function(observer, subscriber){ anObject(observer); this._c = undefined; this._o = observer; observer = new SubscriptionObserver(this); try { var cleanup = subscriber(observer) , subscription = cleanup; if(cleanup != null){ if(typeof cleanup.unsubscribe === 'function')cleanup = function(){ subscription.unsubscribe(); }; else aFunction(cleanup); this._c = cleanup; } } catch(e){ observer.error(e); return; } if(subscriptionClosed(this))cleanupSubscription(this); }; Subscription.prototype = redefineAll({}, { unsubscribe: function unsubscribe(){ closeSubscription(this); } }); var SubscriptionObserver = function(subscription){ this._s = subscription; }; SubscriptionObserver.prototype = redefineAll({}, { next: function next(value){ var subscription = this._s; if(!subscriptionClosed(subscription)){ var observer = subscription._o; try { var m = getMethod(observer.next); if(m)return m.call(observer, value); } catch(e){ try { closeSubscription(subscription); } finally { throw e; } } } }, error: function error(value){ var subscription = this._s; if(subscriptionClosed(subscription))throw value; var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.error); if(!m)throw value; value = m.call(observer, value); } catch(e){ try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; }, complete: function complete(value){ var subscription = this._s; if(!subscriptionClosed(subscription)){ var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.complete); value = m ? m.call(observer, value) : undefined; } catch(e){ try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; } } }); var $Observable = function Observable(subscriber){ anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); }; redefineAll($Observable.prototype, { subscribe: function subscribe(observer){ return new Subscription(observer, this._f); }, forEach: function forEach(fn){ var that = this; return new (core.Promise || global.Promise)(function(resolve, reject){ aFunction(fn); var subscription = that.subscribe({ next : function(value){ try { return fn(value); } catch(e){ reject(e); subscription.unsubscribe(); } }, error: reject, complete: resolve }); }); } }); redefineAll($Observable, { from: function from(x){ var C = typeof this === 'function' ? this : $Observable; var method = getMethod(anObject(x)[OBSERVABLE]); if(method){ var observable = anObject(method.call(x)); return observable.constructor === C ? observable : new C(function(observer){ return observable.subscribe(observer); }); } return new C(function(observer){ var done = false; microtask(function(){ if(!done){ try { if(forOf(x, false, function(it){ observer.next(it); if(done)return RETURN; }) === RETURN)return; } catch(e){ if(done)throw e; observer.error(e); return; } observer.complete(); } }); return function(){ done = true; }; }); }, of: function of(){ for(var i = 0, l = arguments.length, items = Array(l); i < l;)items[i] = arguments[i++]; return new (typeof this === 'function' ? this : $Observable)(function(observer){ var done = false; microtask(function(){ if(!done){ for(var i = 0; i < items.length; ++i){ observer.next(items[i]); if(done)return; } observer.complete(); } }); return function(){ done = true; }; }); } }); hide($Observable.prototype, OBSERVABLE, function(){ return this; }); $export($export.G, {Observable: $Observable}); __webpack_require__(182)('Observable'); /***/ }, /* 271 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , $task = __webpack_require__(187); $export($export.G + $export.B, { setImmediate: $task.set, clearImmediate: $task.clear }); /***/ }, /* 272 */ /***/ function(module, exports, __webpack_require__) { __webpack_require__(179); var global = __webpack_require__(2) , hide = __webpack_require__(10) , Iterators = __webpack_require__(130) , TO_STRING_TAG = __webpack_require__(23)('toStringTag'); for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ var NAME = collections[i] , Collection = global[NAME] , proto = Collection && Collection.prototype; if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = Iterators.Array; } /***/ }, /* 273 */ /***/ function(module, exports, __webpack_require__) { // ie9- setTimeout & setInterval additional parameters fix var global = __webpack_require__(2) , $export = __webpack_require__(6) , invoke = __webpack_require__(74) , partial = __webpack_require__(274) , navigator = global.navigator , MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check var wrap = function(set){ return MSIE ? function(fn, time /*, ...args */){ return set(invoke( partial, [].slice.call(arguments, 2), typeof fn == 'function' ? fn : Function(fn) ), time); } : set; }; $export($export.G + $export.B + $export.F * MSIE, { setTimeout: wrap(global.setTimeout), setInterval: wrap(global.setInterval) }); /***/ }, /* 274 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var path = __webpack_require__(275) , invoke = __webpack_require__(74) , aFunction = __webpack_require__(9); module.exports = function(/* ...pargs */){ var fn = aFunction(this) , length = arguments.length , pargs = Array(length) , i = 0 , _ = path._ , holder = false; while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true; return function(/* ...args */){ var that = this , aLen = arguments.length , j = 0, k = 0, args; if(!holder && !aLen)return invoke(fn, pargs, that); args = pargs.slice(); if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++]; while(aLen > k)args.push(arguments[k++]); return invoke(fn, args, that); }; }; /***/ }, /* 275 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(7); /***/ }, /* 276 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var ctx = __webpack_require__(8) , $export = __webpack_require__(6) , createDesc = __webpack_require__(17) , assign = __webpack_require__(67) , create = __webpack_require__(44) , getPrototypeOf = __webpack_require__(57) , getKeys = __webpack_require__(28) , dP = __webpack_require__(11) , keyOf = __webpack_require__(27) , aFunction = __webpack_require__(9) , forOf = __webpack_require__(185) , isIterable = __webpack_require__(277) , $iterCreate = __webpack_require__(131) , step = __webpack_require__(180) , isObject = __webpack_require__(13) , toIObject = __webpack_require__(30) , DESCRIPTORS = __webpack_require__(4) , has = __webpack_require__(3); // 0 -> Dict.forEach // 1 -> Dict.map // 2 -> Dict.filter // 3 -> Dict.some // 4 -> Dict.every // 5 -> Dict.find // 6 -> Dict.findKey // 7 -> Dict.mapPairs var createDictMethod = function(TYPE){ var IS_MAP = TYPE == 1 , IS_EVERY = TYPE == 4; return function(object, callbackfn, that /* = undefined */){ var f = ctx(callbackfn, that, 3) , O = toIObject(object) , result = IS_MAP || TYPE == 7 || TYPE == 2 ? new (typeof this == 'function' ? this : Dict) : undefined , key, val, res; for(key in O)if(has(O, key)){ val = O[key]; res = f(val, key, object); if(TYPE){ if(IS_MAP)result[key] = res; // map else if(res)switch(TYPE){ case 2: result[key] = val; break; // filter case 3: return true; // some case 5: return val; // find case 6: return key; // findKey case 7: result[res[0]] = res[1]; // mapPairs } else if(IS_EVERY)return false; // every } } return TYPE == 3 || IS_EVERY ? IS_EVERY : result; }; }; var findKey = createDictMethod(6); var createDictIter = function(kind){ return function(it){ return new DictIterator(it, kind); }; }; var DictIterator = function(iterated, kind){ this._t = toIObject(iterated); // target this._a = getKeys(iterated); // keys this._i = 0; // next index this._k = kind; // kind }; $iterCreate(DictIterator, 'Dict', function(){ var that = this , O = that._t , keys = that._a , kind = that._k , key; do { if(that._i >= keys.length){ that._t = undefined; return step(1); } } while(!has(O, key = keys[that._i++])); if(kind == 'keys' )return step(0, key); if(kind == 'values')return step(0, O[key]); return step(0, [key, O[key]]); }); function Dict(iterable){ var dict = create(null); if(iterable != undefined){ if(isIterable(iterable)){ forOf(iterable, true, function(key, value){ dict[key] = value; }); } else assign(dict, iterable); } return dict; } Dict.prototype = null; function reduce(object, mapfn, init){ aFunction(mapfn); var O = toIObject(object) , keys = getKeys(O) , length = keys.length , i = 0 , memo, key; if(arguments.length < 3){ if(!length)throw TypeError('Reduce of empty object with no initial value'); memo = O[keys[i++]]; } else memo = Object(init); while(length > i)if(has(O, key = keys[i++])){ memo = mapfn(memo, O[key], key, object); } return memo; } function includes(object, el){ return (el == el ? keyOf(object, el) : findKey(object, function(it){ return it != it; })) !== undefined; } function get(object, key){ if(has(object, key))return object[key]; } function set(object, key, value){ if(DESCRIPTORS && key in Object)dP.f(object, key, createDesc(0, value)); else object[key] = value; return object; } function isDict(it){ return isObject(it) && getPrototypeOf(it) === Dict.prototype; } $export($export.G + $export.F, {Dict: Dict}); $export($export.S, 'Dict', { keys: createDictIter('keys'), values: createDictIter('values'), entries: createDictIter('entries'), forEach: createDictMethod(0), map: createDictMethod(1), filter: createDictMethod(2), some: createDictMethod(3), every: createDictMethod(4), find: createDictMethod(5), findKey: findKey, mapPairs: createDictMethod(7), reduce: reduce, keyOf: keyOf, includes: includes, has: has, get: get, set: set, isDict: isDict }); /***/ }, /* 277 */ /***/ function(module, exports, __webpack_require__) { var classof = __webpack_require__(152) , ITERATOR = __webpack_require__(23)('iterator') , Iterators = __webpack_require__(130); module.exports = __webpack_require__(7).isIterable = function(it){ var O = Object(it); return O[ITERATOR] !== undefined || '@@iterator' in O || Iterators.hasOwnProperty(classof(O)); }; /***/ }, /* 278 */ /***/ function(module, exports, __webpack_require__) { var anObject = __webpack_require__(12) , get = __webpack_require__(151); module.exports = __webpack_require__(7).getIterator = function(it){ var iterFn = get(it); if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); return anObject(iterFn.call(it)); }; /***/ }, /* 279 */ /***/ function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , core = __webpack_require__(7) , $export = __webpack_require__(6) , partial = __webpack_require__(274); // https://esdiscuss.org/topic/promise-returning-delay-function $export($export.G + $export.F, { delay: function delay(time){ return new (core.Promise || global.Promise)(function(resolve){ setTimeout(partial.call(resolve, true), time); }); } }); /***/ }, /* 280 */ /***/ function(module, exports, __webpack_require__) { var path = __webpack_require__(275) , $export = __webpack_require__(6); // Placeholder __webpack_require__(7)._ = path._ = path._ || {}; $export($export.P + $export.F, 'Function', {part: __webpack_require__(274)}); /***/ }, /* 281 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); $export($export.S + $export.F, 'Object', {isObject: __webpack_require__(13)}); /***/ }, /* 282 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6); $export($export.S + $export.F, 'Object', {classof: __webpack_require__(152)}); /***/ }, /* 283 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , define = __webpack_require__(284); $export($export.S + $export.F, 'Object', {define: define}); /***/ }, /* 284 */ /***/ function(module, exports, __webpack_require__) { var dP = __webpack_require__(11) , gOPD = __webpack_require__(49) , ownKeys = __webpack_require__(208) , toIObject = __webpack_require__(30); module.exports = function define(target, mixin){ var keys = ownKeys(toIObject(mixin)) , length = keys.length , i = 0, key; while(length > i)dP.f(target, key = keys[i++], gOPD.f(mixin, key)); return target; }; /***/ }, /* 285 */ /***/ function(module, exports, __webpack_require__) { var $export = __webpack_require__(6) , define = __webpack_require__(284) , create = __webpack_require__(44); $export($export.S + $export.F, 'Object', { make: function(proto, mixin){ return define(create(proto), mixin); } }); /***/ }, /* 286 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(129)(Number, 'Number', function(iterated){ this._l = +iterated; this._i = 0; }, function(){ var i = this._i++ , done = !(i < this._l); return {done: done, value: done ? undefined : i}; }); /***/ }, /* 287 */ /***/ function(module, exports, __webpack_require__) { // https://github.com/benjamingr/RexExp.escape var $export = __webpack_require__(6) , $re = __webpack_require__(288)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); $export($export.S, 'RegExp', {escape: function escape(it){ return $re(it); }}); /***/ }, /* 288 */ /***/ function(module, exports) { module.exports = function(regExp, replace){ var replacer = replace === Object(replace) ? function(part){ return replace[part]; } : replace; return function(it){ return String(it).replace(regExp, replacer); }; }; /***/ }, /* 289 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6); var $re = __webpack_require__(288)(/[&<>"']/g, { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&apos;' }); $export($export.P + $export.F, 'String', {escapeHTML: function escapeHTML(){ return $re(this); }}); /***/ }, /* 290 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var $export = __webpack_require__(6); var $re = __webpack_require__(288)(/&(?:amp|lt|gt|quot|apos);/g, { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&apos;': "'" }); $export($export.P + $export.F, 'String', {unescapeHTML: function unescapeHTML(){ return $re(this); }}); /***/ } /******/ ]); // CommonJS export if(typeof module != 'undefined' && module.exports)module.exports = __e; // RequireJS export else if(typeof define == 'function' && define.amd)define(function(){return __e}); // Export to global object else __g.core = __e; }(1, 1);
client/react/frontpage/components/WaterFallContent.js
uclaradio/uclaradio
// WaterFallContent.js // Displays social media content in a ResponsiveWaterfall import React from 'react'; import Waterfall from './misc/ResponsiveWaterfall'; import isMobile from './misc/isMobile'; import Loader from './Loader'; // styling import './WaterFallContent.scss'; // API urls const SocialMediaURL = '/getSocialMedia'; const getMoreFBPostsURL = '/getMoreFBPosts'; // local vars let waterfall; const WaterFallContent = React.createClass({ getInitialState() { return { socialMediaPosts: [], fetching: true, }; }, componentDidMount() { // Get initial data $.get(SocialMediaURL, result => { this.setState( { fetching: false, paginatedDataInProgress: false, fb_pagination_until: result.fb_pagination_until, }, function() { waterfall = new Waterfall({ minBoxWidth: 250 }); this.appendPosts(result.social_media); window.addEventListener('scroll', this.handleScroll); } ); }); }, componentWillUnmount() { window.removeEventListener('scroll', this.handleScroll); }, // fetch another page of posts, display in waterfall fetchMorePosts() { $.post( getMoreFBPostsURL, { until: this.state.fb_pagination_until, }, result => { this.setState( { fb_pagination_until: result.fb_pagination_until, paginatedDataInProgress: false, }, function() { this.appendPosts(result.social_media); } ); } ); }, // Add post objects from API to waterfall content as DOM elements appendPosts(newPosts) { newPosts.map(el => { const boxHandle = nodeFromPost(el); if (boxHandle) { waterfall.addBox(boxHandle); } }); }, handleScroll(event) { const i = waterfall.getHighestIndex(); if (i > -1) { // get last box of the column const lastBox = Array.prototype.slice.call( waterfall.columns[i].children, -1 )[0]; if (checkSlide(lastBox) && !isMobile.any()) { if (this.state.paginatedDataInProgress == false) { // locking mechanism so scrolling won't cause an infinite amt of requests this.setState({ paginatedDataInProgress: true, }); // request next set of Facebook posts this.fetchMorePosts(); } } } }, mobileLoadMore() { this.setState({ paginatedDataInProgress: true, }); // request next set of Facebook posts this.fetchMorePosts(); }, render() { return ( <div className="WaterFallContent"> {this.state.fetching && <Loader />} <div className="wf-container" /> {isMobile.any() && ( <span> <br /> <center> <button id="load_more" onClick={this.mobileLoadMore}> MORE </button> </center> </span> )} </div> ); }, }); function checkSlide(elem) { if (elem) { const screenHeight = (document.documentElement.scrollTop || document.body.scrollTop) + (document.documentElement.clientHeight || document.body.clientHeight); const elemCenter = elem.offsetTop + elem.offsetHeight / 2; return elemCenter < 1.5 * screenHeight; } } // create new DOM element from a tumblr or facebook post json object function nodeFromPost(post) { const link = post.link || post.post_url; const picture = post.full_picture; const summary = post.summary || post.message || ''; const created = formatDate(post.created_time); const platform = post.platform || 'FB'; return newNode(picture, summary, created, link, platform); } // create new DOM element representing post with provided content function newNode(full_picture, summary, created_time, link, platform) { if (!full_picture && (!summary || summary.includes('http'))) { return null; } const box = document.createElement('div'); box.className = 'wf-box'; const a = document.createElement('a'); a.href = link; a.target = '_blank'; const box_content = document.createElement('div'); box_content.className = 'wf-box-content'; if (full_picture) { const image = document.createElement('img'); image.src = full_picture; box_content.appendChild(image); const overlay = document.createElement('div'); overlay.className = 'overlay'; box_content.appendChild(overlay); } const box_content_text = document.createElement('div'); switch (platform) { case 'FB': box_content_text.className = 'wf-box-content-text'; var box_content_date = document.createElement('div'); box_content_date.className = 'wf-box-content-text-date'; created_time = String(created_time); box_content_date.appendChild(document.createTextNode(created_time)); box_content_text.appendChild(box_content_date); break; case 'TUMBLR': box_content_text.className = 'wf-box-content-blog'; break; } box_content_text.appendChild(document.createTextNode(summary)); summary = String(summary); if (!summary.includes('http') && !summary.includes('undefined')) { box_content.appendChild(box_content_text); } a.appendChild(box_content); box.appendChild(a); return box; } function formatDate(dateString) { let date = String(dateString); date = new Date(date.substring(0, 10)); return `${date.getMonth() + 1}/${date.getDate()}/${date.getYear() + 1900}`; } export default WaterFallContent;
packages/react/components/segmented.js
iamxiaoma/Framework7
import React from 'react'; import Utils from '../utils/utils'; import Mixins from '../utils/mixins'; import __reactComponentSlots from '../runtime-helpers/react-component-slots.js'; import __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js'; class F7Segmented extends React.Component { constructor(props, context) { super(props, context); } render() { const self = this; const props = self.props; const { className, raised, raisedIos, raisedAurora, raisedMd, round, roundIos, roundAurora, roundMd, strong, strongIos, strongMd, strongAurora, id, style, tag } = props; const classNames = Utils.classNames(className, { segmented: true, 'segmented-raised': raised, 'segmented-raised-ios': raisedIos, 'segmented-raised-aurora': raisedAurora, 'segmented-raised-md': raisedMd, 'segmented-round': round, 'segmented-round-ios': roundIos, 'segmented-round-aurora': roundAurora, 'segmented-round-md': roundMd, 'segmented-strong': strong, 'segmented-strong-ios': strongIos, 'segmented-strong-md': strongMd, 'segmented-strong-aurora': strongAurora }, Mixins.colorClasses(props)); const SegmentedTag = tag; return React.createElement(SegmentedTag, { id: id, style: style, className: classNames }, this.slots['default']); } get slots() { return __reactComponentSlots(this.props); } } __reactComponentSetProps(F7Segmented, Object.assign({ id: [String, Number], className: String, style: Object, raised: Boolean, raisedIos: Boolean, raisedMd: Boolean, raisedAurora: Boolean, round: Boolean, roundIos: Boolean, roundMd: Boolean, roundAurora: Boolean, strong: Boolean, strongIos: Boolean, strongMd: Boolean, strongAurora: Boolean, tag: { type: String, default: 'div' } }, Mixins.colorProps)); F7Segmented.displayName = 'f7-segmented'; export default F7Segmented;
app/components/layout/FacebookSocialButton.js
communicode-source/communicode
import React from 'react'; import { OutboundLink } from 'react-ga'; const FacebookSocialButton = () => <OutboundLink eventLabel="Facebook" className="btn btn-social-icon btn-facebook" to="https://facebook.com/communicode.co" target="_blank"> <span className="fa fa-facebook"/> </OutboundLink>; export default FacebookSocialButton;
js/jqwidgets/demos/react/app/validator/defaultfunctionality/app.js
luissancheza/sice
import React from 'react'; import ReactDOM from 'react-dom'; import JqxExpander from '../../../jqwidgets-react/react_jqxexpander.js'; import JqxValidator from '../../../jqwidgets-react/react_jqxvalidator.js'; import JqxInput from '../../../jqwidgets-react/react_jqxinput.js'; import JqxPasswordInput from '../../../jqwidgets-react/react_jqxpasswordinput.js'; import JqxMaskedInput from '../../../jqwidgets-react/react_jqxmaskedinput.js'; import JqxDateTimeInput from '../../../jqwidgets-react/react_jqxdatetimeinput.js'; import JqxCheckBox from '../../../jqwidgets-react/react_jqxcheckbox.js'; import JqxButton from '../../../jqwidgets-react/react_jqxbuttons.js'; class App extends React.Component { componentDidMount() { this.refs.SendButton.on('click', (event) => { this.refs.myValidator.validate(document.getElementById('form')); }); } render () { let rules = [ { input: '.userInput', message: 'Username is required!', action: 'keyup, blur', rule: 'required' }, { input: '.userInput', message: 'Your username must be between 3 and 12 characters!', action: 'keyup, blur', rule: 'length=3,12' }, { input: '.realNameInput', message: 'Real Name is required!', action: 'keyup, blur', rule: 'required' }, { input: '.realNameInput', message: 'Your real name must contain only letters!', action: 'keyup', rule: 'notNumber' }, { input: '.realNameInput', message: 'Your real name must be between 3 and 12 characters!', action: 'keyup', rule: 'length=3,12' }, { input: '.birthInput', message: 'Your birth date must be between 1/1/1900 and 1/1/2014.', action: 'valueChanged', rule: (input, commit) => { let date = this.refs.dateTimeInput.value(); let result = date.getFullYear() >= 1900 && date.getFullYear() <= 2014; return result; } }, { input: '.passwordInput', message: 'Password is required!', action: 'keyup, blur', rule: 'required' }, { input: '.passwordInput', message: 'Your password must be between 4 and 12 characters!', action: 'keyup, blur', rule: 'length=4,12' }, { input: '.passwordConfirmInput', message: 'Password is required!', action: 'keyup, blur', rule: 'required' }, { input: '.passwordConfirmInput', message: 'Passwords doesn\'t match!', action: 'keyup, focus', rule: (input, commit) => { if (this.refs.passwordInput.val() === this.refs.confirmPasswordInput.val()) { return true; } return false; } }, { input: '.emailInput', message: 'E-mail is required!', action: 'keyup, blur', rule: 'required' }, { input: '.emailInput', message: 'Invalid e-mail!', action: 'keyup', rule: 'email' }, { input: '.ssnInput', message: 'Invalid SSN!', action: 'valuechanged, blur', rule: 'ssn' }, { input: '.phoneInput', message: 'Invalid phone number!', action: 'valuechanged, blur', rule: 'phone' }, { input: '.zipInput', message: 'Invalid zip code!', action: 'valuechanged, blur', rule: 'zipCode' }, { input: '.acceptCheckBox', message: 'You have to accept the terms', action: 'change', rule: 'required', position: 'right:170,0' } ] return ( <JqxExpander width={300} showArrow={false} toggleMode={'none'}> <div><h3>Register</h3></div> <div> <JqxValidator ref='myValidator' rules={rules}> <form id='form' action='./'> <table className='register-table'> <tbody> <tr> <td>Username:</td> <td><JqxInput className='userInput text-input'/></td> </tr> <tr> <td>Password:</td> <td><JqxPasswordInput ref='passwordInput' className='passwordInput text-input'/></td> </tr> <tr> <td>Confirm password:</td> <td><JqxPasswordInput ref='confirmPasswordInput' className='passwordConfirmInput text-input'/></td> </tr> <tr> <td>Real name:</td> <td><JqxInput createWidget={{ }} className='realNameInput text-input'/></td> </tr> <tr> <td>Birth date:</td> <td><JqxDateTimeInput ref='dateTimeInput' width={156} height={22} value={new Date(2014, 4, 1)} className='birthInput'/></td> </tr> <tr> <td>E-mail:</td> <td><JqxInput placeHolder={'someone@mail.com'} className='emailInput text-input'/></td> </tr> <tr> <td>SSN:</td> <td><JqxMaskedInput width={156} height={22} mask={'###-##-####'} className='ssnInput'/></td> </tr> <tr> <td>Phone:</td> <td><JqxMaskedInput width={156} height={22} mask={'(###)###-####'} className='phoneInput'/></td> </tr> <tr> <td>Zip code:</td> <td><JqxMaskedInput width={156} height={22} mask={'#####-####'} className='zipInput'/></td> </tr> <tr> <td colSpan='2' style={{ paddingLeft: 80, paddingTop: 10, paddingBottom: 10 }}> <JqxCheckBox width={130} className='acceptCheckBox' value='I accept terms'/> </td> </tr> <tr> <td colSpan='2'> <JqxButton width={60} height={25} ref='SendButton' value='Send' style={{ marginLeft: 8 + 'em' }}/> </td> </tr> </tbody> </table> </form> </JqxValidator> </div> </JqxExpander> ) } } ReactDOM.render(<App />, document.getElementById('app'));
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.js
shrynx/react-super-scripts
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; export default class extends Component { static propTypes = { onReady: PropTypes.func.isRequired, }; users = [ { id: 1, name: '1' }, { id: 2, name: '2' }, { id: 3, name: '3' }, { id: 4, name: '4' }, ]; componentDidMount() { this.props.onReady(); } render() { return ( <div id="feature-class-properties"> {this.users.map(user => <div key={user.id}> {user.name} </div> )} </div> ); } }
packages/benchmarks/cxs/client/index.js
A-gambit/CSS-IN-JS-Benchmarks
import ReactDOM from 'react-dom'; import React from 'react'; import App from 'benchmarks-utils'; import Table from './Table'; import './index.html'; ReactDOM.render(<App table={Table} />, document.getElementById('root'));
votrfront/js/LoginPage.js
fmfi-svt/votr
import React from 'react'; import _ from 'lodash'; import { AboutModal } from './About'; import { Modal, ModalBase } from './layout'; import { AnalyticsMixin, FakeLink } from './router'; var TYPE_NAMES = { 'cosignproxy': 'Cosign (automatické)', 'cosignpassword': 'Cosign (meno a heslo)', 'cosigncookie': 'Cosign (manuálne cookie)', 'plainpassword': 'Meno a heslo', 'demo': 'Demo' }; export class LoginForm extends React.Component { state = { server: Votr.settings.server || 0, type: Votr.settings.type } handleServerChange = (event) => { var server = event.target.value; var newTypes = Votr.settings.servers[server].login_types; var type = _.includes(newTypes, this.state.type) ? this.state.type : null; this.setState({ server, type }); } handleTypeChange = (event) => { this.setState({ type: event.target.value }); } render() { var serverConfig = Votr.settings.servers[this.state.server]; var currentType = this.state.type || serverConfig.login_types[0]; return <form className="login" action="login" method="POST"> {Votr.settings.invalid_session && <p>Vaše prihlásenie vypršalo. Prihláste sa znova.</p>} {Votr.settings.error && <React.Fragment> <p>Prihlásenie sa nepodarilo.</p> <p> {"Technické detaily: "} <code className="login-error"> {_.last(Votr.settings.error.trim("\n").split("\n"))} </code> {" "} <FakeLink onClick={this.props.onOpenError}>Viac detailov...</FakeLink> </p> <p> Ak problém pretrváva, napíšte nám na <a className="text-nowrap" href="mailto:fmfi-svt@googlegroups.com">fmfi-svt@googlegroups.com </a>. </p> <hr /> </React.Fragment>} <input type="hidden" name="destination" value={location.search} /> {Votr.settings.servers.length > 1 ? <p> <label> {"Server: "} <select name="server" value={this.state.server} onChange={this.handleServerChange}> {Votr.settings.servers.map((server, index) => <option key={index} value={index}>{server.title}</option> )} </select> </label> </p> : <input type="hidden" name="server" value="0" /> } {serverConfig.login_types.length > 1 ? <p> <label> {"Typ prihlásenia: "} <select name="type" value={currentType} onChange={this.handleTypeChange}> {serverConfig.login_types.map((type) => <option key={type} value={type}>{TYPE_NAMES[type]}</option> )} </select> </label> </p> : <input type="hidden" name="type" value={currentType} /> } {(currentType == 'cosignpassword' || currentType == 'plainpassword') && <React.Fragment> <p> <label> {"Meno: "} <input name="username" /> </label> </p> <p> <label> {"Heslo: "} <input name="password" type="password" /> </label> </p> </React.Fragment>} {currentType == 'cosigncookie' && <React.Fragment> {/* TODO: Detailed instructions for cosigncookie. */} {serverConfig.ais_cookie && <p> <label> {"Hodnota cookie " + serverConfig.ais_cookie + ": "} <input name="ais_cookie" /> </label> </p>} {serverConfig.rest_cookie && <p> <label> {"Hodnota cookie " + serverConfig.rest_cookie + ": "} <input name="rest_cookie" /> </label> </p>} </React.Fragment>} <button type="submit" className="btn btn-lg btn-primary center-block">Prihlásiť</button> </form>; } } export function LoginErrorModal() { return ( <Modal title="Chyba pri prihlásení"> <pre>{Votr.settings.error}</pre> </Modal> ); } export class LoginPage extends React.Component { state = {} openAbout = () => { this.setState({ modal: 'about' }); } openError = () => { this.setState({ modal: 'error' }); } closeModal = () => { this.setState({ modal: null }); } render() { var content = <div className="login-page"> <div className="navbar navbar-inverse navbar-static-top"> <div className="container-fluid"> <div className="navbar-header"> <a href={Votr.settings.url_root} className="navbar-brand">Votr</a> </div> </div> </div> <div className="login-content"> <p> <strong>Votr</strong> ponúka študentom jednoduchší a pohodlnejší spôsob, ako robiť najčastejšie činnosti zo systému AIS. Zapíšte sa na skúšky, prezrite si vaše hodnotenia a skontrolujte si počet kreditov bez zbytočného klikania. </p> <hr /> <LoginForm onOpenError={this.openError} /> </div> <div className="text-center"> <ul className="list-inline"> <li><FakeLink className="btn btn-link" onClick={this.openAbout}>O aplikácii</FakeLink></li> <li><a className="btn btn-link" href="https://uniba.sk/" target="_blank">Univerzita Komenského</a></li> <li><a className="btn btn-link" href="https://moja.uniba.sk/" target="_blank">IT služby na UK</a></li> </ul> </div> </div>; var modals = { 'about': AboutModal, 'error': LoginErrorModal }; var modalComponent = modals[this.state.modal]; return <React.Fragment> {content} <ModalBase component={modalComponent} onClose={this.closeModal} /> </React.Fragment>; } }
frontend/ellcrysjs/src/components/app.js
ellcrys/cocoon
import 'whatwg-fetch'; import Promise from 'promise-polyfill'; import React, { Component } from 'react'; import Canvas from './canvas/Canvas'; if (!window.Promise) { window.Promise = Promise; } class App extends Component { render() { return ( <Canvas /> ); } } export default App;
frontend/ext/packages/sencha-core/src/util/Collection.js
tlaitinen/receipts
/** * This class manages uniquely keyed objects such as {@link Ext.data.Model records} or * {@link Ext.Component components}. * * ## Keys * * Unlike `Ext.util.MixedCollection` this class can only manage objects whose key can be * extracted from the instance. That is, this class does not support "external" keys. This * makes this class more efficient because it does not need to track keys in parallel with * items. It also means key-to-item lookup will be optimal and never need to perform a * linear search. * * ### Extra Keys * * In some cases items may need to be looked up by multiple property values. To enable this * there is the `extraKeys` config. * * For example, to quickly look up items by their "name" property: * * var collection = new Ext.util.Collection({ * extraKeys: { * byName: 'name' // based on "name" property of each item * } * }); * * ## Ranges * * When methods accept index arguments to indicate a range of items, these are either an * index and a number of items or a "begin" and "end" index. * * In the case of "begin" and "end", the "end" is the first item outside the range. This * definition makes it simple to expression empty ranges because "length = end - begin". * * ### Negative Indices * * When an item index is provided, negative values are treated as offsets from the end of * the collection. In other words the follow are equivalent: * * +---+---+---+---+---+---+ * | | | | | | | * +---+---+---+---+---+---+ * 0 1 2 3 4 5 * -6 -5 -4 -3 -2 -1 * * ## Legacy Classes * * The legacy classes `Ext.util.MixedCollection' and `Ext.util.AbstractMixedCollection` * may be needed if external keys are required, but for all other situations this class * should be used instead. */ Ext.define('Ext.util.Collection', { mixins: [ 'Ext.mixin.Observable' ], requires: [ 'Ext.util.CollectionKey', 'Ext.util.Filter', 'Ext.util.Sorter', 'Ext.util.Grouper' ], uses: [ 'Ext.util.SorterCollection', 'Ext.util.FilterCollection', 'Ext.util.GroupCollection' ], /** * @property {Boolean} isCollection * `true` in this class to identify an object as an instantiated Collection, or subclass * thereof. * @readonly */ isCollection: true, config: { autoFilter: true, autoSort: true, /** * @cfg {Boolean} autoGroup `true` to sort by the grouper * @private */ autoGroup: true, /** * @cfg {Function} decoder * A function that can convert newly added items to a proper type before being * added to this collection. */ decoder: null, /** * @cfg {Object} extraKeys * One or more `Ext.util.CollectionKey' configuration objects or key properties. * Each property of the given object is the name of the `CollectionKey` instance * that is stored on this collection. The value of each property configures the * `CollectionKey` instance. * * var collection = new Ext.util.Collection({ * extraKeys: { * byName: 'name' // based on "name" property of each item * } * }); * * Or equivalently: * * var collection = new Ext.util.Collection({ * extraKeys: { * byName: { * property: 'name' * } * } * }); * * To provide a custom key extraction function instead: * * var collection = new Ext.util.Collection({ * extraKeys: { * byName: { * keyFn: function (item) { * return item.name; * } * } * } * }); * * Or to call a key getter method from each item: * * var collection = new Ext.util.Collection({ * extraKeys: { * byName: { * keyFn: 'getName' * } * } * }); * * To use the above: * * var item = collection.byName.get('somename'); * * **NOTE** Either a `property` or `keyFn` must be be specified to define each * key. * @since 5.0.0 */ extraKeys: null, /** * @cfg {Array/Ext.util.FilterCollection} filters * The collection of {@link Ext.util.Filter Filters} for this collection. At the * time a collection is created `filters` can be specified as a unit. After that * time the normal `setFilters` method can also be given a set of replacement * filters for the collection. * * Individual filters can be specified as an `Ext.util.Filter` instance, a config * object for `Ext.util.Filter` or simply a function that will be wrapped in a * instance with its {@Ext.util.Filter#filterFn filterFn} set. * * For fine grain control of the filters collection, call `getFilters` to return * the `Ext.util.Collection` instance that holds this collection's filters. * * var collection = new Ext.util.Collection(); * var filters = collection.getFilters(); // an Ext.util.FilterCollection * * function legalAge (item) { * return item.age >= 21;; * } * * filters.add(legalAge); * * //... * * filters.remove(legalAge); * * Any changes to the `filters` collection will cause this collection to adjust * its items accordingly (if `autoFilter` is `true`). * @since 5.0.0 */ filters: null, /** * @cfg {Object} grouper * A configuration object for this collection's {@link Ext.util.Grouper grouper}. * * For example, to group items by the first letter of the last name: * * var collection = new Ext.util.Collection({ * grouper: { * groupFn: function (item) { * return item.lastName.substring(0, 1); * } * } * }); */ grouper: null, /** * @cfg {Ext.util.GroupCollection} groups * The collection of to hold each group container. This collection is created and * removed dynamically based on `grouper`. Application code should only need to * call `getGroups` to retrieve the collection and not `setGroups`. */ groups: null, /** * @cfg {String} rootProperty * The root property to use for aggregation, filtering and sorting. By default * this is `null` but when containing things like {@link Ext.data.Model records} * this config would likely be set to "data" so that property names are applied * to the fields of each record. */ rootProperty: null, /** * @cfg {Array/Ext.util.SorterCollection} sorters * Array of {@link Ext.util.Sorter sorters} for this collection. At the time a * collection is created the `sorters` can be specified as a unit. After that time * the normal `setSorters` method can be also be given a set of replacement * sorters. * * Individual sorters can be specified as an `Ext.util.Sorter` instance, a config * object for `Ext.util.Sorter` or simply the name of a property by which to sort. * * An alternative way to extend the sorters is to call the `sort` method and pass * a property or sorter config to add to the sorters. * * For fine grain control of the sorters collection, call `getSorters` to return * the `Ext.util.Collection` instance that holds this collection's sorters. * * var collection = new Ext.util.Collection(); * var sorters = collection.getSorters(); // an Ext.util.SorterCollection * * sorters.add('name'); * * //... * * sorters.remove('name'); * * Any changes to the `sorters` collection will cause this collection to adjust * its items accordingly (if `autoSort` is `true`). * * @since 5.0.0 */ sorters: null, /** * @cfg {Number} [multiSortLimit=3] * The maximum number of sorters which may be applied to this Sortable when using * the "multi" insertion position when adding sorters. * * New sorters added using the "multi" insertion position are inserted at the top * of the sorters list becoming the new primary sort key. * * If the sorters collection has grown to longer then **`multiSortLimit`**, then * the it is trimmed. */ multiSortLimit: 3, /** * cfg {String} defaultSortDirection * The default sort direction to use if one is not specified. */ defaultSortDirection: 'ASC', /** * @cfg {Ext.util.Collection} source * The base `Collection`. This collection contains the items to which filters * are applied to populate this collection. In this configuration, only the * root `source` collection can have items truly added or removed. * @since 5.0.0 */ source: null }, /** * @property {Number} generation * Mutation counter which is incremented when the collection changes. * @readonly * @since 5.0.0 */ generation: 0, /** * @property {Object} indices * An object used as map to get the index of an item. * @private * @since 5.0.0 */ indices: null, /** * @property {Number} indexRebuilds * The number of times the `indices` have been rebuilt. This is for diagnostic use. * @private * @readonly * @since 5.0.0 */ indexRebuilds: 0, /** * @property {Number} updating * A counter that is increased by `beginUpdate` and decreased by `endUpdate`. When * this transitions from 0 to 1 the `{@link #event-beginupdate beginupdate}` event is * fired. When it transitions back from 1 to 0 the `{@link #event-endupdate endupdate}` * event is fired. * @readonly * @since 5.0.0 */ updating: 0, /** * @property {Boolean} grouped * A read-only flag indicating if this object is grouped. * @readonly */ grouped: false, /** * @property {Boolean} sorted * A read-only flag indicating if this object is sorted. This flag may not be correct * during an update of the sorter collection but will be correct before `onSortChange` * is called. This flag is `true` if `grouped` is `true` because the collection is at * least sorted by the `grouper`. * @readonly */ sorted: false, /** * @property {Boolean} filtered * A read-only flag indicating if this object is filtered. * @readonly */ filtered: false, // private priority that is used for endupdate listeners on the filters and sorters. // set to a very high priority so that our processing of these events takes place prior // to user code - data must already be filtered/sorted when the user's handler runs $endUpdatePriority: 1001, /** * @event add * Fires after items have been added to the collection. * * All `{@link #event-add add}` and `{@link #event-remove remove}` events occur between * `{@link #event-beginupdate beginupdate}` and `{@link #event-endupdate endupdate}` * events so it is best to do only the minimal amount of work in response to these * events and move the more expensive side-effects to an `endupdate` listener. * * @param {Ext.util.Collection} collection The collection being modified. * * @param {Object} details An object describing the addition. * * @param {Number} details.at The index in the collection where the add occurred. * * @param {Object} details.atItem The item after which the new items were inserted or * `null` if at the beginning of the collection. * * @param {Object[]} details.items The items that are now added to the collection. * * @param {Array} [details.keys] If available this array holds the keys (extracted by * `getKey`) for each item in the `items` array. * * @param {Object} [details.next] If more `{@link #event-add add}` events are in queue * to be delivered this is a reference to the `details` instance for the next * `{@link #event-add add}` event. This will only be the case when the collection is * sorted as the new items often need to be inserted at multiple locations to maintain * the sort. In this case, all of the new items have already been added not just those * described by the first `{@link #event-add add}` event. * * @param {Object} [details.replaced] If this addition has a corresponding set of * `{@link #event-remove remove}` events this reference holds the `details` object for * the first `remove` event. That `details` object may have a `next` property if there * are multiple associated `remove` events. * * @since 5.0.0 */ /** * @event beginupdate * Fired before changes are made to the collection. This event fires when the * `beginUpdate` method is called and the counter it manages transitions from 0 to 1. * * All `{@link #event-add add}` and `{@link #event-remove remove}` events occur between * `{@link #event-beginupdate beginupdate}` and `{@link #event-endupdate endupdate}` * events so it is best to do only the minimal amount of work in response to these * events and move the more expensive side-effects to an `endupdate` listener. * * @param {Ext.util.Collection} collection The collection being modified. * * @since 5.0.0 */ /** * @event endupdate * Fired after changes are made to the collection. This event fires when the `endUpdate` * method is called and the counter it manages transitions from 1 to 0. * * All `{@link #event-add add}` and `{@link #event-remove remove}` events occur between * `{@link #event-beginupdate beginupdate}` and `{@link #event-endupdate endupdate}` * events so it is best to do only the minimal amount of work in response to these * events and move the more expensive side-effects to an `endupdate` listener. * * @param {Ext.util.Collection} collection The collection being modified. * * @since 5.0.0 */ /** * @event beforeitemchange * This event fires before an item change is reflected in the collection. This event * is always followed by an `itemchange` event and, depending on the change, possibly * an `add`, `remove` and/or `updatekey` event. * * @param {Ext.util.Collection} collection The collection being modified. * * @param {Object} details An object describing the change. * * @param {Object} details.item The item that has changed. * * @param {String} details.key The key of the item that has changed. * * @param {Boolean} details.filterChanged This is `true` if the filter status of the * `item` has changed. That is, the item was previously filtered out and is no longer * or the opposite. * * @param {Boolean} details.keyChanged This is `true` if the item has changed keys. If * so, check `oldKey` for the old key. An `updatekey` event will follow. * * @param {Boolean} details.indexChanged This is `true` if the item needs to move to * a new index in the collection due to sorting. The index can be seen in `index`. * The old index is in `oldIndex`. * * @param {String[]} [details.modified] If known this property holds the array of names * of the modified properties of the item. * * @param {Boolean} [details.filtered] This value is `true` if the item will be filtered * out of the collection. * * @param {Number} [details.index] The new index in the collection for the item if * the item is being moved (see `indexChanged`). If the item is being removed due to * filtering, this will be -1. * * @param {Number} [details.oldIndex] The old index in the collection for the item if * the item is being moved (see `indexChanged`). If the item was being removed due to * filtering, this will be -1. * * @param {Object} [details.oldKey] The old key for the `item` if the item's key has * changed (see `keyChanged`). * * @param {Boolean} [details.wasFiltered] This value is `true` if the item was filtered * out of the collection. * * @since 5.0.0 */ /** * @event itemchange * This event fires after an item change is reflected in the collection. This event * always follows a `beforeitemchange` event and its corresponding `add`, `remove` * and/or `updatekey` events. * * @param {Ext.util.Collection} collection The collection being modified. * * @param {Object} details An object describing the change. * * @param {Object} details.item The item that has changed. * * @param {String} details.key The key of the item that has changed. * * @param {Boolean} details.filterChanged This is `true` if the filter status of the * `item` has changed. That is, the item was previously filtered out and is no longer * or the opposite. * * @param {Object} details.keyChanged This is `true` if the item has changed keys. If * so, check `oldKey` for the old key. An `updatekey` event will have been sent. * * @param {Boolean} details.indexChanged This is `true` if the item was moved to a * new index in the collection due to sorting. The index can be seen in `index`. * The old index is in `oldIndex`. * * @param {String[]} [details.modified] If known this property holds the array of names * of the modified properties of the item. * * @param {Boolean} [details.filtered] This value is `true` if the item is filtered * out of the collection. * * @param {Number} [details.index] The new index in the collection for the item if * the item has been moved (see `indexChanged`). If the item is removed due to * filtering, this will be -1. * * @param {Number} [details.oldIndex] The old index in the collection for the item if * the item has been moved (see `indexChanged`). If the item was being removed due to * filtering, this will be -1. * * @param {Object} [details.oldKey] The old key for the `item` if the item's key has * changed (see `keyChanged`). * * @param {Boolean} [details.wasFiltered] This value is `true` if the item was filtered * out of the collection. * * @since 5.0.0 */ /** * @event refresh * This event fires when the collection has changed entirely. This event is fired in * cases where the collection's filter is updated or the items are sorted. While the * items previously in the collection may remain the same, the order at a minimum has * changed in ways that cannot be simply translated to other events. * * @param {Ext.util.Collection} collection The collection being modified. */ /** * @event remove * Fires after items have been removed from the collection. Some properties of this * object may not be present if calculating them is deemed too expensive. These are * marked as "optional". * * All `{@link #event-add add}` and `{@link #event-remove remove}` events occur between * `{@link #event-beginupdate beginupdate}` and `{@link #event-endupdate endupdate}` * events so it is best to do only the minimal amount of work in response to these * events and move the more expensive side-effects to an `endupdate` listener. * * @param {Ext.util.Collection} collection The collection being modified. * * @param {Object} details An object describing the removal. * * @param {Number} details.at The index in the collection where the removal occurred. * * @param {Object[]} details.items The items that are now removed from the collection. * * @param {Array} [details.keys] If available this array holds the keys (extracted by * `getKey`) for each item in the `items` array. * * @param {Object} [details.map] If available this is a map keyed by the key of each * item in the `items` array. This will often contain all of the items being removed * and not just the items in the range described by this event. The value held in this * map is the item. * * @param {Object} [details.next] If more `{@link #event-remove remove}` events are in * queue to be delivered this is a reference to the `details` instance for the next * remove event. * * @param {Object} [details.replacement] If this removal has a corresponding * `{@link #event-add add}` taking place this reference holds the `details` object for * that `add` event. If the collection is sorted, the new items are pre-sorted but the * `at` property for the `replacement` will **not** be correct. The new items will be * added in one or more chunks at their proper index. * * @since 5.0.0 */ /** * @event sort * This event fires after the contents of the collection have been sorted. * * @param {Ext.util.Collection} collection The collection being sorted. */ /** * @event beforesort * @private * This event fires before the contents of the collection have been sorted. * * @param {Ext.util.Collection} collection The collection being sorted. * @param {Ext.util.Sorter[]} sorters Array of sorters applied to the Collection. */ /** * @event updatekey * Fires after the key for an item has changed. * * @param {Ext.util.Collection} collection The collection being modified. * * @param {Object} details An object describing the update. * * @param {Object} details.item The item whose key has changed. * * @param {Object} details.newKey The new key for the `item`. * * @param {Object} details.oldKey The old key for the `item`. * * @since 5.0.0 */ constructor: function (config) { var me = this; /** * @property {Object[]} items * An array containing the items. * @private * @since 5.0.0 */ me.items = []; /** * @property {Object} map * An object used as a map to find items based on their key. * @private * @since 5.0.0 */ me.map = {}; /** * @property {Number} length * The count of items in the collection. * @readonly * @since 5.0.0 */ me.length = 0; /** * @cfg {Function} [keyFn] * A function to retrieve the key of an item in the collection. If provided, * this replaces the default `getKey` method. The default `getKey` method handles * items that have either an "id" or "_id" property or failing that a `getId` * method to call. * @since 5.0.0 */ if (config && config.keyFn) { me.getKey = config.keyFn; } me.mixins.observable.constructor.call(me, config); }, /** * Destroys this collection. This is only necessary if this collection uses a `source` * collection as that relationship will keep a reference from the `source` to this * collection and potentially leak memory. * @since 5.0.0 */ destroy: function () { var me = this, filters = me._filters, sorters = me._sorters, groups = me._groups; if (filters) { filters.destroy(); me._filters = null; } if (sorters) { sorters.destroy(); me._sorters = null; } if (groups) { groups.destroy(); me._groups = null; } me.setSource(null); me.observers = me.items = me.map = null; }, /** * Adds an item to the collection. If the item already exists or an item with the * same key exists, the old item will be removed and the new item will be added to * the end. * * This method also accepts an array of items or simply multiple items as individual * arguments. The following 3 code sequences have the same end result: * * // Call add() once per item (not optimal - best avoided): * collection.add(itemA); * collection.add(itemB); * collection.add(itemC); * collection.add(itemD); * * // Call add() with each item as an argument: * collection.add(itemA, itemB, itemC, itemD); * * // Call add() with the items as an array: * collection.add([ itemA, itemB, itemC, itemD ]); * * The first form should be avoided where possible because the collection and all * parties "watching" it will be updated 4 times. * * @param {Object/Object[]} item The item or items to add. * @return {Object/Object[]} The item or items added. * @since 5.0.0 */ add: function (item) { var me = this, items = me.decodeItems(arguments, 0), ret = items; if (items.length) { me.requestedIndex = me.length; me.splice(me.length, 0, items); delete me.requestedIndex; ret = (items.length === 1) ? items[0] : items; } return ret; }, /** * Adds an item to the collection while removing any existing items. Similar to {@link #method-add}. * @param {Object/Object[]} item The item or items to add. * @return {Object/Object[]} The item or items added. * @since 5.0.0 */ replaceAll: function() { var me = this, len = me.length, ret, items; if (len === 0) { return me.add.apply(me, arguments); } items = me.decodeItems(arguments, 0); ret = items; if (items.length) { me.splice(0, me.length, items); ret = (items.length === 1) ? items[0] : items; } else { me.removeAll(); } return ret; }, /** * Returns the result of the specified aggregation operation against all items in this * collection. * * This method is not typically called directly because there are convenience methods * for each of the supported `operation` values. These are: * * * **average** - Returns the average value. * * **bounds** - Returns an array of `[min, max]`. * * **max** - Returns the maximum value or `undefined` if empty. * * **min** - Returns the minimum value or `undefined` if empty. * * **sum** - Returns the sum of all values. * * For example: * * result = collection.aggregate('age', 'sum'); * * result = collection.aggregate('age', 'sum', 2, 10); // the 8 items at index 2 * * To provide a custom operation function: * * function averageAgeOfMinors (items, values) { * var sum = 0, * count = 0; * * for (var i = 0; i < values.length; ++i) { * if (values[i] < 18) { * sum += values[i]; * ++count; * } * } * * return count ? sum / count : 0; * } * * result = collection.aggregate('age', averageAgeOfMinors); * * @param {String} property The name of the property to aggregate from each item. * @param {String/Function} operation The operation to perform. * @param {Array} operation.items The items on which the `operation` function is to * operate. * @param {Array} operation.values The values on which the `operation` function is to * operate. * @param {Number} [begin] The index of the first item in `items` to include in the * aggregation. * @param {Number} [end] The index at which to stop aggregating `items`. The item at * this index will *not* be included in the aggregation. * @param {Object} [scope] The `this` pointer to use if `operation` is a function. * Defaults to this collection. * @return {Object} */ aggregate: function (property, operation, begin, end, scope) { var me = this, args = Ext.Array.slice(arguments); args.unshift(me.items); return me.aggregateItems.apply(me, args); }, /** * See {@link #aggregate}. The functionality is the same, however the aggregates are * provided per group. Assumes this collection has an active {@link #grouper}. * * @param {String} property The name of the property to aggregate from each item. * @param {String/Function} operation The operation to perform. * @param {Array} operation.items The items on which the `operation` function is to * operate. * @param {Array} operation.values The values on which the `operation` function is to * operate. * @param {Object} [scope] The `this` pointer to use if `operation` is a function. * Defaults to this collection. * @return {Object} */ aggregateByGroup: function(property, operation, scope) { var groups = this.getGroups(); return this.aggregateGroups(groups, property, operation, scope); }, /** * Returns the result of the specified aggregation operation against the given items. * For details see `aggregate`. * * @param {Array} items The items to aggregate. * @param {String} property The name of the property to aggregate from each item. * @param {String/Function} operation The operation to perform. * @param {Array} operation.items The items on which the `operation` function is to * operate. * @param {Array} operation.values The values on which the `operation` function is to * operate. * @param {Number} [begin] The index of the first item in `items` to include in the * aggregation. * @param {Number} [end] The index at which to stop aggregating `items`. The item at * this index will *not* be included in the aggregation. * @param {Object} [scope] The `this` pointer to use if `operation` is a function. * Defaults to this collection. * * @private * @return {Object} */ aggregateItems: function (items, property, operation, begin, end, scope) { var me = this, range = Ext.Number.clipIndices(items.length, [ begin, end ]), // Only extract items into new array if a subset is required subsetRequested = (begin !== 0 && end !== items.length), i, j, rangeLen, root, value, values, valueItems; begin = range[0]; end = range[1]; if (!Ext.isFunction(operation)) { operation = me._aggregators[operation]; return operation.call(me, items, begin, end, property, me.getRootProperty()); } root = me.getRootProperty(); // Preallocate values array with known set size. // valueItems can be just the items array is a subset has not been requested values = new Array(rangeLen); valueItems = subsetRequested ? new Array(rangeLen) : items; // Collect the extracted property values and the items for passing to the operation. for (i = begin, j = 0; i < end; ++i, j++) { if (subsetRequested) { valueItems[j] = value = items[i]; } values[j] = (root ? value[root] : value)[property]; } return operation.call(scope || me, items, values, 0); }, /** * Aggregates a set of groups. * @param {Ext.util.GroupCollection} groups The groups * @param {String} property The name of the property to aggregate from each item. * @param {String/Function} operation The operation to perform. * @param {Array} operation.values The values on which the `operation` function is to * operate. * @param {Array} operation.items The items on which the `operation` function is to * operate. * @param {Number} operation.index The index in `items` at which the `operation` * function is to start. The `values.length` indicates the number of items involved. * @param {Object} [scope] The `this` pointer to use if `operation` is a function. * Defaults to this collection. * * @return {Object} * @private */ aggregateGroups: function(groups, property, operation, scope) { var items = groups.items, len = items.length, callDirect = !Ext.isFunction(operation), out = {}, i, group, result; for (i = 0; i < len; ++i) { group = items[i]; if (!callDirect) { result = this.aggregateItems(group.items, property, operation, null, null, scope); } else { result = group[operation](property); } out[group.getGroupKey()] = result; } return out; }, /** * This method is called to indicate the start of multiple changes to the collection. * Application code should seldom need to call this method as it is called internally * when needed. If multiple collection changes are needed, consider wrapping them in * an `update` call rather than calling `beginUpdate` directly. * * Internally this method increments a counter that is decremented by `endUpdate`. It * is important, therefore, that if you call `beginUpdate` directly you match that * call with a call to `endUpdate` or you will prevent the collection from updating * properly. * * For example: * * var collection = new Ext.util.Collection(); * * collection.beginUpdate(); * * collection.add(item); * // ... * * collection.insert(index, otherItem); * //... * * collection.endUpdate(); * * @since 5.0.0 */ beginUpdate: function () { if (!this.updating++) { // jshint ignore:line this.notify('beginupdate'); } }, /** * Removes all items from the collection. This is similar to `removeAll` except that * `removeAll` fire events to inform listeners. This means that this method should be * called only when you are sure there are no listeners. * @since 5.0.0 */ clear: function () { var me = this, generation = me.generation, ret = generation ? me.items : [], extraKeys, indexName; if (generation) { me.items = []; me.length = 0; me.map = {}; me.indices = {}; me.generation++; // Clear any extraKey indices associated with this Collection extraKeys = me.getExtraKeys(); if (extraKeys) { for (indexName in extraKeys) { extraKeys[indexName].clear(); } } } return ret; }, /** * Creates a shallow copy of this collection * @return {Ext.util.Collection} * @since 5.0.0 */ clone: function () { var me = this, copy = new me.self(me.initialConfig); copy.add(me.items); return copy; }, /** * Collects unique values of a particular property in this Collection. * @param {String} property The property to collect on * @param {String} root (optional) 'root' property to extract the first argument from. This is used mainly when * summing fields in records, where the fields are all stored inside the 'data' object * @param {Boolean} [allowNull] Pass `true` to include `null`, `undefined` or empty * string values. * @return {Array} The unique values * @since 5.0.0 */ collect: function (property, root, allowNull) { var items = this.items, length = items.length, map = {}, ret = [], i, strValue, value; for (i = 0; i < length; ++i) { value = items[i]; value = (root ? value[root] : value)[property]; strValue = String(value); if ((allowNull || !Ext.isEmpty(value)) && !map[strValue]) { map[strValue] = 1; ret.push(value); } } return ret; }, /** * Returns true if the collection contains the passed Object as an item. * @param {Object} item The Object to look for in the collection. * @return {Boolean} `true` if the collection contains the Object as an item. * @since 5.0.0 */ contains: function (item) { var ret = false, key; if (item != null) { key = this.getKey(item); ret = this.map[key] === item; } return ret; }, /** * Returns true if the collection contains the passed Object as a key. * @param {String} key The key to look for in the collection. * @return {Boolean} True if the collection contains the Object as a key. * @since 5.0.0 */ containsKey: function (key) { return key in this.map; }, /** * Creates a new collection that is a filtered subset of this collection. The filter * passed can be a function, a simple property name and value, an `Ext.util.Filter` * instance, an array of `Ext.util.Filter` instances. * * If the passed filter is a function the second argument is its "scope" (or "this" * pointer). The function should return `true` given each item in the collection if * that item should be included in the filtered collection. * * var people = new Ext.util.Collection(); * * people.add([ * { id: 1, age: 25, name: 'Ed' }, * { id: 2, age: 24, name: 'Tommy' }, * { id: 3, age: 24, name: 'Arne' }, * { id: 4, age: 26, name: 'Aaron' } * ]); * * // Create a collection of people who are older than 24: * var oldPeople = people.createFiltered(function (item) { * return item.age > 24; * }); * * If the passed filter is a `Ext.util.Filter` instance or array of `Ext.util.Filter` * instances the filter(s) are used to produce the filtered collection and there are * no further arguments. * * If the passed filter is a string it is understood as the name of the property by * which to filter. The second argument is the "value" used to compare each item's * property value. This comparison can be further tuned with the `anyMatch` and * `caseSensitive` (optional) arguments. * * // Create a new Collection containing only the items where age == 24 * var middleAged = people.createFiltered('age', 24); * * Alternatively you can apply `filters` to this Collection by calling `setFilters` * or modifying the filter collection returned by `getFilters`. * * @param {Ext.util.Filter[]/String/Function} property A property on your objects, an * array of {@link Ext.util.Filter Filter} objects or a filter function. * * @param {Object} value If `property` is a function, this argument is the "scope" * (or "this" pointer) for the function. Otherwise this is either a `RegExp` to test * property values or the value with which to compare. * * @param {Boolean} [anyMatch=false] True to match any part of the string, not just * the beginning. * * @param {Boolean} [caseSensitive=false] True for case sensitive comparison. * * @param {Boolean} [exactMatch=false] `true` to force exact match (^ and $ characters added to the regex). * * @return {Ext.util.Collection} The new, filtered collection. * * @since 5.0.0 */ createFiltered: function (property, value, anyMatch, caseSensitive, exactMatch) { var me = this, ret = new me.self(me.initialConfig), root = me.getRootProperty(), items = me.items, length, i, filters, fn, scope; if (Ext.isFunction(property)) { fn = property; scope = value; } else { //support for the simple case of filtering by property/value if (Ext.isString(property)) { filters = [ new Ext.util.Filter({ property : property, value : value, root : root, anyMatch : anyMatch, caseSensitive: caseSensitive, exactMatch : exactMatch }) ]; } else if (property instanceof Ext.util.Filter) { filters = [ property ]; property.setRoot(root); } else if (Ext.isArray(property)) { filters = property.slice(0); for (i = 0, length = filters.length; i < length; ++i) { filters[i].setRoot(root); } } // At this point we have an array of zero or more Ext.util.Filter objects to // filter with, so here we construct a function that combines these filters by // ANDing them together and filter by that. fn = Ext.util.Filter.createFilterFn(filters); } scope = scope || me; for (i = 0, length = items.length; i < length; i++) { if (fn.call(scope, items[i])) { ret.add(items[i]); } } return ret; }, /** * Filter by a function. Returns a <i>new</i> collection that has been filtered. * The passed function will be called with each object in the collection. * If the function returns true, the value is included otherwise it is filtered. * @param {Function} fn The function to be called. * @param {Mixed} fn.item The collection item. * @param {String} fn.key The key of collection item. * @param {Object} scope (optional) The scope (<code>this</code> reference) in * which the function is executed. Defaults to this Collection. * @return {Ext.util.Collection} The new filtered collection * @since 5.0.0 * @deprecated */ filterBy: function(fn, scope) { return this.createFiltered(fn, scope); }, /** * Executes the specified function once for every item in the collection. If the value * returned by `fn` is `false` the iteration stops. In all cases, the last value that * `fn` returns is returned by this method. * * @param {Function} fn The function to execute for each item. * @param {Object} fn.item The collection item. * @param {Number} fn.index The index of item. * @param {Number} fn.len Total length of collection. * @param {Object} [scope=this] The scope (`this` reference) in which the function * is executed. Defaults to this collection. * @since 5.0.0 */ each: function (fn, scope) { var items = this.items, len = items.length, i, ret; if (len) { scope = scope || this; items = items.slice(0); // safe for re-entrant calls for (i = 0; i < len; i++) { ret = fn.call(scope, items[i], i, len); if (ret === false) { break; } } } return ret; }, /** * Executes the specified function once for every key in the collection, passing each * key, and its associated item as the first two parameters. If the value returned by * `fn` is `false` the iteration stops. In all cases, the last value that `fn` returns * is returned by this method. * * @param {Function} fn The function to execute for each item. * @param {String} fn.key The key of collection item. * @param {Object} fn.item The collection item. * @param {Number} fn.index The index of item. * @param {Number} fn.len Total length of collection. * @param {Object} [scope=this] The scope (`this` reference) in which the function * is executed. Defaults to this collection. * @since 5.0.0 */ eachKey: function (fn, scope) { var me = this, items = me.items, len = items.length, i, item, key, ret; if (len) { scope = scope || me; items = items.slice(0); // safe for re-entrant calls for (i = 0; i < len; i++) { key = me.getKey(item = items[i]); ret = fn.call(scope, key, item, i, len); if (ret === false) { break; } } } return ret; }, /** * This method is called after modifications are complete on a collection. For details * see `beginUpdate`. * @since 5.0.0 */ endUpdate: function () { if (! --this.updating) { this.notify('endupdate'); } }, /** * Finds the first matching object in this collection by a specific property/value. * * @param {String} property The name of a property on your objects. * @param {String/RegExp} value A string that the property values * should start with or a RegExp to test against the property. * @param {Number} [start=0] The index to start searching at. * @param {Boolean} [startsWith=true] Pass `false` to allow a match start anywhere in * the string. By default the `value` will match only at the start of the string. * @param {Boolean} [endsWith=true] Pass `false` to allow the match to end before the * end of the string. By default the `value` will match only at the end of the string. * @param {Boolean} [ignoreCase=true] Pass `false` to make the `RegExp` case * sensitive (removes the 'i' flag). * @return {Object} The first item in the collection which matches the criteria or * `null` if none was found. * @since 5.0.0 */ find: function (property, value, start, startsWith, endsWith, ignoreCase) { if (Ext.isEmpty(value, false)) { return null; } var regex = Ext.String.createRegex(value, startsWith, endsWith, ignoreCase), root = this.getRootProperty(); return this.findBy(function (item) { return item && regex.test((root ? item[root] : item)[property]); }, null, start); }, /** * Returns the first item in the collection which elicits a true return value from the * passed selection function. * @param {Function} fn The selection function to execute for each item. * @param {Object} fn.item The collection item. * @param {String} fn.key The key of collection item. * @param {Object} [scope=this] The scope (`this` reference) in which the function * is executed. Defaults to this collection. * @param {Number} [start=0] The index at which to start searching. * @return {Object} The first item in the collection which returned true from the selection * function, or null if none was found. * @since 5.0.0 */ findBy: function (fn, scope, start) { var me = this, items = me.items, len = items.length, i, item, key; scope = scope || me; for (i = start || 0; i < len; i++) { key = me.getKey(item = items[i]); if (fn.call(scope, item, key)) { return items[i]; } } return null; }, /** * Finds the index of the first matching object in this collection by a specific * property/value. * * @param {String} property The name of a property on your objects. * @param {String/RegExp} value A string that the property values * should start with or a RegExp to test against the property. * @param {Number} [start=0] The index to start searching at. * @param {Boolean} [startsWith=true] Pass `false` to allow a match start anywhere in * the string. By default the `value` will match only at the start of the string. * @param {Boolean} [endsWith=true] Pass `false` to allow the match to end before the * end of the string. By default the `value` will match only at the end of the string. * @param {Boolean} [ignoreCase=true] Pass `false` to make the `RegExp` case * sensitive (removes the 'i' flag). * @return {Number} The matched index or -1 if not found. * @since 5.0.0 */ findIndex: function (property, value, start, startsWith, endsWith, ignoreCase) { var item = this.find(property, value, start, startsWith, endsWith, ignoreCase); return item ? this.indexOf(item) : -1; }, /** * Find the index of the first matching object in this collection by a function. * If the function returns `true` it is considered a match. * @param {Function} fn The function to be called. * @param {Object} fn.item The collection item. * @param {String} fn.key The key of collection item. * @param {Object} [scope=this] The scope (`this` reference) in which the function * is executed. Defaults to this collection. * @param {Number} [start=0] The index at which to start searching. * @return {Number} The matched index or -1 * @since 5.0.0 */ findIndexBy: function (fn, scope, start) { var item = this.findBy(fn, scope, start); return item ? this.indexOf(item) : -1; }, /** * Returns the first item in the collection. * @param {Boolean} [grouped] `true` to extract the first item in each group. Only applies if * a {@link #grouper} is active in the collection. * @return {Object} The first item in the collection. If the grouped parameter is passed, * see {@link #aggregateByGroup} for information on the return type. * @since 5.0.0 */ first: function (grouped) { var groups = grouped ? this.getGroups() : undefined; return groups ? this.aggregateGroups(groups, null, 'first') : this.items[0]; }, /** * Returns the last item in the collection. * @param {Boolean} [grouped] `true` to extract the first item in each group. Only applies if * a {@link #grouper} is active in the collection. * @return {Object} The last item in the collection. If the grouped parameter is passed, * see {@link #aggregateByGroup} for information on the return type. * @since 5.0.0 */ last: function (grouped) { var groups = grouped ? this.getGroups() : undefined; return groups ? this.aggregateGroups(groups, null, 'last') : this.items[this.length - 1]; }, /** * Returns the item associated with the passed key. * @param {String/Number} key The key of the item. * @return {Object} The item associated with the passed key. * @since 5.0.0 */ get: function (key) { return this.map[key]; }, /** * Returns the item at the specified index. * @param {Number} index The index of the item. * @return {Object} The item at the specified index. * @since 5.0.0 */ getAt: function (index) { return this.items[index]; }, /** * Returns the item associated with the passed key. * @param {String/Number} key The key of the item. * @return {Object} The item associated with the passed key. * @since 5.0.0 */ getByKey: function (key) { return this.map[key]; }, /** * Returns the number of items in the collection. * @return {Number} the number of items in the collection. * @since 5.0.0 */ getCount: function () { return this.length; }, /** * A function which will be called, passing an object belonging to this collection. * The function should return the key by which that object will be indexed. This key * must be unique to this item as only one item with this key will be retained. * * The default implementation looks basically like this (give or take special case * handling of 0): * * function getKey (item) { * return item.id || item._id || item.getId(); * } * * You can provide your own implementation by passing the `keyFn` config. * * For example, to hold items that have a unique "name" property: * * var elementCollection = new Ext.util.Collection({ * keyFn: function (item) { * return item.name; * } * }); * * The collection can have `extraKeys` if items need to be quickly looked up by other * (potentially non-unique) properties. * * @param {Object} item The item. * @return {Object} The key for the passed item. * @since 5.0.0 */ getKey: function (item) { var id = item.id; return (id === 0 || id) ? id : ((id = item._id) === 0 || id) ? id : item.getId(); }, /** * Returns a range of items in this collection * @param {Number} [begin=0] The index of the first item to get. * @param {Number} [end] The ending index. The item at this index is *not* included. * @return {Array} An array of items * @since 5.0.0 */ getRange: function (begin, end) { var items = this.items, length = items.length, range; //<debug> if (begin > end) { Ext.Error.raise('Inverted range passed to Collection.getRange: [' + begin + ',' + end + ']'); } //</debug> if (!length) { range = []; } else { range = Ext.Number.clipIndices(length, [begin, end]); range = items.slice(range[0], range[1]); } return range; }, /** * @method getSource * Returns all unfiltered items in the Collection when the Collection has been * filtered. Returns `null` when the Collection is not filtered. * @return {Ext.util.Collection} items All unfiltered items (or `null` when the * Collection is not filtered) */ /** * Returns an array of values for the specified (sub) property. * * For example, to get an array of "name" properties from a collection of records (of * `Ext.data.Model` objects): * * var names = collection.getValues('name', 'data'); * * @param {String} property The property to collect on * @param {String} [root] 'root' property to extract the first argument from. This is * used mainly when operating on fields in records, where the fields are all stored * inside the 'data' object. * @return {Array} The values. * @param {Number} [start=0] The index of the first item to include. * @param {Number} [end] The index at which to stop getting values. The value of this * item is *not* included. * @return {Object[]} The array of values. * @since 5.0.0 */ getValues: function (property, root, start, end) { var items = this.items, range = Ext.Number.clipIndices(items.length, [start, end]), ret = [], i, value; for (i = range[0], end = range[1]; i < end; ++i) { value = items[i]; value = (root ? value[root] : value)[property]; ret.push(value); } return ret; }, /** * Returns index within the collection of the passed Object. * @param {Object} item The item to find. * @return {Number} The index of the item or -1 if not found. * @since 5.0.0 */ indexOf: function (item) { if (!item) { return -1; } var key = this.getKey(item); return this.indexOfKey(key); }, /** * Returns index within the collection of the passed key. * @param {Object} key The key to find. * @return {Number} The index of the item or -1 if not found. * @since 5.0.0 */ indexOfKey: function (key) { var me = this, indices = me.indices; if (key in me.map) { if (!indices) { indices = me.getIndices(); } return indices[key]; } return -1; }, /** * Inserts one or more items to the collection. The `index` value is the position at * which the first item will be placed. The items starting at that position will be * shifted to make room. * * @param {Number} index The index at which to insert the item(s). * @param {Object/Object[]} item The item or items to add. * @return {Object/Object[]} The item or items added. * @since 5.0.0 */ insert: function (index, item) { var me = this, items = me.decodeItems(arguments, 1), ret = items; if (items.length) { me.requestedIndex = index; me.splice(index, 0, items); delete me.requestedIndex; ret = (items.length === 1) ? items[0] : items; } return ret; }, /** * This method should be called when an item in this collection has been modified. If * the collection is sorted or filtered the result of modifying an item needs to be * reflected in the collection. If the item's key is also being modified, it is best * to pass the `oldKey` to this same call rather than call `updateKey` separately. * * @param {Object} item The item that was modified. * @param {String[]} [modified] The names of the modified properties of the item. * @param {String/Number} [oldKey] Passed if the item's key was also modified. * @since 5.0.0 */ itemChanged: function (item, modified, oldKey, /* private */ meta) { var me = this, keyChanged = oldKey === 0 || !!oldKey, filtered = me.filtered && me.getAutoFilter(), filterChanged = false, itemMovement = 0, items = me.items, last = me.length - 1, sorted = me.sorted && last > 0 && me.getAutoSort(), // one or zero items is not really sorted // CAN be called on an empty Collection // A TreeStore can call afterEdit on a hidden root before // any child nodes exist in the store. source = me.getSource(), toAdd, toRemove = 0, index, itemFiltered = false, newIndex, wasFiltered = false, details, newKey, sortFn; // We are owned, we cannot react, inform owning collection. if (source && !source.updating) { source.itemChanged(item, modified, oldKey, meta); } // Root Collection has been informed. // Change is propagating downward from root. else { newKey = me.getKey(item); if (filtered) { index = me.indexOfKey(keyChanged ? oldKey : newKey); wasFiltered = (index < 0); itemFiltered = me.isItemFiltered(item); filterChanged = (wasFiltered !== itemFiltered); } if (filterChanged) { if (itemFiltered) { toRemove = [ item ]; newIndex = -1; } else { toAdd = [ item ]; newIndex = me.length; // this will be ignored if sorted } } // If sorted, the newIndex must be reported correctly in the beforeitemchange and itemchange events. // Even though splice ignores the parameter and calculates the insertion point else if (sorted && !itemFiltered) { // If we are sorted and there are 2 or more items make sure this item is at // the proper index. if (!filtered) { // If the filter has not changed we may need to move the item but if // there is a filter we have already determined its index. index = me.indexOfKey(keyChanged ? oldKey : newKey); } sortFn = me.getSortFn(); if (index && sortFn(items[index - 1], items[index]) > 0) { // If this item is not the first and the item before it compares as // greater-than then item needs to move left since it is less-than // item[index - 1]. itemMovement = -1; // We have to bound the binarySearch or else the presence of the // out-of-order "item" would break it. newIndex = Ext.Array.binarySearch(items, item, 0, index, sortFn); } else if (index < last && sortFn(items[index], items[index + 1]) > 0) { // If this item is not the last and the item after it compares as // less-than then item needs to move right since it is greater-than // item[index + 1]. itemMovement = 1; // We have to bound the binarySearch or else the presence of the // out-of-order "item" would break it. newIndex = Ext.Array.binarySearch(items, item, index + 1, sortFn); } if (itemMovement) { toAdd = [ item ]; } } // One may be tempted to avoid this notification when none of our three vars // are true, *but* the problem with that is that these three changes we care // about are only what this collection cares about. Child collections or // outside parties still need to know that the item has changed in some way. // We do NOT adjust the newIndex reported here to allow for position *after* the item has been removed // We report the "visual" position at which the item would be inserted as if it were new. details = { item: item, key: newKey, index: newIndex, filterChanged: filterChanged, keyChanged: keyChanged, indexChanged: !!itemMovement, filtered: itemFiltered, oldIndex: index, newIndex: newIndex, wasFiltered: wasFiltered, meta: meta }; if (keyChanged) { details.oldKey = oldKey; } if (modified) { details.modified = modified; } me.beginUpdate(); me.notify('beforeitemchange', [details]); if (keyChanged) { me.updateKey(item, oldKey); } if (toAdd || toRemove) { // In sorted mode (which is the only time we get here), newIndex is // correct but *ignored* by splice since it has to assume that *insert* // index values need to be determined internally. In other words, the // first argument here is both the remove and insert index but in sorted // mode the insert index is calculated by splice. me.splice(newIndex, toRemove, toAdd); } // Ensure that the newIndex always refers to the item the insertion is *before*. // Ensure that the oldIndex always refers to the item the insertion was *before*. // // Before change to "c" to "h": | Before change "i" to "d": // | // +---+---+---+---+---+---+ | +---+---+---+---+---+---+ // | a | c | e | g | i | k | | | a | c | e | g | i | k | // +---+---+---+---+---+---+ | +---+---+---+---+---+---+ // 0 1 2 3 4 5 | 0 1 2 3 4 5 // ^ ^ | ^ ^ // | | | | | // oldIndex newIndex | newIndex oldIndex // | // After change to "c" to "h": | After change "i" to "d": // | // +---+---+---+---+---+---+ | +---+---+---+---+---+---+ // | a | e | g | h | i | k | | | a | c | d | e | g | k | // +---+---+---+---+---+---+ | +---+---+---+---+---+---+ // 0 1 2 3 4 5 | 0 1 2 3 4 5 // ^ ^ | ^ ^ // | | | | | // oldIndex newIndex | newIndex oldIndex // if (itemMovement > 0) { details.newIndex--; } else if (itemMovement < 0) { details.oldIndex++; } // Divergence depending on whether the record if filtered out at this level in a chaining hierarchy. // Child collections of this collection will not care about filtereditemchange because the record is not in them. // Stores however will still need to know because the record *is* in them, just filtered. me.notify(itemFiltered ? 'filtereditemchange' : 'itemchange', [details]); me.endUpdate(); } }, /** * Remove an item from the collection. * @param {Object/Object[]} item The item or items to remove. * @return {Number} The number of items removed. * @since 5.0.0 */ remove: function (item) { var me = this, items = me.decodeRemoveItems(arguments, 0), length = me.length; me.splice(0, items); return length - me.length; }, /** * Remove all items in the collection. * @return {Ext.util.Collection} This object. * @since 5.0.0 */ removeAll: function () { var me = this, length = me.length; if (me.generation && length) { me.splice(0, length); } return me; }, /** * Remove an item from a specified index in the collection. * @param {Number} index The index within the collection of the item to remove. * @param {Number} [count=1] The number of items to remove. * @return {Object/Number} If `count` was 1 and the item was removed, that item is * returned. Otherwise the number of items removed is returned. * @since 5.0.0 */ removeAt: function (index, count) { var me = this, length = me.length, Num = Ext.Number, range = Num.clipIndices(length, [ index, (count === undefined) ? 1 : count ], Num.Clip.COUNT), n = range[0], removeCount = range[1] - n, item = (removeCount === 1) && me.getAt(n), removed; me.splice(n, removeCount); removed = me.length - length; return (item && removed) ? item : removed; }, /** * Removes the item associated with the passed key from the collection. * @param {String} key The key of the item to remove. * @return {Object} Only returned if removing at a specified key. The item removed or * `false` if no item was removed. * @since 5.0.0 */ removeByKey: function (key) { var item = this.getByKey(key); if (!item || !this.remove(item)) { return false; } return item; }, /* * @private * Replace an old entry with a new entry of the same key if the entry existed. * @param {Object} item The item to insert. * @return {Object} inserted The item inserted. */ replace: function(item) { var index = this.indexOf(item); if (index === -1) { this.add(item); } else { this.insert(index, item); } }, /** * This method is basically the same as the JavaScript Array splice method. * * Negative indexes are interpreted starting at the end of the collection. That is, * a value of -1 indicates the last item, or equivalent to `length - 1`. * * @param {Number} index The index at which to add or remove items. * @param {Number/Object[]} toRemove The number of items to remove or an array of the * items to remove. * @param {Object[]} [toAdd] The items to insert at the given `index`. * @since 5.0.0 */ splice: function (index, toRemove, toAdd) { var me = this, autoSort = me.sorted && me.getAutoSort(), map = me.map, items = me.items, length = me.length, removeItems = (toRemove instanceof Array) ? me.decodeRemoveItems(toRemove) : null, isRemoveCount = !removeItems, Num = Ext.Number, range = Num.clipIndices(length, [index, isRemoveCount ? toRemove : 0], Num.Clip.COUNT), begin = range[0], end = range[1], // Determine how many items we might actually remove: removeCount = end - begin, newItems = me.decodeItems(arguments, 2), newCount = newItems ? newItems.length : 0, addItems, newItemsMap, removeMap, insertAt = begin, indices = me.indices || ((newCount || removeItems) ? me.getIndices() : null), adds = null, removes = removeCount ? [begin] : null, newKeys = null, source = me.getSource(), chunk, chunkItems, chunks, i, item, itemIndex, k, key, keys, n, duplicates, sorters; if (source && !source.updating) { // Modifying the content of a child collection has to be translated into a // change of its source. Because the source has all of the items of the child // (but likely at different indices) we can translate "index" and convert a // "removeCount" request into a "removeItems" request. if (isRemoveCount) { removeItems = []; for (i = 0; i < removeCount; ++i) { removeItems.push(items[begin + i]); } } if (begin < length) { // Map index based on the item at that index since that item will be in // the source collection. i = source.indexOf(items[begin]); } else { // Map end of this collection to end of the source collection. i = source.length; } source.splice(i, removeItems, newItems); return me; } // Loop over the newItems because they could already be in the collection or may // be replacing items in the collection that just happen to have the same key. In // this case, those items must be removed as well. Since we need to call getKey // on each newItem to do this we may as well keep those keys for later. if (newCount) { addItems = newItems; newKeys = []; newItemsMap = {}; // If this collection is sorted we will eventually need to sort addItems so // do that now so we can line up the newKeys properly. We optimize for the // case where we have no duplicates. It would be more expensive to do this // in two passes in an attempt to take advantage of removed duplicates. if (autoSort) { // We'll need the sorters later as well sorters = me.getSorters(); if (newCount > 1) { if (!addItems.$cloned) { newItems = addItems = addItems.slice(0); } me.sortData(addItems); } } for (i = 0; i < newCount; ++i) { key = me.getKey(item = newItems[i]); if ((k = newItemsMap[key]) !== undefined) { // Duplicates in the incoming newItems need to be discarded keeping the // last of the duplicates. We add the index of the last duplicate of // this key to the "duplicates" map. (duplicates || (duplicates = {}))[k] = 1; } else { // This item's index is outside the remove range, so we need to remove // some extra stuff. Only the first occurrence of a given key in the // newItems needs this processing. itemIndex = indices[key]; if (itemIndex < begin || end <= itemIndex) { (removes || (removes = [])).push(itemIndex); // might be the first } } newItemsMap[key] = i; // track the last index of this key in newItems newKeys.push(key); // must correspond 1-to-1 with newItems } if (duplicates) { keys = newKeys; addItems = []; newKeys = []; addItems.$cloned = true; for (i = 0; i < newCount; ++i) { if (!duplicates[i]) { item = newItems[i]; addItems.push(item); newKeys.push(keys[i]); } } newCount = addItems.length; } adds = { //at: insertAt, // must fill this in later //next: null, // only set by spliceMerge //replaced: null, // must fill this in later items: addItems, keys: newKeys }; } // If we are given a set of items to remove, map them to their indices. for (i = removeItems ? removeItems.length : 0; i-- > 0; ) { key = me.getKey(removeItems[i]); if ((itemIndex = indices[key]) !== undefined) { // ignore items we don't have (probably due to filtering) (removes || (removes = [])).push(itemIndex); // might be the first remove } } if (!adds && !removes) { return me; } me.beginUpdate(); // Now we that everything we need to remove has its index in the removes array. // We start by sorting the array so we can coalesce the index values into chunks // or ranges. if (removes) { chunk = null; chunks = []; removeMap = {}; if (removes.length > 1) { removes.sort(Ext.Array.numericSortFn); } // Coalesce the index array into chunks of (index, count) pairs for efficient // removal. for (i = 0, n = removes.length; i < n; ++i) { key = me.getKey(item = items[itemIndex = removes[i]]); if (!(key in map)) { continue; } // Avoids 2nd loop of removed items but also means we won't process any // given item twice (in case of duplicates in removeItems). delete map[key]; // Consider chunk = { at: 1, items: [ item1, item2 ] } // // +---+---+---+---+---+---+ // | | x | x | | | | // +---+---+---+---+---+---+ // 0 1 2 3 4 5 // // If we are adding an itemIndex > 3 we need a new chunk. // if (!chunk || itemIndex > (chunk.at + chunkItems.length)) { chunks.push(chunk = { at: itemIndex, items: (chunkItems = []), keys: (keys = []), map: removeMap, next: chunk, replacement: adds }); // Point "replaced" at the last chunk if (adds) { adds.replaced = chunk; } } chunkItems.push(removeMap[key] = item); keys.push(key); if (itemIndex < insertAt) { // If the removal is ahead of the insertion point specified, we need // to move the insertAt backwards. // // Consider the following splice: // // collection.splice(3, 2, [ { id: 'b' } ]); // // +---+---+---+---+---+---+ // | a | b | c | x | y | d | // +---+---+---+---+---+---+ // 0 1 2 3 4 5 // ^ ^ ^ // | \ / // replace remove // // The intent is to replace x and y with the new item at index=3. But // since the new item has the same key as the item at index=1, that // item must be replaced. The resulting collection will be: // // +---+---+---+---+ // | a | c | b | d | // +---+---+---+---+ // 0 1 2 3 // --insertAt; } if (removeCount > 1 && itemIndex === begin) { // To account for the given range to remove we started by putting the // index of the first such item ("begin") in the array. When we find // it in this loop we have to process all of the items and add them // to the current chunk. The following trick allows us to repeat the // loop for each item in the removeCount. // --removeCount; // countdown... removes[i--] = ++begin; // backup and increment begin } } // for (removes) if (adds) { adds.at = insertAt; // we have the correct(ed) insertAt now } // Loop over the chunks in reverse so as to not invalidate index values on // earlier chunks. for (k = chunks.length; k-- > 0; ) { chunk = chunks[k]; i = chunk.at; n = chunk.items.length; if (i + n < length) { // If we are removing the tail of the collection, we can keep the // indices for the rest of the things... otherwise we need to zap it // and fix up later. me.indices = indices = null; } me.length = length -= n; // We can use splice directly. The IE8 bug which Ext.Array works around // only affects *insertion* // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/6e946d03-e09f-4b22-a4dd-cd5e276bf05a/ //Ext.Array.erase(items, i, n); items.splice(i, n); if (indices) { keys = chunk.keys; for (i = 0; i < n; ++i) { delete indices[keys[i]]; } } ++me.generation; me.notify('remove', [ chunk ]); } } // if (removes) if (adds) { if (autoSort && newCount > 1 && length) { me.spliceMerge(addItems, newKeys); } else { if (autoSort) { if (newCount > 1) { // We have multiple addItems but we are empty, so just add at 0 insertAt = 0; me.indices = indices = null; } else { // If we are adding one item we can position it properly now and // avoid a full sort. insertAt = sorters.findInsertionIndex(adds.items[0], items, me.getSortFn()); } } if (insertAt === length) { // appending items.push.apply(items, addItems); // The indices may have been regenerated, so we need to check if they have been // and update them indices = me.indices; if (indices) { for (i = 0; i < newCount; ++i) { indices[newKeys[i]] = insertAt + i; } } } else { // inserting me.indices = null; Ext.Array.insert(items, insertAt, addItems); } for (i = 0; i < newCount; ++i) { map[newKeys[i]] = addItems[i]; } me.length += newCount; adds.at = insertAt; adds.atItem = insertAt === 0 ? null : items[insertAt - 1]; ++me.generation; me.notify('add', [ adds ]); } } // if (adds) me.endUpdate(); return me; }, /** * This method calls the supplied function `fn` between `beginUpdate` and `endUpdate` * calls. * * collection.update(function () { * // Perform multiple collection updates... * * collection.add(item); * // ... * * collection.insert(index, otherItem); * //... * * collection.remove(someItem); * }); * * @param {Function} fn The function to call that will modify this collection. * @param {Ext.util.Collection} fn.collection This collection. * @param {Object} [scope=this] The `this` pointer to use when calling `fn`. * @return {Object} Returns the value returned from `fn` (typically `undefined`). * @since 5.0.0 */ update: function (fn, scope) { var me = this; me.beginUpdate(); try { return fn.call(scope || me, me); } catch (e) { //<debug> Ext.log.error(this.$className + ': Unhandled Exception: ', e.description || e.message); //</debug> throw e; } finally { me.endUpdate(); } }, /** * Change the key for an existing item in the collection. If the old key does not * exist this call does nothing. Even so, it is highly recommended to *avoid* calling * this method for an `item` that is not a member of this collection. * * @param {Object} item The item whose key has changed. The `item` should be a member * of this collection. * @param {String} oldKey The old key for the `item`. * @since 5.0.0 */ updateKey: function (item, oldKey) { var me = this, map = me.map, indices = me.indices, source = me.getSource(), newKey; if (source && !source.updating) { // If we are being told of the key change and the source has the same idea // on keying the item, push the change down instead. source.updateKey(item, oldKey); } else if ((newKey = me.getKey(item)) !== oldKey) { // If the key has changed and "item" is the item mapped to the oldKey and // there is no collision with an item with the newKey, we can proceed. if (map[oldKey] === item && !(newKey in map)) { delete map[oldKey]; // We need to mark ourselves as updating so that observing collections // don't reflect the updateKey back to us (see above check) but this is // not really a normal update cycle so we don't call begin/endUpdate. me.updating++; me.generation++; map[newKey] = item; if (indices) { indices[newKey] = indices[oldKey]; delete indices[oldKey]; } me.notify('updatekey', [{ item: item, newKey: newKey, oldKey: oldKey }]); me.updating--; } //<debug> else { // It may be that the item is (somehow) already in the map using the // newKey or that there is no item in the map with the oldKey. These // are not errors. if (newKey in map && map[newKey] !== item) { // There is a different item in the map with the newKey which is an // error. To properly handle this, add the item instead. Ext.Error.raise('Duplicate newKey "' + newKey + '" for item with oldKey "' + oldKey + '"'); } if (oldKey in map && map[oldKey] !== item) { // There is a different item in the map with the oldKey which is also // an error. Do not call this method for items that are not part of // the collection. Ext.Error.raise('Incorrect oldKey "' + oldKey + '" for item with newKey "' + newKey + '"'); } } //</debug> } }, findInsertIndex: function(item) { var source = this.getSource(), sourceItems = source.items, i = source.indexOf(item) - 1, sourceItem, index; while (i > -1) { sourceItem = sourceItems[i]; index = this.indexOf(sourceItem); if (index > -1) { return index + 1; } --i; } // If we get here we didn't find any item in the parent before us, so insert // at the start return 0; }, //------------------------------------------------------------------------- // Calls from the source Collection: /** * This method is called when items are added to the `source` collection. This is * equivalent to the `{@link #event-add add}` event but is called before the `add` * event is fired. * @param {Ext.util.Collection} source The source collection. * @param {Object} details The `details` of the `{@link #event-add add}` event. * @private * @since 5.0.0 */ onCollectionAdd: function (source, details) { var me = this, atItem = details.atItem, items = details.items, requestedIndex = me.requestedIndex, filtered, index, copy, i, item, n; // No point determining the index if we're sorted if (!me.sorted) { // If we have a requestedIndex, it means the add/insert was on our collection, so try // use that specified index to do the insertion. if (requestedIndex !== undefined) { index = requestedIndex; } else if (atItem) { index = me.indexOf(atItem); if (index === -1) { // We can't find the reference item in our collection, which means it's probably // filtered out, so we need to search for an appropriate index. Pass the first item // and work back to find index = me.findInsertIndex(items[0]); } else { // We also have that item in our collection, we need to insert after it, so increment ++index; } } else { // If there was no atItem, must be at the front of the collection index = 0; } } if (me.getAutoFilter() && me.filtered) { for (i = 0, n = items.length; i < n; ++i) { item = items[i]; if (me.isItemFiltered(item)) { // If we have an item that is filtered out of this collection, we need // to make a copy of the items up to this point. if (!copy) { copy = items.slice(0, i); } if (!filtered) { filtered = []; } filtered.push(item); } else if (copy) { // If we have a copy of the items, we need to put this item in that // copy since it is not being filtered out. copy.push(item); } } } me.splice((index < 0) ? me.length : index, 0, copy || items); if (filtered) { // Private for now. We may want to let any observers know we just // added these items but got filtered out me.notify('filteradd', [filtered]); } }, /** * This method is called when an item is modified in the `source` collection. This is * equivalent to the `{@link #event-beforeitemchange beforeitemchange}` event but is * called before the `beforeitemchange` event is fired. * @param {Ext.util.Collection} source The source collection. * @param {Object} details The `details` of the * `{@link #event-beforeitemchange beforeitemchange}` event. * @private * @since 5.0.0 */ onCollectionBeforeItemChange: function (source, details) { // Drop the next updatekey event this.onCollectionUpdateKey = null; }, /** * This method is called when the `source` collection starts updating. This is * equivalent to the `{@link #event-beginupdate beginupdate}` event but is called * before the `beginupdate` event is fired. * @param {Ext.util.Collection} source The source collection. * @private * @since 5.0.0 */ onCollectionBeginUpdate: function () { this.beginUpdate(); }, /** * This method is called when the `source` collection finishes updating. This is * equivalent to the `{@link #event-endupdate endupdate}` event but is called before * the `endupdate` event is fired. * @param {Ext.util.Collection} source The source collection. * @private * @since 5.0.0 */ onCollectionEndUpdate: function () { this.endUpdate(); }, /** * This method is called when an item is modified in the `source` collection. This is * equivalent to the `{@link #event-itemchange itemchange}` event but is called before * the `itemchange` event is fired. * @param {Ext.util.Collection} source The source collection. * @param {Object} details The `details` of the `{@link #event-itemchange itemchange}` * event. * @private * @since 5.0.0 */ onCollectionItemChange: function (source, details) { // Restore updatekey events delete this.onCollectionUpdateKey; this.itemChanged(details.item, details.modified, details.oldKey, details.meta); }, // If our source collection informs us that a filtered out item has changed, we do not care // We contain only the filtered in items of the source collection. onCollectionFilteredItemChange: null, /** * This method is called when the `source` collection refreshes. This is equivalent to * the `{@link #event-refresh refresh}` event but is called before the `refresh` event * is fired. * @param {Ext.util.Collection} source The source collection. * @private * @since 5.0.0 */ onCollectionRefresh: function (source) { var me = this, map = {}, indices = {}, i, item, items, key, length; items = source.items; items = me.filtered && me.getAutoFilter() ? Ext.Array.filter(items, me.getFilterFn()) : items.slice(0); if (me.sorted) { me.sortData(items); } me.items = items; me.length = length = items.length; me.map = map; me.indices = indices; for (i = 0; i < length; ++i) { key = me.getKey(item = items[i]); map[key] = item; indices[key] = i; } me.notify('refresh'); }, /** * This method is called when items are removed from the `source` collection. This is * equivalent to the `{@link #event-remove remove}` event but is called before the * `remove` event is fired. * @param {Ext.util.Collection} source The source collection. * @param {Object} details The `details` of the `remove` event. * @private * @since 5.0.0 */ onCollectionRemove: function (source, details) { this.splice(0, details.items); }, /** * @method onCollectionSort * This method is called when the `source` collection is sorted. This is equivalent to * the `{@link #event-sort sort}` event but is called before the `sort` event is fired. * @param {Ext.util.Collection} source The source collection. * @private * @since 5.0.0 */ // onCollectionSort: function (source) { // we ignore sorting of the source collection because we prefer our own order. // }, /** * This method is called when key changes in the `source` collection. This is * equivalent to the `updatekey` event but is called before the `updatekey` event is * fired. * @param {Ext.util.Collection} source The source collection. * @param {Object} details The `details` of the `updatekey` event. * @private * @since 5.0.0 */ onCollectionUpdateKey: function (source, details) { this.updateKey(details.item, details.oldKey); }, //------------------------------------------------------------------------- // Private /** * @method average * Averages property values from some or all of the items in this collection. * * @param {String} property The name of the property to average from each item. * @param {Number} [begin] The index of the first item to include in the average. * @param {Number} [end] The index at which to stop averaging `items`. The item at * this index will *not* be included in the average. * @return {Object} The result of averaging the specified property from the indicated * items. * @since 5.0.0 */ /** * @method averageByGroup * See {@link #average}. The result is partitioned by group. * * @param {String} property The name of the property to average from each item. * @return {Object} The result of {@link #average}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method bounds * Determines the minimum and maximum values for the specified property over some or * all of the items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include in the bounds. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included in the bounds. * @return {Array} An array `[min, max]` with the minimum and maximum of the specified * property. * @since 5.0.0 */ /** * @method boundsByGroup * See {@link #bounds}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #bounds}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method count * Determines the number of items in the collection. * * @return {Number} The number of items. * @since 5.0.0 */ /** * @method countByGroup * See {@link #count}. The result is partitioned by group. * * @return {Object} The result of {@link #count}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method extremes * Finds the items with the minimum and maximum for the specified property over some * or all of the items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included. * @return {Array} An array `[minItem, maxItem]` with the items that have the minimum * and maximum of the specified property. * @since 5.0.0 */ /** * @method extremesByGroup * See {@link #extremes}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #extremes}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method max * Determines the maximum value for the specified property over some or all of the * items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include in the maximum. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included in the maximum. * @return {Object} The maximum of the specified property from the indicated items. * @since 5.0.0 */ /** * @method maxByGroup * See {@link #max}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #max}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method maxItem * Finds the item with the maximum value for the specified property over some or all * of the items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include in the maximum. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included in the maximum. * @return {Object} The item with the maximum of the specified property from the * indicated items. * @since 5.0.0 */ /** * @method maxItemByGroup * See {@link #maxItem}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #maxItem}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method min * Determines the minimum value for the specified property over some or all of the * items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include in the minimum. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included in the minimum. * @return {Object} The minimum of the specified property from the indicated items. * @since 5.0.0 */ /** * @method minByGroup * See {@link #min}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #min}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method minItem * Finds the item with the minimum value for the specified property over some or all * of the items in this collection. * * @param {String} property The name of the property from each item. * @param {Number} [begin] The index of the first item to include in the minimum. * @param {Number} [end] The index at which to stop in `items`. The item at this index * will *not* be included in the minimum. * @return {Object} The item with the minimum of the specified property from the * indicated items. * @since 5.0.0 */ /** * @method minItemByGroup * See {@link #minItem}. The result is partitioned by group. * * @param {String} property The name of the property from each item. * @return {Object} The result of {@link #minItem}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ /** * @method sum * Sums property values from some or all of the items in this collection. * * @param {String} property The name of the property to sum from each item. * @param {Number} [begin] The index of the first item to include in the sum. * @param {Number} [end] The index at which to stop summing `items`. The item at this * index will *not* be included in the sum. * @return {Object} The result of summing the specified property from the indicated * items. * @since 5.0.0 */ /** * @method sumByGroup * See {@link #sum}. The result is partitioned by group. * * @param {String} property The name of the property to sum from each item. * @return {Object} The result of {@link #sum}, partitioned by group. See {@link #aggregateByGroup}. * @since 5.0.0 */ _aggregators: { average: function (items, begin, end, property, root) { var n = end - begin; return n && this._aggregators.sum.call(this, items, begin, end, property, root) / n; }, bounds: function (items, begin, end, property, root) { for (var value, max, min, i = begin; i < end; ++i) { value = items[i]; value = (root ? value[root] : value)[property]; // First pass max and min are undefined and since nothing is less than // or greater than undefined we always evaluate these "if" statements as // true to pick up the first value as both max and min. if (!(value < max)) { // jshint ignore:line max = value; } if (!(value > min)) { // jshint ignore:line min = value; } } return [min, max]; }, count: function(items) { return items.length; }, extremes: function (items, begin, end, property, root) { var most = null, least = null, i, item, max, min, value; for (i = begin; i < end; ++i) { item = items[i]; value = (root ? item[root] : item)[property]; // Same trick as "bounds" if (!(value < max)) { // jshint ignore:line max = value; most = item; } if (!(value > min)) { // jshint ignore:line min = value; least = item; } } return [least, most]; }, max: function (items, begin, end, property, root) { var b = this._aggregators.bounds.call(this, items, begin, end, property, root); return b[1]; }, maxItem: function (items, begin, end, property, root) { var b = this._aggregators.extremes.call(this, items, begin, end, property, root); return b[1]; }, min: function (items, begin, end, property, root) { var b = this._aggregators.bounds.call(this, items, begin, end, property, root); return b[0]; }, minItem: function (items, begin, end, property, root) { var b = this._aggregators.extremes.call(this, items, begin, end, property, root); return b[0]; }, sum: function (items, begin, end, property, root) { for (var value, sum = 0, i = begin; i < end; ++i) { value = items[i]; value = (root ? value[root] : value)[property]; sum += value; } return sum; } }, _eventToMethodMap: { add: 'onCollectionAdd', beforeitemchange: 'onCollectionBeforeItemChange', beginupdate: 'onCollectionBeginUpdate', endupdate: 'onCollectionEndUpdate', itemchange: 'onCollectionItemChange', filtereditemchange: 'onCollectionFilteredItemChange', refresh: 'onCollectionRefresh', remove: 'onCollectionRemove', beforesort: 'beforeCollectionSort', sort: 'onCollectionSort', filter: 'onCollectionFilter', filteradd: 'onCollectionFilterAdd', updatekey: 'onCollectionUpdateKey' }, /** * Adds an observing object to this collection. Observers are given first view of all * events that we may fire. For any event an observer may implement a method whose * name starts with "onCollection" to receive the event. The `{@link #event-add add}` * event for example would be passed to `"onCollectionAdd"`. * * The only restriction to observers is that they are not allowed to add or remove * observers from inside these methods. * * @param {Ext.util.Collection} observer The observer instance. * @private * @since 5.0.0 */ addObserver: function (observer) { var me = this, observers = me.observers; if (!observers) { me.observers = observers = []; } //<debug> if (Ext.Array.contains(observers, observer)) { Ext.Error.raise('Observer already added'); } //</debug> observers.push(observer); if (observers.length > 1) { // Allow observers to be inserted with a priority. // For example GroupCollections must react to Collection mutation before views. Ext.Array.sort(observers, me.prioritySortFn); } }, prioritySortFn: function(o1, o2) { var a = o1.observerPriority || 0, b = o2.observerPriority || 0; return a - b; }, applyExtraKeys: function (extraKeys, oldExtraKeys) { var me = this, ret = oldExtraKeys || {}, config, name, value; for (name in extraKeys) { value = extraKeys[name]; if (!value.isCollectionKey) { config = { collection: me }; if (Ext.isString(value)) { config.property = value; } else { config = Ext.apply(config, value); } value = new Ext.util.CollectionKey(config); } else { value.setCollection(me); } ret[name] = me[name] = value; value.name = name; } return ret; }, applyGrouper: function (grouper) { if (grouper) { grouper = this.getSorters().decodeSorter(grouper, 'Ext.util.Grouper'); } return grouper; }, /** * Returns the items array on which to operate. This is called to handle the two * possible forms used by various methods that accept items: * * collection.add(item1, item2, item3); * collection.add([ item1, item2, item3 ]); * * Things get interesting when other arguments are involved: * * collection.insert(index, item1, item2, item3); * collection.insert(index, [ item1, item2, item3 ]); * * As well as below because we have to distinguish the one item from from the array: * * collection.add(item); * collection.insert(index, item); * * @param {Arguments} args The arguments object from the caller. * @param {Number} index The index in `args` (the caller's arguments) of `items`. * @return {Object[]} The array of items on which to operate. * @private * @since 5.0.0 */ decodeItems: function (args, index) { var me = this, ret = (index === undefined) ? args : args[index], cloned, decoder, i; if (!ret || !ret.$cloned) { cloned = args.length > index + 1 || !Ext.isIterable(ret); if (cloned) { ret = Ext.Array.slice(args, index); if (ret.length === 1 && ret[0] === undefined) { ret.length = 0; } } decoder = me.getDecoder(); if (decoder) { if (!cloned) { ret = ret.slice(0); cloned = true; } for (i = ret.length; i-- > 0; ) { if ((ret[i] = decoder.call(me, ret[i])) === false) { ret.splice(i, 1); } } } if (cloned) { ret.$cloned = true; } } return ret; }, /** * Returns the map of key to index for all items in this collection. This method will * lazily populate this map on request. This map is maintained when doing so does not * involve too much overhead. When this threshold is cross, the index map is discarded * and must be rebuilt by calling this method. * * @return {Object} * @private * @since 5.0.0 */ getIndices: function () { var me = this, indices = me.indices, items = me.items, n = items.length, i, key; if (!indices) { me.indices = indices = {}; ++me.indexRebuilds; for (i = 0; i < n; ++i) { key = me.getKey(items[i]); indices[key] = i; } } return indices; }, /** * This method wraps all fired events and gives observers first view of the change. * * @param {String} eventName The name of the event to fire. * @param {Array} [args] The event arguments. This collection instance is inserted at * the front of this array if there is any receiver for the notification. * * @private * @since 5.0.0 */ notify: function (eventName, args) { var me = this, observers = me.observers, methodName = me._eventToMethodMap[eventName], added = 0, index, length, method, observer; args = args || []; if (observers && methodName) { for (index = 0, length = observers.length; index < length; ++index) { method = (observer = observers[index])[methodName]; if (method) { if (!added++) { // jshint ignore:line args.unshift(me); // put this Collection as the first argument } method.apply(observer, args); } } } // During construction, no need to fire an event here if (!me.hasListeners) { return; } if (me.hasListeners[eventName]) { if (!added) { args.unshift(me); // put this Collection as the first argument } me.fireEventArgs(eventName, args); } }, /** * Returns the filter function. * @return {Function} sortFn The sort function. */ getFilterFn: function () { return this.getFilters().getFilterFn(); }, /** * Returns the `Ext.util.FilterCollection`. Unless `autoCreate` is explicitly passed * as `false` this collection will be automatically created if it does not yet exist. * @param [autoCreate=true] Pass `false` to disable auto-creation of the collection. * @return {Ext.util.FilterCollection} The collection of filters. */ getFilters: function (autoCreate) { var ret = this._filters; if (!ret && autoCreate !== false) { ret = new Ext.util.FilterCollection(); this.setFilters(ret); } return ret; }, /** * This method can be used to conveniently test whether an individual item would be * removed due to the current filter. * @param {Object} item The item to test. * @return {Boolean} The value `true` if the item would be "removed" from the * collection due to filters or `false` otherwise. */ isItemFiltered: function (item) { return !this.getFilters().filterFn(item); }, /** * Called after a change of the filter is complete. * * For example: * * onFilterChange: function (filters) { * if (this.filtered) { * // process filters * } else { * // no filters present * } * } * * @template * @method * @param {Ext.util.FilterCollection} filters The filters collection. */ onFilterChange: function (filters) { var me = this, source = me.getSource(), extraKeys, newKeys, key; if (!source) { // In this method, we have changed the filter but since we don't start with // any and we create the source collection as needed that means we are getting // our first filter. extraKeys = me.getExtraKeys() if (extraKeys) { newKeys = {}; for (key in extraKeys) { newKeys[key] = extraKeys[key].clone(me); } } source = new Ext.util.Collection({ keyFn: me.getKey, extraKeys: newKeys, rootProperty: me.getRootProperty() }); if (me.length) { source.add(me.items); } me.setSource(source); me.autoSource = source; } else if (source.length || me.length) { // if both us and the source are empty then we can skip this me.onCollectionRefresh(source); } me.notify('filter'); }, //------------------------------------------------------------------------- // Private applyFilters: function (filters, collection) { if (filters == null || (filters && filters.isFilterCollection)) { return filters; } if (filters) { if (!collection) { collection = this.getFilters(); } collection.splice(0, collection.length, filters); } return collection; }, updateFilters: function (newFilters, oldFilters) { var me = this; if (oldFilters) { // Do not disconnect from owning Filterable because // default options (eg _rootProperty) are read from there. // FilterCollections are detached from the Collection when the owning Store is remoteFilter: true // or the owning store is a TreeStore and only filters new nodes before filling a parent node. oldFilters.un('endupdate', 'onEndUpdateFilters', me); } if (newFilters) { newFilters.on({ endupdate: 'onEndUpdateFilters', scope: me, priority: me.$endUpdatePriority }); newFilters.$filterable = me; } me.onEndUpdateFilters(newFilters); }, onEndUpdateFilters: function (filters) { var me = this, was = me.filtered, is = !!filters && (filters.length > 0); // booleanize filters if (was || is) { me.filtered = is; me.onFilterChange(filters); } }, /** * Returns an up to date sort function. * @return {Function} The sort function. */ getSortFn: function () { return this._sortFn || this.createSortFn(); }, /** * Returns the `Ext.util.SorterCollection`. Unless `autoCreate` is explicitly passed * as `false` this collection will be automatically created if it does not yet exist. * @param [autoCreate=true] Pass `false` to disable auto-creation of the collection. * @return {Ext.util.SorterCollection} The collection of sorters. */ getSorters: function (autoCreate) { var ret = this._sorters; if (!ret && autoCreate !== false) { ret = new Ext.util.SorterCollection(); this.setSorters(ret); } return ret; }, /** * Called after a change of the sort is complete. * * For example: * * onSortChange: function (sorters) { * if (this.sorted) { * // process sorters * } else { * // no sorters present * } * } * * @template * @method * @param {Ext.util.SorterCollection} sorters The sorters collection. */ onSortChange: function () { if (this.sorted) { this.sortItems(); } }, /** * Updates the sorters collection and triggers sorting of this Sortable. * * For example: * * //sort by a single field * myStore.sort('myField', 'DESC'); * * //sorting by multiple fields * myStore.sort([{ * property : 'age', * direction: 'ASC' * }, { * property : 'name', * direction: 'DESC' * }]); * * When passing a single string argument to sort, the `direction` is maintained for * each field and is toggled automatically. So this code: * * store.sort('myField'); * store.sort('myField'); * * Is equivalent to the following: * * store.sort('myField', 'ASC'); * store.sort('myField', 'DESC'); * * @param {String/Function/Ext.util.Sorter[]} [property] Either the name of a property * (such as a field of a `Ext.data.Model` in a `Store`), an array of configurations * for `Ext.util.Sorter` instances or just a comparison function. * @param {String} [direction] The direction by which to sort the data. This parameter * is only valid when `property` is a String, otherwise the second parameter is the * `mode`. * @param {String} [mode="replace"] Where to put new sorters in the collection. This * should be one the following values: * * * `**replace**` : The new sorter(s) become the sole sorter set for this Sortable. * This is the most useful call mode to programmatically sort by multiple fields. * * * `**prepend**` : The new sorters are inserted as the primary sorters. The sorter * collection length must be controlled by the developer. * * * `**multi**` : Similar to `**prepend**` the new sorters are inserted at the front * of the collection of sorters. Following the insertion, however, this mode trims * the sorter collection to enforce the `multiSortLimit` config. This is useful for * implementing intuitive "Sort by this" user interfaces. * * * `**append**` : The new sorters are added at the end of the collection. * @return {Ext.util.Collection} This instance. */ sort: function (property, direction, mode) { var sorters = this.getSorters(); sorters.addSort.apply(sorters, arguments); return this; }, /** * This method will sort an array based on the currently configured {@link #sorters}. * @param {Array} data The array you want to have sorted. * @return {Array} The array you passed after it is sorted. */ sortData: function (data) { Ext.Array.sort(data, this.getSortFn()); return data; }, /** * Sorts the items of the collection using the supplied function. This should only be * called for collections that have no `sorters` defined. * @param {Function} sortFn The function by which to sort the items. * @since 5.0.0 */ sortItems: function (sortFn) { var me = this; if (me.sorted) { //<debug> if (sortFn) { Ext.Error.raise('Collections with sorters cannot resorted'); } //</debug> sortFn = me.getSortFn(); } me.indices = null; me.notify('beforesort', [me.getSorters(false)]); if (me.length) { Ext.Array.sort(me.items, sortFn); } // Even if there's no data, notify interested parties. // Eg: Stores must react and fire their refresh and sort events. me.notify('sort'); }, /** * Sorts the collection by a single sorter function * @param {Function} sorterFn The function to sort by * @deprecated */ sortBy: function(sortFn) { return this.sortItems(sortFn); }, //------------------------------------------------------------------------- // Private // Can be called to find the insertion index of a passed object in this collection. // Or can be passed an items array to search in, and may be passed a comparator findInsertionIndex: function(item, items, comparatorFn) { if (!items) { items = this.items; } if (!comparatorFn) { comparatorFn = this.getSortFn(); } return Ext.Array.binarySearch(items, item, comparatorFn); }, applySorters: function (sorters, collection) { if (sorters == null || (sorters && sorters.isSorterCollection)) { return sorters; } if (sorters) { if (!collection) { collection = this.getSorters(); } collection.splice(0, collection.length, sorters); } return collection; }, createSortFn: function () { var me = this, grouper = me.getGrouper(), sorters = me.getSorters(false), sorterFn = sorters ? sorters.getSortFn() : null; if (!grouper) { return sorterFn; } return function (lhs, rhs) { var ret = grouper.sort(lhs, rhs); if (!ret && sorterFn) { ret = sorterFn(lhs, rhs); } return ret; }; }, updateGrouper: function (grouper) { var me = this, groups = me.getGroups(), sorters = me.getSorters(), populate; me.onSorterChange(); me.grouped = !!grouper; if (grouper) { if (!groups) { groups = new Ext.util.GroupCollection({ itemRoot: me.getRootProperty() }); groups.$groupable = me; me.setGroups(groups); } groups.setGrouper(grouper); populate = true; } else { if (groups) { me.removeObserver(groups); groups.destroy(); } me.setGroups(null); } if (!sorters.updating) { me.onEndUpdateSorters(sorters); } if (populate) { groups.onCollectionRefresh(me); } }, updateSorters: function (newSorters, oldSorters) { var me = this; if (oldSorters) { // Do not disconnect from owning Filterable because // default options (eg _rootProperty) are read from there. // SorterCollections are detached from the Collection when the owning Store is remoteSort: true // or the owning store is a TreeStore and only sorts new nodes before filling a parent node. oldSorters.un('endupdate', 'onEndUpdateSorters', me); } if (newSorters) { newSorters.on({ endupdate: 'onEndUpdateSorters', scope: me, priority: me.$endUpdatePriority }); newSorters.$sortable = me; } me.onSorterChange(); me.onEndUpdateSorters(newSorters); }, onSorterChange: function() { this._sortFn = null; }, onEndUpdateSorters: function (sorters) { var me = this, was = me.sorted, is = (me.grouped && me.getAutoGroup()) || (sorters && sorters.length > 0); if (was || is) { // ensure flag property is a boolean. // sorters && (sorters.length > 0) may evaluate to null me.sorted = !!is; me.onSortChange(sorters); } }, /** * Removes an observing object to this collection. See `addObserver` for details. * * @param {Ext.util.Collection} observer The observer instance. * @private * @since 5.0.0 */ removeObserver: function (observer) { var observers = this.observers; if (observers) { Ext.Array.remove(observers, observer); } }, /** * This method is what you might find in the core of a merge sort. We have an items * array that is sorted so we sort the newItems and merge the two sorted arrays. In * the general case, newItems will be no larger than all items so sorting it will be * faster than simply concatenating the arrays and calling sort on it. * * We take advantage of the nature of this process to generate add events as ranges. * * @param {Object[]} newItems * @private * @since 5.0.0 */ spliceMerge: function (newItems, newKeys) { var me = this, map = me.map, newLength = newItems.length, oldIndex = 0, oldItems = me.items, oldLength = oldItems.length, adds = [], count = 0, items = [], sortFn = me.getSortFn(), // account for grouper and sorter(s) addItems, end, i, newItem, oldItem, newIndex; me.items = items; // // oldItems // +----+----+----+----+ // | 15 | 25 | 35 | 45 | // +----+----+----+----+ // 0 1 2 3 // // newItems // +----+----+----+----+----+----+ // | 10 | 11 | 20 | 21 | 50 | 51 | // +----+----+----+----+----+----+ // 0 1 2 3 4 5 // for (newIndex = 0; newIndex < newLength; newIndex = end) { newItem = newItems[newIndex]; // Flush out any oldItems that are <= newItem for ( ; oldIndex < oldLength; ++oldIndex) { // Consider above arrays... // at newIndex == 0 this loop sets oldItem but breaks immediately // at newIndex == 2 this loop pushes 15 and breaks w/oldIndex=1 // at newIndex == 4 this loop pushes 25, 35 and 45 and breaks w/oldIndex=4 if (sortFn(newItem, oldItem = oldItems[oldIndex]) < 0) { break; } items.push(oldItem); } if (oldIndex === oldLength) { // Consider above arrays... // at newIndex == 0 we won't come in here (oldIndex == 0) // at newIndex == 2 we won't come in here (oldIndex == 1) // at newIndex == 4 we come here (oldIndex == 4), push 50 & 51 and break adds[count++] = { at: items.length, itemAt: items[items.length - 1], items: (addItems = []) }; if (count > 1) { adds[count - 2].next = adds[count - 1]; } for (; newIndex < newLength; ++newIndex) { addItems.push(newItem = newItems[newIndex]); items.push(newItem); } break; } // else oldItem is the item from oldItems that is > newItem // Consider above arrays... // at newIndex == 0 we will push 10 // at newIndex == 2 we will push 20 adds[count++] = { at: items.length, itemAt: items[items.length - 1], items: (addItems = [ newItem ]) }; if (count > 1) { adds[count - 2].next = adds[count - 1]; } items.push(newItem); for (end = newIndex + 1; end < newLength; ++end) { // Consider above arrays... // at newIndex == 0 this loop pushes 11 then breaks w/end == 2 // at newIndex == 2 this loop pushes 21 the breaks w/end == 4 if (sortFn(newItem = newItems[end], oldItem) >= 0) { break; } items.push(newItem); addItems.push(newItem); } // if oldItems had 55 as its final element, the above loop would have pushed // all of newItems so the outer for loop would then fall out } for (; oldIndex < oldLength; ++oldIndex) { // In the above example, we won't come in here, but if you imagine a 55 in // oldItems we would have oldIndex == 4 and oldLength == 5 items.push(oldItems[oldIndex]); } for (i = 0; i < newLength; ++i) { map[newKeys[i]] = newItems[i]; } me.length = items.length; ++me.generation; me.indices = null; // Tell users of the adds in increasing index order. for (i = 0; i < count; ++i) { me.notify('add', [ adds[i] ]); } }, getGroups: function() { return this.callParent() || null; }, updateAutoGroup: function(autoGroup) { var groups = this.getGroups(); if (groups) { groups.setAutoGroup(autoGroup); } // Important to call this so it can clear the .sorted flag // as needed this.onEndUpdateSorters(this._sorters); }, updateGroups: function (newGroups, oldGroups) { if (oldGroups) { this.removeObserver(oldGroups); } if (newGroups) { this.addObserver(newGroups); } }, updateSource: function (newSource, oldSource) { var auto = this.autoSource; if (oldSource) { oldSource.removeObserver(this); if (oldSource === auto) { auto.destroy(); this.autoSource = null; } } if (newSource) { newSource.addObserver(this); if (newSource.length || this.length) { this.onCollectionRefresh(newSource); } } } }, function () { var prototype = this.prototype; // Minor compat method prototype.removeAtKey = prototype.removeByKey; /** * This method is an alias for `decodeItems` but is called when items are being * removed. If a `decoder` is provided it may be necessary to also override this * method to achieve symmetry between adding and removing items. This is the case * for `Ext.util.FilterCollection' and `Ext.util.SorterCollection' for example. * * @method decodeRemoveItems * @protected * @since 5.0.0 */ prototype.decodeRemoveItems = prototype.decodeItems; Ext.Object.each(prototype._aggregators, function (name) { prototype[name] = function (property, begin, end) { return this.aggregate(property, name, begin, end); }; prototype[name + 'ByGroup'] = function(property) { return this.aggregateByGroup(property, name); }; }); });
src/svg-icons/social/mood.js
manchesergit/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let SocialMood = (props) => ( <SvgIcon {...props}> <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/> </SvgIcon> ); SocialMood = pure(SocialMood); SocialMood.displayName = 'SocialMood'; SocialMood.muiName = 'SvgIcon'; export default SocialMood;
src/parser/deathknight/unholy/modules/features/ScourgeStrikeEfficiency.js
FaideWW/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS'; import SpellIcon from 'common/SpellIcon'; import SpellLink from 'common/SpellLink'; import { formatPercentage } from 'common/format'; import Analyzer from 'parser/core/Analyzer'; import Enemies from 'parser/shared/modules/Enemies'; import StatisticBox, { STATISTIC_ORDER } from 'interface/others/StatisticBox'; import { encodeTargetString } from 'parser/shared/modules/EnemyInstances'; class ScourgeStrikeEfficiency extends Analyzer { static dependencies = { enemies: Enemies, }; constructor(...args) { super(...args); this.active = !this.selectedCombatant.hasTalent(SPELLS.CLAWING_SHADOWS_TALENT.id); } // used to track how many stacks a target has targets = {}; totalScourgeStrikeCasts = 0; scourgeStrikeCastsZeroWounds = 0; on_byPlayer_applydebuffstack(event){ const spellId = event.ability.guid; if(spellId === SPELLS.FESTERING_WOUND.id){ this.targets[encodeTargetString(event.targetID, event.targetInstance)] = event.stack; } } on_byPlayer_removedebuffstack(event){ const spellId = event.ability.guid; if(spellId === SPELLS.FESTERING_WOUND.id){ this.targets[encodeTargetString(event.targetID, event.targetInstance)] = event.stack; } } on_byPlayer_removedebuff(event){ const spellId = event.ability.guid; if(spellId === SPELLS.FESTERING_WOUND.id){ this.targets[encodeTargetString(event.targetID, event.targetInstance)] = 0; } } on_byPlayer_cast(event){ const spellId = event.ability.guid; if(spellId === SPELLS.SCOURGE_STRIKE.id){ this.totalScourgeStrikeCasts++; if(this.targets.hasOwnProperty(encodeTargetString(event.targetID, event.targetInstance))) { const currentTargetWounds = this.targets[encodeTargetString(event.targetID, event.targetInstance)]; if(currentTargetWounds < 1){ this.scourgeStrikeCastsZeroWounds++; } } else { this.scourgeStrikeCastsZeroWounds++; } } } suggestions(when) { const percentCastZeroWounds = this.scourgeStrikeCastsZeroWounds/this.totalScourgeStrikeCasts; const strikeEfficiency = 1 - percentCastZeroWounds; when(strikeEfficiency).isLessThan(0.90) .addSuggestion((suggest, actual, recommended) => { return suggest(<span>You are casting <SpellLink id={SPELLS.SCOURGE_STRIKE.id} /> too often. When spending runes remember to cast <SpellLink id={SPELLS.FESTERING_STRIKE.id} /> instead on targets with no stacks of <SpellLink id={SPELLS.FESTERING_WOUND.id} /></span>) .icon(SPELLS.SCOURGE_STRIKE.icon) .actual(`${formatPercentage(actual)}% of Scourge Strikes were used with Wounds on the target`) .recommended(`>${formatPercentage(recommended)}% is recommended`) .regular(recommended - 0.10).major(recommended - 0.20); }); } statistic() { const percentCastZeroWounds = this.scourgeStrikeCastsZeroWounds/this.totalScourgeStrikeCasts; const strikeEfficiency = 1 - percentCastZeroWounds; return ( <StatisticBox icon={<SpellIcon id={SPELLS.SCOURGE_STRIKE.id} />} value={`${formatPercentage(strikeEfficiency)} %`} label="Scourge Strike Efficiency" tooltip={`${this.scourgeStrikeCastsZeroWounds} out of ${this.totalScourgeStrikeCasts} Scourge Strikes were used with no Festering Wounds on the target.`} /> ); } statisticOrder = STATISTIC_ORDER.CORE(3); } export default ScourgeStrikeEfficiency;
src/svg-icons/device/battery-std.js
spiermar/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBatteryStd = (props) => ( <SvgIcon {...props}> <path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4z"/> </SvgIcon> ); DeviceBatteryStd = pure(DeviceBatteryStd); DeviceBatteryStd.displayName = 'DeviceBatteryStd'; DeviceBatteryStd.muiName = 'SvgIcon'; export default DeviceBatteryStd;
20200300-js-spa-react-node-sql/client/src/components/MenuNavbar.js
DamienFremont/blog
import React from 'react'; import { Navbar, Button, NavbarBrand, } from 'reactstrap'; import avatar from 'avatar.png'; import { FormattedMessage } from 'react-intl'; import { isLogin } from 'helpers/auth'; import { Link } from 'react-router-dom'; const MenuNavbar = (props) => { const renderPublicBar = () => ( <span> <Button color="light" className="mr-1" tag={Link} to="/login"> <FormattedMessage id="MenuNavbar.signin" /> </Button> <Button color="primary" className="mr-1" tag={Link} to="/signup"> <FormattedMessage id="MenuNavbar.signup" /> </Button> </span> ); const renderUserBar = () => ( <Button color="secondary" tag={Link} to="/profile"> <img src={avatar} width="30" height="30" className="d-inline-block align-top" alt="" /> </Button> ); return ( <div> <Navbar> <NavbarBrand className="mr-auto"></NavbarBrand> {isLogin() ? renderUserBar() : renderPublicBar() } </Navbar> </div> ); } export default MenuNavbar;
vendor/humanmade/coding-standards/node_modules/eslint-plugin-react/lib/rules/wrap-multilines.js
humanmade/hm-coffee-break
/** * @fileoverview Prevent missing parentheses around multilines JSX * @author Yannick Croissant * @deprecated */ 'use strict'; // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ var util = require('util'); var jsxWrapMultilines = require('./jsx-wrap-multilines'); var isWarnedForDeprecation = false; module.exports = { meta: { docs: { description: 'Prevent missing parentheses around multilines JSX', category: 'Stylistic Issues', recommended: false }, fixable: 'code', schema: [{ type: 'object', properties: { declaration: { type: 'boolean' }, assignment: { type: 'boolean' }, return: { type: 'boolean' } }, additionalProperties: false }] }, create: function(context) { return util._extend(jsxWrapMultilines.create(context), { Program: function() { if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { return; } /* eslint-disable no-console */ console.log('The react/wrap-multilines rule is deprecated. Please ' + 'use the react/jsx-wrap-multilines rule instead.'); /* eslint-enable no-console */ isWarnedForDeprecation = true; } }); } };
src/server/frontend/Html.react.js
cmsbl/cmsbl-backup
import React, { Component, PropTypes } from 'react'; export default class Html extends Component { static propTypes = { appCssFilename: PropTypes.string, bodyHtml: PropTypes.string.isRequired, googleAnalyticsId: PropTypes.string.isRequired, helmet: PropTypes.object.isRequired, isProduction: PropTypes.bool.isRequired, }; render() { const { appCssFilename, bodyHtml, googleAnalyticsId, isProduction, helmet } = this.props; const linkStyles = appCssFilename && <link href={appCssFilename} rel="stylesheet" />; const analytics = isProduction && googleAnalyticsId !== 'UA-XXXXXXX-X' && <script dangerouslySetInnerHTML={{ __html: ` (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '${googleAnalyticsId}', 'auto'); ga('send', 'pageview');` }} />; return ( <html lang="en"> <head> <meta charSet="utf-8" /> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport" /> <meta content="ie=edge" httpEquiv="x-ua-compatible" /> {helmet.title.toComponent()} {helmet.base.toComponent()} {helmet.meta.toComponent()} {helmet.link.toComponent()} {helmet.script.toComponent()} {linkStyles} {analytics} </head> <body dangerouslySetInnerHTML={{ __html: bodyHtml }} /> </html> ); } }
implementaciones/custom_native_openerp_module/web/static/lib/jquery/jquery-1.8.3.js
eneldoserrata/marcos_openerp
/*! * jQuery JavaScript Library v1.8.3 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) */ (function( window, undefined ) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, navigator = window.navigator, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Save a reference to some core methods core_push = Array.prototype.push, core_slice = Array.prototype.slice, core_indexOf = Array.prototype.indexOf, core_toString = Object.prototype.toString, core_hasOwn = Object.prototype.hasOwnProperty, core_trim = String.prototype.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Used for matching numbers core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // The ready event handler and self cleanup method DOMContentLoaded = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); } else if ( document.readyState === "complete" ) { // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = ( context && context.nodeType ? context.ownerDocument || context : document ); // scripts is true for back-compat selector = jQuery.parseHTML( match[1], doc, true ); if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { this.attr.call( selector, context, true ); } return jQuery.merge( this, selector ); // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.8.3", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return core_slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( core_slice.apply( this, arguments ), "slice", core_slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ core_toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // scripts (optional): If true, will include scripts passed in the html string parseHTML: function( data, context, scripts ) { var parsed; if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { scripts = context; context = 0; } context = context || document; // Single tag if ( (parsed = rsingleTag.exec( data )) ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); return jQuery.merge( [], (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); }, parseJSON: function( data ) { if ( !data || typeof data !== "string") { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && core_rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var name, i = 0, length = obj.length, isObj = length === undefined || jQuery.isFunction( obj ); if ( args ) { if ( isObj ) { for ( name in obj ) { if ( callback.apply( obj[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( obj[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in obj ) { if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var type, ret = results || []; if ( arr != null ) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 type = jQuery.type( arr ); if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { core_push.call( ret, arr ); } else { jQuery.merge( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexOf ) { return core_indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyGet, pass ) { var exec, bulk = key == null, i = 0, length = elems.length; // Sets many values if ( key && typeof key === "object" ) { for ( i in key ) { jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); } chainable = 1; // Sets one value } else if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = pass === undefined && jQuery.isFunction( value ); if ( bulk ) { // Bulk operations only iterate when executing function values if ( exec ) { exec = fn; fn = function( elem, key, value ) { return exec.call( jQuery( elem ), value ); }; // Otherwise they run against the entire set } else { fn.call( elems, value ); fn = null; } } if ( fn ) { for (; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } } chainable = 1; } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }, now: function() { return ( new Date() ).getTime(); } }); jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.split( core_rspace ), function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Control if a given callback is in the list has: function( fn ) { return jQuery.inArray( fn, list ) > -1; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? function() { var returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } } : newDefer[ action ] ); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] = list.fire deferred[ tuple[0] ] = list.fire; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = core_slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, select, opt, input, fragment, eventName, i, isSupported, clickFn, div = document.createElement("div"); // Setup div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // Support tests won't run in some limited or non-browser environments all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; if ( !all || !a || !all.length ) { return {}; } // First batch of tests select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form (#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: ( document.compatMode === "CSS1Compat" ), // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", clickFn = function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent("onclick"); div.detachEvent( "onclick", clickFn ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; input.setAttribute( "checked", "checked" ); // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute( "name", "t" ); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild( input ); fragment.appendChild( div ); // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } // Run tests that need a body at doc ready jQuery(function() { var container, div, tds, marginDiv, divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; body.insertBefore( container, body.firstChild ); // Construct the test element div = document.createElement("div"); container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; tds = div.getElementsByTagName("td"); tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Check box-sizing and margin behavior div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = ( div.offsetWidth === 4 ); support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = document.createElement("div"); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; div.appendChild( marginDiv ); support.reliableMarginRight = !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); } if ( typeof div.style.zoom !== "undefined" ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerHTML = "<div></div>"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); container.style.zoom = 1; } // Null elements to avoid leaks in IE body.removeChild( container ); container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE fragment.removeChild( div ); all = a = select = opt = input = fragment = div = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, deletedIds: [], // Remove at next major release (1.9/2.0) uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if ( jQuery.support.deleteExpando || cache != cache.window ) { delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { attr = elem.attributes; for ( l = attr.length; i < l; i++ ) { name = attr[i].name; if ( !name.indexOf( "data-" ) ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split( ".", 2 ); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jQuery.access( this, function( value ) { if ( value === undefined ) { data = this.triggerHandler( "getData" + part, [ parts[0] ] ); // Try to fetch any internally stored data first if ( data === undefined && elem ) { data = jQuery.data( elem, key ); data = dataAttr( elem, key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } parts[1] = value; this.each(function() { var self = jQuery( this ); self.triggerHandler( "setData" + part, parts ); jQuery.data( this, key, value ); self.triggerHandler( "changeData" + part, parts ); }); }, null, value, arguments.length > 1, null, false ); }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery.removeData( elem, type + "queue", true ); jQuery.removeData( elem, key, true ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodeHook, boolHook, fixSpecified, rclass = /[\t\r\n]/g, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea|)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var removes, className, elem, c, cl, i, l; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { removes = ( value || "" ).split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { className = (" " + elem.className + " ").replace( rclass, " " ); // loop over each item in the removal list for ( c = 0, cl = removes.length; c < cl; c++ ) { // Remove until there is nothing to remove, while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { className = className.replace( " " + removes[ c ] + " " , " " ); } } elem.className = value ? jQuery.trim( className ) : ""; } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( core_rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val, self = jQuery(this); if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 attrFn: {}, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, isBool, i = 0; if ( value && elem.nodeType === 1 ) { attrNames = value.split( core_rspace ); for ( ; i < attrNames.length; i++ ) { name = attrNames[ i ]; if ( name ) { propName = jQuery.propFix[ name ] || name; isBool = rboolean.test( name ); // See #9699 for explanation of this approach (setting first, then removal) // Do not do this for boolean attributes (see #10870) if ( !isBool ) { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes if ( isBool && propName in elem ) { elem[ propName ] = false; } } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { fixSpecified = { name: true, id: true, coords: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return ( ret.value = value + "" ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, hoverHack = function( events ) { return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim( hoverHack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim( hoverHack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; // Remove matching events for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, "events", true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, type = event.type || event, namespaces = []; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; for ( old = elem; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old === (elem.ownerDocument || document) ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), delegateCount = handlers.delegateCount, args = core_slice.call( arguments ), run_all = !event.exclusive && !event.namespace, special = jQuery.event.special[ event.type ] || {}, handlerQueue = []; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers that should run if there are delegated events // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && !(event.button && event.type === "click") ) { for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { selMatch = {}; matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { selMatch[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( selMatch[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } } // Add the remaining (directly-bound) handlers if ( handlers.length > delegateCount ) { handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); } // Run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; event.currentTarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = matched.matches[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { event.data = handleObj.data; event.handleObj = handleObj; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) event.metaKey = !!event.metaKey; return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "_submit_attached" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "_submit_attached", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "_change_attached", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // && selector != null // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function( window, undefined ) { var cachedruns, assertGetIdNotName, Expr, getText, isXML, contains, compile, sortOrder, hasDuplicate, outermostContext, baseHasDuplicate = true, strundefined = "undefined", expando = ( "sizcache" + Math.random() ).replace( ".", "" ), Token = String, document = window.document, docElem = document.documentElement, dirruns = 0, done = 0, pop = [].pop, push = [].push, slice = [].slice, // Use a stripped-down indexOf if a native one is unavailable indexOf = [].indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Augment a function for special use by Sizzle markFunction = function( fn, value ) { fn[ expando ] = value == null || value; return fn; }, createCache = function() { var cache = {}, keys = []; return markFunction(function( key, value ) { // Only keep the most recent entries if ( keys.push( key ) > Expr.cacheLength ) { delete cache[ keys.shift() ]; } // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) return (cache[ key + " " ] = value); }, cache ); }, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // Regex // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments not in parens/brackets, // then attribute selectors and non-pseudos (denoted by :), // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", // For matchExpr.POS and matchExpr.needsContext pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, rnot = /^:not/, rsibling = /[\x20\t\r\n\f]*[+~]/, rendsWithNot = /:not\($/, rheader = /h\d/i, rinputs = /input|select|textarea|button/i, rbackslash = /\\(?!\\)/g, matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "POS": new RegExp( pos, "i" ), "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) }, // Support // Used for testing something on an element assert = function( fn ) { var div = document.createElement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } }, // Check if getElementsByTagName("*") returns only elements assertTagNameNoComments = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }), // Check if getAttribute returns normalized href attributes assertHrefNotNormalized = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }), // Check if attributes should be retrieved by attribute nodes assertAttributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }), // Check if getElementsByClassName can be trusted assertUsableClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }), // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID assertUsableName = assert(function( div ) { // Inject content div.id = expando + 0; div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; docElem.insertBefore( div, docElem.firstChild ); // Test var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2 document.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 document.getElementsByName( expando + 0 ).length; assertGetIdNotName = !document.getElementById( expando ); // Cleanup docElem.removeChild( div ); return pass; }); // If slice is not available, provide a backup try { slice.call( docElem.childNodes, 0 )[0].nodeType; } catch ( e ) { slice = function( i ) { var elem, results = []; for ( ; (elem = this[i]); i++ ) { results.push( elem ); } return results; }; } function Sizzle( selector, context, results, seed ) { results = results || []; context = context || document; var match, elem, xml, m, nodeType = context.nodeType; if ( !selector || typeof selector !== "string" ) { return results; } if ( nodeType !== 1 && nodeType !== 9 ) { return []; } xml = isXML( context ); if ( !xml && !seed ) { if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); return results; } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); } Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { return Sizzle( expr, null, null, [ elem ] ).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( nodeType ) { if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes } else { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } return ret; }; isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); } : docElem.compareDocumentPosition ? function( a, b ) { return b && !!( a.compareDocumentPosition( b ) & 16 ); } : function( a, b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } return false; }; Sizzle.attr = function( elem, name ) { var val, xml = isXML( elem ); if ( !xml ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( xml || assertAttributes ) { return elem.getAttribute( name ); } val = elem.getAttributeNode( name ); return val ? typeof elem[ name ] === "boolean" ? elem[ name ] ? name : null : val.specified ? val.value : null : null; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, // IE6/7 return a modified href attrHandle: assertHrefNotNormalized ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }, find: { "ID": assertGetIdNotName ? function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } } : function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }, "TAG": assertTagNameNoComments ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { var elem, tmp = [], i = 0; for ( ; (elem = results[i]); i++ ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }, "NAME": assertUsableName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }, "CLASS": assertUsableClassName && function( className, context, xml ) { if ( typeof context.getElementsByClassName !== strundefined && !xml ) { return context.getElementsByClassName( className ); } } }, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( rbackslash, "" ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3 xn-component of xn+y argument ([+-]?\d*n|) 4 sign of xn-component 5 x of xn-component 6 sign of y-component 7 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1] === "nth" ) { // nth-child requires argument if ( !match[2] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); // other types prohibit arguments } else if ( match[2] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var unquoted, excess; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } if ( match[3] ) { match[2] = match[3]; } else if ( (unquoted = match[4]) ) { // Only check arguments that contain a pseudo if ( rpseudo.test(unquoted) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index unquoted = unquoted.slice( 0, excess ); match[0] = match[0].slice( 0, excess ); } match[2] = unquoted; } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "ID": assertGetIdNotName ? function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { return elem.getAttribute("id") === id; }; } : function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === id; }; }, "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ expando ][ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem, context ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.substr( result.length - check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, argument, first, last ) { if ( type === "nth" ) { return function( elem ) { var node, diff, parent = elem.parentNode; if ( first === 1 && last === 0 ) { return true; } if ( parent ) { diff = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { diff++; if ( elem === node ) { break; } } } } // Incorporate the offset (or cast to NaN), then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); }; } return function( elem ) { var node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; /* falls through */ case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") var nodeType; elem = elem.firstChild; while ( elem ) { if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { return false; } elem = elem.nextSibling; } return true; }, "header": function( elem ) { return rheader.test( elem.nodeName ); }, "text": function( elem ) { var type, attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); }, // Input types "radio": createInputPseudo("radio"), "checkbox": createInputPseudo("checkbox"), "file": createInputPseudo("file"), "password": createInputPseudo("password"), "image": createInputPseudo("image"), "submit": createButtonPseudo("submit"), "reset": createButtonPseudo("reset"), "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "focus": function( elem ) { var doc = elem.ownerDocument; return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, "active": function( elem ) { return elem === elem.ownerDocument.activeElement; }, // Positional types "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 0; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 1; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; function siblingCheck( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; } sortOrder = docElem.compareDocumentPosition ? function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4 ) ? -1 : 1; } : function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], i = 1, j = 0; hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ expando ][ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); // Cast descendant combinators to space matched.type = match[0].replace( rtrim, " " ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); matched.type = type; matched.matches = match; } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( !xml ) { var cache, dirkey = dirruns + " " + doneName + " ", cachedkey = dirkey + cachedruns; while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( (cache = elem[ expando ]) === cachedkey ) { return elem.sizset; } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { if ( elem.sizset ) { return elem; } } else { elem[ expando ] = cachedkey; if ( matcher( elem, context, xml ) ) { elem.sizset = true; return elem; } elem.sizset = false; } } } } else { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( matcher( elem, context, xml ) ) { return elem; } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && tokens.join("") ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = superMatcher.el; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++superMatcher.el; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); j++ ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; superMatcher.el = 0; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ expando ][ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed, xml ) { var i, tokens, token, type, find, match = tokenize( selector ), j = match.length; if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().length ); } // Fetch a seed set for right-to-left matching for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( rbackslash, "" ), rsibling.test( tokens[0].type ) && context.parentNode || context, xml )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && tokens.join(""); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, xml, results, rsibling.test( selector ) ); return results; } if ( document.querySelectorAll ) { (function() { var disconnectedMatch, oldSelect = select, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ], // matchesSelector(:active) reports false when true (IE9/Opera 11.5) // A support test would require too much code (would include document ready) // just skip matchesSelector for :active rbuggyMatches = [ ":active" ], matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector; // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here (do not put tests after this one) if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE9 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<p test=''></p>"; if ( div.querySelectorAll("[test^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here (do not put tests after this one) div.innerHTML = "<input type='hidden'/>"; if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push(":enabled", ":disabled"); } }); // rbuggyQSA always contains :focus, so no need for a length check rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); select = function( selector, context, results, seed, xml ) { // Only use querySelectorAll when not filtering, // when this is not xml, // and when no QSA bugs apply if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { var groups, i, old = true, nid = expando, newContext = context, newSelector = context.nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + groups[i].join(""); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, slice.call( newContext.querySelectorAll( newSelector ), 0 ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } return oldSelect( selector, context, results, seed, xml ); }; if ( matches ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead try { matches.call( div, "[test!='']:sizzle" ); rbuggyMatches.push( "!=", pseudos ); } catch ( e ) {} }); // rbuggyMatches always contains :active and :focus, so no need for a length check rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); Sizzle.matchesSelector = function( elem, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyMatches always contains :active, so no need for an existence check if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, null, null, [ elem ] ).length > 0; }; } })(); } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Back-compat function setFilters() {} Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, l, length, n, r, ret, self = this; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } ret = this.pushStack( "", "find", selector ); for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentNode; } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, rnocache = /<(?:script|object|embed|option|style)/i, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rcheckableType = /^(?:checkbox|radio)$/, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], area: [ 1, "<map>", "</map>" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if ( !jQuery.support.htmlSerialize ) { wrapMap._default = [ 1, "X<div>", "</div>" ]; } jQuery.fn.extend({ text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); } }, after: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); } }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return jQuery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName( "*" ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function( value ) { if ( !isDisconnected( this[0] ) ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } if ( typeof value !== "string" ) { value = jQuery( value ).detach(); } return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); } else { jQuery(parent).append( value ); } }); } return this.length ? this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : this; }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { // Flatten any nested arrays args = [].concat.apply( [], args ); var results, first, fragment, iNoClone, i = 0, value = args[0], scripts = [], l = this.length; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { return this.each(function() { jQuery(this).domManip( args, table, callback ); }); } if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); args[0] = value.call( this, i, table ? self.html() : undefined ); self.domManip( args, table, callback ); }); } if ( this[0] ) { results = jQuery.buildFragment( args, this, scripts ); fragment = results.fragment; first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). // Fragments from the fragment cache must always be cloned and never used in place. for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { callback.call( table && jQuery.nodeName( this[i], "table" ) ? findOrAppend( this[i], "tbody" ) : this[i], i === iNoClone ? fragment : jQuery.clone( fragment, true, true ) ); } } // Fix #11809: Avoid leaking memory fragment = first = null; if ( scripts.length ) { jQuery.each( scripts, function( i, elem ) { if ( elem.src ) { if ( jQuery.ajax ) { jQuery.ajax({ url: elem.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.error("no ajax"); } } else { jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } }); } } return this; } }); function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function cloneFixAttributes( src, dest ) { var nodeName; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want if ( dest.clearAttributes ) { dest.clearAttributes(); } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events if ( dest.mergeAttributes ) { dest.mergeAttributes( src ); } nodeName = dest.nodeName.toLowerCase(); if ( nodeName === "object" ) { // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; // IE blanks contents when cloning scripts } else if ( nodeName === "script" && dest.text !== src.text ) { dest.text = src.text; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, context, scripts ) { var fragment, cacheable, cachehit, first = args[ 0 ]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && first.charAt(0) === "<" && !rnocache.test( first ) && (jQuery.support.checkClone || !rchecked.test( first )) && (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { // Mark cacheable and look for a hit cacheable = true; fragment = jQuery.fragments[ first ]; cachehit = fragment !== undefined; } if ( !fragment ) { fragment = context.createDocumentFragment(); jQuery.clean( args, context, fragment, scripts ); // Update the cache, but only store false // unless this is a second parsing of the same content if ( cacheable ) { jQuery.fragments[ first ] = cachehit && fragment; } } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), l = insert.length, parent = this.length === 1 && this[0].parentNode; if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { insert[ original ]( this[0] ); return this; } else { for ( ; i < l; i++ ) { elems = ( i > 0 ? this.clone(true) : this ).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, insert.selector ); } }; }); function getAll( elem ) { if ( typeof elem.getElementsByTagName !== "undefined" ) { return elem.getElementsByTagName( "*" ); } else if ( typeof elem.querySelectorAll !== "undefined" ) { return elem.querySelectorAll( "*" ); } else { return []; } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var srcElements, destElements, i, clone; if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. cloneFixAttributes( elem, clone ); // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll( elem ); destElements = getAll( clone ); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { cloneFixAttributes( srcElements[i], destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { cloneCopyEvent( elem, clone ); if ( deepDataAndEvents ) { srcElements = getAll( elem ); destElements = getAll( clone ); for ( i = 0; srcElements[i]; ++i ) { cloneCopyEvent( srcElements[i], destElements[i] ); } } } srcElements = destElements = null; // Return the cloned set return clone; }, clean: function( elems, context, fragment, scripts ) { var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, safe = context === document && safeFragment, ret = []; // Ensure that context is a document if ( !context || typeof context.createDocumentFragment === "undefined" ) { context = document; } // Use the already-created safe fragment if context permits for ( i = 0; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { elem += ""; } if ( !elem ) { continue; } // Convert html string into DOM nodes if ( typeof elem === "string" ) { if ( !rhtml.test( elem ) ) { elem = context.createTextNode( elem ); } else { // Ensure a safe container in which to render the html safe = safe || createSafeFragment( context ); div = context.createElement("div"); safe.appendChild( div ); // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Go to html and back, then peel off extra wrappers tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; depth = wrap[0]; div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( depth-- ) { div = div.lastChild; } // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> hasBody = rtbody.test(elem); tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !hasBody ? div.childNodes : []; for ( j = tbody.length - 1; j >= 0 ; --j ) { if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { tbody[ j ].parentNode.removeChild( tbody[ j ] ); } } } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); } elem = div.childNodes; // Take out of fragment container (we need a fresh div each time) div.parentNode.removeChild( div ); } } if ( elem.nodeType ) { ret.push( elem ); } else { jQuery.merge( ret, elem ); } } // Fix #11356: Clear elements from safeFragment if ( div ) { elem = div = safe = null; } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !jQuery.support.appendChecked ) { for ( i = 0; (elem = ret[i]) != null; i++ ) { if ( jQuery.nodeName( elem, "input" ) ) { fixDefaultChecked( elem ); } else if ( typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); } } } // Append elements to a provided document fragment if ( fragment ) { // Special handling of each script element handleScript = function( elem ) { // Check if we consider it executable if ( !elem.type || rscriptType.test( elem.type ) ) { // Detach the script and store it in the scripts array (if provided) or the fragment // Return truthy to indicate that it has been handled return scripts ? scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : fragment.appendChild( elem ); } }; for ( i = 0; (elem = ret[i]) != null; i++ ) { // Check if we're done after handling an executable script if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { // Append to fragment and handle embedded scripts fragment.appendChild( elem ); if ( typeof elem.getElementsByTagName !== "undefined" ) { // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); // Splice the scripts into ret after their former ancestor and advance our index beyond them ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); i += jsTags.length; } } } } return ret; }, cleanData: function( elems, /* internal */ acceptData ) { var data, id, elem, type, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } jQuery.deletedIds.push( id ); } } } } } }); // Limit scope pollution from any deprecated API (function() { var matched, browser; // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || (/(webkit)[ \/]([\w.]+)/.exec( ua )) || (/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua )) || (/(msie) ([\w.]+)/.exec( ua )) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } jQuery.browser = browser; jQuery.sub = function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), elemdisplay = { BODY: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function isHidden( elem, el ) { elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { var elem, display, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { display = curCSS( elem, "display" ); if ( !values[ index ] && display !== "none" ) { jQuery._data( elem, "olddisplay", display ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function( name, value ) { return jQuery.access( this, function( elem, name, value ) { return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state, fn2 ) { var bool = typeof state === "boolean"; if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { return eventsToggle.apply( this, arguments ); } return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, numeric, extra ) { var val, num, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( numeric || extra !== undefined ) { num = parseFloat( val ); return numeric || jQuery.isNumeric( num ) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.call( elem ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { curCSS = function( elem, name ) { var ret, width, minWidth, maxWidth, computed = window.getComputedStyle( elem, null ), style = elem.style; if ( computed ) { // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed.getPropertyValue( name ) || computed[ name ]; if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if ( document.documentElement.currentStyle ) { curCSS = function( elem, name ) { var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { // we use jQuery.css instead of curCSS here // because of the reliableMarginRight CSS hook! val += jQuery.css( elem, extra + cssExpand[ i ], true ); } // From this point on we use curCSS for maximum performance (relevant in animations) if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } else { // at this point, extra isn't content, so add padding val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { if ( elemdisplay[ nodeName ] ) { return elemdisplay[ nodeName ]; } var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend( document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if ( !iframeDoc || !iframe.createElement ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write("<!doctype html><html><body>"); iframeDoc.close(); } elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); display = curCSS( elem, "display" ); document.body.removeChild( iframe ); } // Store the correct default display elemdisplay[ nodeName ] = display; return display; } jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { return jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }); } else { return getWidthOrHeight( elem, name, extra ); } } }, set: function( elem, value, extra ) { return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" ) : 0 ); } }; }); if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute( "filter" ); // if there there is no filter style applied in a css rule, we are done if ( currentStyle && !currentStyle.filter ) { return; } } // otherwise, set new filter values style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function() { if ( !jQuery.support.reliableMarginRight ) { jQuery.cssHooks.marginRight = { get: function( elem, computed ) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap( elem, { "display": "inline-block" }, function() { if ( computed ) { return curCSS( elem, "marginRight" ); } }); } }; } // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = { get: function( elem, computed ) { if ( computed ) { var ret = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; } } }; }); } }); if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [ value ], expanded = {}; for ( i = 0; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rts = /([?&])_=[^&]*/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), i = 0, length = dataTypes.length; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var selection, list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ); for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already if ( typeof selection === "string" ) { if ( !executeOnly || inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } } jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } // Don't do a request if no elements are being requested if ( !this.length ) { return this; } var selector, type, response, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // Request the remote document jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params, complete: function( jqXHR, status ) { if ( callback ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); } } }).done(function( responseText ) { // Save response for use in complete callback response = arguments; // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append( responseText.replace( rscript, "" ) ) // Locate the specified elements .find( selector ) : // If not, just inject the full result responseText ); }); return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ return this.on( o, f ); }; }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; }); jQuery.extend({ getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { if ( settings ) { // Building a settings object ajaxExtend( target, jQuery.ajaxSettings ); } else { // Extending ajaxSettings settings = target; target = jQuery.ajaxSettings; } ajaxExtend( target, settings ); return target; }, ajaxSettings: { url: ajaxLocation, isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, type: "GET", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": allTypes }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { context: true, url: true } }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // ifModified key ifModifiedKey, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars parts, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events // It's the callbackContext if one was provided in the options // and if it's a DOM node or a jQuery collection globalEventContext = callbackContext !== s && ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { var lname = name.toLowerCase(); name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match === undefined ? null : match; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Cancel the request abort: function( statusText ) { statusText = statusText || strAbort; if ( transport ) { transport.abort( statusText ); } done( 0, statusText ); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ ifModifiedKey ] = modified; } modified = jqXHR.getResponseHeader("Etag"); if ( modified ) { jQuery.etag[ ifModifiedKey ] = modified; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } // Attach deferreds deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { for ( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { tmp = map[ jqXHR.status ]; jqXHR.always( tmp ); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter ifModifiedKey = s.url; // Add anti-cache in url if needed if ( s.cache === false ) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { ifModifiedKey = ifModifiedKey || s.url; if ( jQuery.lastModified[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); } if ( jQuery.etag[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); } } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout( function(){ jqXHR.abort( "timeout" ); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } return jqXHR; }, // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ], converters = {}, i = 0; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split(" "); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.splice( i--, 0, current ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s["throws"] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; } var oldCallbacks = [], rquestion = /\?/, rjsonp = /(=)\?(?=&|$)|\?\?/, nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, data = s.data, url = s.url, hasCallback = s.jsonp !== false, replaceInUrl = hasCallback && rjsonp.test( url ), replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( data ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; overwritten = window[ callbackName ]; // Insert callback into url or form data if ( replaceInUrl ) { s.url = url.replace( rjsonp, "$1" + callbackName ); } else if ( replaceInData ) { s.data = data.replace( rjsonp, "$1" + callbackName ); } else if ( hasCallback ) { s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement( "script" ); script.async = "async"; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } // Dereference the script script = undefined; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( 0, 1 ); } } }; } }); var xhrCallbacks, // #5280: Internet Explorer will keep connections alive if we don't abort on unload xhrOnUnloadAbort = window.ActiveXObject ? function() { // Abort all pending requests for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( 0, 1 ); } } : false, xhrId = 0; // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function() { return !this.isLocal && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; // Determine support properties (function( xhr ) { jQuery.extend( jQuery.support, { ajax: !!xhr, cors: !!xhr && ( "withCredentials" in xhr ) }); })( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { jQuery.ajaxTransport(function( s ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !s.crossDomain || jQuery.support.cors ) { var callback; return { send: function( headers, complete ) { // Get a new xhr var handle, i, xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if ( s.username ) { xhr.open( s.type, s.url, s.async, s.username, s.password ); } else { xhr.open( s.type, s.url, s.async ); } // Apply custom fields if provided if ( s.xhrFields ) { for ( i in s.xhrFields ) { xhr[ i ] = s.xhrFields[ i ]; } } // Override mime type if needed if ( s.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( s.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !s.crossDomain && !headers["X-Requested-With"] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } } catch( _ ) {} // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( s.hasContent && s.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responseHeaders, responses, xml; // Firefox throws exceptions when accessing properties // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Only called once callback = undefined; // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; if ( xhrOnUnloadAbort ) { delete xhrCallbacks[ handle ]; } } // If it's an abort if ( isAbort ) { // Abort it manually if needed if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { status = xhr.status; responseHeaders = xhr.getAllResponseHeaders(); responses = {}; xml = xhr.responseXML; // Construct response list if ( xml && xml.documentElement /* #4958 */ ) { responses.xml = xml; } // When requesting binary data, IE6-9 will throw an exception // on any attempt to access responseText (#11426) try { responses.text = xhr.responseText; } catch( e ) { } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && s.isLocal && !s.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } } catch( firefoxAccessException ) { if ( !isAbort ) { complete( -1, firefoxAccessException ); } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, responseHeaders ); } }; if ( !s.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback, 0 ); } else { handle = ++xhrId; if ( xhrOnUnloadAbort ) { // Create the active xhrs callbacks list if needed // and attach the unload handler if ( !xhrCallbacks ) { xhrCallbacks = {}; jQuery( window ).unload( xhrOnUnloadAbort ); } // Add to list of active xhrs callbacks xhrCallbacks[ handle ] = callback; } xhr.onreadystatechange = callback; } }, abort: function() { if ( callback ) { callback(0,1); } } }; } }); } var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [function( prop, value ) { var end, unit, tween = this.createTween( prop, value ), parts = rfxnum.exec( value ), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20; if ( parts ) { end = +parts[2]; unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); // We need to compute starting value if ( unit !== "px" && start ) { // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant start = jQuery.css( tween.elem, prop, true ) || end || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style( tween.elem, prop, start + unit ); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; } return tween; }] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function() { fxNow = undefined; }, 0 ); return ( fxNow = jQuery.now() ); } function createTweens( animation, props ) { jQuery.each( props, function( prop, value ) { var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( collection[ index ].call( animation, prop, value ) ) { // we're done with this property return; } } }); } function Animation( elem, properties, options ) { var result, index = 0, tweenerIndex = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { // don't match elem in the :animated selector delete tick.elem; }), tick = function() { var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end, easing ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // resolve when we played the last frame // otherwise, reject if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } createTweens( animation, props ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { anim: animation, queue: animation.opts.queue, elem: elem }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); function defaultPrefilter( elem, props, opts ) { var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden( elem ); // handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { // doing this makes sure that the complete handler will be called // before this completes anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } // height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated if ( jQuery.css( elem, "display" ) === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { anim.done(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( index in props ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } handled.push( index ); } } length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } // store state if its toggle - enables .stop().toggle() to "reverse" if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery.removeData( elem, "fxshow", true ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( index = 0 ; index < length ; index++ ) { prop = handled[ index ]; tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } } function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } // passing any value as a 4th parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css( tween.elem, tween.prop, false, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" || // special check for .toggle( handler, handler, ... ) ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { // show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations resolve immediately if ( empty ) { anim.stop( true ); } }; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); } }); // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p*Math.PI ) / 2; } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { if ( timer() && jQuery.timers.push( timer ) && !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.interval = 13; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } if ( (body = doc.body) === elem ) { return jQuery.offset.bodyOffset( elem ); } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if ( typeof elem.getBoundingClientRect !== "undefined" ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); clientTop = docElem.clientTop || body.clientTop || 0; clientLeft = docElem.clientLeft || body.clientLeft || 0; scrollTop = win.pageYOffset || docElem.scrollTop; scrollLeft = win.pageXOffset || docElem.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; }; jQuery.offset = { bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, setOffset: function( elem, options, i ) { var position = jQuery.css( elem, "position" ); // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } var curElem = jQuery( elem ), curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ position: function() { if ( !this[0] ) { return; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent || document.body; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return jQuery.access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return jQuery.access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, value, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } })( window );
src/components/Delegate.js
seripap/wedding.seripap.com
import React, { Component } from 'react'; import { Link } from 'react-router'; import DocumentTitle from 'react-document-title'; import Header from './Header'; export default class Delegate extends Component { constructor(props) { super(props); } render() { return ( <DocumentTitle title="Amanda & Dan's Wedding"> <div> { this.props.children } </div> </DocumentTitle> ); } }
src/component/carousel.js
kinesitherapeute/aqua
import React from 'react'; import {Carousel} from 'react-responsive-carousel'; export default function CarouselAqua(){ return ( <Carousel type="slider" showControls={true} showStatus={true}> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> <img src='http://lorempixel.com/400/200' /> </Carousel> ); }
ajax/libs/handsontable/0.10.0/jquery.handsontable.js
siddii/cdnjs
/** * Handsontable 0.10.0 * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://handsontable.com/ * * Date: Fri Dec 27 2013 17:46:22 GMT+0100 (Central European Standard Time) */ /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */ var Handsontable = { //class namespace extension: {}, //extenstion namespace helper: {} //helper namespace }; (function ($, window, Handsontable) { "use strict"; //http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8 if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } /** * Array.filter() shim by Trevor Menagh (https://github.com/trevmex) with some modifications */ if (!Array.prototype.filter) { Array.prototype.filter = function (fun, thisp) { "use strict"; if (typeof this === "undefined" || this === null) { throw new TypeError(); } if (typeof fun !== "function") { throw new TypeError(); } thisp = thisp || this; if (isNodeList(thisp)) { thisp = convertNodeListToArray(thisp); } var len = thisp.length, res = [], i, val; for (i = 0; i < len; i += 1) { if (thisp.hasOwnProperty(i)) { val = thisp[i]; // in case fun mutates this if (fun.call(thisp, val, i, thisp)) { res.push(val); } } } return res; function isNodeList(object) { return /NodeList/i.test(object.item); } function convertNodeListToArray(nodeList) { var array = []; for (var i = 0, len = nodeList.length; i < len; i++){ array[i] = nodeList[i] } return array; } }; } /* * Copyright 2012 The Polymer Authors. All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file. */ if (typeof WeakMap === 'undefined') { (function() { var defineProperty = Object.defineProperty; try { var properDefineProperty = true; defineProperty(function(){}, 'foo', {}); } catch (e) { properDefineProperty = false; } var counter = Date.now() % 1e9; var WeakMap = function() { this.name = '__st' + (Math.random() * 1e9 >>> 0) + (counter++ + '__'); if(!properDefineProperty){ this._wmCache = []; } }; if(properDefineProperty){ WeakMap.prototype = { set: function(key, value) { var entry = key[this.name]; if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {value: [key, value], writable: true}); }, get: function(key) { var entry; return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined; }, 'delete': function(key) { this.set(key, undefined); } }; } else { WeakMap.prototype = { set: function(key, value) { if(typeof key == 'undefined' || typeof value == 'undefined') return; for(var i = 0, len = this._wmCache.length; i < len; i++){ if(this._wmCache[i].key == key){ this._wmCache[i].value = value; return; } } this._wmCache.push({key: key, value: value}); }, get: function(key) { if(typeof key == 'undefined') return; for(var i = 0, len = this._wmCache.length; i < len; i++){ if(this._wmCache[i].key == key){ return this._wmCache[i].value; } } return; }, 'delete': function(key) { if(typeof key == 'undefined') return; for(var i = 0, len = this._wmCache.length; i < len; i++){ if(this._wmCache[i].key == key){ Array.prototype.slice.call(this._wmCache, i, 1); } } } }; } window.WeakMap = WeakMap; })(); } Handsontable.activeGuid = null; /** * Handsontable constructor * @param rootElement The jQuery element in which Handsontable DOM will be inserted * @param userSettings * @constructor */ Handsontable.Core = function (rootElement, userSettings) { var priv , datamap , grid , selection , editorManager , autofill , instance = this , GridSettings = function () {}; Handsontable.helper.extend(GridSettings.prototype, DefaultSettings.prototype); //create grid settings as a copy of default settings Handsontable.helper.extend(GridSettings.prototype, userSettings); //overwrite defaults with user settings Handsontable.helper.extend(GridSettings.prototype, expandType(userSettings)); this.rootElement = rootElement; var $document = $(document.documentElement); var $body = $(document.body); this.guid = 'ht_' + Handsontable.helper.randomString(); //this is the namespace for global events if (!this.rootElement[0].id) { this.rootElement[0].id = this.guid; //if root element does not have an id, assign a random id } priv = { cellSettings: [], columnSettings: [], columnsSettingConflicts: ['data', 'width'], settings: new GridSettings(), // current settings instance settingsFromDOM: {}, selStart: new Handsontable.SelectionPoint(), selEnd: new Handsontable.SelectionPoint(), isPopulated: null, scrollable: null, extensions: {}, colToProp: null, propToCol: null, dataSchema: null, dataType: 'array', firstRun: true }; datamap = { recursiveDuckSchema: function (obj) { var schema; if ($.isPlainObject(obj)) { schema = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { if ($.isPlainObject(obj[i])) { schema[i] = datamap.recursiveDuckSchema(obj[i]); } else { schema[i] = null; } } } } else { schema = []; } return schema; }, recursiveDuckColumns: function (schema, lastCol, parent) { var prop, i; if (typeof lastCol === 'undefined') { lastCol = 0; parent = ''; } if ($.isPlainObject(schema)) { for (i in schema) { if (schema.hasOwnProperty(i)) { if (schema[i] === null) { prop = parent + i; priv.colToProp.push(prop); priv.propToCol[prop] = lastCol; lastCol++; } else { lastCol = datamap.recursiveDuckColumns(schema[i], lastCol, i + '.'); } } } } return lastCol; }, createMap: function () { if (typeof datamap.getSchema() === "undefined") { throw new Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`"); } var i, ilen, schema = datamap.getSchema(); priv.colToProp = []; priv.propToCol = {}; if (priv.settings.columns) { for (i = 0, ilen = priv.settings.columns.length; i < ilen; i++) { priv.colToProp[i] = priv.settings.columns[i].data; priv.propToCol[priv.settings.columns[i].data] = i; } } else { datamap.recursiveDuckColumns(schema); } }, colToProp: function (col) { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); if (priv.colToProp && typeof priv.colToProp[col] !== 'undefined') { return priv.colToProp[col]; } else { return col; } }, propToCol: function (prop) { var col; if (typeof priv.propToCol[prop] !== 'undefined') { col = priv.propToCol[prop]; } else { col = prop; } col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); return col; }, getSchema: function () { if (priv.settings.dataSchema) { if (typeof priv.settings.dataSchema === 'function') { return priv.settings.dataSchema(); } return priv.settings.dataSchema; } return priv.duckDataSchema; }, /** * Creates row at the bottom of the data array * @param {Number} [index] Optional. Index of the row before which the new row will be inserted */ createRow: function (index, amount) { var row , colCount = instance.countCols() , numberOfCreatedRows = 0 , currentIndex; if (!amount) { amount = 1; } if (typeof index !== 'number' || index >= instance.countRows()) { index = instance.countRows(); } currentIndex = index; while (numberOfCreatedRows < amount && instance.countRows() < priv.settings.maxRows) { if (priv.dataType === 'array') { row = []; for (var c = 0; c < colCount; c++) { row.push(null); } } else if (priv.dataType === 'function') { row = priv.settings.dataSchema(index); } else { row = $.extend(true, {}, datamap.getSchema()); } if (index === instance.countRows()) { GridSettings.prototype.data.push(row); } else { GridSettings.prototype.data.splice(index, 0, row); } numberOfCreatedRows++; currentIndex++; } instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows); instance.forceFullRender = true; //used when data was changed return numberOfCreatedRows; }, /** * Creates col at the right of the data array * @param {Number} [index] Optional. Index of the column before which the new column will be inserted * * @param {Number} [amount] Optional. */ createCol: function (index, amount) { if (priv.dataType === 'object' || priv.settings.columns) { throw new Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting"); } var rlen = instance.countRows() , data = GridSettings.prototype.data , constructor , numberOfCreatedCols = 0 , currentIndex; if (!amount) { amount = 1; } currentIndex = index; while (numberOfCreatedCols < amount && instance.countCols() < priv.settings.maxCols){ constructor = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); if (typeof index !== 'number' || index >= instance.countCols()) { for (var r = 0; r < rlen; r++) { if (typeof data[r] === 'undefined') { data[r] = []; } data[r].push(null); } // Add new column constructor priv.columnSettings.push(constructor); } else { for (var r = 0 ; r < rlen; r++) { data[r].splice(currentIndex, 0, null); } // Add new column constructor at given index priv.columnSettings.splice(currentIndex, 0, constructor); } numberOfCreatedCols++; currentIndex++; } instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols); instance.forceFullRender = true; //used when data was changed return numberOfCreatedCols; }, /** * Removes row from the data array * @param {Number} [index] Optional. Index of the row to be removed. If not provided, the last row will be removed * @param {Number} [amount] Optional. Amount of the rows to be removed. If not provided, one row will be removed */ removeRow: function (index, amount) { if (!amount) { amount = 1; } if (typeof index !== 'number') { index = -amount; } index = (instance.countRows() + index) % instance.countRows(); // We have to map the physical row ids to logical and than perform removing with (possibly) new row id var logicRows = this.physicalRowsToLogical(index, amount); var actionWasNotCancelled = instance.PluginHooks.execute('beforeRemoveRow', index, amount); if(actionWasNotCancelled === false){ return; } var newData = GridSettings.prototype.data.filter(function (row, index) { return logicRows.indexOf(index) == -1; }); GridSettings.prototype.data.length = 0; Array.prototype.push.apply(GridSettings.prototype.data, newData); instance.PluginHooks.run('afterRemoveRow', index, amount); instance.forceFullRender = true; //used when data was changed }, /** * Removes column from the data array * @param {Number} [index] Optional. Index of the column to be removed. If not provided, the last column will be removed * @param {Number} [amount] Optional. Amount of the columns to be removed. If not provided, one column will be removed */ removeCol: function (index, amount) { if (priv.dataType === 'object' || priv.settings.columns) { throw new Error("cannot remove column with object data source or columns option specified"); } if (!amount) { amount = 1; } if (typeof index !== 'number') { index = -amount; } index = (instance.countCols() + index) % instance.countCols(); var actionWasNotCancelled = instance.PluginHooks.execute('beforeRemoveCol', index, amount); if(actionWasNotCancelled === false){ return; } var data = GridSettings.prototype.data; for (var r = 0, rlen = instance.countRows(); r < rlen; r++) { data[r].splice(index, amount); } priv.columnSettings.splice(index, amount); instance.PluginHooks.run('afterRemoveCol', index, amount); instance.forceFullRender = true; //used when data was changed }, /** * Add / removes data from the column * @param {Number} col Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ spliceCol: function (col, index, amount/*, elements...*/) { var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : []; var colData = instance.getDataAtCol(col); var removed = colData.slice(index, index + amount); var after = colData.slice(index + amount); Handsontable.helper.extendArray(elements, after); var i = 0; while (i < amount) { elements.push(null); //add null in place of removed elements i++; } Handsontable.helper.to2dArray(elements); instance.populateFromArray(index, col, elements, null, null, 'spliceCol'); return removed; }, /** * Add / removes data from the row * @param {Number} row Index of row in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ spliceRow: function (row, index, amount/*, elements...*/) { var elements = 4 <= arguments.length ? [].slice.call(arguments, 3) : []; var rowData = instance.getDataAtRow(row); var removed = rowData.slice(index, index + amount); var after = rowData.slice(index + amount); Handsontable.helper.extendArray(elements, after); var i = 0; while (i < amount) { elements.push(null); //add null in place of removed elements i++; } instance.populateFromArray(row, index, [elements], null, null, 'spliceRow'); return removed; }, /** * Returns single value from the data array * @param {Number} row * @param {Number} prop */ getVars: {}, get: function (row, prop) { datamap.getVars.row = row; datamap.getVars.prop = prop; instance.PluginHooks.run('beforeGet', datamap.getVars); if (typeof datamap.getVars.prop === 'string' && datamap.getVars.prop.indexOf('.') > -1) { var sliced = datamap.getVars.prop.split("."); var out = priv.settings.data[datamap.getVars.row]; if (!out) { return null; } for (var i = 0, ilen = sliced.length; i < ilen; i++) { out = out[sliced[i]]; if (typeof out === 'undefined') { return null; } } return out; } else if (typeof datamap.getVars.prop === 'function') { /** * allows for interacting with complex structures, for example * d3/jQuery getter/setter properties: * * {columns: [{ * data: function(row, value){ * if(arguments.length === 1){ * return row.property(); * } * row.property(value); * } * }]} */ return datamap.getVars.prop(priv.settings.data.slice( datamap.getVars.row, datamap.getVars.row + 1 )[0]); } else { return priv.settings.data[datamap.getVars.row] ? priv.settings.data[datamap.getVars.row][datamap.getVars.prop] : null; } }, /** * Saves single value to the data array * @param {Number} row * @param {Number} prop * @param {String} value * @param {String} [source] Optional. Source of hook runner. */ setVars: {}, set: function (row, prop, value, source) { datamap.setVars.row = row; datamap.setVars.prop = prop; datamap.setVars.value = value; instance.PluginHooks.run('beforeSet', datamap.setVars, source || "datamapGet"); if (typeof datamap.setVars.prop === 'string' && datamap.setVars.prop.indexOf('.') > -1) { var sliced = datamap.setVars.prop.split("."); var out = priv.settings.data[datamap.setVars.row]; for (var i = 0, ilen = sliced.length - 1; i < ilen; i++) { out = out[sliced[i]]; } out[sliced[i]] = datamap.setVars.value; } else if (typeof datamap.setVars.prop === 'function') { /* see the `function` handler in `get` */ datamap.setVars.prop(priv.settings.data.slice( datamap.setVars.row, datamap.setVars.row + 1 )[0], datamap.setVars.value); } else { priv.settings.data[datamap.setVars.row][datamap.setVars.prop] = datamap.setVars.value; } }, /** * This ridiculous piece of code maps rows Id that are present in table data to those displayed for user. * The trick is, the physical row id (stored in settings.data) is not necessary the same * as the logical (displayed) row id (e.g. when sorting is applied). */ physicalRowsToLogical: function (index, amount) { var physicRow = (GridSettings.prototype.data.length + index) % GridSettings.prototype.data.length; var logicRows = []; var rowsToRemove = amount; while (physicRow < GridSettings.prototype.data.length && rowsToRemove) { this.get(physicRow, 0); //this performs an actual mapping and saves the result to getVars logicRows.push(this.getVars.row); rowsToRemove--; physicRow++; } return logicRows; }, /** * Clears the data array */ clear: function () { for (var r = 0; r < instance.countRows(); r++) { for (var c = 0; c < instance.countCols(); c++) { datamap.set(r, datamap.colToProp(c), ''); } } }, /** * Returns the data array * @return {Array} */ getAll: function () { return priv.settings.data; }, /** * Returns data range as array * @param {Object} start Start selection position * @param {Object} end End selection position * @return {Array} */ getRange: function (start, end) { var r, rlen, c, clen, output = [], row; rlen = Math.max(start.row, end.row); clen = Math.max(start.col, end.col); for (r = Math.min(start.row, end.row); r <= rlen; r++) { row = []; for (c = Math.min(start.col, end.col); c <= clen; c++) { row.push(datamap.get(r, datamap.colToProp(c))); } output.push(row); } return output; }, /** * Return data as text (tab separated columns) * @param {Object} start (Optional) Start selection position * @param {Object} end (Optional) End selection position * @return {String} */ getText: function (start, end) { return SheetClip.stringify(datamap.getRange(start, end)); } }; grid = { /** * Inserts or removes rows and columns * @param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col" * @param {Number} index * @param {Number} amount * @param {String} [source] Optional. Source of hook runner. * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. */ alter: function (action, index, amount, source, keepEmptyRows) { var delta; amount = amount || 1; switch (action) { case "insert_row": delta = datamap.createRow(index, amount); if (delta) { if (priv.selStart.exists() && priv.selStart.row() >= index) { priv.selStart.row(priv.selStart.row() + delta); selection.transformEnd(delta, 0); //will call render() internally } else { selection.refreshBorders(); //it will call render and prepare methods } } break; case "insert_col": delta = datamap.createCol(index, amount); if (delta) { if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){ var spliceArray = [index, 0]; spliceArray.length += delta; //inserts empty (undefined) elements at the end of an array Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArray); //inserts empty (undefined) elements into the colHeader array } if (priv.selStart.exists() && priv.selStart.col() >= index) { priv.selStart.col(priv.selStart.col() + delta); selection.transformEnd(0, delta); //will call render() internally } else { selection.refreshBorders(); //it will call render and prepare methods } } break; case "remove_row": datamap.removeRow(index, amount); priv.cellSettings.splice(index, amount); grid.adjustRowsAndCols(); selection.refreshBorders(); //it will call render and prepare methods break; case "remove_col": datamap.removeCol(index, amount); for(var row = 0, len = datamap.getAll().length; row < len; row++){ if(row in priv.cellSettings){ //if row hasn't been rendered it wouldn't have cellSettings priv.cellSettings[row].splice(index, amount); } } if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){ if(typeof index == 'undefined'){ index = -1; } instance.getSettings().colHeaders.splice(index, amount); } priv.columnSettings.splice(index, amount); grid.adjustRowsAndCols(); selection.refreshBorders(); //it will call render and prepare methods break; default: throw new Error('There is no such action "' + action + '"'); break; } if (!keepEmptyRows) { grid.adjustRowsAndCols(); //makes sure that we did not add rows that will be removed in next refresh } }, /** * Makes sure there are empty rows at the bottom of the table */ adjustRowsAndCols: function () { var r, rlen, emptyRows = instance.countEmptyRows(true), emptyCols; //should I add empty rows to data source to meet minRows? rlen = instance.countRows(); if (rlen < priv.settings.minRows) { for (r = 0; r < priv.settings.minRows - rlen; r++) { datamap.createRow(); } } //should I add empty rows to meet minSpareRows? if (emptyRows < priv.settings.minSpareRows) { for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) { datamap.createRow(); } } //count currently empty cols emptyCols = instance.countEmptyCols(true); //should I add empty cols to meet minCols? if (!priv.settings.columns && instance.countCols() < priv.settings.minCols) { for (; instance.countCols() < priv.settings.minCols; emptyCols++) { datamap.createCol(); } } //should I add empty cols to meet minSpareCols? if (!priv.settings.columns && priv.dataType === 'array' && emptyCols < priv.settings.minSpareCols) { for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) { datamap.createCol(); } } if (priv.settings.enterBeginsEditing) { for (; (((priv.settings.minRows || priv.settings.minSpareRows) && instance.countRows() > priv.settings.minRows) && (priv.settings.minSpareRows && emptyRows > priv.settings.minSpareRows)); emptyRows--) { datamap.removeRow(); } } if (priv.settings.enterBeginsEditing && !priv.settings.columns) { for (; (((priv.settings.minCols || priv.settings.minSpareCols) && instance.countCols() > priv.settings.minCols) && (priv.settings.minSpareCols && emptyCols > priv.settings.minSpareCols)); emptyCols--) { datamap.removeCol(); } } var rowCount = instance.countRows(); var colCount = instance.countCols(); if (rowCount === 0 || colCount === 0) { selection.deselect(); } if (priv.selStart.exists()) { var selectionChanged; var fromRow = priv.selStart.row(); var fromCol = priv.selStart.col(); var toRow = priv.selEnd.row(); var toCol = priv.selEnd.col(); //if selection is outside, move selection to last row if (fromRow > rowCount - 1) { fromRow = rowCount - 1; selectionChanged = true; if (toRow > fromRow) { toRow = fromRow; } } else if (toRow > rowCount - 1) { toRow = rowCount - 1; selectionChanged = true; if (fromRow > toRow) { fromRow = toRow; } } //if selection is outside, move selection to last row if (fromCol > colCount - 1) { fromCol = colCount - 1; selectionChanged = true; if (toCol > fromCol) { toCol = fromCol; } } else if (toCol > colCount - 1) { toCol = colCount - 1; selectionChanged = true; if (fromCol > toCol) { fromCol = toCol; } } if (selectionChanged) { instance.selectCell(fromRow, fromCol, toRow, toCol); } } }, /** * Populate cells at position with 2d array * @param {Object} start Start selection position * @param {Array} input 2d array * @param {Object} [end] End selection position (only for drag-down mode) * @param {String} [source="populateFromArray"] * @param {String} [method="overwrite"] * @return {Object|undefined} ending td in pasted area (only if any cell was changed) */ populateFromArray: function (start, input, end, source, method) { var r, rlen, c, clen, setData = [], current = {}; rlen = input.length; if (rlen === 0) { return false; } var repeatCol , repeatRow , cmax , rmax; // insert data with specified pasteMode method switch (method) { case 'shift_down' : repeatCol = end ? end.col - start.col + 1 : 0; repeatRow = end ? end.row - start.row + 1 : 0; input = Handsontable.helper.translateRowsToColumns(input); for (c = 0, clen = input.length, cmax = Math.max(clen, repeatCol); c < cmax; c++) { if (c < clen) { for (r = 0, rlen = input[c].length; r < repeatRow - rlen; r++) { input[c].push(input[c][r % rlen]); } input[c].unshift(start.col + c, start.row, 0); instance.spliceCol.apply(instance, input[c]); } else { input[c % clen][0] = start.col + c; instance.spliceCol.apply(instance, input[c % clen]); } } break; case 'shift_right' : repeatCol = end ? end.col - start.col + 1 : 0; repeatRow = end ? end.row - start.row + 1 : 0; for (r = 0, rlen = input.length, rmax = Math.max(rlen, repeatRow); r < rmax; r++) { if (r < rlen) { for (c = 0, clen = input[r].length; c < repeatCol - clen; c++) { input[r].push(input[r][c % clen]); } input[r].unshift(start.row + r, start.col, 0); instance.spliceRow.apply(instance, input[r]); } else { input[r % rlen][0] = start.row + r; instance.spliceRow.apply(instance, input[r % rlen]); } } break; case 'overwrite' : default: // overwrite and other not specified options current.row = start.row; current.col = start.col; for (r = 0; r < rlen; r++) { if ((end && current.row > end.row) || (!priv.settings.minSpareRows && current.row > instance.countRows() - 1) || (current.row >= priv.settings.maxRows)) { break; } current.col = start.col; clen = input[r] ? input[r].length : 0; for (c = 0; c < clen; c++) { if ((end && current.col > end.col) || (!priv.settings.minSpareCols && current.col > instance.countCols() - 1) || (current.col >= priv.settings.maxCols)) { break; } if (!instance.getCellMeta(current.row, current.col).readOnly) { setData.push([current.row, current.col, input[r][c]]); } current.col++; if (end && c === clen - 1) { c = -1; } } current.row++; if (end && r === rlen - 1) { r = -1; } } instance.setDataAtCell(setData, null, null, source || 'populateFromArray'); break; } }, /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @param {Object[]} coordsArr * @returns {Object} */ getCornerCoords: function (coordsArr) { function mapProp(func, array, prop) { function getProp(el) { return el[prop]; } if (Array.prototype.map) { return func.apply(Math, array.map(getProp)); } return func.apply(Math, $.map(array, getProp)); } return { TL: { row: mapProp(Math.min, coordsArr, "row"), col: mapProp(Math.min, coordsArr, "col") }, BR: { row: mapProp(Math.max, coordsArr, "row"), col: mapProp(Math.max, coordsArr, "col") } }; }, /** * Returns array of td objects given start and end coordinates */ getCellsAtCoords: function (start, end) { var corners = grid.getCornerCoords([start, end]); var r, c, output = []; for (r = corners.TL.row; r <= corners.BR.row; r++) { for (c = corners.TL.col; c <= corners.BR.col; c++) { output.push(instance.view.getCellAtCoords({ row: r, col: c })); } } return output; } }; this.selection = selection = { //this public assignment is only temporary inProgress: false, /** * Sets inProgress to true. This enables onSelectionEnd and onSelectionEndByProp to function as desired */ begin: function () { instance.selection.inProgress = true; }, /** * Sets inProgress to false. Triggers onSelectionEnd and onSelectionEndByProp */ finish: function () { var sel = instance.getSelected(); instance.PluginHooks.run("afterSelectionEnd", sel[0], sel[1], sel[2], sel[3]); instance.PluginHooks.run("afterSelectionEndByProp", sel[0], instance.colToProp(sel[1]), sel[2], instance.colToProp(sel[3])); instance.selection.inProgress = false; }, isInProgress: function () { return instance.selection.inProgress; }, /** * Starts selection range on given td object * @param {Object} coords */ setRangeStart: function (coords) { priv.selStart.coords(coords); selection.setRangeEnd(coords); }, /** * Ends selection range on given td object * @param {Object} coords * @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to range end */ setRangeEnd: function (coords, scrollToCell) { instance.selection.begin(); priv.selEnd.coords(coords); if (!priv.settings.multiSelect) { priv.selStart.coords(coords); } //set up current selection instance.view.wt.selections.current.clear(); instance.view.wt.selections.current.add(priv.selStart.arr()); //set up area selection instance.view.wt.selections.area.clear(); if (selection.isMultiple()) { instance.view.wt.selections.area.add(priv.selStart.arr()); instance.view.wt.selections.area.add(priv.selEnd.arr()); } //set up highlight if (priv.settings.currentRowClassName || priv.settings.currentColClassName) { instance.view.wt.selections.highlight.clear(); instance.view.wt.selections.highlight.add(priv.selStart.arr()); instance.view.wt.selections.highlight.add(priv.selEnd.arr()); } //trigger handlers instance.PluginHooks.run("afterSelection", priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col()); instance.PluginHooks.run("afterSelectionByProp", priv.selStart.row(), datamap.colToProp(priv.selStart.col()), priv.selEnd.row(), datamap.colToProp(priv.selEnd.col())); if (scrollToCell !== false) { instance.view.scrollViewport(coords); } selection.refreshBorders(); }, /** * Destroys editor, redraws borders around cells, prepares editor * @param {Boolean} revertOriginal * @param {Boolean} keepEditor */ refreshBorders: function (revertOriginal, keepEditor) { if (!keepEditor) { editorManager.destroyEditor(revertOriginal); } instance.view.render(); if (selection.isSelected() && !keepEditor) { editorManager.prepareEditor(); } }, /** * Returns information if we have a multiselection * @return {Boolean} */ isMultiple: function () { return !(priv.selEnd.col() === priv.selStart.col() && priv.selEnd.row() === priv.selStart.row()); }, /** * Selects cell relative to current cell (if possible) */ transformStart: function (rowDelta, colDelta, force) { if (priv.selStart.row() + rowDelta > instance.countRows() - 1) { if (force && priv.settings.minSpareRows > 0) { instance.alter("insert_row", instance.countRows()); } else if (priv.settings.autoWrapCol) { rowDelta = 1 - instance.countRows(); colDelta = priv.selStart.col() + colDelta == instance.countCols() - 1 ? 1 - instance.countCols() : 1; } } else if (priv.settings.autoWrapCol && priv.selStart.row() + rowDelta < 0 && priv.selStart.col() + colDelta >= 0) { rowDelta = instance.countRows() - 1; colDelta = priv.selStart.col() + colDelta == 0 ? instance.countCols() - 1 : -1; } if (priv.selStart.col() + colDelta > instance.countCols() - 1) { if (force && priv.settings.minSpareCols > 0) { instance.alter("insert_col", instance.countCols()); } else if (priv.settings.autoWrapRow) { rowDelta = priv.selStart.row() + rowDelta == instance.countRows() - 1 ? 1 - instance.countRows() : 1; colDelta = 1 - instance.countCols(); } } else if (priv.settings.autoWrapRow && priv.selStart.col() + colDelta < 0 && priv.selStart.row() + rowDelta >= 0) { rowDelta = priv.selStart.row() + rowDelta == 0 ? instance.countRows() - 1 : -1; colDelta = instance.countCols() - 1; } var totalRows = instance.countRows(); var totalCols = instance.countCols(); var coords = { row: priv.selStart.row() + rowDelta, col: priv.selStart.col() + colDelta }; if (coords.row < 0) { coords.row = 0; } else if (coords.row > 0 && coords.row >= totalRows) { coords.row = totalRows - 1; } if (coords.col < 0) { coords.col = 0; } else if (coords.col > 0 && coords.col >= totalCols) { coords.col = totalCols - 1; } selection.setRangeStart(coords); }, /** * Sets selection end cell relative to current selection end cell (if possible) */ transformEnd: function (rowDelta, colDelta) { if (priv.selEnd.exists()) { var totalRows = instance.countRows(); var totalCols = instance.countCols(); var coords = { row: priv.selEnd.row() + rowDelta, col: priv.selEnd.col() + colDelta }; if (coords.row < 0) { coords.row = 0; } else if (coords.row > 0 && coords.row >= totalRows) { coords.row = totalRows - 1; } if (coords.col < 0) { coords.col = 0; } else if (coords.col > 0 && coords.col >= totalCols) { coords.col = totalCols - 1; } selection.setRangeEnd(coords); } }, /** * Returns true if currently there is a selection on screen, false otherwise * @return {Boolean} */ isSelected: function () { return priv.selEnd.exists(); }, /** * Returns true if coords is within current selection coords * @return {Boolean} */ inInSelection: function (coords) { if (!selection.isSelected()) { return false; } var sel = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); return (sel.TL.row <= coords.row && sel.BR.row >= coords.row && sel.TL.col <= coords.col && sel.BR.col >= coords.col); }, /** * Deselects all selected cells */ deselect: function () { if (!selection.isSelected()) { return; } instance.selection.inProgress = false; //needed by HT inception priv.selEnd = new Handsontable.SelectionPoint(); //create new empty point to remove the existing one instance.view.wt.selections.current.clear(); instance.view.wt.selections.area.clear(); editorManager.destroyEditor(); selection.refreshBorders(); instance.PluginHooks.run('afterDeselect'); }, /** * Select all cells */ selectAll: function () { if (!priv.settings.multiSelect) { return; } selection.setRangeStart({ row: 0, col: 0 }); selection.setRangeEnd({ row: instance.countRows() - 1, col: instance.countCols() - 1 }, false); }, /** * Deletes data from selected cells */ empty: function () { if (!selection.isSelected()) { return; } var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); var r, c, changes = []; for (r = corners.TL.row; r <= corners.BR.row; r++) { for (c = corners.TL.col; c <= corners.BR.col; c++) { if (!instance.getCellMeta(r, c).readOnly) { changes.push([r, c, '']); } } } instance.setDataAtCell(changes); } }; this.autofill = autofill = { //this public assignment is only temporary handle: null, /** * Create fill handle and fill border objects */ init: function () { if (!autofill.handle) { autofill.handle = {}; } else { autofill.handle.disabled = false; } }, /** * Hide fill handle and fill border permanently */ disable: function () { autofill.handle.disabled = true; }, /** * Selects cells down to the last row in the left column, then fills down to that cell */ selectAdjacent: function () { var select, data, r, maxR, c; if (selection.isMultiple()) { select = instance.view.wt.selections.area.getCorners(); } else { select = instance.view.wt.selections.current.getCorners(); } data = datamap.getAll(); rows : for (r = select[2] + 1; r < instance.countRows(); r++) { for (c = select[1]; c <= select[3]; c++) { if (data[r][c]) { break rows; } } if (!!data[r][select[1] - 1] || !!data[r][select[3] + 1]) { maxR = r; } } if (maxR) { instance.view.wt.selections.fill.clear(); instance.view.wt.selections.fill.add([select[0], select[1]]); instance.view.wt.selections.fill.add([maxR, select[3]]); autofill.apply(); } }, /** * Apply fill values to the area in fill border, omitting the selection border */ apply: function () { var drag, select, start, end, _data; autofill.handle.isDragged = 0; drag = instance.view.wt.selections.fill.getCorners(); if (!drag) { return; } instance.view.wt.selections.fill.clear(); if (selection.isMultiple()) { select = instance.view.wt.selections.area.getCorners(); } else { select = instance.view.wt.selections.current.getCorners(); } if (drag[0] === select[0] && drag[1] < select[1]) { start = { row: drag[0], col: drag[1] }; end = { row: drag[2], col: select[1] - 1 }; } else if (drag[0] === select[0] && drag[3] > select[3]) { start = { row: drag[0], col: select[3] + 1 }; end = { row: drag[2], col: drag[3] }; } else if (drag[0] < select[0] && drag[1] === select[1]) { start = { row: drag[0], col: drag[1] }; end = { row: select[0] - 1, col: drag[3] }; } else if (drag[2] > select[2] && drag[1] === select[1]) { start = { row: select[2] + 1, col: drag[1] }; end = { row: drag[2], col: drag[3] }; } if (start) { _data = SheetClip.parse(datamap.getText(priv.selStart.coords(), priv.selEnd.coords())); instance.PluginHooks.run('beforeAutofill', start, end, _data); grid.populateFromArray(start, _data, end, 'autofill'); selection.setRangeStart({row: drag[0], col: drag[1]}); selection.setRangeEnd({row: drag[2], col: drag[3]}); } /*else { //reset to avoid some range bug selection.refreshBorders(); }*/ }, /** * Show fill border */ showBorder: function (coords) { coords.row = coords[0]; coords.col = coords[1]; var corners = grid.getCornerCoords([priv.selStart.coords(), priv.selEnd.coords()]); if (priv.settings.fillHandle !== 'horizontal' && (corners.BR.row < coords.row || corners.TL.row > coords.row)) { coords = [coords.row, corners.BR.col]; } else if (priv.settings.fillHandle !== 'vertical') { coords = [corners.BR.row, coords.col]; } else { return; //wrong direction } instance.view.wt.selections.fill.clear(); instance.view.wt.selections.fill.add([priv.selStart.coords().row, priv.selStart.coords().col]); instance.view.wt.selections.fill.add([priv.selEnd.coords().row, priv.selEnd.coords().col]); instance.view.wt.selections.fill.add(coords); instance.view.render(); } }; this.init = function () { instance.PluginHooks.run('beforeInit'); this.view = new Handsontable.TableView(this); editorManager = new Handsontable.EditorManager(instance, priv, selection, datamap); this.updateSettings(priv.settings, true); this.parseSettingsFromDOM(); this.forceFullRender = true; //used when data was changed this.view.render(); if (typeof priv.firstRun === 'object') { instance.PluginHooks.run('afterChange', priv.firstRun[0], priv.firstRun[1]); priv.firstRun = false; } instance.PluginHooks.run('afterInit'); }; function ValidatorsQueue() { //moved this one level up so it can be used in any function here. Probably this should be moved to a separate file var resolved = false; return { validatorsInQueue: 0, addValidatorToQueue: function () { this.validatorsInQueue++; resolved = false; }, removeValidatorFormQueue: function () { this.validatorsInQueue = this.validatorsInQueue - 1 < 0 ? 0 : this.validatorsInQueue - 1; this.checkIfQueueIsEmpty(); }, onQueueEmpty: function () { }, checkIfQueueIsEmpty: function () { if (this.validatorsInQueue == 0 && resolved == false) { resolved = true; this.onQueueEmpty(); } } }; } function validateChanges(changes, source, callback) { var waitingForValidator = new ValidatorsQueue(); waitingForValidator.onQueueEmpty = resolve; for (var i = changes.length - 1; i >= 0; i--) { if (changes[i] === null) { changes.splice(i, 1); } else { var row = changes[i][0]; var col = datamap.propToCol(changes[i][1]); var logicalCol = instance.runHooksAndReturn('modifyCol', col); //column order may have changes, so we need to translate physical col index (stored in datasource) to logical (displayed to user) var cellProperties = instance.getCellMeta(row, logicalCol); if (cellProperties.type === 'numeric' && typeof changes[i][3] === 'string') { if (changes[i][3].length > 0 && /^-?[\d\s]*\.?\d*$/.test(changes[i][3])) { changes[i][3] = numeral().unformat(changes[i][3] || '0'); //numeral cannot unformat empty string } } if (instance.getCellValidator(cellProperties)) { waitingForValidator.addValidatorToQueue(); instance.validateCell(changes[i][3], cellProperties, (function (i, cellProperties) { return function (result) { if (typeof result !== 'boolean') { throw new Error("Validation error: result is not boolean"); } if (result === false && cellProperties.allowInvalid === false) { changes.splice(i, 1); // cancel the change cellProperties.valid = true; // we cancelled the change, so cell value is still valid --i; } waitingForValidator.removeValidatorFormQueue(); } })(i, cellProperties) , source); } } } waitingForValidator.checkIfQueueIsEmpty(); function resolve() { var beforeChangeResult; if (changes.length) { beforeChangeResult = instance.PluginHooks.execute("beforeChange", changes, source); if (typeof beforeChangeResult === 'function') { $.when(result).then(function () { callback(); //called when async validators and async beforeChange are resolved }); } else if (beforeChangeResult === false) { changes.splice(0, changes.length); //invalidate all changes (remove everything from array) } } if (typeof beforeChangeResult !== 'function') { callback(); //called when async validators are resolved and beforeChange was not async } } } /** * Internal function to apply changes. Called after validateChanges * @param {Array} changes Array in form of [row, prop, oldValue, newValue] * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ function applyChanges(changes, source) { var i = changes.length - 1; if (i < 0) { return; } for (; 0 <= i; i--) { if (changes[i] === null) { changes.splice(i, 1); continue; } if (priv.settings.minSpareRows) { while (changes[i][0] > instance.countRows() - 1) { datamap.createRow(); } } if (priv.dataType === 'array' && priv.settings.minSpareCols) { while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) { datamap.createCol(); } } datamap.set(changes[i][0], changes[i][1], changes[i][3]); } instance.forceFullRender = true; //used when data was changed grid.adjustRowsAndCols(); selection.refreshBorders(null, true); instance.PluginHooks.run('afterChange', changes, source || 'edit'); } this.validateCell = function (value, cellProperties, callback, source) { var validator = instance.getCellValidator(cellProperties); if (Object.prototype.toString.call(validator) === '[object RegExp]') { validator = (function (validator) { return function (value, callback) { callback(validator.test(value)); } })(validator); } if (typeof validator == 'function') { value = instance.PluginHooks.execute("beforeValidate", value, cellProperties.row, cellProperties.prop, source); // To provide consistent behaviour, validation should be always asynchronous setTimeout(function () { validator.call(cellProperties, value, function (valid) { cellProperties.valid = valid; valid = instance.PluginHooks.execute("afterValidate", valid, value, cellProperties.row, cellProperties.prop, source); callback(valid); }); }); } else { //resolve callback even if validator function was not found cellProperties.valid = true; callback(true); } }; function setDataInputToArray(row, prop_or_col, value) { if (typeof row === "object") { //is it an array of changes return row; } else if ($.isPlainObject(value)) { //backwards compatibility return value; } else { return [ [row, prop_or_col, value] ]; } } /** * Set data at given cell * @public * @param {Number|Array} row or array of changes in format [[row, col, value], ...] * @param {Number|String} col or source String * @param {String} value * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ this.setDataAtCell = function (row, col, value, source) { var input = setDataInputToArray(row, col, value) , i , ilen , changes = [] , prop; for (i = 0, ilen = input.length; i < ilen; i++) { if (typeof input[i] !== 'object') { throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter'); } if (typeof input[i][1] !== 'number') { throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); } prop = datamap.colToProp(input[i][1]); changes.push([ input[i][0], prop, datamap.get(input[i][0], prop), input[i][2] ]); } if (!source && typeof row === "object") { source = col; } validateChanges(changes, source, function () { applyChanges(changes, source); }); }; /** * Set data at given row property * @public * @param {Number|Array} row or array of changes in format [[row, prop, value], ...] * @param {String} prop or source String * @param {String} value * @param {String} source String that identifies how this change will be described in changes array (useful in onChange callback) */ this.setDataAtRowProp = function (row, prop, value, source) { var input = setDataInputToArray(row, prop, value) , i , ilen , changes = []; for (i = 0, ilen = input.length; i < ilen; i++) { changes.push([ input[i][0], input[i][1], datamap.get(input[i][0], input[i][1]), input[i][2] ]); } if (!source && typeof row === "object") { source = prop; } validateChanges(changes, source, function () { applyChanges(changes, source); }); }; /** * Listen to document body keyboard input */ this.listen = function () { Handsontable.activeGuid = instance.guid; if (document.activeElement && document.activeElement !== document.body) { document.activeElement.blur(); } else if (!document.activeElement) { //IE document.body.focus(); } }; /** * Stop listening to document body keyboard input */ this.unlisten = function () { Handsontable.activeGuid = null; }; /** * Returns true if current Handsontable instance is listening on document body keyboard input */ this.isListening = function () { return Handsontable.activeGuid === instance.guid; }; /** * Destroys current editor, renders and selects current cell. If revertOriginal != true, edited data is saved * @param {Boolean} revertOriginal */ this.destroyEditor = function (revertOriginal) { selection.refreshBorders(revertOriginal); }; /** * Populate cells at position with 2d array * @param {Number} row Start row * @param {Number} col Start column * @param {Array} input 2d array * @param {Number=} endRow End row (use when you want to cut input when certain row is reached) * @param {Number=} endCol End column (use when you want to cut input when certain column is reached) * @param {String=} [source="populateFromArray"] * @param {String=} [method="overwrite"] * @return {Object|undefined} ending td in pasted area (only if any cell was changed) */ this.populateFromArray = function (row, col, input, endRow, endCol, source, method) { if (!(typeof input === 'object' && typeof input[0] === 'object')) { throw new Error("populateFromArray parameter `input` must be an array of arrays"); //API changed in 0.9-beta2, let's check if you use it correctly } return grid.populateFromArray({row: row, col: col}, input, typeof endRow === 'number' ? {row: endRow, col: endCol} : null, source, method); }; /** * Adds/removes data from the column * @param {Number} col Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ this.spliceCol = function (col, index, amount/*, elements... */) { return datamap.spliceCol.apply(null, arguments); }; /** * Adds/removes data from the row * @param {Number} row Index of column in which do you want to do splice. * @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end * @param {Number} amount An integer indicating the number of old array elements to remove. If amount is 0, no elements are removed * param {...*} elements Optional. The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array */ this.spliceRow = function (row, index, amount/*, elements... */) { return datamap.spliceRow.apply(null, arguments); }; /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @param {Object[]} coordsArr * @returns {Object} */ this.getCornerCoords = function (coordsArr) { return grid.getCornerCoords(coordsArr); }; /** * Returns current selection. Returns undefined if there is no selection. * @public * @return {Array} [`startRow`, `startCol`, `endRow`, `endCol`] */ this.getSelected = function () { //https://github.com/warpech/jquery-handsontable/issues/44 //cjl if (selection.isSelected()) { return [priv.selStart.row(), priv.selStart.col(), priv.selEnd.row(), priv.selEnd.col()]; } }; /** * Parse settings from DOM and CSS * @public */ this.parseSettingsFromDOM = function () { var overflow = this.rootElement.css('overflow'); if (overflow === 'scroll' || overflow === 'auto') { this.rootElement[0].style.overflow = 'visible'; priv.settingsFromDOM.overflow = overflow; } else if (priv.settings.width === void 0 || priv.settings.height === void 0) { priv.settingsFromDOM.overflow = 'auto'; } if (priv.settings.width === void 0) { priv.settingsFromDOM.width = this.rootElement.width(); } else { priv.settingsFromDOM.width = void 0; } priv.settingsFromDOM.height = void 0; if (priv.settings.height === void 0) { if (priv.settingsFromDOM.overflow === 'scroll' || priv.settingsFromDOM.overflow === 'auto') { //this needs to read only CSS/inline style and not actual height //so we need to call getComputedStyle on cloned container var clone = this.rootElement[0].cloneNode(false); var parent = this.rootElement[0].parentNode; if (parent) { clone.removeAttribute('id'); parent.appendChild(clone); var computedHeight = parseInt(window.getComputedStyle(clone, null).getPropertyValue('height'), 10); if(isNaN(computedHeight) && clone.currentStyle){ computedHeight = parseInt(clone.currentStyle.height, 10) } if (computedHeight > 0) { priv.settingsFromDOM.height = computedHeight; } parent.removeChild(clone); } } } }; /** * Render visible data * @public */ this.render = function () { if (instance.view) { instance.forceFullRender = true; //used when data was changed instance.parseSettingsFromDOM(); selection.refreshBorders(null, true); } }; /** * Load data from array * @public * @param {Array} data */ this.loadData = function (data) { if (typeof data === 'object' && data !== null) { if (!(data.push && data.splice)) { //check if data is array. Must use duck-type check so Backbone Collections also pass it //when data is not an array, attempt to make a single-row array of it data = [data]; } } else if(data === null) { data = []; var row; for (var r = 0, rlen = priv.settings.startRows; r < rlen; r++) { row = []; for (var c = 0, clen = priv.settings.startCols; c < clen; c++) { row.push(null); } data.push(row); } } else { throw new Error("loadData only accepts array of objects or array of arrays (" + typeof data + " given)"); } priv.isPopulated = false; GridSettings.prototype.data = data; if (priv.settings.dataSchema instanceof Array || data[0] instanceof Array) { priv.dataType = 'array'; } else if (typeof priv.settings.dataSchema === 'function') { priv.dataType = 'function'; } else { priv.dataType = 'object'; } if (data[0]) { priv.duckDataSchema = datamap.recursiveDuckSchema(data[0]); } else { priv.duckDataSchema = {}; } datamap.createMap(); clearCellSettingCache(); grid.adjustRowsAndCols(); instance.PluginHooks.run('afterLoadData'); if (priv.firstRun) { priv.firstRun = [null, 'loadData']; } else { instance.PluginHooks.run('afterChange', null, 'loadData'); instance.render(); } priv.isPopulated = true; function clearCellSettingCache() { priv.cellSettings.length = 0; } }; /** * Return the current data object (the same that was passed by `data` configuration option or `loadData` method). Optionally you can provide cell range `r`, `c`, `r2`, `c2` to get only a fragment of grid data * @public * @param {Number} r (Optional) From row * @param {Number} c (Optional) From col * @param {Number} r2 (Optional) To row * @param {Number} c2 (Optional) To col * @return {Array|Object} */ this.getData = function (r, c, r2, c2) { if (typeof r === 'undefined') { return datamap.getAll(); } else { return datamap.getRange({row: r, col: c}, {row: r2, col: c2}); } }; this.getCopyableData = function (startRow, startCol, endRow, endCol) { return datamap.getText({row: startRow, col: startCol}, {row: endRow, col: endCol}); } /** * Update settings * @public */ this.updateSettings = function (settings, init) { var i, clen; if (typeof settings.rows !== "undefined") { throw new Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?"); } if (typeof settings.cols !== "undefined") { throw new Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?"); } for (i in settings) { if (i === 'data') { continue; //loadData will be triggered later } else { if (instance.PluginHooks.hooks[i] !== void 0 || instance.PluginHooks.legacy[i] !== void 0) { instance.PluginHooks.add(i, settings[i]); } else { // Update settings if (!init && settings.hasOwnProperty(i)) { GridSettings.prototype[i] = settings[i]; } //launch extensions if (Handsontable.extension[i]) { priv.extensions[i] = new Handsontable.extension[i](instance, settings[i]); } } } } // Load data or create data map if (settings.data === void 0 && priv.settings.data === void 0) { instance.loadData(null); //data source created just now } else if (settings.data !== void 0) { instance.loadData(settings.data); //data source given as option } else if (settings.columns !== void 0) { datamap.createMap(); } // Init columns constructors configuration clen = instance.countCols(); //Clear cellSettings cache priv.cellSettings.length = 0; if (clen > 0) { var proto, column; for (i = 0; i < clen; i++) { priv.columnSettings[i] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); // shortcut for prototype proto = priv.columnSettings[i].prototype; // Use settings provided by user if (GridSettings.prototype.columns) { column = GridSettings.prototype.columns[i]; Handsontable.helper.extend(proto, column); Handsontable.helper.extend(proto, expandType(column)); } } } if (typeof settings.fillHandle !== "undefined") { if (autofill.handle && settings.fillHandle === false) { autofill.disable(); } else if (!autofill.handle && settings.fillHandle !== false) { autofill.init(); } } if (typeof settings.className !== "undefined") { if (GridSettings.prototype.className) { instance.rootElement.removeClass(GridSettings.prototype.className); } if (settings.className) { instance.rootElement.addClass(settings.className); } } if (!init) { instance.PluginHooks.run('afterUpdateSettings'); } grid.adjustRowsAndCols(); if (instance.view && !priv.firstRun) { instance.forceFullRender = true; //used when data was changed selection.refreshBorders(null, true); } }; this.getValue = function () { var sel = instance.getSelected(); if (GridSettings.prototype.getValue) { if (typeof GridSettings.prototype.getValue === 'function') { return GridSettings.prototype.getValue.call(instance); } else if (sel) { return instance.getData()[sel[0]][GridSettings.prototype.getValue]; } } else if (sel) { return instance.getDataAtCell(sel[0], sel[1]); } }; function expandType(obj) { if (!obj.hasOwnProperty('type')) return; //ignore obj.prototype.type var type, expandedType = {}; if (typeof obj.type === 'object') { type = obj.type; } else if (typeof obj.type === 'string') { type = Handsontable.cellTypes[obj.type]; if (type === void 0) { throw new Error('You declared cell type "' + obj.type + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes'); } } for (var i in type) { if (type.hasOwnProperty(i) && !obj.hasOwnProperty(i)) { expandedType[i] = type[i]; } } return expandedType; } /** * Returns current settings object * @return {Object} */ this.getSettings = function () { return priv.settings; }; /** * Returns current settingsFromDOM object * @return {Object} */ this.getSettingsFromDOM = function () { return priv.settingsFromDOM; }; /** * Clears grid * @public */ this.clear = function () { selection.selectAll(); selection.empty(); }; /** * Inserts or removes rows and columns * @param {String} action See grid.alter for possible values * @param {Number} index * @param {Number} amount * @param {String} [source] Optional. Source of hook runner. * @param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows. * @public */ this.alter = function (action, index, amount, source, keepEmptyRows) { grid.alter(action, index, amount, source, keepEmptyRows); }; /** * Returns <td> element corresponding to params row, col * @param {Number} row * @param {Number} col * @public * @return {Element} */ this.getCell = function (row, col) { return instance.view.getCellAtCoords({row: row, col: col}); }; /** * Returns property name associated with column number * @param {Number} col * @public * @return {String} */ this.colToProp = function (col) { return datamap.colToProp(col); }; /** * Returns column number associated with property name * @param {String} prop * @public * @return {Number} */ this.propToCol = function (prop) { return datamap.propToCol(prop); }; /** * Return value at `row`, `col` * @param {Number} row * @param {Number} col * @public * @return value (mixed data type) */ this.getDataAtCell = function (row, col) { return datamap.get(row, datamap.colToProp(col)); }; /** * Return value at `row`, `prop` * @param {Number} row * @param {String} prop * @public * @return value (mixed data type) */ this.getDataAtRowProp = function (row, prop) { return datamap.get(row, prop); }; /** * Return value at `col` * @param {Number} col * @public * @return value (mixed data type) */ this.getDataAtCol = function (col) { return [].concat.apply([], datamap.getRange({row: 0, col: col}, {row: priv.settings.data.length - 1, col: col})); }; /** * Return value at `prop` * @param {String} prop * @public * @return value (mixed data type) */ this.getDataAtProp = function (prop) { return [].concat.apply([], datamap.getRange({row: 0, col: datamap.propToCol(prop)}, {row: priv.settings.data.length - 1, col: datamap.propToCol(prop)})); }; /** * Return value at `row` * @param {Number} row * @public * @return value (mixed data type) */ this.getDataAtRow = function (row) { return priv.settings.data[row]; }; /** * Returns cell meta data object corresponding to params row, col * @param {Number} row * @param {Number} col * @public * @return {Object} */ this.getCellMeta = function (row, col) { var prop = datamap.colToProp(col) , cellProperties; row = translateRowIndex(row); col = translateColIndex(col); if ("undefined" === typeof priv.columnSettings[col]) { priv.columnSettings[col] = Handsontable.helper.columnFactory(GridSettings, priv.columnsSettingConflicts); } if (!priv.cellSettings[row]) { priv.cellSettings[row] = []; } if (!priv.cellSettings[row][col]) { priv.cellSettings[row][col] = new priv.columnSettings[col](); } cellProperties = priv.cellSettings[row][col]; //retrieve cellProperties from cache cellProperties.row = row; cellProperties.col = col; cellProperties.prop = prop; cellProperties.instance = instance; instance.PluginHooks.run('beforeGetCellMeta', row, col, cellProperties); Handsontable.helper.extend(cellProperties, expandType(cellProperties)); //for `type` added in beforeGetCellMeta if (cellProperties.cells) { var settings = cellProperties.cells.call(cellProperties, row, col, prop); if (settings) { Handsontable.helper.extend(cellProperties, settings); Handsontable.helper.extend(cellProperties, expandType(settings)); //for `type` added in cells } } instance.PluginHooks.run('afterGetCellMeta', row, col, cellProperties); return cellProperties; /** * If displayed rows order is different than the order of rows stored in memory (i.e. sorting is applied) * we need to translate logical (stored) row index to physical (displayed) index. * @param row - original row index * @returns {int} translated row index */ function translateRowIndex(row){ var getVars = {row: row}; instance.PluginHooks.execute('beforeGet', getVars); return getVars.row; } /** * If displayed columns order is different than the order of columns stored in memory (i.e. column were moved using manualColumnMove plugin) * we need to translate logical (stored) column index to physical (displayed) index. * @param col - original column index * @returns {int} - translated column index */ function translateColIndex(col){ return Handsontable.PluginHooks.execute(instance, 'modifyCol', col); // warning: this must be done after datamap.colToProp } }; this.getCellRenderer = function (row, col) { var renderer = Handsontable.helper.cellMethodLookupFactory('renderer').call(this, row, col); return Handsontable.renderers.getRenderer(renderer); }; this.getCellEditor = Handsontable.helper.cellMethodLookupFactory('editor'); this.getCellValidator = Handsontable.helper.cellMethodLookupFactory('validator'); /** * Validates all cells using their validator functions and calls callback when finished. Does not render the view * @param callback */ this.validateCells = function (callback) { var waitingForValidator = new ValidatorsQueue(); waitingForValidator.onQueueEmpty = callback; var i = instance.countRows() - 1; while (i >= 0) { var j = instance.countCols() - 1; while (j >= 0) { waitingForValidator.addValidatorToQueue(); instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function () { waitingForValidator.removeValidatorFormQueue(); }, 'validateCells'); j--; } i--; } waitingForValidator.checkIfQueueIsEmpty(); }; /** * Return array of row headers (if they are enabled). If param `row` given, return header at given row as string * @param {Number} row (Optional) * @return {Array|String} */ this.getRowHeader = function (row) { if (row === void 0) { var out = []; for (var i = 0, ilen = instance.countRows(); i < ilen; i++) { out.push(instance.getRowHeader(i)); } return out; } else if (Object.prototype.toString.call(priv.settings.rowHeaders) === '[object Array]' && priv.settings.rowHeaders[row] !== void 0) { return priv.settings.rowHeaders[row]; } else if (typeof priv.settings.rowHeaders === 'function') { return priv.settings.rowHeaders(row); } else if (priv.settings.rowHeaders && typeof priv.settings.rowHeaders !== 'string' && typeof priv.settings.rowHeaders !== 'number') { return row + 1; } else { return priv.settings.rowHeaders; } }; /** * Returns information of this table is configured to display row headers * @returns {boolean} */ this.hasRowHeaders = function () { return !!priv.settings.rowHeaders; }; /** * Returns information of this table is configured to display column headers * @returns {boolean} */ this.hasColHeaders = function () { if (priv.settings.colHeaders !== void 0) { return !!priv.settings.colHeaders; } for (var i = 0, ilen = instance.countCols(); i < ilen; i++) { if (instance.getColHeader(i)) { return true; } } return false; }; /** * Return array of column headers (if they are enabled). If param `col` given, return header at given column as string * @param {Number} col (Optional) * @return {Array|String} */ this.getColHeader = function (col) { if (col === void 0) { var out = []; for (var i = 0, ilen = instance.countCols(); i < ilen; i++) { out.push(instance.getColHeader(i)); } return out; } else { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); if (priv.settings.columns && priv.settings.columns[col] && priv.settings.columns[col].title) { return priv.settings.columns[col].title; } else if (Object.prototype.toString.call(priv.settings.colHeaders) === '[object Array]' && priv.settings.colHeaders[col] !== void 0) { return priv.settings.colHeaders[col]; } else if (typeof priv.settings.colHeaders === 'function') { return priv.settings.colHeaders(col); } else if (priv.settings.colHeaders && typeof priv.settings.colHeaders !== 'string' && typeof priv.settings.colHeaders !== 'number') { return Handsontable.helper.spreadsheetColumnLabel(col); } else { return priv.settings.colHeaders; } } }; /** * Return column width from settings (no guessing). Private use intended * @param {Number} col * @return {Number} */ this._getColWidthFromSettings = function (col) { var cellProperties = instance.getCellMeta(0, col); var width = cellProperties.width; if (width === void 0 || width === priv.settings.width) { width = cellProperties.colWidths; } if (width !== void 0) { switch (typeof width) { case 'object': //array width = width[col]; break; case 'function': width = width(col); break; } if (typeof width === 'string') { width = parseInt(width, 10); } } return width; }; /** * Return column width * @param {Number} col * @return {Number} */ this.getColWidth = function (col) { col = Handsontable.PluginHooks.execute(instance, 'modifyCol', col); var response = { width: instance._getColWidthFromSettings(col) }; if (!response.width) { response.width = 50; } instance.PluginHooks.run('afterGetColWidth', col, response); return response.width; }; /** * Return total number of rows in grid * @return {Number} */ this.countRows = function () { return priv.settings.data.length; }; /** * Return total number of columns in grid * @return {Number} */ this.countCols = function () { if (priv.dataType === 'object' || priv.dataType === 'function') { if (priv.settings.columns && priv.settings.columns.length) { return priv.settings.columns.length; } else { return priv.colToProp.length; } } else if (priv.dataType === 'array') { if (priv.settings.columns && priv.settings.columns.length) { return priv.settings.columns.length; } else if (priv.settings.data && priv.settings.data[0] && priv.settings.data[0].length) { return priv.settings.data[0].length; } else { return 0; } } }; /** * Return index of first visible row * @return {Number} */ this.rowOffset = function () { return instance.view.wt.getSetting('offsetRow'); }; /** * Return index of first visible column * @return {Number} */ this.colOffset = function () { return instance.view.wt.getSetting('offsetColumn'); }; /** * Return number of visible rows. Returns -1 if table is not visible * @return {Number} */ this.countVisibleRows = function () { return instance.view.wt.drawn ? instance.view.wt.wtTable.rowStrategy.countVisible() : -1; }; /** * Return number of visible columns. Returns -1 if table is not visible * @return {Number} */ this.countVisibleCols = function () { return instance.view.wt.drawn ? instance.view.wt.wtTable.columnStrategy.countVisible() : -1; }; /** * Return number of empty rows * @return {Boolean} ending If true, will only count empty rows at the end of the data source */ this.countEmptyRows = function (ending) { var i = instance.countRows() - 1 , empty = 0; while (i >= 0) { datamap.get(i, 0); if (instance.isEmptyRow(datamap.getVars.row)) { empty++; } else if (ending) { break; } i--; } return empty; }; /** * Return number of empty columns * @return {Boolean} ending If true, will only count empty columns at the end of the data source row */ this.countEmptyCols = function (ending) { if (instance.countRows() < 1) { return 0; } var i = instance.countCols() - 1 , empty = 0; while (i >= 0) { if (instance.isEmptyCol(i)) { empty++; } else if (ending) { break; } i--; } return empty; }; /** * Return true if the row at the given index is empty, false otherwise * @param {Number} r Row index * @return {Boolean} */ this.isEmptyRow = function (r) { if (priv.settings.isEmptyRow) { return priv.settings.isEmptyRow.call(instance, r); } var val; for (var c = 0, clen = instance.countCols(); c < clen; c++) { val = instance.getDataAtCell(r, c); if (val !== '' && val !== null && typeof val !== 'undefined') { return false; } } return true; }; /** * Return true if the column at the given index is empty, false otherwise * @param {Number} c Column index * @return {Boolean} */ this.isEmptyCol = function (c) { if (priv.settings.isEmptyCol) { return priv.settings.isEmptyCol.call(instance, c); } var val; for (var r = 0, rlen = instance.countRows(); r < rlen; r++) { val = instance.getDataAtCell(r, c); if (val !== '' && val !== null && typeof val !== 'undefined') { return false; } } return true; }; /** * Selects cell on grid. Optionally selects range to another cell * @param {Number} row * @param {Number} col * @param {Number} [endRow] * @param {Number} [endCol] * @param {Boolean} [scrollToCell=true] If true, viewport will be scrolled to the selection * @public * @return {Boolean} */ this.selectCell = function (row, col, endRow, endCol, scrollToCell) { if (typeof row !== 'number' || row < 0 || row >= instance.countRows()) { return false; } if (typeof col !== 'number' || col < 0 || col >= instance.countCols()) { return false; } if (typeof endRow !== "undefined") { if (typeof endRow !== 'number' || endRow < 0 || endRow >= instance.countRows()) { return false; } if (typeof endCol !== 'number' || endCol < 0 || endCol >= instance.countCols()) { return false; } } priv.selStart.coords({row: row, col: col}); if (document.activeElement && document.activeElement !== document.documentElement && document.activeElement !== document.body) { document.activeElement.blur(); //needed or otherwise prepare won't focus the cell. selectionSpec tests this (should move focus to selected cell) } instance.listen(); if (typeof endRow === "undefined") { selection.setRangeEnd({row: row, col: col}, scrollToCell); } else { selection.setRangeEnd({row: endRow, col: endCol}, scrollToCell); } instance.selection.finish(); return true; }; this.selectCellByProp = function (row, prop, endRow, endProp, scrollToCell) { arguments[1] = datamap.propToCol(arguments[1]); if (typeof arguments[3] !== "undefined") { arguments[3] = datamap.propToCol(arguments[3]); } return instance.selectCell.apply(instance, arguments); }; /** * Deselects current sell selection on grid * @public */ this.deselectCell = function () { selection.deselect(); }; /** * Remove grid from DOM * @public */ this.destroy = function () { instance.clearTimeouts(); if (instance.view) { //in case HT is destroyed before initialization has finished instance.view.wt.destroy(); } instance.rootElement.empty(); instance.rootElement.removeData('handsontable'); instance.rootElement.off('.handsontable'); $(window).off('.' + instance.guid); $document.off('.' + instance.guid); $body.off('.' + instance.guid); instance.PluginHooks.run('afterDestroy'); }; /** * Returns active editor object * @returns {Object} */ this.getActiveEditor = function(){ return editorManager.getActiveEditor(); }; /** * Return Handsontable instance * @public * @return {Object} */ this.getInstance = function () { return instance.rootElement.data("handsontable"); }; (function () { // Create new instance of plugin hooks instance.PluginHooks = new Handsontable.PluginHookClass(); // Upgrade methods to call of global PluginHooks instance var _run = instance.PluginHooks.run , _exe = instance.PluginHooks.execute; instance.PluginHooks.run = function (key, p1, p2, p3, p4, p5) { _run.call(this, instance, key, p1, p2, p3, p4, p5); Handsontable.PluginHooks.run(instance, key, p1, p2, p3, p4, p5); }; instance.PluginHooks.execute = function (key, p1, p2, p3, p4, p5) { var globalHandlerResult = Handsontable.PluginHooks.execute(instance, key, p1, p2, p3, p4, p5); var localHandlerResult = _exe.call(this, instance, key, globalHandlerResult, p2, p3, p4, p5); return typeof localHandlerResult == 'undefined' ? globalHandlerResult : localHandlerResult; }; // Map old API with new methods instance.addHook = function () { instance.PluginHooks.add.apply(instance.PluginHooks, arguments); }; instance.addHookOnce = function () { instance.PluginHooks.once.apply(instance.PluginHooks, arguments); }; instance.removeHook = function () { instance.PluginHooks.remove.apply(instance.PluginHooks, arguments); }; instance.runHooks = function () { instance.PluginHooks.run.apply(instance.PluginHooks, arguments); }; instance.runHooksAndReturn = function () { return instance.PluginHooks.execute.apply(instance.PluginHooks, arguments); }; })(); this.timeouts = {}; /** * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called * @public */ this.registerTimeout = function (key, handle, ms) { clearTimeout(this.timeouts[key]); this.timeouts[key] = setTimeout(handle, ms || 0); }; /** * Clears all known timeouts * @public */ this.clearTimeouts = function () { for (var key in this.timeouts) { if (this.timeouts.hasOwnProperty(key)) { clearTimeout(this.timeouts[key]); } } }; /** * Handsontable version */ this.version = '0.10.0'; //inserted by grunt from package.json }; var DefaultSettings = function () {}; DefaultSettings.prototype = { data: void 0, width: void 0, height: void 0, startRows: 5, startCols: 5, minRows: 0, minCols: 0, maxRows: Infinity, maxCols: Infinity, minSpareRows: 0, minSpareCols: 0, multiSelect: true, fillHandle: true, fixedRowsTop: 0, fixedColumnsLeft: 0, outsideClickDeselects: true, enterBeginsEditing: true, enterMoves: {row: 1, col: 0}, tabMoves: {row: 0, col: 1}, autoWrapRow: false, autoWrapCol: false, copyRowsLimit: 1000, copyColsLimit: 1000, pasteMode: 'overwrite', currentRowClassName: void 0, currentColClassName: void 0, stretchH: 'hybrid', isEmptyRow: void 0, isEmptyCol: void 0, observeDOMVisibility: true, allowInvalid: true, invalidCellClassName: 'htInvalid', placeholderCellClassName: 'htPlaceholder', readOnlyCellClassName: 'htDimmed', fragmentSelection: false, readOnly: false, nativeScrollbars: false, type: 'text', debug: false //shows debug overlays in Walkontable }; Handsontable.DefaultSettings = DefaultSettings; $.fn.handsontable = function (action) { var i , ilen , args , output , userSettings , $this = this.first() // Use only first element from list , instance = $this.data('handsontable'); // Init case if (typeof action !== 'string') { userSettings = action || {}; if (instance) { instance.updateSettings(userSettings); } else { instance = new Handsontable.Core($this, userSettings); $this.data('handsontable', instance); instance.init(); } return $this; } // Action case else { args = []; if (arguments.length > 1) { for (i = 1, ilen = arguments.length; i < ilen; i++) { args.push(arguments[i]); } } if (instance) { if (typeof instance[action] !== 'undefined') { output = instance[action].apply(instance, args); } else { throw new Error('Handsontable do not provide action: ' + action); } } return output; } }; /** * Handsontable TableView constructor * @param {Object} instance */ Handsontable.TableView = function (instance) { var that = this , $window = $(window) , $documentElement = $(document.documentElement); this.instance = instance; this.settings = instance.getSettings(); this.settingsFromDOM = instance.getSettingsFromDOM(); instance.rootElement.data('originalStyle', instance.rootElement[0].getAttribute('style')); //needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions // in IE7 getAttribute('style') returns an object instead of a string, but we only support IE8+ instance.rootElement.addClass('handsontable'); var table = document.createElement('TABLE'); table.className = 'htCore'; this.THEAD = document.createElement('THEAD'); table.appendChild(this.THEAD); this.TBODY = document.createElement('TBODY'); table.appendChild(this.TBODY); instance.$table = $(table); instance.rootElement.prepend(instance.$table); instance.rootElement.on('mousedown.handsontable', function (event) { if (!that.isTextSelectionAllowed(event.target)) { clearTextSelection(); event.preventDefault(); window.focus(); //make sure that window that contains HOT is active. Important when HOT is in iframe. } }); $documentElement.on('keyup.' + instance.guid, function (event) { if (instance.selection.isInProgress() && !event.shiftKey) { instance.selection.finish(); } }); var isMouseDown; $documentElement.on('mouseup.' + instance.guid, function (event) { if (instance.selection.isInProgress() && event.which === 1) { //is left mouse button instance.selection.finish(); } isMouseDown = false; if (instance.autofill.handle && instance.autofill.handle.isDragged) { if (instance.autofill.handle.isDragged > 1) { instance.autofill.apply(); } instance.autofill.handle.isDragged = 0; } if (Handsontable.helper.isOutsideInput(document.activeElement)) { instance.unlisten(); } }); $documentElement.on('mousedown.' + instance.guid, function (event) { var next = event.target; if (next !== that.wt.wtTable.spreader) { //immediate click on "spreader" means click on the right side of vertical scrollbar while (next !== document.documentElement) { if (next === null) { return; //click on something that was a row but now is detached (possibly because your click triggered a rerender) } if (next === instance.rootElement[0] || next.nodeName === 'HANDSONTABLE-TABLE') { return; //click inside container or Web Component (HANDSONTABLE-TABLE is the name of the custom element) } next = next.parentNode; } } if (that.settings.outsideClickDeselects) { instance.deselectCell(); } else { instance.destroyEditor(); } }); instance.rootElement.on('mousedown.handsontable', '.dragdealer', function () { instance.destroyEditor(); }); instance.$table.on('selectstart', function (event) { if (that.settings.fragmentSelection) { return; } //https://github.com/warpech/jquery-handsontable/issues/160 //selectstart is IE only event. Prevent text from being selected when performing drag down in IE8 event.preventDefault(); }); var clearTextSelection = function () { //http://stackoverflow.com/questions/3169786/clear-text-selection-with-javascript if (window.getSelection) { if (window.getSelection().empty) { // Chrome window.getSelection().empty(); } else if (window.getSelection().removeAllRanges) { // Firefox window.getSelection().removeAllRanges(); } } else if (document.selection) { // IE? document.selection.empty(); } }; var walkontableConfig = { debug: function () { return that.settings.debug; }, table: table, stretchH: this.settings.stretchH, data: instance.getDataAtCell, totalRows: instance.countRows, totalColumns: instance.countCols, nativeScrollbars: this.settings.nativeScrollbars, offsetRow: 0, offsetColumn: 0, width: this.getWidth(), height: this.getHeight(), fixedColumnsLeft: function () { return that.settings.fixedColumnsLeft; }, fixedRowsTop: function () { return that.settings.fixedRowsTop; }, rowHeaders: function () { return instance.hasRowHeaders() ? [function (index, TH) { that.appendRowHeader(index, TH); }] : [] }, columnHeaders: function () { return instance.hasColHeaders() ? [function (index, TH) { that.appendColHeader(index, TH); }] : [] }, columnWidth: instance.getColWidth, cellRenderer: function (row, col, TD) { var prop = that.instance.colToProp(col) , cellProperties = that.instance.getCellMeta(row, col) , renderer = that.instance.getCellRenderer(cellProperties); var value = that.instance.getDataAtRowProp(row, prop); renderer(that.instance, TD, row, col, prop, value, cellProperties); that.instance.PluginHooks.run('afterRenderer', TD, row, col, prop, value, cellProperties); }, selections: { current: { className: 'current', border: { width: 2, color: '#5292F7', style: 'solid', cornerVisible: function () { return that.settings.fillHandle && !that.isCellEdited() && !instance.selection.isMultiple() } } }, area: { className: 'area', border: { width: 1, color: '#89AFF9', style: 'solid', cornerVisible: function () { return that.settings.fillHandle && !that.isCellEdited() && instance.selection.isMultiple() } } }, highlight: { highlightRowClassName: that.settings.currentRowClassName, highlightColumnClassName: that.settings.currentColClassName }, fill: { className: 'fill', border: { width: 1, color: 'red', style: 'solid' } } }, hideBorderOnMouseDownOver: function () { return that.settings.fragmentSelection; }, onCellMouseDown: function (event, coords, TD) { instance.listen(); isMouseDown = true; var coordsObj = {row: coords[0], col: coords[1]}; if (event.button === 2 && instance.selection.inInSelection(coordsObj)) { //right mouse button //do nothing } else if (event.shiftKey) { instance.selection.setRangeEnd(coordsObj); } else { instance.selection.setRangeStart(coordsObj); } instance.PluginHooks.run('afterOnCellMouseDown', event, coords, TD); }, /*onCellMouseOut: function (/*event, coords, TD* /) { if (isMouseDown && that.settings.fragmentSelection === 'single') { clearTextSelection(); //otherwise text selection blinks during multiple cells selection } },*/ onCellMouseOver: function (event, coords, TD) { var coordsObj = {row: coords[0], col: coords[1]}; if (isMouseDown) { /*if (that.settings.fragmentSelection === 'single') { clearTextSelection(); //otherwise text selection blinks during multiple cells selection }*/ instance.selection.setRangeEnd(coordsObj); } else if (instance.autofill.handle && instance.autofill.handle.isDragged) { instance.autofill.handle.isDragged++; instance.autofill.showBorder(coords); } instance.PluginHooks.run('afterOnCellMouseOver', event, coords, TD); }, onCellCornerMouseDown: function (event) { instance.autofill.handle.isDragged = 1; event.preventDefault(); instance.PluginHooks.run('afterOnCellCornerMouseDown', event); }, onCellCornerDblClick: function () { instance.autofill.selectAdjacent(); }, beforeDraw: function (force) { that.beforeRender(force); }, onDraw: function(force){ that.onDraw(force); }, onScrollVertically: function () { instance.runHooks('afterScrollVertically'); }, onScrollHorizontally: function () { instance.runHooks('afterScrollHorizontally'); } }; instance.PluginHooks.run('beforeInitWalkontable', walkontableConfig); this.wt = new Walkontable(walkontableConfig); $window.on('resize.' + instance.guid, function () { instance.registerTimeout('resizeTimeout', function () { instance.parseSettingsFromDOM(); var newWidth = that.getWidth(); var newHeight = that.getHeight(); if (walkontableConfig.width !== newWidth || walkontableConfig.height !== newHeight) { instance.forceFullRender = true; that.render(); walkontableConfig.width = newWidth; walkontableConfig.height = newHeight; } }, 60); }); $(that.wt.wtTable.spreader).on('mousedown.handsontable, contextmenu.handsontable', function (event) { if (event.target === that.wt.wtTable.spreader && event.which === 3) { //right mouse button exactly on spreader means right clickon the right hand side of vertical scrollbar event.stopPropagation(); } }); $documentElement.on('click.' + instance.guid, function () { if (that.settings.observeDOMVisibility) { if (that.wt.drawInterrupted) { that.instance.forceFullRender = true; that.render(); } } }); }; Handsontable.TableView.prototype.isTextSelectionAllowed = function (el) { if ( Handsontable.helper.isInput(el) ) { return (true); } if (this.settings.fragmentSelection && this.wt.wtDom.isChildOf(el, this.TBODY)) { return (true); } return false; }; Handsontable.TableView.prototype.isCellEdited = function () { var activeEditor = this.instance.getActiveEditor(); return activeEditor && activeEditor.isOpened(); }; Handsontable.TableView.prototype.getWidth = function () { var val = this.settings.width !== void 0 ? this.settings.width : this.settingsFromDOM.width; return typeof val === 'function' ? val() : val; }; Handsontable.TableView.prototype.getHeight = function () { var val = this.settings.height !== void 0 ? this.settings.height : this.settingsFromDOM.height; return typeof val === 'function' ? val() : val; }; Handsontable.TableView.prototype.beforeRender = function (force) { if (force) { //force = did Walkontable decide to do full render this.instance.PluginHooks.run('beforeRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render? this.wt.update('width', this.getWidth()); this.wt.update('height', this.getHeight()); } }; Handsontable.TableView.prototype.onDraw = function(force){ if (force) { //force = did Walkontable decide to do full render this.instance.PluginHooks.run('afterRender', this.instance.forceFullRender); //this.instance.forceFullRender = did Handsontable request full render? } }; Handsontable.TableView.prototype.render = function () { this.wt.draw(!this.instance.forceFullRender); this.instance.forceFullRender = false; this.instance.rootElement.triggerHandler('render.handsontable'); }; /** * Returns td object given coordinates */ Handsontable.TableView.prototype.getCellAtCoords = function (coords) { var td = this.wt.wtTable.getCell([coords.row, coords.col]); if (td < 0) { //there was an exit code (cell is out of bounds) return null; } else { return td; } }; /** * Scroll viewport to selection * @param coords */ Handsontable.TableView.prototype.scrollViewport = function (coords) { this.wt.scrollViewport([coords.row, coords.col]); }; /** * Append row header to a TH element * @param row * @param TH */ Handsontable.TableView.prototype.appendRowHeader = function (row, TH) { if (row > -1) { this.wt.wtDom.fastInnerHTML(TH, this.instance.getRowHeader(row)); } else { var DIV = document.createElement('DIV'); DIV.className = 'relative'; this.wt.wtDom.fastInnerText(DIV, '\u00A0'); this.wt.wtDom.empty(TH); TH.appendChild(DIV); } }; /** * Append column header to a TH element * @param col * @param TH */ Handsontable.TableView.prototype.appendColHeader = function (col, TH) { var DIV = document.createElement('DIV') , SPAN = document.createElement('SPAN'); DIV.className = 'relative'; SPAN.className = 'colHeader'; this.wt.wtDom.fastInnerHTML(SPAN, this.instance.getColHeader(col)); DIV.appendChild(SPAN); this.wt.wtDom.empty(TH); TH.appendChild(DIV); this.instance.PluginHooks.run('afterGetColHeader', col, TH); }; /** * Given a element's left position relative to the viewport, returns maximum element width until the right edge of the viewport (before scrollbar) * @param {Number} left * @return {Number} */ Handsontable.TableView.prototype.maximumVisibleElementWidth = function (left) { var rootWidth = this.wt.wtViewport.getWorkspaceWidth(); if(this.settings.nativeScrollbars) { return rootWidth; } return rootWidth - left; }; /** * Given a element's top position relative to the viewport, returns maximum element height until the bottom edge of the viewport (before scrollbar) * @param {Number} top * @return {Number} */ Handsontable.TableView.prototype.maximumVisibleElementHeight = function (top) { var rootHeight = this.wt.wtViewport.getWorkspaceHeight(); if(this.settings.nativeScrollbars) { return rootHeight; } return rootHeight - top; }; /** * Utility to register editors and common namespace for keeping reference to all editor classes */ (function (Handsontable) { 'use strict'; function RegisteredEditor(editorClass) { var clazz, instances; instances = {}; clazz = editorClass; this.getInstance = function (hotInstance) { if (!(hotInstance.guid in instances)) { instances[hotInstance.guid] = new clazz(hotInstance); } return instances[hotInstance.guid]; } } var registeredEditorNames = {}; var registeredEditorClasses = new WeakMap(); Handsontable.editors = { /** * Registers editor under given name * @param {String} editorName * @param {Function} editorClass */ registerEditor: function (editorName, editorClass) { var editor = new RegisteredEditor(editorClass); if (typeof editorName === "string") { registeredEditorNames[editorName] = editor; } registeredEditorClasses.set(editorClass, editor); }, /** * Returns instance (singleton) of editor class * @param {String|Function} editorName/editorClass * @returns {Function} editorClass */ getEditor: function (editorName, hotInstance) { var editor; if (typeof editorName == 'function') { if (!(registeredEditorClasses.get(editorName))) { this.registerEditor(null, editorName); } editor = registeredEditorClasses.get(editorName); } else if (typeof editorName == 'string') { editor = registeredEditorNames[editorName]; } else { throw Error('Only strings and functions can be passed as "editor" parameter '); } if (!editor) { throw Error('No editor registered under name "' + editorName + '"'); } return editor.getInstance(hotInstance); } }; })(Handsontable); (function(Handsontable){ 'use strict'; Handsontable.EditorManager = function(instance, priv, selection){ var that = this; var $document = $(document); var keyCodes = Handsontable.helper.keyCode; var activeEditor; var init = function () { function onKeyDown(event) { if (!instance.isListening()) { return; } if (priv.settings.beforeOnKeyDown) { // HOT in HOT Plugin priv.settings.beforeOnKeyDown.call(instance, event); } instance.PluginHooks.run('beforeKeyDown', event); if (!event.isImmediatePropagationStopped()) { priv.lastKeyCode = event.keyCode; if (selection.isSelected()) { var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (!activeEditor.isWaiting()) { if (!Handsontable.helper.isMetaKey(event.keyCode) && !ctrlDown) { that.openEditor(''); event.stopPropagation(); //required by HandsontableEditor return; } } var rangeModifier = event.shiftKey ? selection.setRangeEnd : selection.setRangeStart; switch (event.keyCode) { case keyCodes.A: if (ctrlDown) { selection.selectAll(); //select all cells event.preventDefault(); event.stopPropagation(); break; } case keyCodes.ARROW_UP: if (that.isEditorOpened() && !activeEditor.isWaiting()){ that.closeEditorAndSaveChanges(ctrlDown); } moveSelectionUp(event.shiftKey); event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.ARROW_DOWN: if (that.isEditorOpened() && !activeEditor.isWaiting()){ that.closeEditorAndSaveChanges(ctrlDown); } moveSelectionDown(event.shiftKey); event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.ARROW_RIGHT: if(that.isEditorOpened() && !activeEditor.isWaiting()){ that.closeEditorAndSaveChanges(ctrlDown); } moveSelectionRight(event.shiftKey); event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.ARROW_LEFT: if(that.isEditorOpened() && !activeEditor.isWaiting()){ that.closeEditorAndSaveChanges(ctrlDown); } moveSelectionLeft(event.shiftKey); event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.TAB: var tabMoves = typeof priv.settings.tabMoves === 'function' ? priv.settings.tabMoves(event) : priv.settings.tabMoves; if (event.shiftKey) { selection.transformStart(-tabMoves.row, -tabMoves.col); //move selection left } else { selection.transformStart(tabMoves.row, tabMoves.col, true); //move selection right (add a new column if needed) } event.preventDefault(); event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.BACKSPACE: case keyCodes.DELETE: selection.empty(event); that.prepareEditor(); event.preventDefault(); break; case keyCodes.F2: /* F2 */ that.openEditor(); event.preventDefault(); //prevent Opera from opening Go to Page dialog break; case keyCodes.ENTER: /* return/enter */ if(that.isEditorOpened()){ if (activeEditor.state !== Handsontable.EditorState.WAITING){ that.closeEditorAndSaveChanges(ctrlDown); } moveSelectionAfterEnter(event.shiftKey); } else { if (instance.getSettings().enterBeginsEditing){ that.openEditor(); } else { moveSelectionAfterEnter(event.shiftKey); } } event.preventDefault(); //don't add newline to field event.stopImmediatePropagation(); //required by HandsontableEditor break; case keyCodes.ESCAPE: if(that.isEditorOpened()){ that.closeEditorAndRestoreOriginalValue(ctrlDown); } event.preventDefault(); break; case keyCodes.HOME: if (event.ctrlKey || event.metaKey) { rangeModifier({row: 0, col: priv.selStart.col()}); } else { rangeModifier({row: priv.selStart.row(), col: 0}); } event.preventDefault(); //don't scroll the window event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.END: if (event.ctrlKey || event.metaKey) { rangeModifier({row: instance.countRows() - 1, col: priv.selStart.col()}); } else { rangeModifier({row: priv.selStart.row(), col: instance.countCols() - 1}); } event.preventDefault(); //don't scroll the window event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.PAGE_UP: selection.transformStart(-instance.countVisibleRows(), 0); instance.view.wt.scrollVertical(-instance.countVisibleRows()); instance.view.render(); event.preventDefault(); //don't page up the window event.stopPropagation(); //required by HandsontableEditor break; case keyCodes.PAGE_DOWN: selection.transformStart(instance.countVisibleRows(), 0); instance.view.wt.scrollVertical(instance.countVisibleRows()); instance.view.render(); event.preventDefault(); //don't page down the window event.stopPropagation(); //required by HandsontableEditor break; default: break; } } } } $document.on('keydown.handsontable.' + instance.guid, onKeyDown); function onDblClick() { // that.instance.destroyEditor(); that.openEditor(); } instance.view.wt.update('onCellDblClick', onDblClick); instance.addHook('afterDestroy', function(){ $document.off('keydown.handsontable.' + instance.guid); }); function moveSelectionAfterEnter(shiftKey){ var enterMoves = typeof priv.settings.enterMoves === 'function' ? priv.settings.enterMoves(event) : priv.settings.enterMoves; if (shiftKey) { selection.transformStart(-enterMoves.row, -enterMoves.col); //move selection up } else { selection.transformStart(enterMoves.row, enterMoves.col, true); //move selection down (add a new row if needed) } } function moveSelectionUp(shiftKey){ if (shiftKey) { selection.transformEnd(-1, 0); } else { selection.transformStart(-1, 0); } } function moveSelectionDown(shiftKey){ if (shiftKey) { selection.transformEnd(1, 0); //expanding selection down with shift } else { selection.transformStart(1, 0); //move selection down } } function moveSelectionRight(shiftKey){ if (shiftKey) { selection.transformEnd(0, 1); } else { selection.transformStart(0, 1); } } function moveSelectionLeft(shiftKey){ if (shiftKey) { selection.transformEnd(0, -1); } else { selection.transformStart(0, -1); } } }; /** * Destroy current editor, if exists * @param {Boolean} revertOriginal */ this.destroyEditor = function (revertOriginal) { this.closeEditor(revertOriginal); }; this.getActiveEditor = function () { return activeEditor; }; /** * Prepare text input to be displayed at given grid cell */ this.prepareEditor = function () { if (activeEditor && activeEditor.isWaiting()){ this.closeEditor(false, false, function(dataSaved){ if(dataSaved){ that.prepareEditor(); } }); return; } var row = priv.selStart.row(); var col = priv.selStart.col(); var prop = instance.colToProp(col); var td = instance.getCell(row, col); var originalValue = instance.getDataAtCell(row, col); var cellProperties = instance.getCellMeta(row, col); var editorClass = instance.getCellEditor(cellProperties); activeEditor = Handsontable.editors.getEditor(editorClass, instance); activeEditor.prepare(row, col, prop, td, originalValue, cellProperties); }; this.isEditorOpened = function () { return activeEditor.isOpened(); }; this.openEditor = function (initialValue) { activeEditor.beginEditing(initialValue); }; this.closeEditor = function (restoreOriginalValue, ctrlDown, callback) { if (!activeEditor){ if(callback) { callback(false); } } else { activeEditor.finishEditing(restoreOriginalValue, ctrlDown, callback); } }; this.closeEditorAndSaveChanges = function(ctrlDown){ return this.closeEditor(false, ctrlDown); }; this.closeEditorAndRestoreOriginalValue = function(ctrlDown){ return this.closeEditor(true, ctrlDown); }; init(); }; })(Handsontable); /** * Utility to register renderers and common namespace for keeping reference to all renderers classes */ (function (Handsontable) { 'use strict'; var registeredRenderers = {}; Handsontable.renderers = { /** * Registers renderer under given name * @param {String} rendererName * @param {Function} rendererFunction */ registerRenderer: function (rendererName, rendererFunction) { registeredRenderers[rendererName] = rendererFunction }, /** * @param {String|Function} rendererName/rendererFunction * @returns {Function} rendererFunction */ getRenderer: function (rendererName) { if (typeof rendererName == 'function'){ return rendererName; } if (typeof rendererName != 'string'){ throw Error('Only strings and functions can be passed as "renderer" parameter '); } if (!(rendererName in registeredRenderers)) { throw Error('No editor registered under name "' + rendererName + '"'); } return registeredRenderers[rendererName]; } }; })(Handsontable); /** * DOM helper optimized for maximum performance * It is recommended for Handsontable plugins and renderers, because it is much faster than jQuery * @type {WalkonableDom} */ Handsontable.Dom = new WalkontableDom(); /** * Returns true if keyCode represents a printable character * @param {Number} keyCode * @return {Boolean} */ Handsontable.helper.isPrintableChar = function (keyCode) { return ((keyCode == 32) || //space (keyCode >= 48 && keyCode <= 57) || //0-9 (keyCode >= 96 && keyCode <= 111) || //numpad (keyCode >= 186 && keyCode <= 192) || //;=,-./` (keyCode >= 219 && keyCode <= 222) || //[]{}\|"' keyCode >= 226 || //special chars (229 for Asian chars) (keyCode >= 65 && keyCode <= 90)); //a-z }; Handsontable.helper.isMetaKey = function (keyCode) { var keyCodes = Handsontable.helper.keyCode; var metaKeys = [ keyCodes.ARROW_DOWN, keyCodes.ARROW_UP, keyCodes.ARROW_LEFT, keyCodes.ARROW_RIGHT, keyCodes.HOME, keyCodes.END, keyCodes.DELETE, keyCodes.BACKSPACE, keyCodes.F1, keyCodes.F2, keyCodes.F3, keyCodes.F4, keyCodes.F5, keyCodes.F6, keyCodes.F7, keyCodes.F8, keyCodes.F9, keyCodes.F10, keyCodes.F11, keyCodes.F12, keyCodes.TAB, keyCodes.PAGE_DOWN, keyCodes.PAGE_UP, keyCodes.ENTER, keyCodes.ESCAPE, keyCodes.SHIFT, keyCodes.CAPS_LOCK ]; return metaKeys.indexOf(keyCode) != -1; }; Handsontable.helper.isCtrlKey = function (keyCode) { var keys = Handsontable.helper.keyCode; return [keys.CONTROL_LEFT, 224, keys.COMMAND_LEFT, keys.COMMAND_RIGHT].indexOf(keyCode) != -1; }; /** * Converts a value to string * @param value * @return {String} */ Handsontable.helper.stringify = function (value) { switch (typeof value) { case 'string': case 'number': return value + ''; break; case 'object': if (value === null) { return ''; } else { return value.toString(); } break; case 'undefined': return ''; break; default: return value.toString(); } }; /** * Generates spreadsheet-like column names: A, B, C, ..., Z, AA, AB, etc * @param index * @returns {String} */ Handsontable.helper.spreadsheetColumnLabel = function (index) { var dividend = index + 1; var columnLabel = ''; var modulo; while (dividend > 0) { modulo = (dividend - 1) % 26; columnLabel = String.fromCharCode(65 + modulo) + columnLabel; dividend = parseInt((dividend - modulo) / 26, 10); } return columnLabel; }; /** * Checks if value of n is a numeric one * http://jsperf.com/isnan-vs-isnumeric/4 * @param n * @returns {boolean} */ Handsontable.helper.isNumeric = function (n) { var t = typeof n; return t == 'number' ? !isNaN(n) && isFinite(n) : t == 'string' ? !n.length ? false : n.length == 1 ? /\d/.test(n) : /^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(n) : t == 'object' ? !!n && typeof n.valueOf() == "number" && !(n instanceof Date) : false; }; Handsontable.helper.isArray = function (obj) { return Object.prototype.toString.call(obj).match(/array/i) !== null; }; /** * Checks if child is a descendant of given parent node * http://stackoverflow.com/questions/2234979/how-to-check-in-javascript-if-one-element-is-a-child-of-another * @param parent * @param child * @returns {boolean} */ Handsontable.helper.isDescendant = function (parent, child) { var node = child.parentNode; while (node != null) { if (node == parent) { return true; } node = node.parentNode; } return false; }; /** * Generates a random hex string. Used as namespace for Handsontable instance events. * @return {String} - 16 character random string: "92b1bfc74ec4" */ Handsontable.helper.randomString = function () { return walkontableRandomString(); }; /** * Inherit without without calling parent constructor, and setting `Child.prototype.constructor` to `Child` instead of `Parent`. * Creates temporary dummy function to call it as constructor. * Described in ticket: https://github.com/warpech/jquery-handsontable/pull/516 * @param {Object} Child child class * @param {Object} Parent parent class * @return {Object} extended Child */ Handsontable.helper.inherit = function (Child, Parent) { Parent.prototype.constructor = Parent; Child.prototype = new Parent(); Child.prototype.constructor = Child; return Child; }; /** * Perform shallow extend of a target object with extension's own properties * @param {Object} target An object that will receive the new properties * @param {Object} extension An object containing additional properties to merge into the target */ Handsontable.helper.extend = function (target, extension) { for (var i in extension) { if (extension.hasOwnProperty(i)) { target[i] = extension[i]; } } }; Handsontable.helper.getPrototypeOf = function (obj) { var prototype; if(typeof obj.__proto__ == "object"){ prototype = obj.__proto__; } else { var oldConstructor, constructor = obj.constructor; if (typeof obj.constructor == "function") { oldConstructor = constructor; if (delete obj.constructor){ constructor = obj.constructor; // get real constructor obj.constructor = oldConstructor; // restore constructor } } prototype = constructor ? constructor.prototype : null; // needed for IE } return prototype; }; /** * Factory for columns constructors. * @param {Object} GridSettings * @param {Array} conflictList * @return {Object} ColumnSettings */ Handsontable.helper.columnFactory = function (GridSettings, conflictList) { function ColumnSettings () {} Handsontable.helper.inherit(ColumnSettings, GridSettings); // Clear conflict settings for (var i = 0, len = conflictList.length; i < len; i++) { ColumnSettings.prototype[conflictList[i]] = void 0; } return ColumnSettings; }; Handsontable.helper.translateRowsToColumns = function (input) { var i , ilen , j , jlen , output = [] , olen = 0; for (i = 0, ilen = input.length; i < ilen; i++) { for (j = 0, jlen = input[i].length; j < jlen; j++) { if (j == olen) { output.push([]); olen++; } output[j].push(input[i][j]) } } return output; }; Handsontable.helper.to2dArray = function (arr) { var i = 0 , ilen = arr.length; while (i < ilen) { arr[i] = [arr[i]]; i++; } }; Handsontable.helper.extendArray = function (arr, extension) { var i = 0 , ilen = extension.length; while (i < ilen) { arr.push(extension[i]); i++; } }; /** * Determines if the given DOM element is an input field. * Notice: By 'input' we mean input, textarea and select nodes * @param element - DOM element * @returns {boolean} */ Handsontable.helper.isInput = function (element) { var inputs = ['INPUT', 'SELECT', 'TEXTAREA']; return inputs.indexOf(element.nodeName) > -1; } /** * Determines if the given DOM element is an input field placed OUTSIDE of HOT. * Notice: By 'input' we mean input, textarea and select nodes * @param element - DOM element * @returns {boolean} */ Handsontable.helper.isOutsideInput = function (element) { return Handsontable.helper.isInput(element) && element.className.indexOf('handsontableInput') == -1; }; Handsontable.helper.keyCode = { MOUSE_LEFT: 1, MOUSE_RIGHT: 3, MOUSE_MIDDLE: 2, BACKSPACE: 8, COMMA: 188, DELETE: 46, END: 35, ENTER: 13, ESCAPE: 27, CONTROL_LEFT: 91, COMMAND_LEFT: 17, COMMAND_RIGHT: 93, HOME: 36, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, SPACE: 32, SHIFT: 16, CAPS_LOCK: 20, TAB: 9, ARROW_RIGHT: 39, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_DOWN: 40, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, A: 65, X: 88, C: 67, V: 86 }; /** * Determines whether given object is a plain Object. * Note: String and Array are not plain Objects * @param {*} obj * @returns {boolean} */ Handsontable.helper.isObject = function (obj) { return Object.prototype.toString.call(obj) == '[object Object]'; }; /** * Determines whether given object is an Array. * Note: String is not an Array * @param {*} obj * @returns {boolean} */ Handsontable.helper.isArray = function(obj){ return Array.isArray ? Array.isArray(obj) : Object.prototype.toString.call(obj) == '[object Array]'; }; Handsontable.helper.pivot = function (arr) { var pivotedArr = []; if(!arr || arr.length == 0 || !arr[0] || arr[0].length == 0){ return pivotedArr; } var rowCount = arr.length; var colCount = arr[0].length; for(var i = 0; i < rowCount; i++){ for(var j = 0; j < colCount; j++){ if(!pivotedArr[j]){ pivotedArr[j] = []; } pivotedArr[j][i] = arr[i][j]; } } return pivotedArr; }; Handsontable.helper.proxy = function (fun, context) { return function () { return fun.apply(context, arguments); }; }; Handsontable.helper.cellMethodLookupFactory = function (methodName) { return function cellMethodLookup (row, col) { return (function getMethodFromProperties(properties) { if (!properties){ return; //method not found } else if (properties.hasOwnProperty(methodName) && properties[methodName]) { //check if it is own and is not empty return properties[methodName]; //method defined directly } else if (properties.hasOwnProperty('type') && properties.type) { //check if it is own and is not empty var type; if(typeof properties.type != 'string' ){ throw new Error('Cell type must be a string '); } type = translateTypeNameToObject(properties.type); return type[methodName]; //method defined in type. if does not exist (eg. validator), returns undefined } return getMethodFromProperties(Handsontable.helper.getPrototypeOf(properties)); })(typeof row == 'number' ? this.getCellMeta(row, col) : row); }; function translateTypeNameToObject(typeName) { var type = Handsontable.cellTypes[typeName]; if(typeof type == 'undefined'){ throw new Error('You declared cell type "' + typeName + '" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes'); } return type; } }; Handsontable.SelectionPoint = function () { this._row = null; //private use intended this._col = null; }; Handsontable.SelectionPoint.prototype.exists = function () { return (this._row !== null); }; Handsontable.SelectionPoint.prototype.row = function (val) { if (val !== void 0) { this._row = val; } return this._row; }; Handsontable.SelectionPoint.prototype.col = function (val) { if (val !== void 0) { this._col = val; } return this._col; }; Handsontable.SelectionPoint.prototype.coords = function (coords) { if (coords !== void 0) { this._row = coords.row; this._col = coords.col; } return { row: this._row, col: this._col } }; Handsontable.SelectionPoint.prototype.arr = function (arr) { if (arr !== void 0) { this._row = arr[0]; this._col = arr[1]; } return [this._row, this._col] }; (function (Handsontable) { 'use strict'; /* Adds appropriate CSS class to table cell, based on cellProperties */ Handsontable.renderers.cellDecorator = function (instance, TD, row, col, prop, value, cellProperties) { if (cellProperties.readOnly) { instance.view.wt.wtDom.addClass(TD, cellProperties.readOnlyCellClassName); } if (cellProperties.valid === false && cellProperties.invalidCellClassName) { instance.view.wt.wtDom.addClass(TD, cellProperties.invalidCellClassName); } if (!value && cellProperties.placeholder) { instance.view.wt.wtDom.addClass(TD, cellProperties.placeholderCellClassName); } } })(Handsontable); /** * Default text renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ (function (Handsontable) { 'use strict'; var TextRenderer = function (instance, TD, row, col, prop, value, cellProperties) { Handsontable.renderers.cellDecorator.apply(this, arguments); if (!value && cellProperties.placeholder) { value = cellProperties.placeholder; } var escaped = Handsontable.helper.stringify(value); if (cellProperties.rendererTemplate) { instance.view.wt.wtDom.empty(TD); var TEMPLATE = document.createElement('TEMPLATE'); TEMPLATE.setAttribute('bind', '{{}}'); TEMPLATE.innerHTML = cellProperties.rendererTemplate; HTMLTemplateElement.decorate(TEMPLATE); TEMPLATE.model = instance.getDataAtRow(row); TD.appendChild(TEMPLATE); } else { instance.view.wt.wtDom.fastInnerText(TD, escaped); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips } }; //Handsontable.TextRenderer = TextRenderer; //Left for backward compatibility Handsontable.renderers.TextRenderer = TextRenderer; Handsontable.renderers.registerRenderer('text', TextRenderer); })(Handsontable); (function (Handsontable) { var clonableWRAPPER = document.createElement('DIV'); clonableWRAPPER.className = 'htAutocompleteWrapper'; var clonableARROW = document.createElement('DIV'); clonableARROW.className = 'htAutocompleteArrow'; clonableARROW.appendChild(document.createTextNode('\u25BC')); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips var wrapTdContentWithWrapper = function(TD, WRAPPER){ WRAPPER.innerHTML = TD.innerHTML; Handsontable.Dom.empty(TD); TD.appendChild(WRAPPER); }; /** * Autocomplete renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ var AutocompleteRenderer = function (instance, TD, row, col, prop, value, cellProperties) { var WRAPPER = clonableWRAPPER.cloneNode(true); //this is faster than createElement var ARROW = clonableARROW.cloneNode(true); //this is faster than createElement Handsontable.renderers.TextRenderer(instance, TD, row, col, prop, value, cellProperties); TD.appendChild(ARROW); Handsontable.Dom.addClass(TD, 'htAutocomplete'); if (!TD.firstChild) { //http://jsperf.com/empty-node-if-needed //otherwise empty fields appear borderless in demo/renderers.html (IE) TD.appendChild(document.createTextNode('\u00A0')); //\u00A0 equals &nbsp; for a text node //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips } if (!instance.acArrowListener) { //not very elegant but easy and fast instance.acArrowListener = function () { instance.view.wt.getSetting('onCellDblClick'); }; instance.rootElement.on('mousedown', '.htAutocompleteArrow', instance.acArrowListener); //this way we don't bind event listener to each arrow. We rely on propagation instead } }; Handsontable.AutocompleteRenderer = AutocompleteRenderer; Handsontable.renderers.AutocompleteRenderer = AutocompleteRenderer; Handsontable.renderers.registerRenderer('autocomplete', AutocompleteRenderer); })(Handsontable); /** * Checkbox renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ (function (Handsontable) { 'use strict'; var clonableINPUT = document.createElement('INPUT'); clonableINPUT.className = 'htCheckboxRendererInput'; clonableINPUT.type = 'checkbox'; clonableINPUT.setAttribute('autocomplete', 'off'); var CheckboxRenderer = function (instance, TD, row, col, prop, value, cellProperties) { if (typeof cellProperties.checkedTemplate === "undefined") { cellProperties.checkedTemplate = true; } if (typeof cellProperties.uncheckedTemplate === "undefined") { cellProperties.uncheckedTemplate = false; } instance.view.wt.wtDom.empty(TD); //TODO identify under what circumstances this line can be removed var INPUT = clonableINPUT.cloneNode(false); //this is faster than createElement if (value === cellProperties.checkedTemplate || value === Handsontable.helper.stringify(cellProperties.checkedTemplate)) { INPUT.checked = true; TD.appendChild(INPUT); } else if (value === cellProperties.uncheckedTemplate || value === Handsontable.helper.stringify(cellProperties.uncheckedTemplate)) { TD.appendChild(INPUT); } else if (value === null) { //default value INPUT.className += ' noValue'; TD.appendChild(INPUT); } else { instance.view.wt.wtDom.fastInnerText(TD, '#bad value#'); //this is faster than innerHTML. See: https://github.com/warpech/jquery-handsontable/wiki/JavaScript-&-DOM-performance-tips } var $input = $(INPUT); if (cellProperties.readOnly) { $input.on('click', function (event) { event.preventDefault(); }); } else { $input.on('mousedown', function (event) { event.stopPropagation(); //otherwise can confuse cell mousedown handler }); $input.on('mouseup', function (event) { event.stopPropagation(); //otherwise can confuse cell dblclick handler }); $input.on('change', function(){ if (this.checked) { instance.setDataAtRowProp(row, prop, cellProperties.checkedTemplate); } else { instance.setDataAtRowProp(row, prop, cellProperties.uncheckedTemplate); } }); } if(!instance.CheckboxRenderer || !instance.CheckboxRenderer.beforeKeyDownHookBound){ instance.CheckboxRenderer = { beforeKeyDownHookBound : true }; instance.addHook('beforeKeyDown', function(event){ if(event.keyCode == Handsontable.helper.keyCode.SPACE){ var selection = instance.getSelected(); var cell, checkbox, cellProperties; var selStart = { row: Math.min(selection[0], selection[2]), col: Math.min(selection[1], selection[3]) }; var selEnd = { row: Math.max(selection[0], selection[2]), col: Math.max(selection[1], selection[3]) }; for(var row = selStart.row; row <= selEnd.row; row++ ){ for(var col = selEnd.col; col <= selEnd.col; col++){ cell = instance.getCell(row, col); cellProperties = instance.getCellMeta(row, col); checkbox = cell.querySelectorAll('input[type=checkbox]'); if(checkbox.length > 0 && !cellProperties.readOnly){ if(!event.isImmediatePropagationStopped()){ event.stopImmediatePropagation(); event.preventDefault(); } for(var i = 0, len = checkbox.length; i < len; i++){ checkbox[i].checked = !checkbox[i].checked; $(checkbox[i]).trigger('change'); } } } } } }); } }; Handsontable.CheckboxRenderer = CheckboxRenderer; Handsontable.renderers.CheckboxRenderer = CheckboxRenderer; Handsontable.renderers.registerRenderer('checkbox', CheckboxRenderer); })(Handsontable); /** * Numeric cell renderer * @param {Object} instance Handsontable instance * @param {Element} TD Table cell where to render * @param {Number} row * @param {Number} col * @param {String|Number} prop Row object property name * @param value Value to render (remember to escape unsafe HTML before inserting to DOM!) * @param {Object} cellProperties Cell properites (shared by cell renderer and editor) */ (function (Handsontable) { 'use strict'; var NumericRenderer = function (instance, TD, row, col, prop, value, cellProperties) { if (Handsontable.helper.isNumeric(value)) { if (typeof cellProperties.language !== 'undefined') { numeral.language(cellProperties.language) } value = numeral(value).format(cellProperties.format || '0'); //docs: http://numeraljs.com/ instance.view.wt.wtDom.addClass(TD, 'htNumeric'); } Handsontable.renderers.TextRenderer(instance, TD, row, col, prop, value, cellProperties); }; Handsontable.NumericRenderer = NumericRenderer; //Left for backward compatibility with versions prior 0.10.0 Handsontable.renderers.NumericRenderer = NumericRenderer; Handsontable.renderers.registerRenderer('numeric', NumericRenderer); })(Handsontable); (function(Handosntable){ 'use strict'; var PasswordRenderer = function (instance, TD, row, col, prop, value, cellProperties) { Handsontable.renderers.TextRenderer.apply(this, arguments); value = TD.innerHTML; var hash; var hashLength = cellProperties.hashLength || value.length; var hashSymbol = cellProperties.hashSymbol || '*'; for( hash = ''; hash.split(hashSymbol).length - 1 < hashLength; hash += hashSymbol); instance.view.wt.wtDom.fastInnerHTML(TD, hash); }; Handosntable.PasswordRenderer = PasswordRenderer; Handosntable.renderers.PasswordRenderer = PasswordRenderer; Handosntable.renderers.registerRenderer('password', PasswordRenderer); })(Handsontable); (function (Handsontable) { function HtmlRenderer(instance, TD, row, col, prop, value, cellProperties){ Handsontable.renderers.cellDecorator.apply(this, arguments); Handsontable.Dom.fastInnerHTML(TD, value); } Handsontable.renderers.registerRenderer('html', HtmlRenderer); Handsontable.renderers.HtmlRenderer = HtmlRenderer; })(Handsontable); (function (Handsontable) { 'use strict'; Handsontable.EditorState = { VIRGIN: 'STATE_VIRGIN', //before editing EDITING: 'STATE_EDITING', WAITING: 'STATE_WAITING', //waiting for async validation FINISHED: 'STATE_FINISHED' }; function BaseEditor(instance) { this.instance = instance; this.state = Handsontable.EditorState.VIRGIN; this._opened = false; this._closeCallback = null; this.init(); } BaseEditor.prototype._fireCallbacks = function(result) { if(this._closeCallback){ this._closeCallback(result); this._closeCallback = null; } } BaseEditor.prototype.init = function(){}; BaseEditor.prototype.getValue = function(){ throw Error('Editor getValue() method unimplemented'); }; BaseEditor.prototype.setValue = function(newValue){ throw Error('Editor setValue() method unimplemented'); }; BaseEditor.prototype.open = function(){ throw Error('Editor open() method unimplemented'); }; BaseEditor.prototype.close = function(){ throw Error('Editor close() method unimplemented'); }; BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellProperties){ this.TD = td; this.row = row; this.col = col; this.prop = prop; this.originalValue = originalValue; this.cellProperties = cellProperties; this.state = Handsontable.EditorState.VIRGIN; }; BaseEditor.prototype.extend = function(){ var baseClass = this.constructor; function Editor(){ baseClass.apply(this, arguments); } function inherit(Child, Parent){ function Bridge() { } Bridge.prototype = Parent.prototype; Child.prototype = new Bridge(); Child.prototype.constructor = Child; return Child; } return inherit(Editor, baseClass); }; BaseEditor.prototype.saveValue = function (val, ctrlDown) { if (ctrlDown) { //if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells) var sel = this.instance.getSelected(); this.instance.populateFromArray(sel[0], sel[1], val, sel[2], sel[3], 'edit'); } else { this.instance.populateFromArray(this.row, this.col, val, null, null, 'edit'); } }; BaseEditor.prototype.beginEditing = function(initialValue){ if (this.state != Handsontable.EditorState.VIRGIN) { return; } if (this.cellProperties.readOnly) { return; } this.instance.view.scrollViewport({row: this.row, col: this.col}); this.instance.view.render(); this.state = Handsontable.EditorState.EDITING; initialValue = typeof initialValue == 'string' ? initialValue : this.originalValue; this.setValue(Handsontable.helper.stringify(initialValue)); this.open(); this._opened = true; this.focus(); this.instance.view.render(); //only rerender the selections (FillHandle should disappear when beginediting is triggered) }; BaseEditor.prototype.finishEditing = function (restoreOriginalValue, ctrlDown, callback) { if (callback) { var previousCloseCallback = this._closeCallback; this._closeCallback = function (result) { if(previousCloseCallback){ previousCloseCallback(result); } callback(result); }; } if (this.isWaiting()) { return; } if (this.state == Handsontable.EditorState.VIRGIN) { var that = this; setTimeout(function () { that._fireCallbacks(true); }); return; } if (this.state == Handsontable.EditorState.EDITING) { if (restoreOriginalValue) { this.cancelChanges(); return; } var val = [ [String.prototype.trim.call(this.getValue())] //String.prototype.trim is defined in Walkontable polyfill.js ]; this.state = Handsontable.EditorState.WAITING; this.saveValue(val, ctrlDown); if(this.instance.getCellValidator(this.cellProperties)){ var that = this; this.instance.addHookOnce('afterValidate', function (result) { that.state = Handsontable.EditorState.FINISHED; that.discardEditor(result); }); } else { this.state = Handsontable.EditorState.FINISHED; this.discardEditor(true); } } }; BaseEditor.prototype.cancelChanges = function () { this.state = Handsontable.EditorState.FINISHED; this.discardEditor(); }; BaseEditor.prototype.discardEditor = function (result) { if (this.state !== Handsontable.EditorState.FINISHED) { return; } if (result === false && this.cellProperties.allowInvalid !== true) { //validator was defined and failed this.instance.selectCell(this.row, this.col); this.focus(); this.state = Handsontable.EditorState.EDITING; this._fireCallbacks(false); } else { this.close(); this._opened = false; this.state = Handsontable.EditorState.VIRGIN; this._fireCallbacks(true); } }; BaseEditor.prototype.isOpened = function(){ return this._opened; }; BaseEditor.prototype.isWaiting = function () { return this.state === Handsontable.EditorState.WAITING; }; Handsontable.editors.BaseEditor = BaseEditor; })(Handsontable); (function(Handsontable){ var TextEditor = Handsontable.editors.BaseEditor.prototype.extend(); TextEditor.prototype.init = function(){ this.createElements(); this.bindEvents(); }; TextEditor.prototype.getValue = function(){ return this.TEXTAREA.value }; TextEditor.prototype.setValue = function(newValue){ this.TEXTAREA.value = newValue; }; var onBeforeKeyDown = function onBeforeKeyDown(event){ var instance = this; var that = instance.getActiveEditor(); var keyCodes = Handsontable.helper.keyCode; var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) //Process only events that have been fired in the editor if (event.target !== that.TEXTAREA || event.isImmediatePropagationStopped()){ return; } if (event.keyCode === 17 || event.keyCode === 224 || event.keyCode === 91 || event.keyCode === 93) { //when CTRL or its equivalent is pressed and cell is edited, don't prepare selectable text in textarea event.stopImmediatePropagation(); return; } switch (event.keyCode) { case keyCodes.ARROW_RIGHT: if (that.wtDom.getCaretPosition(that.TEXTAREA) !== that.TEXTAREA.value.length) { event.stopImmediatePropagation(); } break; case keyCodes.ARROW_LEFT: /* arrow left */ if (that.wtDom.getCaretPosition(that.TEXTAREA) !== 0) { event.stopImmediatePropagation(); } break; case keyCodes.ENTER: var selected = that.instance.getSelected(); var isMultipleSelection = !(selected[0] === selected[2] && selected[1] === selected[3]); if ((ctrlDown && !isMultipleSelection) || event.altKey) { //if ctrl+enter or alt+enter, add new line if(that.isOpened()){ that.setValue(that.getValue() + '\n'); that.focus(); } else { that.beginEditing(that.originalValue + '\n') } event.stopImmediatePropagation(); } event.preventDefault(); //don't add newline to field break; case keyCodes.A: case keyCodes.X: case keyCodes.C: case keyCodes.V: if(ctrlDown){ event.stopImmediatePropagation(); //CTRL+A, CTRL+C, CTRL+V, CTRL+X should only work locally when cell is edited (not in table context) break; } case keyCodes.BACKSPACE: case keyCodes.DELETE: case keyCodes.HOME: case keyCodes.END: event.stopImmediatePropagation(); //backspace, delete, home, end should only work locally when cell is edited (not in table context) break; } }; TextEditor.prototype.open = function(){ this.refreshDimensions(); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348 this.instance.addHook('beforeKeyDown', onBeforeKeyDown); }; TextEditor.prototype.close = function(){ this.textareaParentStyle.display = 'none'; if (document.activeElement === this.TEXTAREA) { this.instance.listen(); //don't refocus the table if user focused some cell outside of HT on purpose } this.instance.removeHook('beforeKeyDown', onBeforeKeyDown); }; TextEditor.prototype.focus = function(){ this.TEXTAREA.focus(); this.wtDom.setCaretPosition(this.TEXTAREA, this.TEXTAREA.value.length); }; TextEditor.prototype.createElements = function () { this.$body = $(document.body); this.wtDom = new WalkontableDom(); this.TEXTAREA = document.createElement('TEXTAREA'); this.$textarea = $(this.TEXTAREA); this.wtDom.addClass(this.TEXTAREA, 'handsontableInput'); this.textareaStyle = this.TEXTAREA.style; this.textareaStyle.width = 0; this.textareaStyle.height = 0; this.TEXTAREA_PARENT = document.createElement('DIV'); this.wtDom.addClass(this.TEXTAREA_PARENT, 'handsontableInputHolder'); this.textareaParentStyle = this.TEXTAREA_PARENT.style; this.textareaParentStyle.top = 0; this.textareaParentStyle.left = 0; this.textareaParentStyle.display = 'none'; this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT); var that = this; Handsontable.PluginHooks.add('afterRender', function () { that.instance.registerTimeout('refresh_editor_dimensions', function () { that.refreshDimensions(); }, 0); }); }; TextEditor.prototype.refreshDimensions = function () { if (this.state !== Handsontable.EditorState.EDITING) { return; } ///start prepare textarea position this.TD = this.instance.getCell(this.row, this.col); if (!this.TD) { //TD is outside of the viewport. Otherwise throws exception when scrolling the table while a cell is edited return; } var $td = $(this.TD); //because old td may have been scrolled out with scrollViewport var currentOffset = this.wtDom.offset(this.TD); var containerOffset = this.wtDom.offset(this.instance.rootElement[0]); var scrollTop = this.instance.rootElement.scrollTop(); var scrollLeft = this.instance.rootElement.scrollLeft(); var editTop = currentOffset.top - containerOffset.top + scrollTop - 1; var editLeft = currentOffset.left - containerOffset.left + scrollLeft - 1; var settings = this.instance.getSettings(); var rowHeadersCount = settings.rowHeaders === false ? 0 : 1; var colHeadersCount = settings.colHeaders === false ? 0 : 1; if (editTop < 0) { editTop = 0; } if (editLeft < 0) { editLeft = 0; } if (rowHeadersCount > 0 && parseInt($td.css('border-top-width'), 10) > 0) { editTop += 1; } if (colHeadersCount > 0 && parseInt($td.css('border-left-width'), 10) > 0) { editLeft += 1; } this.textareaParentStyle.top = editTop + 'px'; this.textareaParentStyle.left = editLeft + 'px'; ///end prepare textarea position var width = $td.width() , maxWidth = this.instance.view.maximumVisibleElementWidth(editLeft) - 10 //10 is TEXTAREAs border and padding , height = $td.outerHeight() - 4 , maxHeight = this.instance.view.maximumVisibleElementHeight(editTop) - 5; //10 is TEXTAREAs border and padding if (parseInt($td.css('border-top-width'), 10) > 0) { height -= 1; } if (parseInt($td.css('border-left-width'), 10) > 0) { if (rowHeadersCount > 0) { width -= 1; } } //in future may change to pure JS http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize this.$textarea.autoResize({ minHeight: Math.min(height, maxHeight), maxHeight: maxHeight, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) minWidth: Math.min(width, maxWidth), maxWidth: maxWidth, //TEXTAREA should never be wider than visible part of the viewport (should not cover the scrollbar) animate: false, extraSpace: 0 }); this.textareaParentStyle.display = 'block'; }; TextEditor.prototype.bindEvents = function () { this.$textarea.on('cut.editor', function (event) { event.stopPropagation(); }); this.$textarea.on('paste.editor', function (event) { event.stopPropagation(); }); }; Handsontable.editors.TextEditor = TextEditor; Handsontable.editors.registerEditor('text', Handsontable.editors.TextEditor); })(Handsontable); (function(Handsontable){ //Blank editor, because all the work is done by renderer var CheckboxEditor = Handsontable.editors.BaseEditor.prototype.extend(); CheckboxEditor.prototype.beginEditing = function () { this.saveValue([ [!this.originalValue] ]); }; CheckboxEditor.prototype.finishEditing = function () {}; CheckboxEditor.prototype.init = function () {}; CheckboxEditor.prototype.open = function () {}; CheckboxEditor.prototype.close = function () {}; CheckboxEditor.prototype.getValue = function () {}; CheckboxEditor.prototype.setValue = function () {}; CheckboxEditor.prototype.focus = function () {}; Handsontable.editors.CheckboxEditor = CheckboxEditor; Handsontable.editors.registerEditor('checkbox', CheckboxEditor); })(Handsontable); (function (Handsontable) { var DateEditor = Handsontable.editors.TextEditor.prototype.extend(); DateEditor.prototype.init = function () { if (!$.datepicker) { throw new Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?"); } Handsontable.editors.TextEditor.prototype.init.apply(this, arguments); this.isCellEdited = false; var that = this; this.instance.addHook('afterDestroy', function () { that.destroyElements(); }) }; DateEditor.prototype.createElements = function () { Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments); this.datePicker = document.createElement('DIV'); this.instance.view.wt.wtDom.addClass(this.datePicker, 'htDatepickerHolder'); this.datePickerStyle = this.datePicker.style; this.datePickerStyle.position = 'absolute'; this.datePickerStyle.top = 0; this.datePickerStyle.left = 0; this.datePickerStyle.zIndex = 99; document.body.appendChild(this.datePicker); this.$datePicker = $(this.datePicker); var that = this; var defaultOptions = { dateFormat: "yy-mm-dd", showButtonPanel: true, changeMonth: true, changeYear: true, altField: this.$textarea, onSelect: function () { that.finishEditing(false); } }; this.$datePicker.datepicker(defaultOptions); /** * Prevent recognizing clicking on jQuery Datepicker as clicking outside of table */ this.$datePicker.on('mousedown', function (event) { event.stopPropagation(); }); this.hideDatepicker(); }; DateEditor.prototype.destroyElements = function () { this.$datePicker.datepicker('destroy'); this.$datePicker.remove(); }; DateEditor.prototype.beginEditing = function (row, col, prop, useOriginalValue, suffix) { Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, arguments); this.showDatepicker(); }; DateEditor.prototype.finishEditing = function (isCancelled, ctrlDown) { this.hideDatepicker(); Handsontable.editors.TextEditor.prototype.finishEditing.apply(this, arguments); }; DateEditor.prototype.showDatepicker = function () { var $td = $(this.TD); var offset = $td.offset(); this.datePickerStyle.top = (offset.top + $td.height()) + 'px'; this.datePickerStyle.left = offset.left + 'px'; var dateOptions = { defaultDate: this.originalValue || void 0 }; $.extend(dateOptions, this.cellProperties); this.$datePicker.datepicker("option", dateOptions); if (this.originalValue) { this.$datePicker.datepicker("setDate", this.originalValue); } this.datePickerStyle.display = 'block'; }; DateEditor.prototype.hideDatepicker = function () { this.datePickerStyle.display = 'none'; }; Handsontable.editors.DateEditor = DateEditor; Handsontable.editors.registerEditor('date', DateEditor); })(Handsontable); /** * This is inception. Using Handsontable as Handsontable editor */ (function (Handsontable) { "use strict"; var HandsontableEditor = Handsontable.editors.TextEditor.prototype.extend(); HandsontableEditor.prototype.createElements = function () { Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments); var DIV = document.createElement('DIV'); DIV.className = 'handsontableEditor'; this.TEXTAREA_PARENT.appendChild(DIV); this.$htContainer = $(DIV); this.$htContainer.handsontable(); }; HandsontableEditor.prototype.prepare = function (td, row, col, prop, value, cellProperties) { Handsontable.editors.TextEditor.prototype.prepare.apply(this, arguments); var parent = this; var options = { startRows: 0, startCols: 0, minRows: 0, minCols: 0, className: 'listbox', copyPaste: false, cells: function () { return { readOnly: true } }, fillHandle: false, afterOnCellMouseDown: function () { var value = this.getValue(); if (value !== void 0) { //if the value is undefined then it means we don't want to set the value parent.setValue(value); } parent.instance.destroyEditor(); }, beforeOnKeyDown: function (event) { var instance = this; switch (event.keyCode) { case Handsontable.helper.keyCode.ESCAPE: parent.instance.destroyEditor(true); event.stopImmediatePropagation(); event.preventDefault(); break; case Handsontable.helper.keyCode.ENTER: //enter var sel = instance.getSelected(); var value = this.getDataAtCell(sel[0], sel[1]); if (value !== void 0) { //if the value is undefined then it means we don't want to set the value parent.setValue(value); } parent.instance.destroyEditor(); break; case Handsontable.helper.keyCode.ARROW_UP: if (instance.getSelected() && instance.getSelected()[0] == 0 && !parent.cellProperties.strict){ instance.deselectCell(); parent.instance.listen(); parent.focus(); event.preventDefault(); event.stopImmediatePropagation(); } break; } } }; if (this.cellProperties.handsontable) { options = $.extend(options, cellProperties.handsontable); } this.$htContainer.handsontable('destroy'); this.$htContainer.handsontable(options); }; var onBeforeKeyDown = function (event) { if (event.isImmediatePropagationStopped()) { return; } var editor = this.getActiveEditor(); var innerHOT = editor.$htContainer.handsontable('getInstance'); if (event.keyCode == Handsontable.helper.keyCode.ARROW_DOWN) { if (!innerHOT.getSelected()){ innerHOT.selectCell(0, 0); } else { var selectedRow = innerHOT.getSelected()[0]; var rowToSelect = selectedRow < innerHOT.countRows() - 1 ? selectedRow + 1 : selectedRow; innerHOT.selectCell(rowToSelect, 0); } event.preventDefault(); event.stopImmediatePropagation(); } }; HandsontableEditor.prototype.open = function () { this.instance.addHook('beforeKeyDown', onBeforeKeyDown); Handsontable.editors.TextEditor.prototype.open.apply(this, arguments); this.$htContainer.handsontable('render'); if (this.cellProperties.strict) { this.$htContainer.handsontable('selectCell', 0, 0); this.$textarea[0].style.visibility = 'hidden'; } else { this.$htContainer.handsontable('deselectCell'); this.$textarea[0].style.visibility = 'visible'; } this.wtDom.setCaretPosition(this.$textarea[0], 0, this.$textarea[0].value.length); }; HandsontableEditor.prototype.close = function () { this.instance.removeHook('beforeKeyDown', onBeforeKeyDown); this.instance.listen(); Handsontable.editors.TextEditor.prototype.close.apply(this, arguments); }; HandsontableEditor.prototype.focus = function () { this.instance.listen(); Handsontable.editors.TextEditor.prototype.focus.apply(this, arguments); }; HandsontableEditor.prototype.beginEditing = function (initialValue) { var onBeginEditing = this.instance.getSettings().onBeginEditing; if (onBeginEditing && onBeginEditing() === false) { return; } Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, arguments); }; HandsontableEditor.prototype.finishEditing = function (isCancelled, ctrlDown) { if (this.$htContainer.handsontable('isListening')) { //if focus is still in the HOT editor this.instance.listen(); //return the focus to the parent HOT instance } if (this.$htContainer.handsontable('getSelected')) { var value = this.$htContainer.handsontable('getInstance').getValue(); if (value !== void 0) { //if the value is undefined then it means we don't want to set the value this.setValue(value); } } return Handsontable.editors.TextEditor.prototype.finishEditing.apply(this, arguments); }; Handsontable.editors.HandsontableEditor = HandsontableEditor; Handsontable.editors.registerEditor('handsontable', HandsontableEditor); })(Handsontable); (function (Handsontable) { var AutocompleteEditor = Handsontable.editors.HandsontableEditor.prototype.extend(); AutocompleteEditor.prototype.init = function () { Handsontable.editors.HandsontableEditor.prototype.init.apply(this, arguments); this.query = null; }; AutocompleteEditor.prototype.createElements = function(){ Handsontable.editors.HandsontableEditor.prototype.createElements.apply(this, arguments); this.$htContainer.addClass('autocompleteEditor'); }; AutocompleteEditor.prototype.bindEvents = function(){ var that = this; this.$textarea.on('keydown.autocompleteEditor', function(event){ if(!Handsontable.helper.isMetaKey(event.keyCode) || [Handsontable.helper.keyCode.BACKSPACE, Handsontable.helper.keyCode.DELETE].indexOf(event.keyCode) != -1){ setTimeout(function () { that.queryChoices(that.$textarea.val()); }); } else if (event.keyCode == Handsontable.helper.keyCode.ENTER && that.cellProperties.strict !== true){ that.$htContainer.handsontable('deselectCell'); } }); this.$htContainer.on('mouseenter', function () { that.$htContainer.handsontable('deselectCell'); }); this.$htContainer.on('mouseleave', function () { that.queryChoices(that.query); }); Handsontable.editors.HandsontableEditor.prototype.bindEvents.apply(this, arguments); }; AutocompleteEditor.prototype.beginEditing = function () { Handsontable.editors.HandsontableEditor.prototype.beginEditing.apply(this, arguments); var that = this; setTimeout(function () { that.queryChoices(that.TEXTAREA.value); }); var hot = this.$htContainer.handsontable('getInstance'); hot.updateSettings({ 'colWidths': [this.wtDom.outerWidth(this.TEXTAREA) - 2], afterRenderer: function (TD, row, col, prop, value, cellProperties) { var match = TD.innerHTML.match(new RegExp(that.query, 'i')); if(match){ TD.innerHTML = value.replace(match[0], '<strong>' + match[0] + '</strong>'); } } }); }; var onBeforeKeyDownInner; AutocompleteEditor.prototype.open = function () { var parent = this; onBeforeKeyDownInner = function (event) { var instance = this; if (event.keyCode == Handsontable.helper.keyCode.ARROW_UP){ if (instance.getSelected() && instance.getSelected()[0] == 0){ if(!parent.cellProperties.strict){ instance.deselectCell(); } parent.instance.listen(); parent.focus(); event.preventDefault(); event.stopImmediatePropagation(); } } }; this.$htContainer.handsontable('getInstance').addHook('beforeKeyDown', onBeforeKeyDownInner); Handsontable.editors.HandsontableEditor.prototype.open.apply(this, arguments); this.$textarea[0].style.visibility = 'visible'; parent.focus(); }; AutocompleteEditor.prototype.close = function () { this.$htContainer.handsontable('getInstance').removeHook('beforeKeyDown', onBeforeKeyDownInner); Handsontable.editors.HandsontableEditor.prototype.close.apply(this, arguments); }; AutocompleteEditor.prototype.queryChoices = function(query){ this.query = query; if (typeof this.cellProperties.source == 'function'){ var that = this; this.cellProperties.source(query, function(choices){ that.updateChoicesList(choices) }); } else if (Handsontable.helper.isArray(this.cellProperties.source)) { var choices; if(!query || this.cellProperties.filter === false){ choices = this.cellProperties.source; } else { var queryRegex = new RegExp(query, this.cellProperties.filteringCaseSensitive === true ? '' : 'i'); choices = this.cellProperties.source.filter(function(choice){ return queryRegex.test(choice); }); } this.updateChoicesList(choices) } else { this.updateChoicesList([]); } }; function findItemIndexToHighlight(items, value){ var bestMatch = {}; var valueLength = value.length; var currentItem; var indexOfValue; var charsLeft; for(var i = 0, len = items.length; i < len; i++){ currentItem = items[i]; if(valueLength > 0){ indexOfValue = currentItem.indexOf(value) } else { indexOfValue = currentItem === value ? 0 : -1; } if(indexOfValue == -1) continue; charsLeft = currentItem.length - indexOfValue - valueLength; if( typeof bestMatch.indexOfValue == 'undefined' || bestMatch.indexOfValue > indexOfValue || ( bestMatch.indexOfValue == indexOfValue && bestMatch.charsLeft > charsLeft ) ){ bestMatch.indexOfValue = indexOfValue; bestMatch.charsLeft = charsLeft; bestMatch.index = i; } } return bestMatch.index; } AutocompleteEditor.prototype.updateChoicesList = function (choices) { this.$htContainer.handsontable('loadData', Handsontable.helper.pivot([choices])); var value = this.getValue(); var rowToHighlight; if(this.cellProperties.strict === true){ rowToHighlight = findItemIndexToHighlight(choices, value); if ( typeof rowToHighlight == 'undefined'){ rowToHighlight = 0; } } if(typeof rowToHighlight == 'undefined'){ this.$htContainer.handsontable('deselectCell'); } else { this.$htContainer.handsontable('selectCell', rowToHighlight, 0); } this.focus(); }; Handsontable.editors.AutocompleteEditor = AutocompleteEditor; Handsontable.editors.registerEditor('autocomplete', AutocompleteEditor); })(Handsontable); (function(Handsontable){ var PasswordEditor = Handsontable.editors.TextEditor.prototype.extend(); var wtDom = new WalkontableDom(); PasswordEditor.prototype.createElements = function () { Handsontable.editors.TextEditor.prototype.createElements.apply(this, arguments); this.TEXTAREA = document.createElement('input'); this.TEXTAREA.setAttribute('type', 'password'); this.TEXTAREA.className = 'handsontableInput'; this.textareaStyle = this.TEXTAREA.style; this.textareaStyle.width = 0; this.textareaStyle.height = 0; this.$textarea = $(this.TEXTAREA); wtDom.empty(this.TEXTAREA_PARENT); this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); }; Handsontable.editors.PasswordEditor = PasswordEditor; Handsontable.editors.registerEditor('password', PasswordEditor); })(Handsontable); (function (Handsontable) { var SelectEditor = Handsontable.editors.BaseEditor.prototype.extend(); SelectEditor.prototype.init = function(){ this.select = $('<select />') .addClass('htSelectEditor') .hide(); this.instance.rootElement.append(this.select); }; SelectEditor.prototype.prepare = function(){ Handsontable.editors.BaseEditor.prototype.prepare.apply(this, arguments); var selectOptions = this.cellProperties.selectOptions; var options; if (typeof selectOptions == 'function'){ options = this.prepareOptions(selectOptions(this.row, this.col, this.prop)) } else { options = this.prepareOptions(selectOptions); } var optionElements = []; for (var option in options){ if (options.hasOwnProperty(option)){ var optionElement = $('<option />'); optionElement.val(option); optionElement.html(options[option]); optionElements.push(optionElement); } } this.select.empty(); this.select.append(optionElements); }; SelectEditor.prototype.prepareOptions = function(optionsToPrepare){ var preparedOptions = {}; if (Handsontable.helper.isArray(optionsToPrepare)){ for(var i = 0, len = optionsToPrepare.length; i < len; i++){ preparedOptions[optionsToPrepare[i]] = optionsToPrepare[i]; } } else if (typeof optionsToPrepare == 'object') { preparedOptions = optionsToPrepare; } return preparedOptions; }; SelectEditor.prototype.getValue = function () { return this.select.val(); }; SelectEditor.prototype.setValue = function (value) { this.select.val(value); }; var onBeforeKeyDown = function (event) { var instance = this; var editor = instance.getActiveEditor(); switch (event.keyCode){ case Handsontable.helper.keyCode.ARROW_UP: var previousOption = editor.select.find('option:selected').prev(); if (previousOption.length == 1){ previousOption.prop('selected', true); } event.stopImmediatePropagation(); event.preventDefault(); break; case Handsontable.helper.keyCode.ARROW_DOWN: var nextOption = editor.select.find('option:selected').next(); if (nextOption.length == 1){ nextOption.prop('selected', true); } event.stopImmediatePropagation(); event.preventDefault(); break; } }; SelectEditor.prototype.open = function () { this.select.css({ height: $(this.TD).height(), 'min-width' : $(this.TD).outerWidth() }); this.select.show(); this.select.offset($(this.TD).offset()); this.instance.addHook('beforeKeyDown', onBeforeKeyDown); }; SelectEditor.prototype.close = function () { this.select.hide(); this.instance.removeHook('beforeKeyDown', onBeforeKeyDown); }; SelectEditor.prototype.focus = function () { this.select.focus(); }; Handsontable.editors.SelectEditor = SelectEditor; Handsontable.editors.registerEditor('select', SelectEditor); })(Handsontable); (function (Handsontable) { var DropdownEditor = Handsontable.editors.AutocompleteEditor.prototype.extend(); DropdownEditor.prototype.prepare = function () { Handsontable.editors.AutocompleteEditor.prototype.prepare.apply(this, arguments); this.cellProperties.filter = false; this.cellProperties.strict = true; }; Handsontable.editors.DropdownEditor = DropdownEditor; Handsontable.editors.registerEditor('dropdown', DropdownEditor); })(Handsontable); /** * Numeric cell validator * @param {*} value - Value of edited cell * @param {*} callback - Callback called with validation result */ Handsontable.NumericValidator = function (value, callback) { if (value === null) { value = ''; } callback(/^-?\d*\.?\d*$/.test(value)); }; /** * Function responsible for validation of autocomplete value * @param {*} value - Value of edited cell * @param {*} calback - Callback called with validation result */ var process = function (value, callback) { var originalVal = value; var lowercaseVal = typeof originalVal === 'string' ? originalVal.toLowerCase() : null; return function (source) { var found = false; for (var s = 0, slen = source.length; s < slen; s++) { if (originalVal === source[s]) { found = true; //perfect match break; } else if (lowercaseVal === source[s].toLowerCase()) { // changes[i][3] = source[s]; //good match, fix the case << TODO? found = true; break; } } callback(found); } }; /** * Autocomplete cell validator * @param {*} value - Value of edited cell * @param {*} calback - Callback called with validation result */ Handsontable.AutocompleteValidator = function (value, callback) { if (this.strict && this.source) { typeof this.source === 'function' ? this.source(value, process(value, callback)) : process(value, callback)(this.source); } else { callback(true); } }; /** * Cell type is just a shortcut for setting bunch of cellProperties (used in getCellMeta) */ Handsontable.AutocompleteCell = { editor: Handsontable.editors.AutocompleteEditor, renderer: Handsontable.renderers.AutocompleteRenderer, validator: Handsontable.AutocompleteValidator }; Handsontable.CheckboxCell = { editor: Handsontable.editors.CheckboxEditor, renderer: Handsontable.renderers.CheckboxRenderer }; Handsontable.TextCell = { editor: Handsontable.editors.TextEditor, renderer: Handsontable.renderers.TextRenderer }; Handsontable.NumericCell = { editor: Handsontable.editors.TextEditor, renderer: Handsontable.renderers.NumericRenderer, validator: Handsontable.NumericValidator, dataType: 'number' }; Handsontable.DateCell = { editor: Handsontable.editors.DateEditor, renderer: Handsontable.renderers.AutocompleteRenderer //displays small gray arrow on right side of the cell }; Handsontable.HandsontableCell = { editor: Handsontable.editors.HandsontableEditor, renderer: Handsontable.renderers.AutocompleteRenderer //displays small gray arrow on right side of the cell }; Handsontable.PasswordCell = { editor: Handsontable.editors.PasswordEditor, renderer: Handsontable.renderers.PasswordRenderer }; Handsontable.DropdownCell = { editor: Handsontable.editors.DropdownEditor, renderer: Handsontable.renderers.AutocompleteRenderer, //displays small gray arrow on right side of the cell validator: Handsontable.AutocompleteValidator }; //here setup the friendly aliases that are used by cellProperties.type Handsontable.cellTypes = { text: Handsontable.TextCell, date: Handsontable.DateCell, numeric: Handsontable.NumericCell, checkbox: Handsontable.CheckboxCell, autocomplete: Handsontable.AutocompleteCell, handsontable: Handsontable.HandsontableCell, password: Handsontable.PasswordCell, dropdown: Handsontable.DropdownCell }; //here setup the friendly aliases that are used by cellProperties.renderer and cellProperties.editor Handsontable.cellLookup = { validator: { numeric: Handsontable.NumericValidator, autocomplete: Handsontable.AutocompleteValidator } }; /* * jQuery.fn.autoResize 1.1+ * -- * https://github.com/warpech/jQuery.fn.autoResize * * This fork differs from others in a way that it autoresizes textarea in 2-dimensions (horizontally and vertically). * It was originally forked from alexbardas's repo but maybe should be merged with dpashkevich's repo in future. * * originally forked from: * https://github.com/jamespadolsey/jQuery.fn.autoResize * which is now located here: * https://github.com/alexbardas/jQuery.fn.autoResize * though the mostly maintained for is here: * https://github.com/dpashkevich/jQuery.fn.autoResize/network * * -- * This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ (function($){ autoResize.defaults = { onResize: function(){}, animate: { duration: 200, complete: function(){} }, extraSpace: 50, minHeight: 'original', maxHeight: 500, minWidth: 'original', maxWidth: 500 }; autoResize.cloneCSSProperties = [ 'lineHeight', 'textDecoration', 'letterSpacing', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust', 'padding' ]; autoResize.cloneCSSValues = { position: 'absolute', top: -9999, left: -9999, opacity: 0, overflow: 'hidden', overflowX: 'hidden', overflowY: 'hidden', border: '1px solid black', padding: '0.49em' //this must be about the width of caps W character }; autoResize.resizableFilterSelector = 'textarea,input:not(input[type]),input[type=text],input[type=password]'; autoResize.AutoResizer = AutoResizer; $.fn.autoResize = autoResize; function autoResize(config) { this.filter(autoResize.resizableFilterSelector).each(function(){ new AutoResizer( $(this), config ); }); return this; } function AutoResizer(el, config) { if(this.clones) return; this.config = $.extend({}, autoResize.defaults, config); this.el = el; this.nodeName = el[0].nodeName.toLowerCase(); this.previousScrollTop = null; if (config.maxWidth === 'original') config.maxWidth = el.width(); if (config.minWidth === 'original') config.minWidth = el.width(); if (config.maxHeight === 'original') config.maxHeight = el.height(); if (config.minHeight === 'original') config.minHeight = el.height(); if (this.nodeName === 'textarea') { el.css({ resize: 'none', overflowY: 'none' }); } el.data('AutoResizer', this); this.createClone(); this.injectClone(); this.bind(); } AutoResizer.prototype = { bind: function() { var check = $.proxy(function(){ this.check(); return true; }, this); this.unbind(); this.el .bind('keyup.autoResize', check) //.bind('keydown.autoResize', check) .bind('change.autoResize', check); this.check(null, true); }, unbind: function() { this.el.unbind('.autoResize'); }, createClone: function() { var el = this.el, self = this, config = this.config; this.clones = $(); if (config.minHeight !== 'original' || config.maxHeight !== 'original') { this.hClone = el.clone().height('auto'); this.clones = this.clones.add(this.hClone); } if (config.minWidth !== 'original' || config.maxWidth !== 'original') { this.wClone = $('<div/>').width('auto').css({ whiteSpace: 'nowrap', 'float': 'left' }); this.clones = this.clones.add(this.wClone); } $.each(autoResize.cloneCSSProperties, function(i, p){ self.clones.css(p, el.css(p)); }); this.clones .removeAttr('name') .removeAttr('id') .attr('tabIndex', -1) .css(autoResize.cloneCSSValues) .css('overflowY', 'scroll'); }, check: function(e, immediate) { var config = this.config, wClone = this.wClone, hClone = this.hClone, el = this.el, value = el.val(); if (wClone) { wClone.text(value); // Calculate new width + whether to change var cloneWidth = wClone.outerWidth(), newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ? cloneWidth + config.extraSpace : config.minWidth, currentWidth = el.width(); newWidth = Math.min(newWidth, config.maxWidth); if ( (newWidth < currentWidth && newWidth >= config.minWidth) || (newWidth >= config.minWidth && newWidth <= config.maxWidth) ) { config.onResize.call(el); el.scrollLeft(0); config.animate && !immediate ? el.stop(1,1).animate({ width: newWidth }, config.animate) : el.width(newWidth); } } if (hClone) { if (newWidth) { hClone.width(newWidth); } hClone.height(0).val(value).scrollTop(10000); var scrollTop = hClone[0].scrollTop + config.extraSpace; // Don't do anything if scrollTop hasen't changed: if (this.previousScrollTop === scrollTop) { return; } this.previousScrollTop = scrollTop; if (scrollTop >= config.maxHeight) { scrollTop = config.maxHeight; } if (scrollTop < config.minHeight) { scrollTop = config.minHeight; } if(scrollTop == config.maxHeight && newWidth == config.maxWidth) { el.css('overflowY', 'scroll'); } else { el.css('overflowY', 'hidden'); } config.onResize.call(el); // Either animate or directly apply height: config.animate && !immediate ? el.stop(1,1).animate({ height: scrollTop }, config.animate) : el.height(scrollTop); } }, destroy: function() { this.unbind(); this.el.removeData('AutoResizer'); this.clones.remove(); delete this.el; delete this.hClone; delete this.wClone; delete this.clones; }, injectClone: function() { ( autoResize.cloneContainer || (autoResize.cloneContainer = $('<arclones/>').appendTo('body')) ).empty().append(this.clones); //this should be refactored so that a node is never cloned more than once } }; })(jQuery); /** * SheetClip - Spreadsheet Clipboard Parser * version 0.2 * * This tiny library transforms JavaScript arrays to strings that are pasteable by LibreOffice, OpenOffice, * Google Docs and Microsoft Excel. * * Copyright 2012, Marcin Warpechowski * Licensed under the MIT license. * http://github.com/warpech/sheetclip/ */ /*jslint white: true*/ (function (global) { "use strict"; function countQuotes(str) { return str.split('"').length - 1; } global.SheetClip = { parse: function (str) { var r, rlen, rows, arr = [], a = 0, c, clen, multiline, last; rows = str.split('\n'); if (rows.length > 1 && rows[rows.length - 1] === '') { rows.pop(); } for (r = 0, rlen = rows.length; r < rlen; r += 1) { rows[r] = rows[r].split('\t'); for (c = 0, clen = rows[r].length; c < clen; c += 1) { if (!arr[a]) { arr[a] = []; } if (multiline && c === 0) { last = arr[a].length - 1; arr[a][last] = arr[a][last] + '\n' + rows[r][0]; if (multiline && (countQuotes(rows[r][0]) & 1)) { //& 1 is a bitwise way of performing mod 2 multiline = false; arr[a][last] = arr[a][last].substring(0, arr[a][last].length - 1).replace(/""/g, '"'); } } else { if (c === clen - 1 && rows[r][c].indexOf('"') === 0) { arr[a].push(rows[r][c].substring(1).replace(/""/g, '"')); multiline = true; } else { arr[a].push(rows[r][c].replace(/""/g, '"')); multiline = false; } } } if (!multiline) { a += 1; } } return arr; }, stringify: function (arr) { var r, rlen, c, clen, str = '', val; for (r = 0, rlen = arr.length; r < rlen; r += 1) { for (c = 0, clen = arr[r].length; c < clen; c += 1) { if (c > 0) { str += '\t'; } val = arr[r][c]; if (typeof val === 'string') { if (val.indexOf('\n') > -1) { str += '"' + val.replace(/"/g, '""') + '"'; } else { str += val; } } else if (val === null || val === void 0) { //void 0 resolves to undefined str += ''; } else { str += val; } } str += '\n'; } return str; } }; }(window)); /** * CopyPaste.js * Creates a textarea that stays hidden on the page and gets focused when user presses CTRL while not having a form input focused * In future we may implement a better driver when better APIs are available * @constructor */ var CopyPaste = (function () { var instance; return { getInstance: function () { if (!instance) { instance = new CopyPasteClass(); } else if (instance.hasBeenDestroyed()){ instance.init(); } instance.refCounter++; return instance; } }; })(); function CopyPasteClass() { this.refCounter = 0; this.init(); } CopyPasteClass.prototype.init = function () { var that = this , style , parent; this.copyCallbacks = []; this.cutCallbacks = []; this.pasteCallbacks = []; this.listenerElement = document.documentElement; parent = document.body; if (document.getElementById('CopyPasteDiv')) { this.elDiv = document.getElementById('CopyPasteDiv'); this.elTextarea = this.elDiv.firstChild; } else { this.elDiv = document.createElement('DIV'); this.elDiv.id = 'CopyPasteDiv'; style = this.elDiv.style; style.position = 'fixed'; style.top = 0; style.left = 0; parent.appendChild(this.elDiv); this.elTextarea = document.createElement('TEXTAREA'); this.elTextarea.className = 'copyPaste'; style = this.elTextarea.style; style.width = '1px'; style.height = '1px'; this.elDiv.appendChild(this.elTextarea); if (typeof style.opacity !== 'undefined') { style.opacity = 0; } else { /*@cc_on @if (@_jscript) if(typeof style.filter === 'string') { style.filter = 'alpha(opacity=0)'; } @end @*/ } } this.keydownListener = function (event) { var isCtrlDown = false; if (event.metaKey) { //mac isCtrlDown = true; } else if (event.ctrlKey && navigator.userAgent.indexOf('Mac') === -1) { //pc isCtrlDown = true; } if (isCtrlDown) { if (document.activeElement !== that.elTextarea && (that.getSelectionText() != '' || ['INPUT', 'SELECT', 'TEXTAREA'].indexOf(document.activeElement.nodeName) != -1)) { return; //this is needed by fragmentSelection in Handsontable. Ignore copypaste.js behavior if fragment of cell text is selected } that.selectNodeText(that.elTextarea); setTimeout(function () { that.selectNodeText(that.elTextarea); }, 0); } /* 67 = c * 86 = v * 88 = x */ if (isCtrlDown && (event.keyCode === 67 || event.keyCode === 86 || event.keyCode === 88)) { // that.selectNodeText(that.elTextarea); if (event.keyCode === 88) { //works in all browsers, incl. Opera < 12.12 setTimeout(function () { that.triggerCut(event); }, 0); } else if (event.keyCode === 86) { setTimeout(function () { that.triggerPaste(event); }, 0); } } } this._bindEvent(this.listenerElement, 'keydown', this.keydownListener); }; //http://jsperf.com/textara-selection //http://stackoverflow.com/questions/1502385/how-can-i-make-this-code-work-in-ie CopyPasteClass.prototype.selectNodeText = function (el) { el.select(); }; //http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text CopyPasteClass.prototype.getSelectionText = function () { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; } return text; }; CopyPasteClass.prototype.copyable = function (str) { if (typeof str !== 'string' && str.toString === void 0) { throw new Error('copyable requires string parameter'); } this.elTextarea.value = str; }; /*CopyPasteClass.prototype.onCopy = function (fn) { this.copyCallbacks.push(fn); };*/ CopyPasteClass.prototype.onCut = function (fn) { this.cutCallbacks.push(fn); }; CopyPasteClass.prototype.onPaste = function (fn) { this.pasteCallbacks.push(fn); }; CopyPasteClass.prototype.removeCallback = function (fn) { var i, ilen; for (i = 0, ilen = this.copyCallbacks.length; i < ilen; i++) { if (this.copyCallbacks[i] === fn) { this.copyCallbacks.splice(i, 1); return true; } } for (i = 0, ilen = this.cutCallbacks.length; i < ilen; i++) { if (this.cutCallbacks[i] === fn) { this.cutCallbacks.splice(i, 1); return true; } } for (i = 0, ilen = this.pasteCallbacks.length; i < ilen; i++) { if (this.pasteCallbacks[i] === fn) { this.pasteCallbacks.splice(i, 1); return true; } } return false; }; CopyPasteClass.prototype.triggerCut = function (event) { var that = this; if (that.cutCallbacks) { setTimeout(function () { for (var i = 0, ilen = that.cutCallbacks.length; i < ilen; i++) { that.cutCallbacks[i](event); } }, 50); } }; CopyPasteClass.prototype.triggerPaste = function (event, str) { var that = this; if (that.pasteCallbacks) { setTimeout(function () { var val = (str || that.elTextarea.value).replace(/\n$/, ''); //remove trailing newline for (var i = 0, ilen = that.pasteCallbacks.length; i < ilen; i++) { that.pasteCallbacks[i](val, event); } }, 50); } }; CopyPasteClass.prototype.destroy = function () { if(!this.hasBeenDestroyed() && --this.refCounter == 0){ if (this.elDiv && this.elDiv.parentNode) { this.elDiv.parentNode.removeChild(this.elDiv); } this._unbindEvent(this.listenerElement, 'keydown', this.keydownListener); } }; CopyPasteClass.prototype.hasBeenDestroyed = function () { return !this.refCounter; }; //old version used this: // - http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/ // - http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization //but that cannot work with jQuery.trigger CopyPasteClass.prototype._bindEvent = (function () { if (window.jQuery) { //if jQuery exists, use jQuery event (for compatibility with $.trigger and $.triggerHandler, which can only trigger jQuery events - and we use that in tests) return function (elem, type, cb) { $(elem).on(type + '.copypaste', cb); }; } else { return function (elem, type, cb) { elem.addEventListener(type, cb, false); //sorry, IE8 will only work with jQuery }; } })(); CopyPasteClass.prototype._unbindEvent = (function () { if (window.jQuery) { //if jQuery exists, use jQuery event (for compatibility with $.trigger and $.triggerHandler, which can only trigger jQuery events - and we use that in tests) return function (elem, type, cb) { $(elem).off(type + '.copypaste', cb); }; } else { return function (elem, type, cb) { elem.removeEventListener(type, cb, false); //sorry, IE8 will only work with jQuery }; } })(); // json-patch-duplex.js 0.3.6 // (c) 2013 Joachim Wester // MIT license var jsonpatch; (function (jsonpatch) { var objOps = { add: function (obj, key) { obj[key] = this.value; return true; }, remove: function (obj, key) { delete obj[key]; return true; }, replace: function (obj, key) { obj[key] = this.value; return true; }, move: function (obj, key, tree) { var temp = { op: "_get", path: this.from }; apply(tree, [temp]); apply(tree, [ { op: "remove", path: this.from } ]); apply(tree, [ { op: "add", path: this.path, value: temp.value } ]); return true; }, copy: function (obj, key, tree) { var temp = { op: "_get", path: this.from }; apply(tree, [temp]); apply(tree, [ { op: "add", path: this.path, value: temp.value } ]); return true; }, test: function (obj, key) { return (JSON.stringify(obj[key]) === JSON.stringify(this.value)); }, _get: function (obj, key) { this.value = obj[key]; } }; var arrOps = { add: function (arr, i) { arr.splice(i, 0, this.value); return true; }, remove: function (arr, i) { arr.splice(i, 1); return true; }, replace: function (arr, i) { arr[i] = this.value; return true; }, move: objOps.move, copy: objOps.copy, test: objOps.test, _get: objOps._get }; var observeOps = { add: function (patches, path) { var patch = { op: "add", path: path + escapePathComponent(this.name), value: this.object[this.name] }; patches.push(patch); }, 'delete': function (patches, path) { var patch = { op: "remove", path: path + escapePathComponent(this.name) }; patches.push(patch); }, update: function (patches, path) { var patch = { op: "replace", path: path + escapePathComponent(this.name), value: this.object[this.name] }; patches.push(patch); } }; function escapePathComponent(str) { if (str.indexOf('/') === -1 && str.indexOf('~') === -1) return str; return str.replace(/~/g, '~0').replace(/\//g, '~1'); } function _getPathRecursive(root, obj) { var found; for (var key in root) { if (root.hasOwnProperty(key)) { if (root[key] === obj) { return escapePathComponent(key) + '/'; } else if (typeof root[key] === 'object') { found = _getPathRecursive(root[key], obj); if (found != '') { return escapePathComponent(key) + '/' + found; } } } } return ''; } function getPath(root, obj) { if (root === obj) { return '/'; } var path = _getPathRecursive(root, obj); if (path === '') { throw new Error("Object not found in root"); } return '/' + path; } var beforeDict = []; jsonpatch.intervals; var Mirror = (function () { function Mirror(obj) { this.observers = []; this.obj = obj; } return Mirror; })(); var ObserverInfo = (function () { function ObserverInfo(callback, observer) { this.callback = callback; this.observer = observer; } return ObserverInfo; })(); function getMirror(obj) { for (var i = 0, ilen = beforeDict.length; i < ilen; i++) { if (beforeDict[i].obj === obj) { return beforeDict[i]; } } } function getObserverFromMirror(mirror, callback) { for (var j = 0, jlen = mirror.observers.length; j < jlen; j++) { if (mirror.observers[j].callback === callback) { return mirror.observers[j].observer; } } } function removeObserverFromMirror(mirror, observer) { for (var j = 0, jlen = mirror.observers.length; j < jlen; j++) { if (mirror.observers[j].observer === observer) { mirror.observers.splice(j, 1); return; } } } function unobserve(root, observer) { generate(observer); if (Object.observe) { _unobserve(observer, root); } else { clearTimeout(observer.next); } var mirror = getMirror(root); removeObserverFromMirror(mirror, observer); } jsonpatch.unobserve = unobserve; function observe(obj, callback) { var patches = []; var root = obj; var observer; var mirror = getMirror(obj); if (!mirror) { mirror = new Mirror(obj); beforeDict.push(mirror); } else { observer = getObserverFromMirror(mirror, callback); } if (observer) { return observer; } if (Object.observe) { observer = function (arr) { //This "refresh" is needed to begin observing new object properties _unobserve(observer, obj); _observe(observer, obj); var a = 0, alen = arr.length; while (a < alen) { if (!(arr[a].name === 'length' && _isArray(arr[a].object)) && !(arr[a].name === '__Jasmine_been_here_before__')) { var type = arr[a].type; switch (type) { case 'new': type = 'add'; break; case 'deleted': type = 'delete'; break; case 'updated': type = 'update'; break; } observeOps[type].call(arr[a], patches, getPath(root, arr[a].object)); } a++; } if (patches) { if (callback) { callback(patches); } } observer.patches = patches; patches = []; }; } else { observer = {}; mirror.value = JSON.parse(JSON.stringify(obj)); if (callback) { //callbacks.push(callback); this has no purpose observer.callback = callback; observer.next = null; var intervals = this.intervals || [100, 1000, 10000, 60000]; var currentInterval = 0; var dirtyCheck = function () { generate(observer); }; var fastCheck = function () { clearTimeout(observer.next); observer.next = setTimeout(function () { dirtyCheck(); currentInterval = 0; observer.next = setTimeout(slowCheck, intervals[currentInterval++]); }, 0); }; var slowCheck = function () { dirtyCheck(); if (currentInterval == intervals.length) currentInterval = intervals.length - 1; observer.next = setTimeout(slowCheck, intervals[currentInterval++]); }; if (typeof window !== 'undefined') { if (window.addEventListener) { window.addEventListener('mousedown', fastCheck); window.addEventListener('mouseup', fastCheck); window.addEventListener('keydown', fastCheck); } else { window.attachEvent('onmousedown', fastCheck); window.attachEvent('onmouseup', fastCheck); window.attachEvent('onkeydown', fastCheck); } } observer.next = setTimeout(slowCheck, intervals[currentInterval++]); } } observer.patches = patches; observer.object = obj; mirror.observers.push(new ObserverInfo(callback, observer)); return _observe(observer, obj); } jsonpatch.observe = observe; /// Listen to changes on an object tree, accumulate patches function _observe(observer, obj) { if (Object.observe) { Object.observe(obj, observer); for (var key in obj) { if (obj.hasOwnProperty(key)) { var v = obj[key]; if (v && typeof (v) === "object") { _observe(observer, v); } } } } return observer; } function _unobserve(observer, obj) { if (Object.observe) { Object.unobserve(obj, observer); for (var key in obj) { if (obj.hasOwnProperty(key)) { var v = obj[key]; if (v && typeof (v) === "object") { _unobserve(observer, v); } } } } return observer; } function generate(observer) { if (Object.observe) { Object.deliverChangeRecords(observer); } else { var mirror; for (var i = 0, ilen = beforeDict.length; i < ilen; i++) { if (beforeDict[i].obj === observer.object) { mirror = beforeDict[i]; break; } } _generate(mirror.value, observer.object, observer.patches, ""); } var temp = observer.patches; if (temp.length > 0) { observer.patches = []; if (observer.callback) { observer.callback(temp); } } return temp; } jsonpatch.generate = generate; var _objectKeys; if (Object.keys) { _objectKeys = Object.keys; } else { _objectKeys = function (obj) { var keys = []; for (var o in obj) { if (obj.hasOwnProperty(o)) { keys.push(o); } } return keys; }; } // Dirty check if obj is different from mirror, generate patches and update mirror function _generate(mirror, obj, patches, path) { var newKeys = _objectKeys(obj); var oldKeys = _objectKeys(mirror); var changed = false; var deleted = false; for (var t = oldKeys.length - 1; t >= 0; t--) { var key = oldKeys[t]; var oldVal = mirror[key]; if (obj.hasOwnProperty(key)) { var newVal = obj[key]; if (oldVal instanceof Object) { _generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key)); } else { if (oldVal != newVal) { changed = true; patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: newVal }); mirror[key] = newVal; } } } else { patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) }); delete mirror[key]; deleted = true; } } if (!deleted && newKeys.length == oldKeys.length) { return; } for (var t = 0; t < newKeys.length; t++) { var key = newKeys[t]; if (!mirror.hasOwnProperty(key)) { patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: obj[key] }); mirror[key] = JSON.parse(JSON.stringify(obj[key])); } } } var _isArray; if (Array.isArray) { _isArray = Array.isArray; } else { _isArray = function (obj) { return obj.push && typeof obj.length === 'number'; }; } /// Apply a json-patch operation on an object tree function apply(tree, patches) { var result = false, p = 0, plen = patches.length, patch; while (p < plen) { patch = patches[p]; // Find the object var keys = patch.path.split('/'); var obj = tree; var t = 1; var len = keys.length; while (true) { if (_isArray(obj)) { var index = parseInt(keys[t], 10); t++; if (t >= len) { result = arrOps[patch.op].call(patch, obj, index, tree); break; } obj = obj[index]; } else { var key = keys[t]; if (key.indexOf('~') != -1) key = key.replace(/~1/g, '/').replace(/~0/g, '~'); t++; if (t >= len) { result = objOps[patch.op].call(patch, obj, key, tree); break; } obj = obj[key]; } } p++; } return result; } jsonpatch.apply = apply; })(jsonpatch || (jsonpatch = {})); if (typeof exports !== "undefined") { exports.apply = jsonpatch.apply; exports.observe = jsonpatch.observe; exports.unobserve = jsonpatch.unobserve; exports.generate = jsonpatch.generate; } Handsontable.PluginHookClass = (function () { var Hooks = function () { return { // Hooks beforeInitWalkontable: [], beforeInit: [], beforeRender: [], beforeChange: [], beforeRemoveCol: [], beforeRemoveRow: [], beforeValidate: [], beforeGet: [], beforeSet: [], beforeGetCellMeta: [], beforeAutofill: [], beforeKeyDown: [], beforeColumnSort: [], afterInit : [], afterLoadData : [], afterUpdateSettings: [], afterRender : [], afterRenderer : [], afterChange : [], afterValidate: [], afterGetCellMeta: [], afterGetColHeader: [], afterGetColWidth: [], afterDestroy: [], afterRemoveRow: [], afterCreateRow: [], afterRemoveCol: [], afterCreateCol: [], afterColumnResize: [], afterColumnMove: [], afterColumnSort: [], afterDeselect: [], afterSelection: [], afterSelectionByProp: [], afterSelectionEnd: [], afterSelectionEndByProp: [], afterCopyLimit: [], afterOnCellMouseDown: [], afterOnCellMouseOver: [], afterOnCellCornerMouseDown: [], afterScrollVertically: [], afterScrollHorizontally: [], // Modifiers modifyCol: [] } }; var legacy = { onBeforeChange: "beforeChange", onChange: "afterChange", onCreateRow: "afterCreateRow", onCreateCol: "afterCreateCol", onSelection: "afterSelection", onCopyLimit: "afterCopyLimit", onSelectionEnd: "afterSelectionEnd", onSelectionByProp: "afterSelectionByProp", onSelectionEndByProp: "afterSelectionEndByProp" }; function PluginHookClass() { this.hooks = Hooks(); this.legacy = legacy; } PluginHookClass.prototype.add = function (key, fn) { // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } if (typeof this.hooks[key] === "undefined") { this.hooks[key] = []; } if (Handsontable.helper.isArray(fn)) { for (var i = 0, len = fn.length; i < len; i++) { this.hooks[key].push(fn[i]); } } else { if (this.hooks[key].indexOf(fn) > -1) { throw new Error("Seems that you are trying to set the same plugin hook twice (" + key + ", " + fn + ")"); //error here should help writing bug-free plugins } this.hooks[key].push(fn); } return this; }; PluginHookClass.prototype.once = function(key, fn){ if(Handsontable.helper.isArray(fn)){ for(var i = 0, len = fn.length; i < len; i++){ fn[i].runOnce = true; this.add(key, fn[i]); } } else { fn.runOnce = true; this.add(key, fn); } }; PluginHookClass.prototype.remove = function (key, fn) { var status = false; // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } if (typeof this.hooks[key] !== 'undefined') { for (var i = 0, leni = this.hooks[key].length; i < leni; i++) { if (this.hooks[key][i] == fn) { delete this.hooks[key][i].runOnce; this.hooks[key].splice(i, 1); status = true; break; } } } return status; }; PluginHookClass.prototype.run = function (instance, key, p1, p2, p3, p4, p5) { // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } //performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture if (typeof this.hooks[key] !== 'undefined') { //Make a copy of handler array var handlers = Array.prototype.slice.call(this.hooks[key]); for (var i = 0, leni = handlers.length; i < leni; i++) { handlers[i].call(instance, p1, p2, p3, p4, p5); if(handlers[i].runOnce){ this.remove(key, handlers[i]); } } } }; PluginHookClass.prototype.execute = function (instance, key, p1, p2, p3, p4, p5) { var res, handlers; // provide support for old versions of HOT if (key in legacy) { key = legacy[key]; } //performance considerations - http://jsperf.com/call-vs-apply-for-a-plugin-architecture if (typeof this.hooks[key] !== 'undefined') { handlers = Array.prototype.slice.call(this.hooks[key]); for (var i = 0, leni = handlers.length; i < leni; i++) { res = handlers[i].call(instance, p1, p2, p3, p4, p5); if (res !== void 0) { p1 = res; } if(handlers[i].runOnce){ this.remove(key, handlers[i]); } if(res === false){ //if any handler returned false return false; //event has been cancelled and further execution of handler queue is being aborted } } } return p1; }; return PluginHookClass; })(); Handsontable.PluginHooks = new Handsontable.PluginHookClass(); (function (Handsontable) { function HandsontableAutoColumnSize() { var plugin = this , sampleCount = 5; //number of samples to take of each value length this.beforeInit = function () { var instance = this; instance.autoColumnWidths = []; if (instance.getSettings().autoColumnSize !== false) { if (!instance.autoColumnSizeTmp) { instance.autoColumnSizeTmp = { table: null, tableStyle: null, theadTh: null, tbody: null, container: null, containerStyle: null, determineBeforeNextRender: true }; instance.addHook('beforeRender', htAutoColumnSize.determineIfChanged); instance.addHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.addHook('afterDestroy', htAutoColumnSize.afterDestroy); instance.determineColumnWidth = plugin.determineColumnWidth; } } else { if (instance.autoColumnSizeTmp) { instance.removeHook('beforeRender', htAutoColumnSize.determineIfChanged); instance.removeHook('afterGetColWidth', htAutoColumnSize.getColWidth); instance.removeHook('afterDestroy', htAutoColumnSize.afterDestroy); delete instance.determineColumnWidth; plugin.afterDestroy.call(instance); } } }; this.determineIfChanged = function (force) { if (force) { htAutoColumnSize.determineColumnsWidth.apply(this, arguments); } }; this.determineColumnWidth = function (col) { var instance = this , tmp = instance.autoColumnSizeTmp; if (!tmp.container) { createTmpContainer.call(tmp, instance); } tmp.container.className = instance.rootElement[0].className + ' htAutoColumnSize'; tmp.table.className = instance.$table[0].className; var rows = instance.countRows(); var samples = {}; var maxLen = 0; for (var r = 0; r < rows; r++) { var value = Handsontable.helper.stringify(instance.getDataAtCell(r, col)); var len = value.length; if (len > maxLen) { maxLen = len; } if (!samples[len]) { samples[len] = { needed: sampleCount, strings: [] }; } if (samples[len].needed) { samples[len].strings.push({value: value, row: r}); samples[len].needed--; } } var settings = instance.getSettings(); if (settings.colHeaders) { instance.view.appendColHeader(col, tmp.theadTh); //TH innerHTML } instance.view.wt.wtDom.empty(tmp.tbody); var cellProperties = instance.getCellMeta(0, col); var renderer = instance.getCellRenderer(cellProperties); for (var i in samples) { if (samples.hasOwnProperty(i)) { for (var j = 0, jlen = samples[i].strings.length; j < jlen; j++) { var tr = document.createElement('tr'); var td = document.createElement('td'); renderer(instance, td, samples[i].strings[j].row, col, instance.colToProp(col), samples[i].strings[j].value, cellProperties); r++; tr.appendChild(td); tmp.tbody.appendChild(tr); } } } var parent = instance.rootElement[0].parentNode; parent.appendChild(tmp.container); var width = instance.view.wt.wtDom.outerWidth(tmp.table); parent.removeChild(tmp.container); if (!settings.nativeScrollbars) { //with native scrollbars a cell size can safely exceed the width of the viewport var maxWidth = instance.view.wt.wtViewport.getViewportWidth() - 2; //2 is some overhead for cell border if (width > maxWidth) { width = maxWidth; } } return width; }; this.determineColumnsWidth = function () { var instance = this; var settings = this.getSettings(); if (settings.autoColumnSize || !settings.colWidths) { var cols = this.countCols(); for (var c = 0; c < cols; c++) { if (!instance._getColWidthFromSettings(c)) { this.autoColumnWidths[c] = plugin.determineColumnWidth.call(instance, c); } } } }; this.getColWidth = function (col, response) { if (this.autoColumnWidths[col] && this.autoColumnWidths[col] > response.width) { response.width = this.autoColumnWidths[col]; } }; this.afterDestroy = function () { var instance = this; if (instance.autoColumnSizeTmp && instance.autoColumnSizeTmp.container && instance.autoColumnSizeTmp.container.parentNode) { instance.autoColumnSizeTmp.container.parentNode.removeChild(instance.autoColumnSizeTmp.container); } instance.autoColumnSizeTmp = null; }; function createTmpContainer(instance) { var d = document , tmp = this; tmp.table = d.createElement('table'); tmp.theadTh = d.createElement('th'); tmp.table.appendChild(d.createElement('thead')).appendChild(d.createElement('tr')).appendChild(tmp.theadTh); tmp.tableStyle = tmp.table.style; tmp.tableStyle.tableLayout = 'auto'; tmp.tableStyle.width = 'auto'; tmp.tbody = d.createElement('tbody'); tmp.table.appendChild(tmp.tbody); tmp.container = d.createElement('div'); tmp.container.className = instance.rootElement[0].className + ' hidden'; tmp.containerStyle = tmp.container.style; tmp.container.appendChild(tmp.table); } } var htAutoColumnSize = new HandsontableAutoColumnSize(); Handsontable.PluginHooks.add('beforeInit', htAutoColumnSize.beforeInit); Handsontable.PluginHooks.add('afterUpdateSettings', htAutoColumnSize.beforeInit); })(Handsontable); /** * This plugin sorts the view by a column (but does not sort the data source!) * @constructor */ function HandsontableColumnSorting() { var plugin = this; this.init = function (source) { var instance = this; var sortingSettings = instance.getSettings().columnSorting; var sortingColumn, sortingOrder; instance.sortingEnabled = !!(sortingSettings); if (instance.sortingEnabled) { instance.sortIndex = []; var loadedSortingState = loadSortingState.call(instance); if (typeof loadedSortingState != 'undefined') { sortingColumn = loadedSortingState.sortColumn; sortingOrder = loadedSortingState.sortOrder; } else { sortingColumn = sortingSettings.column; sortingOrder = sortingSettings.sortOrder; } plugin.sortByColumn.call(instance, sortingColumn, sortingOrder); instance.sort = function(){ var args = Array.prototype.slice.call(arguments); return plugin.sortByColumn.apply(instance, args) }; if (typeof instance.getSettings().observeChanges == 'undefined'){ enableObserveChangesPlugin.call(instance); } if (source == 'afterInit') { bindColumnSortingAfterClick.call(instance); instance.addHook('afterCreateRow', plugin.afterCreateRow); instance.addHook('afterRemoveRow', plugin.afterRemoveRow); instance.addHook('afterLoadData', plugin.init); } } else { delete instance.sort; instance.removeHook('afterCreateRow', plugin.afterCreateRow); instance.removeHook('afterRemoveRow', plugin.afterRemoveRow); instance.removeHook('afterLoadData', plugin.init); } }; this.setSortingColumn = function (col, order) { var instance = this; if (typeof col == 'undefined') { delete instance.sortColumn; delete instance.sortOrder; return; } else if (instance.sortColumn === col && typeof order == 'undefined') { instance.sortOrder = !instance.sortOrder; } else { instance.sortOrder = typeof order != 'undefined' ? order : true; } instance.sortColumn = col; }; this.sortByColumn = function (col, order) { var instance = this; plugin.setSortingColumn.call(instance, col, order); if(typeof instance.sortColumn == 'undefined'){ return; } instance.PluginHooks.run('beforeColumnSort', instance.sortColumn, instance.sortOrder); plugin.sort.call(instance); instance.render(); saveSortingState.call(instance); instance.PluginHooks.run('afterColumnSort', instance.sortColumn, instance.sortOrder); }; var saveSortingState = function () { var instance = this; var sortingState = {}; if (typeof instance.sortColumn != 'undefined') { sortingState.sortColumn = instance.sortColumn; } if (typeof instance.sortOrder != 'undefined') { sortingState.sortOrder = instance.sortOrder; } if (sortingState.hasOwnProperty('sortColumn') || sortingState.hasOwnProperty('sortOrder')) { instance.PluginHooks.run('persistentStateSave', 'columnSorting', sortingState); } }; var loadSortingState = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'columnSorting', storedState); return storedState.value; }; var bindColumnSortingAfterClick = function () { var instance = this; instance.rootElement.on('click.handsontable', '.columnSorting', function (e) { if (instance.view.wt.wtDom.hasClass(e.target, 'columnSorting')) { var col = getColumn(e.target); plugin.sortByColumn.call(instance, col); } }); function countRowHeaders() { var THs = instance.view.TBODY.querySelector('tr').querySelectorAll('th'); return THs.length; } function getColumn(target) { var TH = instance.view.wt.wtDom.closest(target, 'TH'); return instance.view.wt.wtDom.index(TH) - countRowHeaders(); } }; function enableObserveChangesPlugin () { var instance = this; instance.registerTimeout('enableObserveChanges', function(){ instance.updateSettings({ observeChanges: true }); }, 0); } function defaultSort(sortOrder) { return function (a, b) { if (a[1] === b[1]) { return 0; } if (a[1] === null) { return 1; } if (b[1] === null) { return -1; } if (a[1] < b[1]) return sortOrder ? -1 : 1; if (a[1] > b[1]) return sortOrder ? 1 : -1; return 0; } } function dateSort(sortOrder) { return function (a, b) { if (a[1] === b[1]) { return 0; } if (a[1] === null) { return 1; } if (b[1] === null) { return -1; } var aDate = new Date(a[1]); var bDate = new Date(b[1]); if (aDate < bDate) return sortOrder ? -1 : 1; if (aDate > bDate) return sortOrder ? 1 : -1; return 0; } } this.sort = function () { var instance = this; if (typeof instance.sortOrder == 'undefined') { return; } instance.sortingEnabled = false; //this is required by translateRow plugin hook instance.sortIndex.length = 0; var colOffset = this.colOffset(); for (var i = 0, ilen = this.countRows() - instance.getSettings()['minSpareRows']; i < ilen; i++) { this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]); } var colMeta = instance.getCellMeta(0, instance.sortColumn); var sortFunction; switch (colMeta.type) { case 'date': sortFunction = dateSort; break; default: sortFunction = defaultSort; } this.sortIndex.sort(sortFunction(instance.sortOrder)); //Append spareRows for(var i = this.sortIndex.length; i < instance.countRows(); i++){ this.sortIndex.push([i, instance.getDataAtCell(i, this.sortColumn + colOffset)]); } instance.sortingEnabled = true; //this is required by translateRow plugin hook }; this.translateRow = function (row) { var instance = this; if (instance.sortingEnabled && instance.sortIndex && instance.sortIndex.length && instance.sortIndex[row]) { return instance.sortIndex[row][0]; } return row; }; this.onBeforeGetSet = function (getVars) { var instance = this; getVars.row = plugin.translateRow.call(instance, getVars.row); }; this.untranslateRow = function (row) { var instance = this; if (instance.sortingEnabled && instance.sortIndex && instance.sortIndex.length) { for (var i = 0; i < instance.sortIndex.length; i++) { if (instance.sortIndex[i][0] == row) { return i; } } } }; this.getColHeader = function (col, TH) { if (this.getSettings().columnSorting) { this.view.wt.wtDom.addClass(TH.querySelector('.colHeader'), 'columnSorting'); } }; function isSorted(instance){ return typeof instance.sortColumn != 'undefined'; } this.afterCreateRow = function(index, amount){ var instance = this; if(!isSorted(instance)){ return; } for(var i = 0; i < instance.sortIndex.length; i++){ if (instance.sortIndex[i][0] >= index){ instance.sortIndex[i][0] += amount; } } for(var i=0; i < amount; i++){ instance.sortIndex.splice(index+i, 0, [index+i, instance.getData()[index+i][instance.sortColumn + instance.colOffset()]]); } saveSortingState.call(instance); }; this.afterRemoveRow = function(index, amount){ var instance = this; if(!isSorted(instance)){ return; } var physicalRemovedIndex = plugin.untranslateRow.call(instance, index); instance.sortIndex.splice(index, amount); for(var i = 0; i < instance.sortIndex.length; i++){ if (instance.sortIndex[i][0] > physicalRemovedIndex){ instance.sortIndex[i][0] -= amount; } } saveSortingState.call(instance); }; this.afterChangeSort = function (changes/*, source*/) { var instance = this; var sortColumnChanged = false; var selection = {}; if (!changes) { return; } for (var i = 0; i < changes.length; i++) { if (changes[i][1] == instance.sortColumn) { sortColumnChanged = true; selection.row = plugin.translateRow.call(instance, changes[i][0]); selection.col = changes[i][1]; break; } } if (sortColumnChanged) { setTimeout(function () { plugin.sort.call(instance); instance.render(); instance.selectCell(plugin.untranslateRow.call(instance, selection.row), selection.col); }, 0); } }; } var htSortColumn = new HandsontableColumnSorting(); Handsontable.PluginHooks.add('afterInit', function () { htSortColumn.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htSortColumn.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('beforeGet', htSortColumn.onBeforeGetSet); Handsontable.PluginHooks.add('beforeSet', htSortColumn.onBeforeGetSet); Handsontable.PluginHooks.add('afterGetColHeader', htSortColumn.getColHeader); (function (Handsontable) { 'use strict'; function ContextMenu(instance, customOptions){ this.instance = instance; var contextMenu = this; this.menu = createMenu(); this.enabled = true; this.bindMouseEvents(); this.bindTableEvents(); this.instance.addHook('afterDestroy', function () { contextMenu.destroy(); }); this.defaultOptions = { items: { 'row_above': { name: 'Insert row above', callback: function(key, selection){ this.alter("insert_row", selection.start.row()); }, disabled: function () { return this.countRows() >= this.getSettings().maxRows; } }, 'row_below': { name: 'Insert row below', callback: function(key, selection){ this.alter("insert_row", selection.end.row() + 1); }, disabled: function () { return this.countRows() >= this.getSettings().maxRows; } }, "hsep1": ContextMenu.SEPARATOR, 'col_left': { name: 'Insert column on the left', callback: function(key, selection){ this.alter("insert_col", selection.start.col()); }, disabled: function () { return this.countCols() >= this.getSettings().maxCols; } }, 'col_right': { name: 'Insert column on the right', callback: function(key, selection){ this.alter("insert_col", selection.end.col() + 1); }, disabled: function () { return this.countCols() >= this.getSettings().maxCols; } }, "hsep2": ContextMenu.SEPARATOR, 'remove_row': { name: 'Remove row', callback: function(key, selection){ var amount = selection.end.row() - selection.start.row() + 1; this.alter("remove_row", selection.start.row(), amount); } }, 'remove_col': { name: 'Remove column', callback: function(key, selection){ var amount = selection.end.col() - selection.start.col() + 1; this.alter("remove_col", selection.start.col(), amount); } }, "hsep3": ContextMenu.SEPARATOR, 'undo': { name: 'Undo', callback: function(){ this.undo(); }, disabled: function () { return this.undoRedo && !this.undoRedo.isUndoAvailable(); } }, 'redo': { name: 'Redo', callback: function(){ this.redo(); }, disabled: function () { return this.undoRedo && !this.undoRedo.isRedoAvailable(); } } } }; this.options = {}; Handsontable.helper.extend(this.options, this.defaultOptions); this.updateOptions(customOptions); function createMenu(){ var menu = $('body > .htContextMenu')[0]; if(!menu){ menu = document.createElement('DIV'); Handsontable.Dom.addClass(menu, 'htContextMenu'); document.getElementsByTagName('body')[0].appendChild(menu); } return menu; } } ContextMenu.prototype.bindMouseEvents = function (){ function contextMenuOpenListener(event){ event.preventDefault(); if(event.target.nodeName != 'TD' && !(Handsontable.Dom.hasClass(event.target, 'current') && Handsontable.Dom.hasClass(event.target, 'wtBorder'))){ return; } this.show(event.pageY, event.pageX); $(document).on('mousedown.htContextMenu', Handsontable.helper.proxy(ContextMenu.prototype.close, this)); } this.instance.rootElement.on('contextmenu.htContextMenu', Handsontable.helper.proxy(contextMenuOpenListener, this)); $(this.menu).on('mousedown', Handsontable.helper.proxy(this.performAction, this)); }; ContextMenu.prototype.bindTableEvents = function () { var that = this; this._afterScrollCallback = function () { that.close(); }; this.instance.addHook('afterScrollVertically', this._afterScrollCallback); this.instance.addHook('afterScrollHorizontally', this._afterScrollCallback); }; ContextMenu.prototype.unbindTableEvents = function () { var that = this; if(this._afterScrollCallback){ this.instance.removeHook('afterScrollVertically', this._afterScrollCallback); this.instance.removeHook('afterScrollHorizontally', this._afterScrollCallback); this._afterScrollCallback = null; } }; ContextMenu.prototype.performAction = function (){ var hot = $(this.menu).handsontable('getInstance'); var selectedItemIndex = hot.getSelected()[0]; var selectedItem = hot.getData()[selectedItemIndex]; if (selectedItem.disabled === true || (typeof selectedItem.disabled == 'function' && selectedItem.disabled.call(this.instance) === true)){ return; } if(typeof selectedItem.callback != 'function'){ return; } var corners = this.instance.getSelected(); var normalizedSelection = ContextMenu.utils.normalizeSelection(corners); selectedItem.callback.call(this.instance, selectedItem.key, normalizedSelection); }; ContextMenu.prototype.unbindMouseEvents = function () { this.instance.rootElement.off('contextmenu.htContextMenu'); $(document).off('mousedown.htContextMenu'); }; ContextMenu.prototype.show = function(top, left){ this.menu.style.display = 'block'; $(this.menu).handsontable({ data: ContextMenu.utils.convertItemsToArray(this.getItems()), colHeaders: false, colWidths: [160], readOnly: true, copyPaste: false, columns: [ { data: 'name', renderer: Handsontable.helper.proxy(this.renderer, this) } ], beforeKeyDown: Handsontable.helper.proxy(this.onBeforeKeyDown, this) }); this.bindTableEvents(); this.setMenuPosition(top, left); $(this.menu).handsontable('listen'); }; ContextMenu.prototype.close = function () { this.hide(); $(document).off('mousedown.htContextMenu'); this.unbindTableEvents(); this.instance.listen(); }; ContextMenu.prototype.hide = function(){ this.menu.style.display = 'none'; $(this.menu).handsontable('destroy'); }; ContextMenu.prototype.renderer = function(instance, TD, row, col, prop, value, cellProperties){ var contextMenu = this; var item = instance.getData()[row]; var wrapper = document.createElement('DIV'); Handsontable.Dom.empty(TD); TD.appendChild(wrapper); if(itemIsSeparator(item)){ Handsontable.Dom.addClass(TD, 'htSeparator'); } else { Handsontable.Dom.fastInnerText(wrapper, value); } if (itemIsDisabled(item, contextMenu.instance)){ Handsontable.Dom.addClass(TD, 'htDisabled'); $(wrapper).on('mouseenter', function () { instance.deselectCell(); }); } else { Handsontable.Dom.removeClass(TD, 'htDisabled'); $(wrapper).on('mouseenter', function () { instance.selectCell(row, col); }); } function itemIsSeparator(item){ return new RegExp(ContextMenu.SEPARATOR, 'i').test(item.name); } function itemIsDisabled(item, instance){ return item.disabled === true || (typeof item.disabled == 'function' && item.disabled.call(contextMenu.instance) === true); } }; ContextMenu.prototype.onBeforeKeyDown = function (event) { var contextMenu = this; var instance = $(contextMenu.menu).handsontable('getInstance'); var selection = instance.getSelected(); switch(event.keyCode){ case Handsontable.helper.keyCode.ESCAPE: contextMenu.close(); event.preventDefault(); event.stopImmediatePropagation(); break; case Handsontable.helper.keyCode.ENTER: if(instance.getSelected()){ contextMenu.performAction(); contextMenu.close(); } break; case Handsontable.helper.keyCode.ARROW_DOWN: if(!selection){ selectFirstCell(instance); } else { selectNextCell(selection[0], selection[1], instance); } event.preventDefault(); event.stopImmediatePropagation(); break; case Handsontable.helper.keyCode.ARROW_UP: if(!selection){ selectLastCell(instance); } else { selectPrevCell(selection[0], selection[1], instance); } event.preventDefault(); event.stopImmediatePropagation(); break; } function selectFirstCell(instance) { var firstCell = instance.getCell(0, 0); if(ContextMenu.utils.isSeparator(firstCell) || ContextMenu.utils.isDisabled(firstCell)){ selectNextCell(0, 0, instance); } else { instance.selectCell(0, 0); } } function selectLastCell(instance) { var lastRow = instance.countRows() - 1; var lastCell = instance.getCell(lastRow, 0); if(ContextMenu.utils.isSeparator(lastCell) || ContextMenu.utils.isDisabled(lastCell)){ selectPrevCell(lastRow, 0, instance); } else { instance.selectCell(lastRow, 0); } } function selectNextCell(row, col, instance){ var nextRow = row + 1; var nextCell = nextRow < instance.countRows() ? instance.getCell(nextRow, col) : null; if(!nextCell){ return; } if(ContextMenu.utils.isSeparator(nextCell) || ContextMenu.utils.isDisabled(nextCell)){ selectNextCell(nextRow, col, instance); } else { instance.selectCell(nextRow, col); } } function selectPrevCell(row, col, instance) { var prevRow = row - 1; var prevCell = prevRow >= 0 ? instance.getCell(prevRow, col) : null; if (!prevCell) { return; } if(ContextMenu.utils.isSeparator(prevCell) || ContextMenu.utils.isDisabled(prevCell)){ selectPrevCell(prevRow, col, instance); } else { instance.selectCell(prevRow, col); } } }; ContextMenu.prototype.getItems = function () { var items = {}; function Item(rawItem){ if(typeof rawItem == 'string'){ this.name = rawItem; } else { Handsontable.helper.extend(this, rawItem); } } Item.prototype = this.options; for(var itemName in this.options.items){ if(this.options.items.hasOwnProperty(itemName) && (!this.itemsFilter || this.itemsFilter.indexOf(itemName) != -1)){ items[itemName] = new Item(this.options.items[itemName]); } } return items; }; ContextMenu.prototype.updateOptions = function(newOptions){ newOptions = newOptions || {}; if(newOptions.items){ for(var itemName in newOptions.items){ var item = {}; if(newOptions.items.hasOwnProperty(itemName)) { if(this.defaultOptions.items.hasOwnProperty(itemName) && Handsontable.helper.isObject(newOptions.items[itemName])){ Handsontable.helper.extend(item, this.defaultOptions.items[itemName]); Handsontable.helper.extend(item, newOptions.items[itemName]); newOptions.items[itemName] = item; } } } } Handsontable.helper.extend(this.options, newOptions); }; ContextMenu.prototype.setMenuPosition = function (cursorY, cursorX) { var cursor = { top: cursorY, topRelative: cursorY - document.documentElement.scrollTop, left: cursorX, leftRelative:cursorX - document.documentElement.scrollLeft }; if(this.menuFitsBelowCursor(cursor)){ this.positionMenuBelowCursor(cursor); } else { this.positionMenuAboveCursor(cursor); } if(this.menuFitsOnRightOfCursor(cursor)){ this.positionMenuOnRightOfCursor(cursor); } else { this.positionMenuOnLeftOfCursor(cursor); } }; ContextMenu.prototype.menuFitsBelowCursor = function (cursor) { return cursor.topRelative + this.menu.offsetHeight <= document.documentElement.scrollTop + document.documentElement.clientHeight; }; ContextMenu.prototype.menuFitsOnRightOfCursor = function (cursor) { return cursor.leftRelative + this.menu.offsetWidth <= document.documentElement.scrollLeft + document.documentElement.clientWidth; }; ContextMenu.prototype.positionMenuBelowCursor = function (cursor) { this.menu.style.top = cursor.top + 'px'; }; ContextMenu.prototype.positionMenuAboveCursor = function (cursor) { this.menu.style.top = (cursor.top - this.menu.offsetHeight) + 'px'; }; ContextMenu.prototype.positionMenuOnRightOfCursor = function (cursor) { this.menu.style.left = cursor.left + 'px'; }; ContextMenu.prototype.positionMenuOnLeftOfCursor = function (cursor) { this.menu.style.left = (cursor.left - this.menu.offsetWidth) + 'px'; }; ContextMenu.utils = {}; ContextMenu.utils.convertItemsToArray = function (items) { var itemArray = []; var item; for(var itemName in items){ if(items.hasOwnProperty(itemName)){ if(typeof items[itemName] == 'string'){ item = {name: items[itemName]}; } else if (items[itemName].visible !== false) { item = items[itemName]; } else { continue; } item.key = itemName; itemArray.push(item); } } return itemArray; }; ContextMenu.utils.normalizeSelection = function(corners){ var selection = { start: new Handsontable.SelectionPoint(), end: new Handsontable.SelectionPoint() }; selection.start.row(Math.min(corners[0], corners[2])); selection.start.col(Math.min(corners[1], corners[3])); selection.end.row(Math.max(corners[0], corners[2])); selection.end.col(Math.max(corners[1], corners[3])); return selection; }; ContextMenu.utils.isSeparator = function (cell) { return Handsontable.Dom.hasClass(cell, 'htSeparator'); }; ContextMenu.utils.isDisabled = function (cell) { return Handsontable.Dom.hasClass(cell, 'htDisabled'); }; ContextMenu.prototype.enable = function () { if(!this.enabled){ this.enabled = true; this.bindMouseEvents(); } }; ContextMenu.prototype.disable = function () { if(this.enabled){ this.enabled = false; this.close(); this.unbindMouseEvents(); this.unbindTableEvents(); } }; ContextMenu.prototype.destroy = function () { this.close(); this.unbindMouseEvents(); this.unbindTableEvents(); if(!this.isMenuEnabledByOtherHotInstance()){ this.removeMenu(); } }; ContextMenu.prototype.isMenuEnabledByOtherHotInstance = function () { var hotContainers = $('.handsontable'); var menuEnabled = false; for(var i = 0, len = hotContainers.length; i < len; i++){ var instance = $(hotContainers[i]).handsontable('getInstance'); if(instance && instance.getSettings().contextMenu){ menuEnabled = true; break; } } return menuEnabled; }; ContextMenu.prototype.removeMenu = function () { if(this.menu.parentNode){ this.menu.parentNode.removeChild(this.menu); } } ContextMenu.prototype.filterItems = function(itemsToLeave){ this.itemsFilter = itemsToLeave; }; ContextMenu.SEPARATOR = "---------"; function init(){ var instance = this; var contextMenuSetting = instance.getSettings().contextMenu; var customOptions = Handsontable.helper.isObject(contextMenuSetting) ? contextMenuSetting : {}; if(contextMenuSetting){ if(!instance.contextMenu){ instance.contextMenu = new ContextMenu(instance, customOptions); } instance.contextMenu.enable(); if(Handsontable.helper.isArray(contextMenuSetting)){ instance.contextMenu.filterItems(contextMenuSetting); } } else if(instance.contextMenu){ instance.contextMenu.destroy(); delete instance.contextMenu; } } Handsontable.PluginHooks.add('afterInit', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); Handsontable.ContextMenu = ContextMenu; })(Handsontable); /** * This plugin adds support for legacy features, deprecated APIs, etc. */ /** * Support for old autocomplete syntax * For old syntax, see: https://github.com/warpech/jquery-handsontable/blob/8c9e701d090ea4620fe08b6a1a048672fadf6c7e/README.md#defining-autocomplete */ Handsontable.PluginHooks.add('beforeGetCellMeta', function (row, col, cellProperties) { //isWritable - deprecated since 0.8.0 cellProperties.isWritable = !cellProperties.readOnly; //autocomplete - deprecated since 0.7.1 (see CHANGELOG.md) if (cellProperties.autoComplete) { throw new Error("Support for legacy autocomplete syntax was removed in Handsontable 0.10.0. Please remove the property named 'autoComplete' from your config. For replacement instructions, see wiki page https://github.com/warpech/jquery-handsontable/wiki/Migration-guide-to-0.10.x"); } }); function HandsontableManualColumnMove() { var pressed , startCol , endCol , startX , startOffset; var ghost = document.createElement('DIV') , ghostStyle = ghost.style; ghost.className = 'ghost'; ghostStyle.position = 'absolute'; ghostStyle.top = '25px'; ghostStyle.left = 0; ghostStyle.width = '10px'; ghostStyle.height = '10px'; ghostStyle.backgroundColor = '#CCC'; ghostStyle.opacity = 0.7; var saveManualColumnPositions = function () { var instance = this; instance.PluginHooks.run('persistentStateSave', 'manualColumnPositions', instance.manualColumnPositions); }; var loadManualColumnPositions = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'manualColumnPositions', storedState); return storedState.value; }; var bindMoveColEvents = function () { var instance = this; instance.rootElement.on('mousemove.manualColumnMove', function (e) { if (pressed) { ghostStyle.left = startOffset + e.pageX - startX + 6 + 'px'; if (ghostStyle.display === 'none') { ghostStyle.display = 'block'; } } }); instance.rootElement.on('mouseup.manualColumnMove', function () { if (pressed) { if (startCol < endCol) { endCol--; } if (instance.getSettings().rowHeaders) { startCol--; endCol--; } instance.manualColumnPositions.splice(endCol, 0, instance.manualColumnPositions.splice(startCol, 1)[0]); $('.manualColumnMover.active').removeClass('active'); pressed = false; instance.forceFullRender = true; instance.view.render(); //updates all ghostStyle.display = 'none'; saveManualColumnPositions.call(instance); instance.PluginHooks.run('afterColumnMove', startCol, endCol); } }); instance.rootElement.on('mousedown.manualColumnMove', '.manualColumnMover', function (e) { var mover = e.currentTarget; var TH = instance.view.wt.wtDom.closest(mover, 'TH'); startCol = instance.view.wt.wtDom.index(TH) + instance.colOffset(); endCol = startCol; pressed = true; startX = e.pageX; var TABLE = instance.$table[0]; TABLE.parentNode.appendChild(ghost); ghostStyle.width = instance.view.wt.wtDom.outerWidth(TH) + 'px'; ghostStyle.height = instance.view.wt.wtDom.outerHeight(TABLE) + 'px'; startOffset = parseInt(instance.view.wt.wtDom.offset(TH).left - instance.view.wt.wtDom.offset(TABLE).left, 10); ghostStyle.left = startOffset + 6 + 'px'; }); instance.rootElement.on('mouseenter.manualColumnMove', 'td, th', function () { if (pressed) { var active = instance.view.THEAD.querySelector('.manualColumnMover.active'); if (active) { instance.view.wt.wtDom.removeClass(active, 'active'); } endCol = instance.view.wt.wtDom.index(this) + instance.colOffset(); var THs = instance.view.THEAD.querySelectorAll('th'); var mover = THs[endCol].querySelector('.manualColumnMover'); instance.view.wt.wtDom.addClass(mover, 'active'); } }); instance.addHook('afterDestroy', unbindMoveColEvents); }; var unbindMoveColEvents = function(){ var instance = this; instance.rootElement.off('mouseup.manualColumnMove'); instance.rootElement.off('mousemove.manualColumnMove'); instance.rootElement.off('mousedown.manualColumnMove'); instance.rootElement.off('mouseenter.manualColumnMove'); }; this.beforeInit = function () { this.manualColumnPositions = []; }; this.init = function (source) { var instance = this; var manualColMoveEnabled = !!(this.getSettings().manualColumnMove); if (manualColMoveEnabled) { var initialManualColumnPositions = this.getSettings().manualColumnMove; var loadedManualColumnPositions = loadManualColumnPositions.call(instance); if (typeof loadedManualColumnPositions != 'undefined') { this.manualColumnPositions = loadedManualColumnPositions; } else if (initialManualColumnPositions instanceof Array) { this.manualColumnPositions = initialManualColumnPositions; } else { this.manualColumnPositions = []; } instance.forceFullRender = true; if (source == 'afterInit') { bindMoveColEvents.call(this); if (this.manualColumnPositions.length > 0) { this.forceFullRender = true; this.render(); } } } else { unbindMoveColEvents.call(this); this.manualColumnPositions = []; } }; this.modifyCol = function (col) { //TODO test performance: http://jsperf.com/object-wrapper-vs-primitive/2 if (this.getSettings().manualColumnMove) { if (typeof this.manualColumnPositions[col] === 'undefined') { this.manualColumnPositions[col] = col; } return this.manualColumnPositions[col]; } return col; }; this.getColHeader = function (col, TH) { if (this.getSettings().manualColumnMove) { var DIV = document.createElement('DIV'); DIV.className = 'manualColumnMover'; TH.firstChild.appendChild(DIV); } }; } var htManualColumnMove = new HandsontableManualColumnMove(); Handsontable.PluginHooks.add('beforeInit', htManualColumnMove.beforeInit); Handsontable.PluginHooks.add('afterInit', function () { htManualColumnMove.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htManualColumnMove.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('afterGetColHeader', htManualColumnMove.getColHeader); Handsontable.PluginHooks.add('modifyCol', htManualColumnMove.modifyCol); function HandsontableManualColumnResize() { var pressed , currentTH , currentCol , currentWidth , instance , newSize , startX , startWidth , startOffset , resizer = document.createElement('DIV') , handle = document.createElement('DIV') , line = document.createElement('DIV') , lineStyle = line.style; resizer.className = 'manualColumnResizer'; handle.className = 'manualColumnResizerHandle'; resizer.appendChild(handle); line.className = 'manualColumnResizerLine'; resizer.appendChild(line); var $document = $(document); $document.mousemove(function (e) { if (pressed) { currentWidth = startWidth + (e.pageX - startX); newSize = setManualSize(currentCol, currentWidth); //save col width resizer.style.left = startOffset + currentWidth + 'px'; } }); $document.mouseup(function () { if (pressed) { instance.view.wt.wtDom.removeClass(resizer, 'active'); pressed = false; if(newSize != startWidth){ instance.forceFullRender = true; instance.view.render(); //updates all saveManualColumnWidths.call(instance); instance.PluginHooks.run('afterColumnResize', currentCol, newSize); } refreshResizerPosition.call(instance, currentTH); } }); var saveManualColumnWidths = function () { var instance = this; instance.PluginHooks.run('persistentStateSave', 'manualColumnWidths', instance.manualColumnWidths); }; var loadManualColumnWidths = function () { var instance = this; var storedState = {}; instance.PluginHooks.run('persistentStateLoad', 'manualColumnWidths', storedState); return storedState.value; }; function refreshResizerPosition(TH) { instance = this; currentTH = TH; var col = this.view.wt.wtTable.getCoords(TH)[1]; //getCoords returns array [row, col] if (col >= 0) { //if not row header currentCol = col; var rootOffset = this.view.wt.wtDom.offset(this.rootElement[0]).left; var thOffset = this.view.wt.wtDom.offset(TH).left; startOffset = (thOffset - rootOffset) - 6; resizer.style.left = startOffset + parseInt(this.view.wt.wtDom.outerWidth(TH), 10) + 'px'; this.rootElement[0].appendChild(resizer); } } function refreshLinePosition() { var instance = this; startWidth = parseInt(this.view.wt.wtDom.outerWidth(currentTH), 10); instance.view.wt.wtDom.addClass(resizer, 'active'); lineStyle.height = instance.view.wt.wtDom.outerHeight(instance.$table[0]) + 'px'; pressed = instance; } var bindManualColumnWidthEvents = function () { var instance = this; var dblclick = 0; var autoresizeTimeout = null; this.rootElement.on('mouseenter.handsontable', 'th', function (e) { if (!pressed) { refreshResizerPosition.call(instance, e.currentTarget); } }); this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function () { if (autoresizeTimeout == null) { autoresizeTimeout = setTimeout(function () { if (dblclick >= 2) { newSize = instance.determineColumnWidth.call(instance, currentCol); setManualSize(currentCol, newSize); instance.forceFullRender = true; instance.view.render(); //updates all instance.PluginHooks.run('afterColumnResize', currentCol, newSize); } dblclick = 0; autoresizeTimeout = null; }, 500); } dblclick++; }); this.rootElement.on('mousedown.handsontable', '.manualColumnResizer', function (e) { startX = e.pageX; refreshLinePosition.call(instance); newSize = startWidth; }); }; this.beforeInit = function () { this.manualColumnWidths = []; }; this.init = function (source) { var instance = this; var manualColumnWidthEnabled = !!(this.getSettings().manualColumnResize); if (manualColumnWidthEnabled) { var initialColumnWidths = this.getSettings().manualColumnResize; var loadedManualColumnWidths = loadManualColumnWidths.call(instance); if (typeof loadedManualColumnWidths != 'undefined') { this.manualColumnWidths = loadedManualColumnWidths; } else if (initialColumnWidths instanceof Array) { this.manualColumnWidths = initialColumnWidths; } else { this.manualColumnWidths = []; } if (source == 'afterInit') { bindManualColumnWidthEvents.call(this); instance.forceFullRender = true; instance.render(); } } }; var setManualSize = function (col, width) { width = Math.max(width, 20); /** * We need to run col through modifyCol hook, in case the order of displayed columns is different than the order * in data source. For instance, this order can be modified by manualColumnMove plugin. */ col = instance.PluginHooks.execute('modifyCol', col); instance.manualColumnWidths[col] = width; return width; }; this.getColWidth = function (col, response) { if (this.getSettings().manualColumnResize && this.manualColumnWidths[col]) { response.width = this.manualColumnWidths[col]; } }; } var htManualColumnResize = new HandsontableManualColumnResize(); Handsontable.PluginHooks.add('beforeInit', htManualColumnResize.beforeInit); Handsontable.PluginHooks.add('afterInit', function () { htManualColumnResize.init.call(this, 'afterInit') }); Handsontable.PluginHooks.add('afterUpdateSettings', function () { htManualColumnResize.init.call(this, 'afterUpdateSettings') }); Handsontable.PluginHooks.add('afterGetColWidth', htManualColumnResize.getColWidth); (function HandsontableObserveChanges() { Handsontable.PluginHooks.add('afterLoadData', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); function init() { var instance = this; var pluginEnabled = instance.getSettings().observeChanges; if (pluginEnabled) { if(instance.observer) { destroy.call(instance); //destroy observer for old data object } createObserver.call(instance); bindEvents.call(instance); } else if (!pluginEnabled){ destroy.call(instance); } } function createObserver(){ var instance = this; instance.observeChangesActive = true; instance.pauseObservingChanges = function(){ instance.observeChangesActive = false; }; instance.resumeObservingChanges = function(){ instance.observeChangesActive = true; }; instance.observedData = instance.getData(); instance.observer = jsonpatch.observe(instance.observedData, function (patches) { if(instance.observeChangesActive){ runHookForOperation.call(instance, patches); instance.render(); } instance.runHooks('afterChangesObserved'); }); } function runHookForOperation(rawPatches){ var instance = this; var patches = cleanPatches(rawPatches); for(var i = 0, len = patches.length; i < len; i++){ var patch = patches[i]; var parsedPath = parsePath(patch.path); switch(patch.op){ case 'add': if(isNaN(parsedPath.col)){ instance.runHooks('afterCreateRow', parsedPath.row); } else { instance.runHooks('afterCreateCol', parsedPath.col); } break; case 'remove': if(isNaN(parsedPath.col)){ instance.runHooks('afterRemoveRow', parsedPath.row, 1); } else { instance.runHooks('afterRemoveCol', parsedPath.col, 1); } break; case 'replace': instance.runHooks('afterChange', [parsedPath.row, parsedPath.col, null, patch.value], 'external'); break; } } function cleanPatches(rawPatches){ var patches; patches = removeLengthRelatedPatches(rawPatches); patches = removeMultipleAddOrRemoveColPatches(patches); return patches; } /** * Removing or adding column will produce one patch for each table row. * This function leaves only one patch for each column add/remove operation */ function removeMultipleAddOrRemoveColPatches(rawPatches){ var newOrRemovedColumns = []; return rawPatches.filter(function(patch){ var parsedPath = parsePath(patch.path); if(['add', 'remove'].indexOf(patch.op) != -1 && !isNaN(parsedPath.col)){ if(newOrRemovedColumns.indexOf(parsedPath.col) != -1){ return false; } else { newOrRemovedColumns.push(parsedPath.col); } } return true; }); } /** * If observeChanges uses native Object.observe method, then it produces patches for length property. * This function removes them. */ function removeLengthRelatedPatches(rawPatches){ return rawPatches.filter(function(patch){ return !/[/]length/ig.test(patch.path); }) } function parsePath(path){ var match = path.match(/^\/(\d+)\/?(.*)?$/); return { row: parseInt(match[1], 10), col: /^\d*$/.test(match[2]) ? parseInt(match[2], 10) : match[2] } } } function destroy(){ var instance = this; if (instance.observer){ destroyObserver.call(instance); unbindEvents.call(instance); } } function destroyObserver(){ var instance = this; jsonpatch.unobserve(instance.observedData, instance.observer); delete instance.observeChangesActive; delete instance.pauseObservingChanges; delete instance.resumeObservingChanges; } function bindEvents(){ var instance = this; instance.addHook('afterDestroy', destroy); instance.addHook('afterCreateRow', afterTableAlter); instance.addHook('afterRemoveRow', afterTableAlter); instance.addHook('afterCreateCol', afterTableAlter); instance.addHook('afterRemoveCol', afterTableAlter); instance.addHook('afterChange', function(changes, source){ if(source != 'loadData'){ afterTableAlter.call(this); } }); } function unbindEvents(){ var instance = this; instance.removeHook('afterDestroy', destroy); instance.removeHook('afterCreateRow', afterTableAlter); instance.removeHook('afterRemoveRow', afterTableAlter); instance.removeHook('afterCreateCol', afterTableAlter); instance.removeHook('afterRemoveCol', afterTableAlter); instance.removeHook('afterChange', afterTableAlter); } function afterTableAlter(){ var instance = this; instance.pauseObservingChanges(); instance.addHookOnce('afterChangesObserved', function(){ instance.resumeObservingChanges(); }); } })(); /* * * Plugin enables saving table state * * */ function Storage(prefix) { var savedKeys; var saveSavedKeys = function () { window.localStorage[prefix + '__' + 'persistentStateKeys'] = JSON.stringify(savedKeys); }; var loadSavedKeys = function () { var keysJSON = window.localStorage[prefix + '__' + 'persistentStateKeys']; var keys = typeof keysJSON == 'string' ? JSON.parse(keysJSON) : void 0; savedKeys = keys ? keys : []; }; var clearSavedKeys = function () { savedKeys = []; saveSavedKeys(); }; loadSavedKeys(); this.saveValue = function (key, value) { window.localStorage[prefix + '_' + key] = JSON.stringify(value); if (savedKeys.indexOf(key) == -1) { savedKeys.push(key); saveSavedKeys(); } }; this.loadValue = function (key, defaultValue) { key = typeof key != 'undefined' ? key : defaultValue; var value = window.localStorage[prefix + '_' + key]; return typeof value == "undefined" ? void 0 : JSON.parse(value); }; this.reset = function (key) { window.localStorage.removeItem(prefix + '_' + key); }; this.resetAll = function () { for (var index = 0; index < savedKeys.length; index++) { window.localStorage.removeItem(prefix + '_' + savedKeys[index]); } clearSavedKeys(); }; } (function (StorageClass) { function HandsontablePersistentState() { var plugin = this; this.init = function () { var instance = this, pluginSettings = instance.getSettings()['persistentState']; plugin.enabled = !!(pluginSettings); if (!plugin.enabled) { removeHooks.call(instance); return; } if (!instance.storage) { instance.storage = new StorageClass(instance.rootElement[0].id); } instance.resetState = plugin.resetValue; addHooks.call(instance); }; this.saveValue = function (key, value) { var instance = this; instance.storage.saveValue(key, value); }; this.loadValue = function (key, saveTo) { var instance = this; saveTo.value = instance.storage.loadValue(key); }; this.resetValue = function (key) { var instance = this; if (typeof key != 'undefined') { instance.storage.reset(key); } else { instance.storage.resetAll(); } }; var hooks = { 'persistentStateSave': plugin.saveValue, 'persistentStateLoad': plugin.loadValue, 'persistentStateReset': plugin.resetValue }; function addHooks() { var instance = this; for (var hookName in hooks) { if (hooks.hasOwnProperty(hookName) && !hookExists.call(instance, hookName)) { instance.PluginHooks.add(hookName, hooks[hookName]); } } } function removeHooks() { var instance = this; for (var hookName in hooks) { if (hooks.hasOwnProperty(hookName) && hookExists.call(instance, hookName)) { instance.PluginHooks.remove(hookName, hooks[hookName]); } } } function hookExists(hookName) { var instance = this; return instance.PluginHooks.hooks.hasOwnProperty(hookName); } } var htPersistentState = new HandsontablePersistentState(); Handsontable.PluginHooks.add('beforeInit', htPersistentState.init); Handsontable.PluginHooks.add('afterUpdateSettings', htPersistentState.init); })(Storage); /** * Handsontable UndoRedo class */ (function(Handsontable){ Handsontable.UndoRedo = function (instance) { var plugin = this; this.instance = instance; this.doneActions = []; this.undoneActions = []; this.ignoreNewActions = false; instance.addHook("afterChange", function (changes, origin) { if(changes){ var action = new Handsontable.UndoRedo.ChangeAction(changes); plugin.done(action); } }); instance.addHook("afterCreateRow", function (index, amount) { var action = new Handsontable.UndoRedo.CreateRowAction(index, amount); plugin.done(action); }); instance.addHook("beforeRemoveRow", function (index, amount) { var originalData = plugin.instance.getData(); index = ( originalData.length + index ) % originalData.length; var removedData = originalData.slice(index, index + amount); var action = new Handsontable.UndoRedo.RemoveRowAction(index, removedData); plugin.done(action); }); instance.addHook("afterCreateCol", function (index, amount) { var action = new Handsontable.UndoRedo.CreateColumnAction(index, amount); plugin.done(action); }); instance.addHook("beforeRemoveCol", function (index, amount) { var originalData = plugin.instance.getData(); index = ( plugin.instance.countCols() + index ) % plugin.instance.countCols(); var removedData = []; for (var i = 0, len = originalData.length; i < len; i++) { removedData[i] = originalData[i].slice(index, index + amount); } var headers; if(Handsontable.helper.isArray(instance.getSettings().colHeaders)){ headers = instance.getSettings().colHeaders.slice(index, index + removedData.length); } var action = new Handsontable.UndoRedo.RemoveColumnAction(index, removedData, headers); plugin.done(action); }); }; Handsontable.UndoRedo.prototype.done = function (action) { if (!this.ignoreNewActions) { this.doneActions.push(action); this.undoneActions.length = 0; } }; /** * Undo operation from current revision */ Handsontable.UndoRedo.prototype.undo = function () { if (this.isUndoAvailable()) { var action = this.doneActions.pop(); this.ignoreNewActions = true; action.undo(this.instance); this.ignoreNewActions = false; this.undoneActions.push(action); } }; /** * Redo operation from current revision */ Handsontable.UndoRedo.prototype.redo = function () { if (this.isRedoAvailable()) { var action = this.undoneActions.pop(); this.ignoreNewActions = true; action.redo(this.instance); this.ignoreNewActions = true; this.doneActions.push(action); } }; /** * Returns true if undo point is available * @return {Boolean} */ Handsontable.UndoRedo.prototype.isUndoAvailable = function () { return this.doneActions.length > 0; }; /** * Returns true if redo point is available * @return {Boolean} */ Handsontable.UndoRedo.prototype.isRedoAvailable = function () { return this.undoneActions.length > 0; }; /** * Clears undo history */ Handsontable.UndoRedo.prototype.clear = function () { this.doneActions.length = 0; this.undoneActions.length = 0; }; Handsontable.UndoRedo.Action = function () { }; Handsontable.UndoRedo.Action.prototype.undo = function () { }; Handsontable.UndoRedo.Action.prototype.redo = function () { }; Handsontable.UndoRedo.ChangeAction = function (changes) { this.changes = changes; }; Handsontable.helper.inherit(Handsontable.UndoRedo.ChangeAction, Handsontable.UndoRedo.Action); Handsontable.UndoRedo.ChangeAction.prototype.undo = function (instance) { var data = $.extend(true, [], this.changes); for (var i = 0, len = data.length; i < len; i++) { data[i].splice(3, 1); } instance.setDataAtRowProp(data, null, null, 'undo'); }; Handsontable.UndoRedo.ChangeAction.prototype.redo = function (instance) { var data = $.extend(true, [], this.changes); for (var i = 0, len = data.length; i < len; i++) { data[i].splice(2, 1); } instance.setDataAtRowProp(data, null, null, 'redo'); }; Handsontable.UndoRedo.CreateRowAction = function (index, amount) { this.index = index; this.amount = amount; }; Handsontable.helper.inherit(Handsontable.UndoRedo.CreateRowAction, Handsontable.UndoRedo.Action); Handsontable.UndoRedo.CreateRowAction.prototype.undo = function (instance) { instance.alter('remove_row', this.index, this.amount); }; Handsontable.UndoRedo.CreateRowAction.prototype.redo = function (instance) { instance.alter('insert_row', this.index + 1, this.amount); }; Handsontable.UndoRedo.RemoveRowAction = function (index, data) { this.index = index; this.data = data; }; Handsontable.helper.inherit(Handsontable.UndoRedo.RemoveRowAction, Handsontable.UndoRedo.Action); Handsontable.UndoRedo.RemoveRowAction.prototype.undo = function (instance) { var spliceArgs = [this.index, 0]; Array.prototype.push.apply(spliceArgs, this.data); Array.prototype.splice.apply(instance.getData(), spliceArgs); instance.render(); }; Handsontable.UndoRedo.RemoveRowAction.prototype.redo = function (instance) { instance.alter('remove_row', this.index, this.data.length); }; Handsontable.UndoRedo.CreateColumnAction = function (index, amount) { this.index = index; this.amount = amount; }; Handsontable.helper.inherit(Handsontable.UndoRedo.CreateColumnAction, Handsontable.UndoRedo.Action); Handsontable.UndoRedo.CreateColumnAction.prototype.undo = function (instance) { instance.alter('remove_col', this.index, this.amount); }; Handsontable.UndoRedo.CreateColumnAction.prototype.redo = function (instance) { instance.alter('insert_col', this.index + 1, this.amount); }; Handsontable.UndoRedo.RemoveColumnAction = function (index, data, headers) { this.index = index; this.data = data; this.amount = this.data[0].length; this.headers = headers; }; Handsontable.helper.inherit(Handsontable.UndoRedo.RemoveColumnAction, Handsontable.UndoRedo.Action); Handsontable.UndoRedo.RemoveColumnAction.prototype.undo = function (instance) { var row, spliceArgs; for (var i = 0, len = instance.getData().length; i < len; i++) { row = instance.getDataAtRow(i); spliceArgs = [this.index, 0]; Array.prototype.push.apply(spliceArgs, this.data[i]); Array.prototype.splice.apply(row, spliceArgs); } if(typeof this.headers != 'undefined'){ spliceArgs = [this.index, 0]; Array.prototype.push.apply(spliceArgs, this.headers); Array.prototype.splice.apply(instance.getSettings().colHeaders, spliceArgs); } instance.render(); }; Handsontable.UndoRedo.RemoveColumnAction.prototype.redo = function (instance) { instance.alter('remove_col', this.index, this.amount); }; })(Handsontable); (function(Handsontable){ function init(){ var instance = this; var pluginEnabled = typeof instance.getSettings().undo == 'undefined' || instance.getSettings().undo; if(pluginEnabled){ if(!instance.undoRedo){ instance.undoRedo = new Handsontable.UndoRedo(instance); exposeUndoRedoMethods(instance); instance.addHook('beforeKeyDown', onBeforeKeyDown); instance.addHook('afterChange', onAfterChange); } } else { if(instance.undoRedo){ delete instance.undoRedo; removeExposedUndoRedoMethods(instance); instance.removeHook('beforeKeyDown', onBeforeKeyDown); instance.removeHook('afterChange', onAfterChange); } } } function onBeforeKeyDown(event){ var instance = this; var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; if(ctrlDown){ if (event.keyCode === 89 || (event.shiftKey && event.keyCode === 90)) { //CTRL + Y or CTRL + SHIFT + Z instance.undoRedo.redo(); event.stopImmediatePropagation(); } else if (event.keyCode === 90) { //CTRL + Z instance.undoRedo.undo(); event.stopImmediatePropagation(); } } } function onAfterChange(changes, source){ var instance = this; if (source == 'loadData'){ return instance.undoRedo.clear(); } } function exposeUndoRedoMethods(instance){ instance.undo = function(){ return instance.undoRedo.undo(); }; instance.redo = function(){ return instance.undoRedo.redo(); }; instance.isUndoAvailable = function(){ return instance.undoRedo.isUndoAvailable(); }; instance.isRedoAvailable = function(){ return instance.undoRedo.isRedoAvailable(); }; instance.clearUndo = function(){ return instance.undoRedo.clear(); }; } function removeExposedUndoRedoMethods(instance){ delete instance.undo; delete instance.redo; delete instance.isUndoAvailable; delete instance.isRedoAvailable; delete instance.clearUndo; } Handsontable.PluginHooks.add('afterInit', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); })(Handsontable); /** * Plugin used to scroll Handsontable by selecting a cell and dragging outside of visible viewport * @constructor */ function DragToScroll() { this.boundaries = null; this.callback = null; } /** * @param boundaries {Object} compatible with getBoundingClientRect */ DragToScroll.prototype.setBoundaries = function (boundaries) { this.boundaries = boundaries; }; /** * @param callback {Function} */ DragToScroll.prototype.setCallback = function (callback) { this.callback = callback; }; /** * Check if mouse position (x, y) is outside of the viewport * @param x * @param y */ DragToScroll.prototype.check = function (x, y) { var diffX = 0; var diffY = 0; if (y < this.boundaries.top) { //y is less than top diffY = y - this.boundaries.top; } else if (y > this.boundaries.bottom) { //y is more than bottom diffY = y - this.boundaries.bottom; } if (x < this.boundaries.left) { //x is less than left diffX = x - this.boundaries.left; } else if (x > this.boundaries.right) { //x is more than right diffX = x - this.boundaries.right; } this.callback(diffX, diffY); }; var listening = false; var dragToScroll; var instance; if (typeof Handsontable !== 'undefined') { var setupListening = function (instance) { var scrollHandler = instance.view.wt.wtScrollbars.vertical.scrollHandler; //native scroll dragToScroll = new DragToScroll(); if (scrollHandler === window) { //not much we can do currently return; } else if (scrollHandler) { dragToScroll.setBoundaries(scrollHandler.getBoundingClientRect()); } else { dragToScroll.setBoundaries(instance.$table[0].getBoundingClientRect()); } dragToScroll.setCallback(function (scrollX, scrollY) { if (scrollX < 0) { if (scrollHandler) { scrollHandler.scrollLeft -= 50; } else { instance.view.wt.scrollHorizontal(-1).draw(); } } else if (scrollX > 0) { if (scrollHandler) { scrollHandler.scrollLeft += 50; } else { instance.view.wt.scrollHorizontal(1).draw(); } } if (scrollY < 0) { if (scrollHandler) { scrollHandler.scrollTop -= 20; } else { instance.view.wt.scrollVertical(-1).draw(); } } else if (scrollY > 0) { if (scrollHandler) { scrollHandler.scrollTop += 20; } else { instance.view.wt.scrollVertical(1).draw(); } } }); listening = true; }; Handsontable.PluginHooks.add('afterInit', function () { $(document).on('mouseup.' + this.guid, function () { listening = false; }); $(document).on('mousemove.' + this.guid, function (event) { if (listening) { dragToScroll.check(event.clientX, event.clientY); } }); }); Handsontable.PluginHooks.add('destroy', function () { $(document).off('.' + this.guid); }); Handsontable.PluginHooks.add('afterOnCellMouseDown', function () { setupListening(this); }); Handsontable.PluginHooks.add('afterOnCellCornerMouseDown', function () { setupListening(this); }); } (function (Handsontable, CopyPaste, SheetClip) { function CopyPastePlugin(instance) { this.copyPasteInstance = CopyPaste.getInstance(); this.copyPasteInstance.onCut(onCut); this.copyPasteInstance.onPaste(onPaste); var plugin = this; instance.addHook('beforeKeyDown', onBeforeKeyDown); function onCut() { if (!instance.isListening()) { return; } instance.selection.empty(); } function onPaste(str) { if (!instance.isListening() || !instance.selection.isSelected()) { return; } var input = str.replace(/^[\r\n]*/g, '').replace(/[\r\n]*$/g, '') //remove newline from the start and the end of the input , inputArray = SheetClip.parse(input) , selected = instance.getSelected() , coords = instance.getCornerCoords([{row: selected[0], col: selected[1]}, {row: selected[2], col: selected[3]}]) , areaStart = coords.TL , areaEnd = { row: Math.max(coords.BR.row, inputArray.length - 1 + coords.TL.row), col: Math.max(coords.BR.col, inputArray[0].length - 1 + coords.TL.col) }; instance.PluginHooks.once('afterChange', function (changes, source) { if (changes && changes.length) { this.selectCell(areaStart.row, areaStart.col, areaEnd.row, areaEnd.col); } }); instance.populateFromArray(areaStart.row, areaStart.col, inputArray, areaEnd.row, areaEnd.col, 'paste', instance.getSettings().pasteMode); }; function onBeforeKeyDown (event) { if (Handsontable.helper.isCtrlKey(event.keyCode)) { //when CTRL is pressed, prepare selectable text in textarea //http://stackoverflow.com/questions/3902635/how-does-one-capture-a-macs-command-key-via-javascript plugin.setCopyableText(); event.stopImmediatePropagation(); return; } var ctrlDown = (event.ctrlKey || event.metaKey) && !event.altKey; //catch CTRL but not right ALT (which in some systems triggers ALT+CTRL) if (event.keyCode == Handsontable.helper.keyCode.A && ctrlDown) { setTimeout(Handsontable.helper.proxy(plugin.setCopyableText, plugin)); } } this.destroy = function () { this.copyPasteInstance.removeCallback(onCut); this.copyPasteInstance.removeCallback(onPaste); this.copyPasteInstance.destroy(); instance.removeHook('beforeKeyDown', onBeforeKeyDown); }; instance.addHook('afterDestroy', Handsontable.helper.proxy(this.destroy, this)); this.triggerPaste = Handsontable.helper.proxy(this.copyPasteInstance.triggerPaste, this.copyPasteInstance); this.triggerCut = Handsontable.helper.proxy(this.copyPasteInstance.triggerCut, this.copyPasteInstance); /** * Prepares copyable text in the invisible textarea */ this.setCopyableText = function () { var selection = instance.getSelected(); var settings = instance.getSettings(); var copyRowsLimit = settings.copyRowsLimit; var copyColsLimit = settings.copyColsLimit; var startRow = Math.min(selection[0], selection[2]); var startCol = Math.min(selection[1], selection[3]); var endRow = Math.max(selection[0], selection[2]); var endCol = Math.max(selection[1], selection[3]); var finalEndRow = Math.min(endRow, startRow + copyRowsLimit - 1); var finalEndCol = Math.min(endCol, startCol + copyColsLimit - 1); instance.copyPaste.copyPasteInstance.copyable(instance.getCopyableData(startRow, startCol, finalEndRow, finalEndCol)); if (endRow !== finalEndRow || endCol !== finalEndCol) { instance.PluginHooks.run("afterCopyLimit", endRow - startRow + 1, endCol - startCol + 1, copyRowsLimit, copyColsLimit); } }; } function init() { var instance = this; var pluginEnabled = instance.getSettings().copyPaste !== false; if(pluginEnabled && !instance.copyPaste){ instance.copyPaste = new CopyPastePlugin(instance); } else if (!pluginEnabled && instance.copyPaste) { instance.copyPaste.destroy(); delete instance.copyPaste; } } Handsontable.PluginHooks.add('afterInit', init); Handsontable.PluginHooks.add('afterUpdateSettings', init); })(Handsontable, CopyPaste, SheetClip); /** * Creates an overlay over the original Walkontable instance. The overlay renders the clone of the original Walkontable * and (optionally) implements behavior needed for native horizontal and vertical scrolling */ function WalkontableOverlay() { this.maxOuts = 10; //max outs in one direction (before and after table) } /* Possible optimizations: [x] don't rerender if scroll delta is smaller than the fragment outside of the viewport [ ] move .style.top change before .draw() [ ] put .draw() in requestAnimationFrame [ ] don't rerender rows that remain visible after the scroll */ WalkontableOverlay.prototype.init = function () { this.TABLE = this.instance.wtTable.TABLE; this.fixed = this.instance.wtTable.hider; this.fixedContainer = this.instance.wtTable.holder; this.fixed.style.position = 'absolute'; this.fixed.style.left = '0'; this.scrollHandler = this.getScrollableElement(this.TABLE); this.$scrollHandler = $(this.scrollHandler); //in future remove jQuery from here }; WalkontableOverlay.prototype.makeClone = function (direction) { var clone = document.createElement('DIV'); clone.className = 'ht_clone_' + direction + ' handsontable'; clone.style.position = 'fixed'; clone.style.overflow = 'hidden'; var table2 = document.createElement('TABLE'); table2.className = this.instance.wtTable.TABLE.className; clone.appendChild(table2); this.instance.wtTable.holder.parentNode.appendChild(clone); return new Walkontable({ cloneSource: this.instance, cloneOverlay: this, table: table2 }); }; WalkontableOverlay.prototype.getScrollableElement = function (TABLE) { var el = TABLE.parentNode; while (el && el.style) { if (el.style.overflow !== 'visible' && el.style.overflow !== '') { return el; } if (this instanceof WalkontableHorizontalScrollbarNative && el.style.overflowX !== 'visible' && el.style.overflowX !== '') { return el; } el = el.parentNode; } return window; }; WalkontableOverlay.prototype.prepare = function () { }; WalkontableOverlay.prototype.onScroll = function (forcePosition) { this.windowScrollPosition = this.getScrollPosition(); this.readSettings(); //read window scroll position if (forcePosition) { this.windowScrollPosition = forcePosition; } this.resetFixedPosition(); //may be redundant }; WalkontableOverlay.prototype.availableSize = function () { var availableSize; if (this.windowScrollPosition > this.tableParentOffset /*&& last > -1*/) { //last -1 means that viewport is scrolled behind the table if (this.instance.wtTable.getLastVisibleRow() === this.total - 1) { availableSize = this.instance.wtDom.outerHeight(this.TABLE); } else { availableSize = this.windowSize; } } else { availableSize = this.windowSize - (this.tableParentOffset); } return availableSize; }; WalkontableOverlay.prototype.refresh = function (selectionsOnly) { var last = this.getLastCell(); this.measureBefore = this.sumCellSizes(0, this.offset); if (last === -1) { //last -1 means that viewport is scrolled behind the table this.measureAfter = 0; } else { this.measureAfter = this.sumCellSizes(last, this.total - last); } this.applyToDOM(); this.clone && this.clone.draw(selectionsOnly); }; WalkontableOverlay.prototype.destroy = function () { this.$scrollHandler.off('.' + this.instance.guid); $(window).off('.' + this.instance.guid); $(document).off('.' + this.instance.guid); }; function WalkontableBorder(instance, settings) { var style; //reference to instance this.instance = instance; this.settings = settings; this.wtDom = this.instance.wtDom; this.main = document.createElement("div"); style = this.main.style; style.position = 'absolute'; style.top = 0; style.left = 0; // style.visibility = 'hidden'; for (var i = 0; i < 5; i++) { var DIV = document.createElement('DIV'); DIV.className = 'wtBorder ' + (settings.className || ''); style = DIV.style; style.backgroundColor = settings.border.color; style.height = settings.border.width + 'px'; style.width = settings.border.width + 'px'; this.main.appendChild(DIV); } this.top = this.main.childNodes[0]; this.left = this.main.childNodes[1]; this.bottom = this.main.childNodes[2]; this.right = this.main.childNodes[3]; /*$(this.top).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.left).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.bottom).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); }); $(this.right).on(sss, function(event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).hide(); });*/ this.topStyle = this.top.style; this.leftStyle = this.left.style; this.bottomStyle = this.bottom.style; this.rightStyle = this.right.style; this.corner = this.main.childNodes[4]; this.corner.className += ' corner'; this.cornerStyle = this.corner.style; this.cornerStyle.width = '5px'; this.cornerStyle.height = '5px'; this.cornerStyle.border = '2px solid #FFF'; this.disappear(); if (!instance.wtTable.bordersHolder) { instance.wtTable.bordersHolder = document.createElement('div'); instance.wtTable.bordersHolder.className = 'htBorders'; instance.wtTable.hider.appendChild(instance.wtTable.bordersHolder); } instance.wtTable.bordersHolder.appendChild(this.main); var down = false; var $body = $(document.body); $body.on('mousedown.walkontable.' + instance.guid, function () { down = true; }); $body.on('mouseup.walkontable.' + instance.guid, function () { down = false }); $(this.main.childNodes).on('mouseenter', function (event) { if (!down || !instance.getSetting('hideBorderOnMouseDownOver')) { return; } event.preventDefault(); event.stopImmediatePropagation(); var bounds = this.getBoundingClientRect(); var $this = $(this); $this.hide(); var isOutside = function (event) { if (event.clientY < Math.floor(bounds.top)) { return true; } if (event.clientY > Math.ceil(bounds.top + bounds.height)) { return true; } if (event.clientX < Math.floor(bounds.left)) { return true; } if (event.clientX > Math.ceil(bounds.left + bounds.width)) { return true; } }; $body.on('mousemove.border.' + instance.guid, function (event) { if (isOutside(event)) { $body.off('mousemove.border.' + instance.guid); $this.show(); } }); }); } /** * Show border around one or many cells * @param {Array} corners */ WalkontableBorder.prototype.appear = function (corners) { var isMultiple, fromTD, toTD, fromOffset, toOffset, containerOffset, top, minTop, left, minLeft, height, width; if (this.disabled) { return; } var instance = this.instance , fromRow , fromColumn , toRow , toColumn , hideTop = false , hideLeft = false , hideBottom = false , hideRight = false , i , ilen , s; if (!instance.wtTable.isRowInViewport(corners[0])) { hideTop = true; } if (!instance.wtTable.isRowInViewport(corners[2])) { hideBottom = true; } ilen = instance.wtTable.rowStrategy.countVisible(); for (i = 0; i < ilen; i++) { s = instance.wtTable.rowFilter.visibleToSource(i); if (s >= corners[0] && s <= corners[2]) { fromRow = s; break; } } for (i = ilen - 1; i >= 0; i--) { s = instance.wtTable.rowFilter.visibleToSource(i); if (s >= corners[0] && s <= corners[2]) { toRow = s; break; } } if (hideTop && hideBottom) { hideLeft = true; hideRight = true; } else { if (!instance.wtTable.isColumnInViewport(corners[1])) { hideLeft = true; } if (!instance.wtTable.isColumnInViewport(corners[3])) { hideRight = true; } ilen = instance.wtTable.columnStrategy.countVisible(); for (i = 0; i < ilen; i++) { s = instance.wtTable.columnFilter.visibleToSource(i); if (s >= corners[1] && s <= corners[3]) { fromColumn = s; break; } } for (i = ilen - 1; i >= 0; i--) { s = instance.wtTable.columnFilter.visibleToSource(i); if (s >= corners[1] && s <= corners[3]) { toColumn = s; break; } } } if (fromRow !== void 0 && fromColumn !== void 0) { isMultiple = (fromRow !== toRow || fromColumn !== toColumn); fromTD = instance.wtTable.getCell([fromRow, fromColumn]); toTD = isMultiple ? instance.wtTable.getCell([toRow, toColumn]) : fromTD; fromOffset = this.wtDom.offset(fromTD); toOffset = isMultiple ? this.wtDom.offset(toTD) : fromOffset; containerOffset = this.wtDom.offset(instance.wtTable.TABLE); minTop = fromOffset.top; height = toOffset.top + this.wtDom.outerHeight(toTD) - minTop; minLeft = fromOffset.left; width = toOffset.left + this.wtDom.outerWidth(toTD) - minLeft; top = minTop - containerOffset.top - 1; left = minLeft - containerOffset.left - 1; var style = this.wtDom.getComputedStyle(fromTD); if (parseInt(style['borderTopWidth'], 10) > 0) { top += 1; height = height > 0 ? height - 1 : 0; } if (parseInt(style['borderLeftWidth'], 10) > 0) { left += 1; width = width > 0 ? width - 1 : 0; } } else { this.disappear(); return; } if (hideTop) { this.topStyle.display = 'none'; } else { this.topStyle.top = top + 'px'; this.topStyle.left = left + 'px'; this.topStyle.width = width + 'px'; this.topStyle.display = 'block'; } if (hideLeft) { this.leftStyle.display = 'none'; } else { this.leftStyle.top = top + 'px'; this.leftStyle.left = left + 'px'; this.leftStyle.height = height + 'px'; this.leftStyle.display = 'block'; } var delta = Math.floor(this.settings.border.width / 2); if (hideBottom) { this.bottomStyle.display = 'none'; } else { this.bottomStyle.top = top + height - delta + 'px'; this.bottomStyle.left = left + 'px'; this.bottomStyle.width = width + 'px'; this.bottomStyle.display = 'block'; } if (hideRight) { this.rightStyle.display = 'none'; } else { this.rightStyle.top = top + 'px'; this.rightStyle.left = left + width - delta + 'px'; this.rightStyle.height = height + 1 + 'px'; this.rightStyle.display = 'block'; } if (hideBottom || hideRight || !this.hasSetting(this.settings.border.cornerVisible)) { this.cornerStyle.display = 'none'; } else { this.cornerStyle.top = top + height - 4 + 'px'; this.cornerStyle.left = left + width - 4 + 'px'; this.cornerStyle.display = 'block'; } }; /** * Hide border */ WalkontableBorder.prototype.disappear = function () { this.topStyle.display = 'none'; this.leftStyle.display = 'none'; this.bottomStyle.display = 'none'; this.rightStyle.display = 'none'; this.cornerStyle.display = 'none'; }; WalkontableBorder.prototype.hasSetting = function (setting) { if (typeof setting === 'function') { return setting(); } return !!setting; }; /** * WalkontableCellFilter * @constructor */ function WalkontableCellFilter() { this.offset = 0; this.total = 0; this.fixedCount = 0; } WalkontableCellFilter.prototype.source = function (n) { return n; }; WalkontableCellFilter.prototype.offsetted = function (n) { return n + this.offset; }; WalkontableCellFilter.prototype.unOffsetted = function (n) { return n - this.offset; }; WalkontableCellFilter.prototype.fixed = function (n) { if (n < this.fixedCount) { return n - this.offset; } else { return n; } }; WalkontableCellFilter.prototype.unFixed = function (n) { if (n < this.fixedCount) { return n + this.offset; } else { return n; } }; WalkontableCellFilter.prototype.visibleToSource = function (n) { return this.source(this.offsetted(this.fixed(n))); }; WalkontableCellFilter.prototype.sourceToVisible = function (n) { return this.source(this.unOffsetted(this.unFixed(n))); }; /** * WalkontableCellStrategy * @constructor */ function WalkontableCellStrategy(instance) { this.instance = instance; } WalkontableCellStrategy.prototype.getSize = function (index) { return this.cellSizes[index]; }; WalkontableCellStrategy.prototype.getContainerSize = function (proposedSize) { return typeof this.containerSizeFn === 'function' ? this.containerSizeFn(proposedSize) : this.containerSizeFn; }; WalkontableCellStrategy.prototype.countVisible = function () { return this.cellCount; }; WalkontableCellStrategy.prototype.isLastIncomplete = function () { if(this.instance.getSetting('nativeScrollbars')){ var nativeScrollbar = this.instance.cloneFrom ? this.instance.cloneFrom.wtScrollbars.vertical : this.instance.wtScrollbars.vertical; return this.remainingSize > nativeScrollbar.sumCellSizes(nativeScrollbar.offset, nativeScrollbar.offset + nativeScrollbar.curOuts + 1); } else { return this.remainingSize > 0; } }; /** * WalkontableClassNameList * @constructor */ function WalkontableClassNameCache() { this.cache = []; } WalkontableClassNameCache.prototype.add = function (r, c, cls) { if (!this.cache[r]) { this.cache[r] = []; } if (!this.cache[r][c]) { this.cache[r][c] = []; } this.cache[r][c][cls] = true; }; WalkontableClassNameCache.prototype.test = function (r, c, cls) { return (this.cache[r] && this.cache[r][c] && this.cache[r][c][cls]); }; /** * WalkontableColumnFilter * @constructor */ function WalkontableColumnFilter() { this.countTH = 0; } WalkontableColumnFilter.prototype = new WalkontableCellFilter(); WalkontableColumnFilter.prototype.readSettings = function (instance) { this.offset = instance.wtSettings.settings.offsetColumn; this.total = instance.getSetting('totalColumns'); this.fixedCount = instance.getSetting('fixedColumnsLeft'); this.countTH = instance.getSetting('rowHeaders').length; }; WalkontableColumnFilter.prototype.offsettedTH = function (n) { return n - this.countTH; }; WalkontableColumnFilter.prototype.unOffsettedTH = function (n) { return n + this.countTH; }; WalkontableColumnFilter.prototype.visibleRowHeadedColumnToSourceColumn = function (n) { return this.visibleToSource(this.offsettedTH(n)); }; WalkontableColumnFilter.prototype.sourceColumnToVisibleRowHeadedColumn = function (n) { return this.unOffsettedTH(this.sourceToVisible(n)); }; /** * WalkontableColumnStrategy * @param containerSizeFn * @param sizeAtIndex * @param strategy - all, last, none * @constructor */ function WalkontableColumnStrategy(instance, containerSizeFn, sizeAtIndex, strategy) { var size , i = 0; WalkontableCellStrategy.apply(this, arguments); this.containerSizeFn = containerSizeFn; this.cellSizesSum = 0; this.cellSizes = []; this.cellStretch = []; this.cellCount = 0; this.remainingSize = 0; this.strategy = strategy; //step 1 - determine cells that fit containerSize and cache their widths while (true) { size = sizeAtIndex(i); if (size === void 0) { break; //total columns exceeded } if (this.cellSizesSum >= this.getContainerSize(this.cellSizesSum + size)) { break; //total width exceeded } this.cellSizes.push(size); this.cellSizesSum += size; this.cellCount++; i++; } var containerSize = this.getContainerSize(this.cellSizesSum); this.remainingSize = this.cellSizesSum - containerSize; //negative value means the last cell is fully visible and there is some space left for stretching //positive value means the last cell is not fully visible } WalkontableColumnStrategy.prototype = new WalkontableCellStrategy(); WalkontableColumnStrategy.prototype.getSize = function (index) { return this.cellSizes[index] + (this.cellStretch[index] || 0); }; WalkontableColumnStrategy.prototype.stretch = function () { //step 2 - apply stretching strategy var containerSize = this.getContainerSize(this.cellSizesSum) , i = 0; this.remainingSize = this.cellSizesSum - containerSize; this.cellStretch.length = 0; //clear previous stretch if (this.strategy === 'all') { if (this.remainingSize < 0) { var ratio = containerSize / this.cellSizesSum; var newSize; while (i < this.cellCount - 1) { //"i < this.cellCount - 1" is needed because last cellSize is adjusted after the loop newSize = Math.floor(ratio * this.cellSizes[i]); this.remainingSize += newSize - this.cellSizes[i]; this.cellStretch[i] = newSize - this.cellSizes[i]; i++; } this.cellStretch[this.cellCount - 1] = -this.remainingSize; this.remainingSize = 0; } } else if (this.strategy === 'last') { if (this.remainingSize < 0 && containerSize !== Infinity) { //Infinity is with native scroll when the table is wider than the viewport (TODO: test) this.cellStretch[this.cellCount - 1] = -this.remainingSize; this.remainingSize = 0; } } }; function Walkontable(settings) { var that = this, originalHeaders = []; this.guid = 'wt_' + walkontableRandomString(); //this is the namespace for global events //bootstrap from settings this.wtDom = new WalkontableDom(); if (settings.cloneSource) { this.cloneSource = settings.cloneSource; this.cloneOverlay = settings.cloneOverlay; this.wtSettings = settings.cloneSource.wtSettings; this.wtTable = new WalkontableTable(this, settings.table); this.wtScroll = new WalkontableScroll(this); this.wtViewport = settings.cloneSource.wtViewport; } else { this.wtSettings = new WalkontableSettings(this, settings); this.wtTable = new WalkontableTable(this, settings.table); this.wtScroll = new WalkontableScroll(this); this.wtViewport = new WalkontableViewport(this); this.wtScrollbars = new WalkontableScrollbars(this); this.wtWheel = new WalkontableWheel(this); this.wtEvent = new WalkontableEvent(this); } //find original headers if (this.wtTable.THEAD.childNodes.length && this.wtTable.THEAD.childNodes[0].childNodes.length) { for (var c = 0, clen = this.wtTable.THEAD.childNodes[0].childNodes.length; c < clen; c++) { originalHeaders.push(this.wtTable.THEAD.childNodes[0].childNodes[c].innerHTML); } if (!this.getSetting('columnHeaders').length) { this.update('columnHeaders', [function (column, TH) { that.wtDom.fastInnerText(TH, originalHeaders[column]); }]); } } //initialize selections this.selections = {}; var selectionsSettings = this.getSetting('selections'); if (selectionsSettings) { for (var i in selectionsSettings) { if (selectionsSettings.hasOwnProperty(i)) { this.selections[i] = new WalkontableSelection(this, selectionsSettings[i]); } } } this.drawn = false; this.drawInterrupted = false; //at this point the cached row heights may be invalid, but it is better not to reset the cache, which could cause scrollbar jumping when there are multiline cells outside of the rendered part of the table /*if (window.Handsontable) { Handsontable.PluginHooks.add('beforeChange', function () { if (that.rowHeightCache) { that.rowHeightCache.length = 0; } }); }*/ } Walkontable.prototype.draw = function (selectionsOnly) { this.drawInterrupted = false; if (!selectionsOnly && !this.wtDom.isVisible(this.wtTable.TABLE)) { this.drawInterrupted = true; //draw interrupted because TABLE is not visible return; } this.getSetting('beforeDraw', !selectionsOnly); selectionsOnly = selectionsOnly && this.getSetting('offsetRow') === this.lastOffsetRow && this.getSetting('offsetColumn') === this.lastOffsetColumn; if (this.drawn) { //fix offsets that might have changed this.scrollVertical(0); this.scrollHorizontal(0); } this.lastOffsetRow = this.getSetting('offsetRow'); this.lastOffsetColumn = this.getSetting('offsetColumn'); this.wtTable.draw(selectionsOnly); if (!this.cloneSource) { this.getSetting('onDraw', !selectionsOnly); } return this; }; Walkontable.prototype.update = function (settings, value) { return this.wtSettings.update(settings, value); }; Walkontable.prototype.scrollVertical = function (delta) { var result = this.wtScroll.scrollVertical(delta); this.getSetting('onScrollVertically'); return result; }; Walkontable.prototype.scrollHorizontal = function (delta) { var result = this.wtScroll.scrollHorizontal(delta); this.getSetting('onScrollHorizontally'); return result; }; Walkontable.prototype.scrollViewport = function (coords) { this.wtScroll.scrollViewport(coords); return this; }; Walkontable.prototype.getViewport = function () { return [ this.wtTable.rowFilter.visibleToSource(0), this.wtTable.columnFilter.visibleToSource(0), this.wtTable.getLastVisibleRow(), this.wtTable.getLastVisibleColumn() ]; }; Walkontable.prototype.getSetting = function (key, param1, param2, param3) { return this.wtSettings.getSetting(key, param1, param2, param3); }; Walkontable.prototype.hasSetting = function (key) { return this.wtSettings.has(key); }; Walkontable.prototype.destroy = function () { $(document.body).off('.' + this.guid); this.wtScrollbars.destroy(); clearTimeout(this.wheelTimeout); this.wtEvent && this.wtEvent.destroy(); }; /** * A overlay that renders ALL available rows & columns positioned on top of the original Walkontable instance and all other overlays. * Used for debugging purposes to see if the other overlays (that render only part of the rows & columns) are positioned correctly * @param instance * @constructor */ function WalkontableDebugOverlay(instance) { this.instance = instance; this.init(); this.clone = this.makeClone('debug'); this.clone.wtTable.holder.style.opacity = 0.4; this.clone.wtTable.holder.style.textShadow = '0 0 2px #ff0000'; var that = this; var lastTimeout; var lastX = 0; var lastY = 0; var overlayContainer = that.clone.wtTable.holder.parentNode; $(document.body).on('mousemove.' + this.instance.guid, function (event) { if (!that.instance.wtTable.holder.parentNode) { return; //removed from DOM } if ((event.clientX - lastX > -5 && event.clientX - lastX < 5) && (event.clientY - lastY > -5 && event.clientY - lastY < 5)) { return; //ignore minor mouse movement } lastX = event.clientX; lastY = event.clientY; WalkontableDom.prototype.addClass(overlayContainer, 'wtDebugHidden'); WalkontableDom.prototype.removeClass(overlayContainer, 'wtDebugVisible'); clearTimeout(lastTimeout); lastTimeout = setTimeout(function () { WalkontableDom.prototype.removeClass(overlayContainer, 'wtDebugHidden'); WalkontableDom.prototype.addClass(overlayContainer, 'wtDebugVisible'); }, 1000); }); } WalkontableDebugOverlay.prototype = new WalkontableOverlay(); WalkontableDebugOverlay.prototype.resetFixedPosition = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } var elem = this.clone.wtTable.holder.parentNode; var box = this.instance.wtTable.holder.getBoundingClientRect(); elem.style.top = Math.ceil(box.top, 10) + 'px'; elem.style.left = Math.ceil(box.left, 10) + 'px'; }; WalkontableDebugOverlay.prototype.prepare = function () { }; WalkontableDebugOverlay.prototype.refresh = function (selectionsOnly) { this.clone && this.clone.draw(selectionsOnly); }; WalkontableDebugOverlay.prototype.getScrollPosition = function () { }; WalkontableDebugOverlay.prototype.getLastCell = function () { }; WalkontableDebugOverlay.prototype.applyToDOM = function () { }; WalkontableDebugOverlay.prototype.scrollTo = function () { }; WalkontableDebugOverlay.prototype.readWindowSize = function () { }; WalkontableDebugOverlay.prototype.readSettings = function () { }; function WalkontableDom() { } //goes up the DOM tree (including given element) until it finds an element that matches the nodeName WalkontableDom.prototype.closest = function (elem, nodeNames, until) { while (elem != null && elem !== until) { if (elem.nodeType === 1 && nodeNames.indexOf(elem.nodeName) > -1) { return elem; } elem = elem.parentNode; } return null; }; //goes up the DOM tree and checks if element is child of another element WalkontableDom.prototype.isChildOf = function (child, parent) { var node = child.parentNode; while (node != null) { if (node == parent) { return true; } node = node.parentNode; } return false; }; /** * Counts index of element within its parent * WARNING: for performance reasons, assumes there are only element nodes (no text nodes). This is true for Walkotnable * Otherwise would need to check for nodeType or use previousElementSibling * @see http://jsperf.com/sibling-index/10 * @param {Element} elem * @return {Number} */ WalkontableDom.prototype.index = function (elem) { var i = 0; while (elem = elem.previousSibling) { ++i } return i; }; if (document.documentElement.classList) { // HTML5 classList API WalkontableDom.prototype.hasClass = function (ele, cls) { return ele.classList.contains(cls); }; WalkontableDom.prototype.addClass = function (ele, cls) { ele.classList.add(cls); }; WalkontableDom.prototype.removeClass = function (ele, cls) { ele.classList.remove(cls); }; } else { //http://snipplr.com/view/3561/addclass-removeclass-hasclass/ WalkontableDom.prototype.hasClass = function (ele, cls) { return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); }; WalkontableDom.prototype.addClass = function (ele, cls) { if (!this.hasClass(ele, cls)) ele.className += " " + cls; }; WalkontableDom.prototype.removeClass = function (ele, cls) { if (this.hasClass(ele, cls)) { //is this really needed? var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); ele.className = ele.className.replace(reg, ' ').trim(); //String.prototype.trim is defined in polyfill.js } }; } /*//http://net.tutsplus.com/tutorials/javascript-ajax/javascript-from-null-cross-browser-event-binding/ WalkontableDom.prototype.addEvent = (function () { var that = this; if (document.addEventListener) { return function (elem, type, cb) { if ((elem && !elem.length) || elem === window) { elem.addEventListener(type, cb, false); } else if (elem && elem.length) { var len = elem.length; for (var i = 0; i < len; i++) { that.addEvent(elem[i], type, cb); } } }; } else { return function (elem, type, cb) { if ((elem && !elem.length) || elem === window) { elem.attachEvent('on' + type, function () { //normalize //http://stackoverflow.com/questions/4643249/cross-browser-event-object-normalization var e = window['event']; e.target = e.srcElement; //e.offsetX = e.layerX; //e.offsetY = e.layerY; e.relatedTarget = e.relatedTarget || e.type == 'mouseover' ? e.fromElement : e.toElement; if (e.target.nodeType === 3) e.target = e.target.parentNode; //Safari bug return cb.call(elem, e) }); } else if (elem.length) { var len = elem.length; for (var i = 0; i < len; i++) { that.addEvent(elem[i], type, cb); } } }; } })(); WalkontableDom.prototype.triggerEvent = function (element, eventName, target) { var event; if (document.createEvent) { event = document.createEvent("MouseEvents"); event.initEvent(eventName, true, true); } else { event = document.createEventObject(); event.eventType = eventName; } event.eventName = eventName; event.target = target; if (document.createEvent) { target.dispatchEvent(event); } else { target.fireEvent("on" + event.eventType, event); } };*/ WalkontableDom.prototype.removeTextNodes = function (elem, parent) { if (elem.nodeType === 3) { parent.removeChild(elem); //bye text nodes! } else if (['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR'].indexOf(elem.nodeName) > -1) { var childs = elem.childNodes; for (var i = childs.length - 1; i >= 0; i--) { this.removeTextNodes(childs[i], elem); } } }; /** * Remove childs function * WARNING - this doesn't unload events and data attached by jQuery * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/9 * http://jsperf.com/jquery-html-vs-empty-vs-innerhtml/11 - no siginificant improvement with Chrome remove() method * @param element * @returns {void} */ // WalkontableDom.prototype.empty = function (element) { var child; while (child = element.lastChild) { element.removeChild(child); } }; WalkontableDom.prototype.HTML_CHARACTERS = /(<(.*)>|&(.*);)/; /** * Insert content into element trying avoid innerHTML method. * @return {void} */ WalkontableDom.prototype.fastInnerHTML = function (element, content) { if (this.HTML_CHARACTERS.test(content)) { element.innerHTML = content; } else { this.fastInnerText(element, content); } }; /** * Insert text content into element * @return {void} */ if (document.createTextNode('test').textContent) { //STANDARDS WalkontableDom.prototype.fastInnerText = function (element, content) { var child = element.firstChild; if (child && child.nodeType === 3 && child.nextSibling === null) { //fast lane - replace existing text node //http://jsperf.com/replace-text-vs-reuse child.textContent = content; } else { //slow lane - empty element and insert a text node this.empty(element); element.appendChild(document.createTextNode(content)); } }; } else { //IE8 WalkontableDom.prototype.fastInnerText = function (element, content) { var child = element.firstChild; if (child && child.nodeType === 3 && child.nextSibling === null) { //fast lane - replace existing text node //http://jsperf.com/replace-text-vs-reuse child.data = content; } else { //slow lane - empty element and insert a text node this.empty(element); element.appendChild(document.createTextNode(content)); } }; } /** * Returns true/false depending if element has offset parent * @param elem * @returns {boolean} */ /*if (document.createTextNode('test').textContent) { //STANDARDS WalkontableDom.prototype.hasOffsetParent = function (elem) { return !!elem.offsetParent; } } else { WalkontableDom.prototype.hasOffsetParent = function (elem) { try { if (!elem.offsetParent) { return false; } } catch (e) { return false; //IE8 throws "Unspecified error" when offsetParent is not found - we catch it here } return true; } }*/ /** * Returns true if element is attached to the DOM and visible, false otherwise * @param elem * @returns {boolean} */ WalkontableDom.prototype.isVisible = function (elem) { //fast method according to benchmarks, but requires layout so slow in our case /* if (!WalkontableDom.prototype.hasOffsetParent(elem)) { return false; //fixes problem with UI Bootstrap <tabs> directive } // if (elem.offsetWidth > 0 || (elem.parentNode && elem.parentNode.offsetWidth > 0)) { //IE10 was mistaken here if (elem.offsetWidth > 0) { return true; } */ //slow method var next = elem; while (next !== document.documentElement) { //until <html> reached if (next === null) { //parent detached from DOM return false; } else if (next.nodeType === 11) { //nodeType == 1 -> DOCUMENT_FRAGMENT_NODE if (next.host) { //this is Web Components Shadow DOM //see: http://w3c.github.io/webcomponents/spec/shadow/#encapsulation //according to spec, should be if (next.ownerDocument !== window.document), but that doesn't work yet if (next.host.impl) { //Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features disabled return WalkontableDom.prototype.isVisible(next.host.impl); } else if (next.host) { //Chrome 33.0.1723.0 canary (2013-11-29) Web Platform features enabled return WalkontableDom.prototype.isVisible(next.host); } else { throw new Error("Lost in Web Components world"); } } else { return false; //this is a node detached from document in IE8 } } else if (next.style.display === 'none') { return false; } next = next.parentNode; } return true; }; /** * Returns elements top and left offset relative to the document. In our usage case compatible with jQuery but 2x faster * @param {HTMLElement} elem * @return {Object} */ WalkontableDom.prototype.offset = function (elem) { if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { //fixes problem with Firefox ignoring <caption> in TABLE offset (see also WalkontableDom.prototype.outerHeight) //http://jsperf.com/offset-vs-getboundingclientrect/8 var box = elem.getBoundingClientRect(); return { top: box.top + (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), left: box.left + (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0) }; } var offsetLeft = elem.offsetLeft , offsetTop = elem.offsetTop , lastElem = elem; while (elem = elem.offsetParent) { if (elem === document.body) { //from my observation, document.body always has scrollLeft/scrollTop == 0 break; } offsetLeft += elem.offsetLeft; offsetTop += elem.offsetTop; lastElem = elem; } if (lastElem && lastElem.style.position === 'fixed') { //slow - http://jsperf.com/offset-vs-getboundingclientrect/6 //if(lastElem !== document.body) { //faster but does gives false positive in Firefox offsetLeft += window.pageXOffset || document.documentElement.scrollLeft; offsetTop += window.pageYOffset || document.documentElement.scrollTop; } return { left: offsetLeft, top: offsetTop }; }; WalkontableDom.prototype.getComputedStyle = function (elem) { return elem.currentStyle || document.defaultView.getComputedStyle(elem); }; WalkontableDom.prototype.outerWidth = function (elem) { return elem.offsetWidth; }; WalkontableDom.prototype.outerHeight = function (elem) { if (this.hasCaptionProblem() && elem.firstChild && elem.firstChild.nodeName === 'CAPTION') { //fixes problem with Firefox ignoring <caption> in TABLE.offsetHeight //jQuery (1.10.1) still has this unsolved //may be better to just switch to getBoundingClientRect //http://bililite.com/blog/2009/03/27/finding-the-size-of-a-table/ //http://lists.w3.org/Archives/Public/www-style/2009Oct/0089.html //http://bugs.jquery.com/ticket/2196 //http://lists.w3.org/Archives/Public/www-style/2009Oct/0140.html#start140 return elem.offsetHeight + elem.firstChild.offsetHeight; } else { return elem.offsetHeight; } }; (function () { var hasCaptionProblem; function detectCaptionProblem() { var TABLE = document.createElement('TABLE'); TABLE.style.borderSpacing = 0; TABLE.style.borderWidth = 0; TABLE.style.padding = 0; var TBODY = document.createElement('TBODY'); TABLE.appendChild(TBODY); TBODY.appendChild(document.createElement('TR')); TBODY.firstChild.appendChild(document.createElement('TD')); TBODY.firstChild.firstChild.innerHTML = '<tr><td>t<br>t</td></tr>'; var CAPTION = document.createElement('CAPTION'); CAPTION.innerHTML = 'c<br>c<br>c<br>c'; CAPTION.style.padding = 0; CAPTION.style.margin = 0; TABLE.insertBefore(CAPTION, TBODY); document.body.appendChild(TABLE); hasCaptionProblem = (TABLE.offsetHeight < 2 * TABLE.lastChild.offsetHeight); //boolean document.body.removeChild(TABLE); } WalkontableDom.prototype.hasCaptionProblem = function () { if (hasCaptionProblem === void 0) { detectCaptionProblem(); } return hasCaptionProblem; }; /** * Returns caret position in text input * @author http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea * @return {Number} */ WalkontableDom.prototype.getCaretPosition = function (el) { if (el.selectionStart) { return el.selectionStart; } else if (document.selection) { //IE8 el.focus(); var r = document.selection.createRange(); if (r == null) { return 0; } var re = el.createTextRange(), rc = re.duplicate(); re.moveToBookmark(r.getBookmark()); rc.setEndPoint('EndToStart', re); return rc.text.length; } return 0; }; /** * Sets caret position in text input * @author http://blog.vishalon.net/index.php/javascript-getting-and-setting-caret-position-in-textarea/ * @param {Element} el * @param {Number} pos * @param {Number} endPos */ WalkontableDom.prototype.setCaretPosition = function (el, pos, endPos) { if (endPos === void 0) { endPos = pos; } if (el.setSelectionRange) { el.focus(); el.setSelectionRange(pos, endPos); } else if (el.createTextRange) { //IE8 var range = el.createTextRange(); range.collapse(true); range.moveEnd('character', endPos); range.moveStart('character', pos); range.select(); } }; var cachedScrollbarWidth; //http://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes function walkontableCalculateScrollbarWidth() { var inner = document.createElement('p'); inner.style.width = "100%"; inner.style.height = "200px"; var outer = document.createElement('div'); outer.style.position = "absolute"; outer.style.top = "0px"; outer.style.left = "0px"; outer.style.visibility = "hidden"; outer.style.width = "200px"; outer.style.height = "150px"; outer.style.overflow = "hidden"; outer.appendChild(inner); (document.body || document.documentElement).appendChild(outer); var w1 = inner.offsetWidth; outer.style.overflow = 'scroll'; var w2 = inner.offsetWidth; if (w1 == w2) w2 = outer.clientWidth; (document.body || document.documentElement).removeChild(outer); return (w1 - w2); } /** * Returns the computed width of the native browser scroll bar * @return {Number} width */ WalkontableDom.prototype.getScrollbarWidth = function () { if (cachedScrollbarWidth === void 0) { cachedScrollbarWidth = walkontableCalculateScrollbarWidth(); } return cachedScrollbarWidth; } })(); function WalkontableEvent(instance) { var that = this; //reference to instance this.instance = instance; this.wtDom = this.instance.wtDom; var dblClickOrigin = [null, null]; var dblClickTimeout = [null, null]; var onMouseDown = function (event) { var cell = that.parentCell(event.target); if (that.wtDom.hasClass(event.target, 'corner')) { that.instance.getSetting('onCellCornerMouseDown', event, event.target); } else if (cell.TD && cell.TD.nodeName === 'TD') { if (that.instance.hasSetting('onCellMouseDown')) { that.instance.getSetting('onCellMouseDown', event, cell.coords, cell.TD); } } if (event.button !== 2) { //if not right mouse button if (cell.TD && cell.TD.nodeName === 'TD') { dblClickOrigin[0] = cell.TD; clearTimeout(dblClickTimeout[0]); dblClickTimeout[0] = setTimeout(function () { dblClickOrigin[0] = null; }, 1000); } } }; var lastMouseOver; var onMouseOver = function (event) { if (that.instance.hasSetting('onCellMouseOver')) { var TABLE = that.instance.wtTable.TABLE; var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE); if (TD && TD !== lastMouseOver && that.wtDom.isChildOf(TD, TABLE)) { lastMouseOver = TD; if (TD.nodeName === 'TD') { that.instance.getSetting('onCellMouseOver', event, that.instance.wtTable.getCoords(TD), TD); } } } }; /* var lastMouseOut; var onMouseOut = function (event) { if (that.instance.hasSetting('onCellMouseOut')) { var TABLE = that.instance.wtTable.TABLE; var TD = that.wtDom.closest(event.target, ['TD', 'TH'], TABLE); if (TD && TD !== lastMouseOut && that.wtDom.isChildOf(TD, TABLE)) { lastMouseOut = TD; if (TD.nodeName === 'TD') { that.instance.getSetting('onCellMouseOut', event, that.instance.wtTable.getCoords(TD), TD); } } } };*/ var onMouseUp = function (event) { if (event.button !== 2) { //if not right mouse button var cell = that.parentCell(event.target); if (cell.TD === dblClickOrigin[0] && cell.TD === dblClickOrigin[1]) { if (that.wtDom.hasClass(event.target, 'corner')) { that.instance.getSetting('onCellCornerDblClick', event, cell.coords, cell.TD); } else if (cell.TD) { that.instance.getSetting('onCellDblClick', event, cell.coords, cell.TD); } dblClickOrigin[0] = null; dblClickOrigin[1] = null; } else if (cell.TD === dblClickOrigin[0]) { dblClickOrigin[1] = cell.TD; clearTimeout(dblClickTimeout[1]); dblClickTimeout[1] = setTimeout(function () { dblClickOrigin[1] = null; }, 500); } } }; $(this.instance.wtTable.holder).on('mousedown', onMouseDown); $(this.instance.wtTable.TABLE).on('mouseover', onMouseOver); // $(this.instance.wtTable.TABLE).on('mouseout', onMouseOut); $(this.instance.wtTable.holder).on('mouseup', onMouseUp); } WalkontableEvent.prototype.parentCell = function (elem) { var cell = {}; var TABLE = this.instance.wtTable.TABLE; var TD = this.wtDom.closest(elem, ['TD', 'TH'], TABLE); if (TD && this.wtDom.isChildOf(TD, TABLE)) { cell.coords = this.instance.wtTable.getCoords(TD); cell.TD = TD; } else if (this.wtDom.hasClass(elem, 'wtBorder') && this.wtDom.hasClass(elem, 'current')) { cell.coords = this.instance.selections.current.selected[0]; cell.TD = this.instance.wtTable.getCell(cell.coords); } return cell; }; WalkontableEvent.prototype.destroy = function () { clearTimeout(this.dblClickTimeout0); clearTimeout(this.dblClickTimeout1); }; function walkontableRangesIntersect() { var from = arguments[0]; var to = arguments[1]; for (var i = 1, ilen = arguments.length / 2; i < ilen; i++) { if (from <= arguments[2 * i + 1] && to >= arguments[2 * i]) { return true; } } return false; } /** * Generates a random hex string. Used as namespace for Walkontable instance events. * @return {String} - 16 character random string: "92b1bfc74ec4" */ function walkontableRandomString() { function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return s4() + s4() + s4() + s4(); } /** * http://notes.jetienne.com/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame.html */ window.requestAnimFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (/* function */ callback, /* DOMElement */ element) { return window.setTimeout(callback, 1000 / 60); }; })(); window.cancelRequestAnimFrame = (function () { return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || clearTimeout })(); //http://snipplr.com/view/13523/ //modified for speed //http://jsperf.com/getcomputedstyle-vs-style-vs-css/8 if (!window.getComputedStyle) { (function () { var elem; var styleObj = { getPropertyValue: function getPropertyValue(prop) { if (prop == 'float') prop = 'styleFloat'; return elem.currentStyle[prop.toUpperCase()] || null; } }; window.getComputedStyle = function (el) { elem = el; return styleObj; } })(); } /** * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim */ if (!String.prototype.trim) { var trimRegex = /^\s+|\s+$/g; String.prototype.trim = function () { return this.replace(trimRegex, ''); }; } /** * WalkontableRowFilter * @constructor */ function WalkontableRowFilter() { } WalkontableRowFilter.prototype = new WalkontableCellFilter(); WalkontableRowFilter.prototype.readSettings = function (instance) { if (instance.cloneOverlay instanceof WalkontableDebugOverlay) { this.offset = 0; } else { this.offset = instance.wtSettings.settings.offsetRow; } this.total = instance.getSetting('totalRows'); this.fixedCount = instance.getSetting('fixedRowsTop'); }; /** * WalkontableRowStrategy * @param containerSizeFn * @param sizeAtIndex * @constructor */ function WalkontableRowStrategy(instance, containerSizeFn, sizeAtIndex) { WalkontableCellStrategy.apply(this, arguments); this.containerSizeFn = containerSizeFn; this.sizeAtIndex = sizeAtIndex; this.cellSizesSum = 0; this.cellSizes = []; this.cellCount = 0; this.remainingSize = -Infinity; } WalkontableRowStrategy.prototype = new WalkontableCellStrategy(); WalkontableRowStrategy.prototype.add = function (i, TD, reverse) { if (!this.isLastIncomplete() && this.remainingSize != 0) { var size = this.sizeAtIndex(i, TD); if (size === void 0) { return false; //total rows exceeded } var containerSize = this.getContainerSize(this.cellSizesSum + size); if (reverse) { this.cellSizes.unshift(size); } else { this.cellSizes.push(size); } this.cellSizesSum += size; this.cellCount++; this.remainingSize = this.cellSizesSum - containerSize; if (reverse && this.isLastIncomplete()) { //something is outside of the screen, maybe even some full rows? return false; } return true; } return false; }; WalkontableRowStrategy.prototype.remove = function () { var size = this.cellSizes.pop(); this.cellSizesSum -= size; this.cellCount--; this.remainingSize -= size; }; WalkontableRowStrategy.prototype.removeOutstanding = function () { while (this.cellCount > 0 && this.cellSizes[this.cellCount - 1] < this.remainingSize) { //this row is completely off screen! this.remove(); } }; function WalkontableScroll(instance) { this.instance = instance; } WalkontableScroll.prototype.scrollVertical = function (delta) { if (!this.instance.drawn) { throw new Error('scrollVertical can only be called after table was drawn to DOM'); } var instance = this.instance , newOffset , offset = instance.getSetting('offsetRow') , fixedCount = instance.getSetting('fixedRowsTop') , total = instance.getSetting('totalRows') , maxSize = instance.wtViewport.getViewportHeight(); if (total > 0) { newOffset = this.scrollLogicVertical(delta, offset, total, fixedCount, maxSize, function (row) { if (row - offset < fixedCount && row - offset >= 0) { return instance.getSetting('rowHeight', row - offset); } else { return instance.getSetting('rowHeight', row); } }, function (isReverse) { instance.wtTable.verticalRenderReverse = isReverse; }); } else { newOffset = 0; } if (newOffset !== offset) { this.instance.wtScrollbars.vertical.scrollTo(newOffset); } return instance; }; WalkontableScroll.prototype.scrollHorizontal = function (delta) { if (!this.instance.drawn) { throw new Error('scrollHorizontal can only be called after table was drawn to DOM'); } var instance = this.instance , newOffset , offset = instance.getSetting('offsetColumn') , fixedCount = instance.getSetting('fixedColumnsLeft') , total = instance.getSetting('totalColumns') , maxSize = instance.wtViewport.getViewportWidth(); if (total > 0) { newOffset = this.scrollLogicHorizontal(delta, offset, total, fixedCount, maxSize, function (col) { if (col - offset < fixedCount && col - offset >= 0) { return instance.getSetting('columnWidth', col - offset); } else { return instance.getSetting('columnWidth', col); } }); } else { newOffset = 0; } if (newOffset !== offset) { this.instance.wtScrollbars.horizontal.scrollTo(newOffset); } return instance; }; WalkontableScroll.prototype.scrollLogicVertical = function (delta, offset, total, fixedCount, maxSize, cellSizeFn, setReverseRenderFn) { var newOffset = offset + delta; if (newOffset >= total - fixedCount) { newOffset = total - fixedCount - 1; setReverseRenderFn(true); } if (newOffset < 0) { newOffset = 0; } return newOffset; }; WalkontableScroll.prototype.scrollLogicHorizontal = function (delta, offset, total, fixedCount, maxSize, cellSizeFn) { var newOffset = offset + delta , sum = 0 , col; if (newOffset > fixedCount) { if (newOffset >= total - fixedCount) { newOffset = total - fixedCount - 1; } col = newOffset; while (sum < maxSize && col < total) { sum += cellSizeFn(col); col++; } if (sum < maxSize) { while (newOffset > 0) { //if sum still less than available width, we cannot scroll that far (must move offset to the left) sum += cellSizeFn(newOffset - 1); if (sum < maxSize) { newOffset--; } else { break; } } } } else if (newOffset < 0) { newOffset = 0; } return newOffset; }; /** * Scrolls viewport to a cell by minimum number of cells */ WalkontableScroll.prototype.scrollViewport = function (coords) { if (!this.instance.drawn) { return; } var offsetRow = this.instance.getSetting('offsetRow') , offsetColumn = this.instance.getSetting('offsetColumn') , lastVisibleRow = this.instance.wtTable.getLastVisibleRow() , totalRows = this.instance.getSetting('totalRows') , totalColumns = this.instance.getSetting('totalColumns') , fixedRowsTop = this.instance.getSetting('fixedRowsTop') , fixedColumnsLeft = this.instance.getSetting('fixedColumnsLeft'); if (this.instance.getSetting('nativeScrollbars')) { var TD = this.instance.wtTable.getCell(coords); if (typeof TD === 'object') { var offset = WalkontableDom.prototype.offset(TD); var outerWidth = WalkontableDom.prototype.outerWidth(TD); var outerHeight = WalkontableDom.prototype.outerHeight(TD); var scrollX = this.instance.wtScrollbars.horizontal.getScrollPosition(); var scrollY = this.instance.wtScrollbars.vertical.getScrollPosition(); var clientWidth = WalkontableDom.prototype.outerWidth(this.instance.wtScrollbars.horizontal.scrollHandler); var clientHeight = WalkontableDom.prototype.outerHeight(this.instance.wtScrollbars.vertical.scrollHandler); if (this.instance.wtScrollbars.horizontal.scrollHandler !== window) { offset.left = offset.left - WalkontableDom.prototype.offset(this.instance.wtScrollbars.horizontal.scrollHandler).left; } if (this.instance.wtScrollbars.vertical.scrollHandler !== window) { offset.top = offset.top - WalkontableDom.prototype.offset(this.instance.wtScrollbars.vertical.scrollHandler).top; } clientWidth -= 20; clientHeight -= 20; if (outerWidth < clientWidth) { if (offset.left < scrollX) { this.instance.wtScrollbars.horizontal.setScrollPosition(offset.left); } else if (offset.left + outerWidth > scrollX + clientWidth) { this.instance.wtScrollbars.horizontal.setScrollPosition(offset.left - clientWidth + outerWidth); } } if (outerHeight < clientHeight) { if (offset.top < scrollY) { this.instance.wtScrollbars.vertical.setScrollPosition(offset.top); } else if (offset.top + outerHeight > scrollY + clientHeight) { this.instance.wtScrollbars.vertical.setScrollPosition(offset.top - clientHeight + outerHeight); } } return; } } if (coords[0] < 0 || coords[0] > totalRows - 1) { throw new Error('row ' + coords[0] + ' does not exist'); } else if (coords[1] < 0 || coords[1] > totalColumns - 1) { throw new Error('column ' + coords[1] + ' does not exist'); } if (coords[0] > lastVisibleRow) { // this.scrollVertical(coords[0] - lastVisibleRow + 1); this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); this.instance.wtTable.verticalRenderReverse = true; } else if (coords[0] === lastVisibleRow && this.instance.wtTable.rowStrategy.isLastIncomplete()) { // this.scrollVertical(coords[0] - lastVisibleRow + 1); this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); this.instance.wtTable.verticalRenderReverse = true; } else if (coords[0] - fixedRowsTop < offsetRow) { this.scrollVertical(coords[0] - fixedRowsTop - offsetRow); } else { this.scrollVertical(0); //Craig's issue: remove row from the last scroll page should scroll viewport a row up if needed } if (this.instance.wtTable.isColumnBeforeViewport(coords[1])) { //scroll left this.instance.wtScrollbars.horizontal.scrollTo(coords[1] - fixedColumnsLeft); } else if (this.instance.wtTable.isColumnAfterViewport(coords[1]) || (this.instance.wtTable.getLastVisibleColumn() === coords[1] && !this.instance.wtTable.isLastColumnFullyVisible())) { //scroll right var sum = 0; for (var i = 0; i < fixedColumnsLeft; i++) { sum += this.instance.getSetting('columnWidth', i); } var scrollTo = coords[1]; sum += this.instance.getSetting('columnWidth', scrollTo); var available = this.instance.wtViewport.getViewportWidth(); if (sum < available) { var next = this.instance.getSetting('columnWidth', scrollTo - 1); while (sum + next <= available && scrollTo >= fixedColumnsLeft) { scrollTo--; sum += next; next = this.instance.getSetting('columnWidth', scrollTo - 1); } } this.instance.wtScrollbars.horizontal.scrollTo(scrollTo - fixedColumnsLeft); } /*else { //no scroll }*/ return this.instance; }; function WalkontableScrollbar() { } WalkontableScrollbar.prototype.init = function () { var that = this; //reference to instance this.$table = $(this.instance.wtTable.TABLE); //create elements this.slider = document.createElement('DIV'); this.sliderStyle = this.slider.style; this.sliderStyle.position = 'absolute'; this.sliderStyle.top = '0'; this.sliderStyle.left = '0'; this.sliderStyle.display = 'none'; this.slider.className = 'dragdealer ' + this.type; this.handle = document.createElement('DIV'); this.handleStyle = this.handle.style; this.handle.className = 'handle'; this.slider.appendChild(this.handle); this.container = this.instance.wtTable.holder; this.container.appendChild(this.slider); var firstRun = true; this.dragTimeout = null; var dragDelta; var dragRender = function () { that.onScroll(dragDelta); }; this.dragdealer = new Dragdealer(this.slider, { vertical: (this.type === 'vertical'), horizontal: (this.type === 'horizontal'), slide: false, speed: 100, animationCallback: function (x, y) { if (firstRun) { firstRun = false; return; } that.skipRefresh = true; dragDelta = that.type === 'vertical' ? y : x; if (that.dragTimeout === null) { that.dragTimeout = setInterval(dragRender, 100); dragRender(); } }, callback: function (x, y) { that.skipRefresh = false; clearInterval(that.dragTimeout); that.dragTimeout = null; dragDelta = that.type === 'vertical' ? y : x; that.onScroll(dragDelta); } }); this.skipRefresh = false; }; WalkontableScrollbar.prototype.onScroll = function (delta) { if (this.instance.drawn) { this.readSettings(); if (this.total > this.visibleCount) { var newOffset = Math.round(this.handlePosition * this.total / this.sliderSize); if (delta === 1) { if (this.type === 'vertical') { this.instance.scrollVertical(Infinity).draw(); } else { this.instance.scrollHorizontal(Infinity).draw(); } } else if (newOffset !== this.offset) { //is new offset different than old offset if (this.type === 'vertical') { this.instance.scrollVertical(newOffset - this.offset).draw(); } else { this.instance.scrollHorizontal(newOffset - this.offset).draw(); } } else { this.refresh(); } } } }; /** * Returns what part of the scroller should the handle take * @param viewportCount {Number} number of visible rows or columns * @param totalCount {Number} total number of rows or columns * @return {Number} 0..1 */ WalkontableScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) { if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) { return 1; } return 1 / totalCount; }; WalkontableScrollbar.prototype.prepare = function () { if (this.skipRefresh) { return; } var ratio = this.getHandleSizeRatio(this.visibleCount, this.total); if (((ratio === 1 || isNaN(ratio)) && this.scrollMode === 'auto') || this.scrollMode === 'none') { //isNaN is needed because ratio equals NaN when totalRows/totalColumns equals 0 this.visible = false; } else { this.visible = true; } }; WalkontableScrollbar.prototype.refresh = function () { if (this.skipRefresh) { return; } else if (!this.visible) { this.sliderStyle.display = 'none'; return; } var ratio , sliderSize , handleSize , handlePosition , visibleCount = this.visibleCount , tableWidth = this.instance.wtViewport.getWorkspaceWidth() , tableHeight = this.instance.wtViewport.getWorkspaceHeight(); if (tableWidth === Infinity) { tableWidth = this.instance.wtViewport.getWorkspaceActualWidth(); } if (tableHeight === Infinity) { tableHeight = this.instance.wtViewport.getWorkspaceActualHeight(); } if (this.type === 'vertical') { if (this.instance.wtTable.rowStrategy.isLastIncomplete()) { visibleCount--; } sliderSize = tableHeight - 2; //2 is sliders border-width this.sliderStyle.top = this.instance.wtDom.offset(this.$table[0]).top - this.instance.wtDom.offset(this.container).top + 'px'; this.sliderStyle.left = tableWidth - 1 + 'px'; //1 is sliders border-width this.sliderStyle.height = Math.max(sliderSize, 0) + 'px'; } else { //horizontal sliderSize = tableWidth - 2; //2 is sliders border-width this.sliderStyle.left = this.instance.wtDom.offset(this.$table[0]).left - this.instance.wtDom.offset(this.container).left + 'px'; this.sliderStyle.top = tableHeight - 1 + 'px'; //1 is sliders border-width this.sliderStyle.width = Math.max(sliderSize, 0) + 'px'; } ratio = this.getHandleSizeRatio(visibleCount, this.total); handleSize = Math.round(sliderSize * ratio); if (handleSize < 10) { handleSize = 15; } handlePosition = Math.floor(sliderSize * (this.offset / this.total)); if (handleSize + handlePosition > sliderSize) { handlePosition = sliderSize - handleSize; } if (this.type === 'vertical') { this.handleStyle.height = handleSize + 'px'; this.handleStyle.top = handlePosition + 'px'; } else { //horizontal this.handleStyle.width = handleSize + 'px'; this.handleStyle.left = handlePosition + 'px'; } this.sliderStyle.display = 'block'; }; WalkontableScrollbar.prototype.destroy = function () { clearInterval(this.dragdealer.interval); }; /// var WalkontableVerticalScrollbar = function (instance) { this.instance = instance; this.type = 'vertical'; this.init(); }; WalkontableVerticalScrollbar.prototype = new WalkontableScrollbar(); WalkontableVerticalScrollbar.prototype.scrollTo = function (cell) { this.instance.update('offsetRow', cell); }; WalkontableVerticalScrollbar.prototype.readSettings = function () { this.scrollMode = this.instance.getSetting('scrollV'); this.offset = this.instance.getSetting('offsetRow'); this.total = this.instance.getSetting('totalRows'); this.visibleCount = this.instance.wtTable.rowStrategy.countVisible(); if(this.visibleCount > 1 && this.instance.wtTable.rowStrategy.isLastIncomplete()) { this.visibleCount--; } this.handlePosition = parseInt(this.handleStyle.top, 10); this.sliderSize = parseInt(this.sliderStyle.height, 10); this.fixedCount = this.instance.getSetting('fixedRowsTop'); }; /// var WalkontableHorizontalScrollbar = function (instance) { this.instance = instance; this.type = 'horizontal'; this.init(); }; WalkontableHorizontalScrollbar.prototype = new WalkontableScrollbar(); WalkontableHorizontalScrollbar.prototype.scrollTo = function (cell) { this.instance.update('offsetColumn', cell); }; WalkontableHorizontalScrollbar.prototype.readSettings = function () { this.scrollMode = this.instance.getSetting('scrollH'); this.offset = this.instance.getSetting('offsetColumn'); this.total = this.instance.getSetting('totalColumns'); this.visibleCount = this.instance.wtTable.columnStrategy.countVisible(); if(this.visibleCount > 1 && this.instance.wtTable.columnStrategy.isLastIncomplete()) { this.visibleCount--; } this.handlePosition = parseInt(this.handleStyle.left, 10); this.sliderSize = parseInt(this.sliderStyle.width, 10); this.fixedCount = this.instance.getSetting('fixedColumnsLeft'); }; WalkontableHorizontalScrollbar.prototype.getHandleSizeRatio = function (viewportCount, totalCount) { if (!totalCount || viewportCount > totalCount || viewportCount == totalCount) { return 1; } return viewportCount / totalCount; }; function WalkontableCornerScrollbarNative(instance) { this.instance = instance; this.init(); this.clone = this.makeClone('corner'); } WalkontableCornerScrollbarNative.prototype = new WalkontableOverlay(); WalkontableCornerScrollbarNative.prototype.resetFixedPosition = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } var elem = this.clone.wtTable.holder.parentNode; var box; if (this.scrollHandler === window) { box = this.instance.wtTable.hider.getBoundingClientRect(); var top = Math.ceil(box.top, 10); var bottom = Math.ceil(box.bottom, 10); if (top < 0 && bottom > 0) { elem.style.top = '0'; } else { elem.style.top = top + 'px'; } var left = Math.ceil(box.left, 10); var right = Math.ceil(box.right, 10); if (left < 0 && right > 0) { elem.style.left = '0'; } else { elem.style.left = left + 'px'; } } else { box = this.scrollHandler.getBoundingClientRect(); elem.style.top = Math.ceil(box.top, 10) + 'px'; elem.style.left = Math.ceil(box.left, 10) + 'px'; } elem.style.width = WalkontableDom.prototype.outerWidth(this.clone.wtTable.TABLE) + 4 + 'px'; elem.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 4 + 'px'; }; WalkontableCornerScrollbarNative.prototype.prepare = function () { }; WalkontableCornerScrollbarNative.prototype.refresh = function (selectionsOnly) { this.measureBefore = 0; this.measureAfter = 0; this.clone && this.clone.draw(selectionsOnly); }; WalkontableCornerScrollbarNative.prototype.getScrollPosition = function () { }; WalkontableCornerScrollbarNative.prototype.getLastCell = function () { }; WalkontableCornerScrollbarNative.prototype.applyToDOM = function () { }; WalkontableCornerScrollbarNative.prototype.scrollTo = function () { }; WalkontableCornerScrollbarNative.prototype.readWindowSize = function () { }; WalkontableCornerScrollbarNative.prototype.readSettings = function () { }; function WalkontableHorizontalScrollbarNative(instance) { this.instance = instance; this.type = 'horizontal'; this.cellSize = 50; this.init(); this.clone = this.makeClone('left'); } WalkontableHorizontalScrollbarNative.prototype = new WalkontableOverlay(); //resetFixedPosition (in future merge it with this.refresh?) WalkontableHorizontalScrollbarNative.prototype.resetFixedPosition = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } var elem = this.clone.wtTable.holder.parentNode; var box; if (this.scrollHandler === window) { box = this.instance.wtTable.hider.getBoundingClientRect(); var left = Math.ceil(box.left, 10); var right = Math.ceil(box.right, 10); if (left < 0 && right > 0) { elem.style.left = '0'; } else { elem.style.left = left + 'px'; } } else { box = this.scrollHandler.getBoundingClientRect(); elem.style.top = Math.ceil(box.top, 10) + 'px'; elem.style.left = Math.ceil(box.left, 10) + 'px'; } }; //react on movement of the other dimension scrollbar (in future merge it with this.refresh?) WalkontableHorizontalScrollbarNative.prototype.react = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } var overlayContainer = this.clone.wtTable.holder.parentNode; if (this.instance.wtScrollbars.vertical.scrollHandler === window) { var box = this.instance.wtTable.hider.getBoundingClientRect(); overlayContainer.style.top = Math.ceil(box.top, 10) + 'px'; overlayContainer.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 'px'; } else { this.clone.wtTable.holder.style.top = -(this.instance.wtScrollbars.vertical.windowScrollPosition - this.instance.wtScrollbars.vertical.measureBefore) + 'px'; overlayContainer.style.height = this.instance.wtViewport.getWorkspaceHeight() + 'px' } overlayContainer.style.width = WalkontableDom.prototype.outerWidth(this.clone.wtTable.TABLE) + 4 + 'px'; //4 is for the box shadow }; WalkontableHorizontalScrollbarNative.prototype.prepare = function () { }; WalkontableHorizontalScrollbarNative.prototype.refresh = function (selectionsOnly) { this.measureBefore = 0; this.measureAfter = 0; this.clone && this.clone.draw(selectionsOnly); }; WalkontableHorizontalScrollbarNative.prototype.getScrollPosition = function () { if (this.scrollHandler === window) { return this.scrollHandler.scrollX; } else { return this.scrollHandler.scrollLeft; } }; WalkontableHorizontalScrollbarNative.prototype.setScrollPosition = function (pos) { this.scrollHandler.scrollLeft = pos; }; WalkontableHorizontalScrollbarNative.prototype.onScroll = function () { WalkontableOverlay.prototype.onScroll.apply(this, arguments); this.instance.getSetting('onScrollHorizontally'); }; WalkontableHorizontalScrollbarNative.prototype.getLastCell = function () { return this.instance.wtTable.getLastVisibleColumn(); }; //applyToDOM (in future merge it with this.refresh?) WalkontableHorizontalScrollbarNative.prototype.applyToDOM = function () { this.fixedContainer.style.paddingLeft = this.measureBefore + 'px'; this.fixedContainer.style.paddingRight = this.measureAfter + 'px'; }; WalkontableHorizontalScrollbarNative.prototype.scrollTo = function (cell) { this.$scrollHandler.scrollLeft(this.tableParentOffset + cell * this.cellSize); }; //readWindowSize (in future merge it with this.prepare?) WalkontableHorizontalScrollbarNative.prototype.readWindowSize = function () { if (this.scrollHandler === window) { this.windowSize = document.documentElement.clientWidth; this.tableParentOffset = this.instance.wtTable.holderOffset.left; } else { this.windowSize = WalkontableDom.prototype.outerWidth(this.scrollHandler); this.tableParentOffset = 0; } this.windowScrollPosition = this.getScrollPosition(); }; //readSettings (in future merge it with this.prepare?) WalkontableHorizontalScrollbarNative.prototype.readSettings = function () { this.offset = this.instance.getSetting('offsetColumn'); this.total = this.instance.getSetting('totalColumns'); }; function WalkontableVerticalScrollbarNative(instance) { this.instance = instance; this.type = 'vertical'; this.cellSize = 23; this.init(); this.clone = this.makeClone('top'); } WalkontableVerticalScrollbarNative.prototype = new WalkontableOverlay(); //resetFixedPosition (in future merge it with this.refresh?) WalkontableVerticalScrollbarNative.prototype.resetFixedPosition = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } var elem = this.clone.wtTable.holder.parentNode; var box; if (this.scrollHandler === window) { box = this.instance.wtTable.hider.getBoundingClientRect(); var top = Math.ceil(box.top, 10); var bottom = Math.ceil(box.bottom, 10); if (top < 0 && bottom > 0) { elem.style.top = '0'; } else { elem.style.top = top + 'px'; } } else { box = this.instance.wtScrollbars.horizontal.scrollHandler.getBoundingClientRect(); elem.style.top = Math.ceil(box.top, 10) + 'px'; elem.style.left = Math.ceil(box.left, 10) + 'px'; } if (this.instance.wtScrollbars.horizontal.scrollHandler === window) { elem.style.width = this.instance.wtViewport.getWorkspaceActualWidth() + 'px'; } else { elem.style.width = WalkontableDom.prototype.outerWidth(this.instance.wtTable.holder.parentNode) + 'px'; } elem.style.height = WalkontableDom.prototype.outerHeight(this.clone.wtTable.TABLE) + 4 + 'px'; }; //react on movement of the other dimension scrollbar (in future merge it with this.refresh?) WalkontableVerticalScrollbarNative.prototype.react = function () { if (!this.instance.wtTable.holder.parentNode) { return; //removed from DOM } if (this.instance.wtScrollbars.horizontal.scrollHandler !== window) { var elem = this.clone.wtTable.holder.parentNode; elem.firstChild.style.left = -this.instance.wtScrollbars.horizontal.windowScrollPosition + 'px'; } }; WalkontableVerticalScrollbarNative.prototype.getScrollPosition = function () { if (this.scrollHandler === window) { return this.scrollHandler.scrollY; } else { return this.scrollHandler.scrollTop; } }; WalkontableVerticalScrollbarNative.prototype.setScrollPosition = function (pos) { this.scrollHandler.scrollTop = pos; }; WalkontableVerticalScrollbarNative.prototype.onScroll = function (forcePosition) { WalkontableOverlay.prototype.onScroll.apply(this, arguments); var scrollDelta; var newOffset = 0; if (1 == 1 || this.windowScrollPosition > this.tableParentOffset) { scrollDelta = this.windowScrollPosition - this.tableParentOffset; partialOffset = 0; if (scrollDelta > 0) { var sum = 0; var last; for (var i = 0; i < this.total; i++) { last = this.instance.getSetting('rowHeight', i); sum += last; if (sum > scrollDelta) { break; } } if (this.offset > 0) { partialOffset = (sum - scrollDelta); } newOffset = i; newOffset = Math.min(newOffset, this.total); } } this.curOuts = newOffset > this.maxOuts ? this.maxOuts : newOffset; newOffset -= this.curOuts; this.instance.update('offsetRow', newOffset); this.readSettings(); //read new offset this.instance.draw(); this.instance.getSetting('onScrollVertically'); }; WalkontableVerticalScrollbarNative.prototype.getLastCell = function () { return this.instance.getSetting('offsetRow') + this.instance.wtTable.tbodyChildrenLength - 1; }; var partialOffset = 0; WalkontableVerticalScrollbarNative.prototype.sumCellSizes = function (from, length) { var sum = 0; while (from < length) { sum += this.instance.getSetting('rowHeight', from); from++; } return sum; }; //applyToDOM (in future merge it with this.refresh?) WalkontableVerticalScrollbarNative.prototype.applyToDOM = function () { var headerSize = this.instance.wtViewport.getColumnHeaderHeight(); this.fixedContainer.style.height = headerSize + this.sumCellSizes(0, this.total) + 4 + 'px'; //+4 is needed, otherwise vertical scroll appears in Chrome (window scroll mode) - maybe because of fill handle in last row or because of box shadow this.fixed.style.top = this.measureBefore + 'px'; this.fixed.style.bottom = ''; }; WalkontableVerticalScrollbarNative.prototype.scrollTo = function (cell) { var newY = this.tableParentOffset + cell * this.cellSize; this.$scrollHandler.scrollTop(newY); this.onScroll(newY); }; //readWindowSize (in future merge it with this.prepare?) WalkontableVerticalScrollbarNative.prototype.readWindowSize = function () { if (this.scrollHandler === window) { this.windowSize = document.documentElement.clientHeight; this.tableParentOffset = this.instance.wtTable.holderOffset.top; } else { //this.windowSize = WalkontableDom.prototype.outerHeight(this.scrollHandler); this.windowSize = this.scrollHandler.clientHeight; //returns height without DIV scrollbar this.tableParentOffset = 0; } this.windowScrollPosition = this.getScrollPosition(); }; //readSettings (in future merge it with this.prepare?) WalkontableVerticalScrollbarNative.prototype.readSettings = function () { this.offset = this.instance.getSetting('offsetRow'); this.total = this.instance.getSetting('totalRows'); }; function WalkontableScrollbars(instance) { this.instance = instance; if (instance.getSetting('nativeScrollbars')) { instance.update('scrollbarWidth', instance.wtDom.getScrollbarWidth()); instance.update('scrollbarHeight', instance.wtDom.getScrollbarWidth()); this.vertical = new WalkontableVerticalScrollbarNative(instance); this.horizontal = new WalkontableHorizontalScrollbarNative(instance); this.corner = new WalkontableCornerScrollbarNative(instance); if (instance.getSetting('debug')) { this.debug = new WalkontableDebugOverlay(instance); } this.registerListeners(); } else { this.vertical = new WalkontableVerticalScrollbar(instance); this.horizontal = new WalkontableHorizontalScrollbar(instance); } } WalkontableScrollbars.prototype.registerListeners = function () { var that = this; var oldVerticalScrollPosition , oldHorizontalScrollPosition , oldBoxTop , oldBoxLeft , oldBoxWidth , oldBoxHeight; function refreshAll() { if (!that.instance.wtTable.holder.parentNode) { //Walkontable was detached from DOM, but this handler was not removed that.destroy(); return; } that.vertical.windowScrollPosition = that.vertical.getScrollPosition(); that.horizontal.windowScrollPosition = that.horizontal.getScrollPosition(); that.box = that.instance.wtTable.hider.getBoundingClientRect(); if((that.box.width !== oldBoxWidth || that.box.height !== oldBoxHeight) && that.instance.rowHeightCache) { //that.instance.rowHeightCache.length = 0; //at this point the cached row heights may be invalid, but it is better not to reset the cache, which could cause scrollbar jumping when there are multiline cells outside of the rendered part of the table oldBoxWidth = that.box.width; oldBoxHeight = that.box.height; that.instance.draw(); } if (that.vertical.windowScrollPosition !== oldVerticalScrollPosition || that.horizontal.windowScrollPosition !== oldHorizontalScrollPosition || that.box.top !== oldBoxTop || that.box.left !== oldBoxLeft) { that.vertical.onScroll(); that.horizontal.onScroll(); //it's done here to make sure that all onScroll's are executed before changing styles that.vertical.react(); that.horizontal.react(); //it's done here to make sure that all onScroll's are executed before changing styles oldVerticalScrollPosition = that.vertical.windowScrollPosition; oldHorizontalScrollPosition = that.horizontal.windowScrollPosition; oldBoxTop = that.box.top; oldBoxLeft = that.box.left; } } var $window = $(window); this.vertical.$scrollHandler.on('scroll.' + this.instance.guid, refreshAll); if (this.vertical.scrollHandler !== this.horizontal.scrollHandler) { this.horizontal.$scrollHandler.on('scroll.' + this.instance.guid, refreshAll); } if (this.vertical.scrollHandler !== window && this.horizontal.scrollHandler !== window) { $window.on('scroll.' + this.instance.guid, refreshAll); } $window.on('load.' + this.instance.guid, refreshAll); $window.on('resize.' + this.instance.guid, refreshAll); $(document).on('ready.' + this.instance.guid, refreshAll); setInterval(refreshAll, 100); //Marcin - only idea I have to reposition scrollbars on CSS change of the container (container was moved using some styles after page was loaded) }; WalkontableScrollbars.prototype.destroy = function () { this.vertical && this.vertical.destroy(); this.horizontal && this.horizontal.destroy(); }; WalkontableScrollbars.prototype.refresh = function (selectionsOnly) { this.horizontal && this.horizontal.readSettings(); this.vertical && this.vertical.readSettings(); this.horizontal && this.horizontal.prepare(); this.vertical && this.vertical.prepare(); this.horizontal && this.horizontal.refresh(selectionsOnly); this.vertical && this.vertical.refresh(selectionsOnly); this.corner && this.corner.refresh(selectionsOnly); this.debug && this.debug.refresh(selectionsOnly); }; function WalkontableSelection(instance, settings) { this.instance = instance; this.settings = settings; this.selected = []; if (settings.border) { this.border = new WalkontableBorder(instance, settings); } } WalkontableSelection.prototype.add = function (coords) { this.selected.push(coords); }; WalkontableSelection.prototype.clear = function () { this.selected.length = 0; //http://jsperf.com/clear-arrayxxx }; /** * Returns the top left (TL) and bottom right (BR) selection coordinates * @returns {Object} */ WalkontableSelection.prototype.getCorners = function () { var minRow , minColumn , maxRow , maxColumn , i , ilen = this.selected.length; if (ilen > 0) { minRow = maxRow = this.selected[0][0]; minColumn = maxColumn = this.selected[0][1]; if (ilen > 1) { for (i = 1; i < ilen; i++) { if (this.selected[i][0] < minRow) { minRow = this.selected[i][0]; } else if (this.selected[i][0] > maxRow) { maxRow = this.selected[i][0]; } if (this.selected[i][1] < minColumn) { minColumn = this.selected[i][1]; } else if (this.selected[i][1] > maxColumn) { maxColumn = this.selected[i][1]; } } } } return [minRow, minColumn, maxRow, maxColumn]; }; WalkontableSelection.prototype.draw = function () { var corners, r, c, source_r, source_c; var visibleRows = this.instance.wtTable.rowStrategy.countVisible() , visibleColumns = this.instance.wtTable.columnStrategy.countVisible(); if (this.selected.length) { corners = this.getCorners(); for (r = 0; r < visibleRows; r++) { for (c = 0; c < visibleColumns; c++) { source_r = this.instance.wtTable.rowFilter.visibleToSource(r); source_c = this.instance.wtTable.columnFilter.visibleToSource(c); if (source_r >= corners[0] && source_r <= corners[2] && source_c >= corners[1] && source_c <= corners[3]) { //selected cell this.instance.wtTable.currentCellCache.add(r, c, this.settings.className); } else if (source_r >= corners[0] && source_r <= corners[2]) { //selection is in this row this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightRowClassName); } else if (source_c >= corners[1] && source_c <= corners[3]) { //selection is in this column this.instance.wtTable.currentCellCache.add(r, c, this.settings.highlightColumnClassName); } } } this.border && this.border.appear(corners); //warning! border.appear modifies corners! } else { this.border && this.border.disappear(); } }; function WalkontableSettings(instance, settings) { var that = this; this.instance = instance; //default settings. void 0 means it is required, null means it can be empty this.defaults = { table: void 0, debug: false, //shows WalkontableDebugOverlay //presentation mode scrollH: 'auto', //values: scroll (always show scrollbar), auto (show scrollbar if table does not fit in the container), none (never show scrollbar) scrollV: 'auto', //values: see above nativeScrollbars: false, //values: false (dragdealer), true (native) stretchH: 'hybrid', //values: hybrid, all, last, none currentRowClassName: null, currentColumnClassName: null, //data source data: void 0, offsetRow: 0, offsetColumn: 0, fixedColumnsLeft: 0, fixedRowsTop: 0, rowHeaders: function () { return [] }, //this must be array of functions: [function (row, TH) {}] columnHeaders: function () { return [] }, //this must be array of functions: [function (column, TH) {}] totalRows: void 0, totalColumns: void 0, width: null, height: null, cellRenderer: function (row, column, TD) { var cellData = that.getSetting('data', row, column); that.instance.wtDom.fastInnerText(TD, cellData === void 0 || cellData === null ? '' : cellData); }, columnWidth: 50, selections: null, hideBorderOnMouseDownOver: false, //callbacks onCellMouseDown: null, onCellMouseOver: null, // onCellMouseOut: null, onCellDblClick: null, onCellCornerMouseDown: null, onCellCornerDblClick: null, beforeDraw: null, onDraw: null, onScrollVertically: null, onScrollHorizontally: null, //constants scrollbarWidth: 10, scrollbarHeight: 10 }; //reference to settings this.settings = {}; for (var i in this.defaults) { if (this.defaults.hasOwnProperty(i)) { if (settings[i] !== void 0) { this.settings[i] = settings[i]; } else if (this.defaults[i] === void 0) { throw new Error('A required setting "' + i + '" was not provided'); } else { this.settings[i] = this.defaults[i]; } } } } /** * generic methods */ WalkontableSettings.prototype.update = function (settings, value) { if (value === void 0) { //settings is object for (var i in settings) { if (settings.hasOwnProperty(i)) { this.settings[i] = settings[i]; } } } else { //if value is defined then settings is the key this.settings[settings] = value; } return this.instance; }; WalkontableSettings.prototype.getSetting = function (key, param1, param2, param3) { if (this[key]) { return this[key](param1, param2, param3); } else { return this._getSetting(key, param1, param2, param3); } }; WalkontableSettings.prototype._getSetting = function (key, param1, param2, param3) { if (typeof this.settings[key] === 'function') { return this.settings[key](param1, param2, param3); } else if (param1 !== void 0 && Object.prototype.toString.call(this.settings[key]) === '[object Array]') { return this.settings[key][param1]; } else { return this.settings[key]; } }; WalkontableSettings.prototype.has = function (key) { return !!this.settings[key] }; /** * specific methods */ WalkontableSettings.prototype.rowHeight = function (row, TD) { if (!this.instance.rowHeightCache) { this.instance.rowHeightCache = []; //hack. This cache is being invalidated in WOT core.js } if (this.instance.rowHeightCache[row] === void 0) { var size = 23; //guess if (TD) { size = this.instance.wtDom.outerHeight(TD); //measure this.instance.rowHeightCache[row] = size; //cache only something we measured } return size; } else { return this.instance.rowHeightCache[row]; } }; function WalkontableTable(instance, table) { //reference to instance this.instance = instance; this.TABLE = table; this.wtDom = this.instance.wtDom; this.wtDom.removeTextNodes(this.TABLE); //wtSpreader var parent = this.TABLE.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var spreader = document.createElement('DIV'); spreader.className = 'wtSpreader'; if (parent) { parent.insertBefore(spreader, this.TABLE); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } spreader.appendChild(this.TABLE); } this.spreader = this.TABLE.parentNode; //wtHider parent = this.spreader.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var hider = document.createElement('DIV'); hider.className = 'wtHider'; if (parent) { parent.insertBefore(hider, this.spreader); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } hider.appendChild(this.spreader); } this.hider = this.spreader.parentNode; this.hiderStyle = this.hider.style; this.hiderStyle.position = 'relative'; //wtHolder parent = this.hider.parentNode; if (!parent || parent.nodeType !== 1 || !this.wtDom.hasClass(parent, 'wtHolder')) { var holder = document.createElement('DIV'); holder.style.position = 'relative'; holder.className = 'wtHolder'; if (parent) { parent.insertBefore(holder, this.hider); //if TABLE is detached (e.g. in Jasmine test), it has no parentNode so we cannot attach holder to it } holder.appendChild(this.hider); } this.holder = this.hider.parentNode; //bootstrap from settings this.TBODY = this.TABLE.getElementsByTagName('TBODY')[0]; if (!this.TBODY) { this.TBODY = document.createElement('TBODY'); this.TABLE.appendChild(this.TBODY); } this.THEAD = this.TABLE.getElementsByTagName('THEAD')[0]; if (!this.THEAD) { this.THEAD = document.createElement('THEAD'); this.TABLE.insertBefore(this.THEAD, this.TBODY); } this.COLGROUP = this.TABLE.getElementsByTagName('COLGROUP')[0]; if (!this.COLGROUP) { this.COLGROUP = document.createElement('COLGROUP'); this.TABLE.insertBefore(this.COLGROUP, this.THEAD); } if (this.instance.getSetting('columnHeaders').length) { if (!this.THEAD.childNodes.length) { var TR = document.createElement('TR'); this.THEAD.appendChild(TR); } } this.colgroupChildrenLength = this.COLGROUP.childNodes.length; this.theadChildrenLength = this.THEAD.firstChild ? this.THEAD.firstChild.childNodes.length : 0; this.tbodyChildrenLength = this.TBODY.childNodes.length; this.oldCellCache = new WalkontableClassNameCache(); this.currentCellCache = new WalkontableClassNameCache(); this.rowFilter = new WalkontableRowFilter(); this.columnFilter = new WalkontableColumnFilter(); this.verticalRenderReverse = false; } WalkontableTable.prototype.refreshHiderDimensions = function () { var height = this.instance.wtViewport.getWorkspaceHeight(); var width = this.instance.wtViewport.getWorkspaceWidth(); var spreaderStyle = this.spreader.style; if ((height !== Infinity || width !== Infinity) && !this.instance.getSetting('nativeScrollbars')) { if (height === Infinity) { height = this.instance.wtViewport.getWorkspaceActualHeight(); } if (width === Infinity) { width = this.instance.wtViewport.getWorkspaceActualWidth(); } this.hiderStyle.overflow = 'hidden'; spreaderStyle.position = 'absolute'; spreaderStyle.top = '0'; spreaderStyle.left = '0'; if (!this.instance.getSetting('nativeScrollbars')) { spreaderStyle.height = '4000px'; spreaderStyle.width = '4000px'; } if (height < 0) { //this happens with WalkontableOverlay and causes "Invalid argument" error in IE8 height = 0; } this.hiderStyle.height = height + 'px'; this.hiderStyle.width = width + 'px'; } else { spreaderStyle.position = 'relative'; spreaderStyle.width = 'auto'; spreaderStyle.height = 'auto'; } }; WalkontableTable.prototype.refreshStretching = function () { if (this.instance.cloneSource) { return; } var instance = this.instance , stretchH = instance.getSetting('stretchH') , totalRows = instance.getSetting('totalRows') , totalColumns = instance.getSetting('totalColumns') , offsetColumn = instance.getSetting('offsetColumn'); var containerWidthFn = function (cacheWidth) { var viewportWidth = that.instance.wtViewport.getViewportWidth(cacheWidth); if (viewportWidth < cacheWidth && that.instance.getSetting('nativeScrollbars')) { return Infinity; //disable stretching when viewport is bigger than sum of the cell widths } return viewportWidth; }; var that = this; var columnWidthFn = function (i) { var source_c = that.columnFilter.visibleToSource(i); if (source_c < totalColumns) { return instance.getSetting('columnWidth', source_c); } }; if (stretchH === 'hybrid') { if (offsetColumn > 0) { stretchH = 'last'; } else { stretchH = 'none'; } } var containerHeightFn = function (cacheHeight) { if (that.instance.getSetting('nativeScrollbars')) { if (that.instance.cloneOverlay instanceof WalkontableDebugOverlay) { return Infinity; } else { return 2 * that.instance.wtViewport.getViewportHeight(cacheHeight); } } return that.instance.wtViewport.getViewportHeight(cacheHeight); }; var rowHeightFn = function (i, TD) { if (that.instance.getSetting('nativeScrollbars')) { return 20; } var source_r = that.rowFilter.visibleToSource(i); if (source_r < totalRows) { if (that.verticalRenderReverse && i === 0) { return that.instance.getSetting('rowHeight', source_r, TD) - 1; } else { return that.instance.getSetting('rowHeight', source_r, TD); } } }; this.columnStrategy = new WalkontableColumnStrategy(instance, containerWidthFn, columnWidthFn, stretchH); this.rowStrategy = new WalkontableRowStrategy(instance, containerHeightFn, rowHeightFn); }; WalkontableTable.prototype.adjustAvailableNodes = function () { var displayTds , rowHeaders = this.instance.getSetting('rowHeaders') , displayThs = rowHeaders.length , columnHeaders = this.instance.getSetting('columnHeaders') , TR , TD , c; //adjust COLGROUP while (this.colgroupChildrenLength < displayThs) { this.COLGROUP.appendChild(document.createElement('COL')); this.colgroupChildrenLength++; } this.refreshStretching(); //actually it is wrong position because it assumes rowHeader would be always 50px wide (because we measure before it is filled with text). TODO: debug if (this.instance.cloneSource && (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative)) { displayTds = this.instance.getSetting('fixedColumnsLeft'); } else { displayTds = this.columnStrategy.cellCount; } //adjust COLGROUP while (this.colgroupChildrenLength < displayTds + displayThs) { this.COLGROUP.appendChild(document.createElement('COL')); this.colgroupChildrenLength++; } while (this.colgroupChildrenLength > displayTds + displayThs) { this.COLGROUP.removeChild(this.COLGROUP.lastChild); this.colgroupChildrenLength--; } //adjust THEAD TR = this.THEAD.firstChild; if (columnHeaders.length) { if (!TR) { TR = document.createElement('TR'); this.THEAD.appendChild(TR); } this.theadChildrenLength = TR.childNodes.length; while (this.theadChildrenLength < displayTds + displayThs) { TR.appendChild(document.createElement('TH')); this.theadChildrenLength++; } while (this.theadChildrenLength > displayTds + displayThs) { TR.removeChild(TR.lastChild); this.theadChildrenLength--; } } else if (TR) { this.wtDom.empty(TR); } //draw COLGROUP for (c = 0; c < this.colgroupChildrenLength; c++) { if (c < displayThs) { this.wtDom.addClass(this.COLGROUP.childNodes[c], 'rowHeader'); } else { this.wtDom.removeClass(this.COLGROUP.childNodes[c], 'rowHeader'); } } //draw THEAD if (columnHeaders.length) { TR = this.THEAD.firstChild; if (displayThs) { TD = TR.firstChild; //actually it is TH but let's reuse single variable for (c = 0; c < displayThs; c++) { rowHeaders[c](-displayThs + c, TD); TD = TD.nextSibling; } } } for (c = 0; c < displayTds; c++) { if (columnHeaders.length) { columnHeaders[0](this.columnFilter.visibleToSource(c), TR.childNodes[displayThs + c]); } } }; WalkontableTable.prototype.adjustColumns = function (TR, desiredCount) { var count = TR.childNodes.length; while (count < desiredCount) { var TD = document.createElement('TD'); TR.appendChild(TD); count++; } while (count > desiredCount) { TR.removeChild(TR.lastChild); count--; } }; WalkontableTable.prototype.draw = function (selectionsOnly) { if (this.instance.getSetting('nativeScrollbars')) { this.verticalRenderReverse = false; //this is only supported in dragdealer mode, not in native } this.rowFilter.readSettings(this.instance); this.columnFilter.readSettings(this.instance); if (!selectionsOnly) { if (this.instance.getSetting('nativeScrollbars')) { if (this.instance.cloneSource) { this.tableOffset = this.instance.cloneSource.wtTable.tableOffset; } else { this.holderOffset = this.wtDom.offset(this.holder); this.tableOffset = this.wtDom.offset(this.TABLE); this.instance.wtScrollbars.vertical.readWindowSize(); this.instance.wtScrollbars.horizontal.readWindowSize(); this.instance.wtViewport.resetSettings(); } } else { this.tableOffset = this.wtDom.offset(this.TABLE); this.instance.wtViewport.resetSettings(); } this._doDraw(); } else { this.instance.wtScrollbars && this.instance.wtScrollbars.refresh(true); } this.refreshPositions(selectionsOnly); if (!selectionsOnly) { if (this.instance.getSetting('nativeScrollbars')) { if (!this.instance.cloneSource) { this.instance.wtScrollbars.vertical.resetFixedPosition(); this.instance.wtScrollbars.horizontal.resetFixedPosition(); this.instance.wtScrollbars.corner.resetFixedPosition(); this.instance.wtScrollbars.debug && this.instance.wtScrollbars.debug.resetFixedPosition(); } } } this.instance.drawn = true; return this; }; WalkontableTable.prototype._doDraw = function () { var r = 0 , source_r , c , source_c , offsetRow = this.instance.getSetting('offsetRow') , totalRows = this.instance.getSetting('totalRows') , totalColumns = this.instance.getSetting('totalColumns') , displayTds , rowHeaders = this.instance.getSetting('rowHeaders') , displayThs = rowHeaders.length , TR , TD , TH , adjusted = false , workspaceWidth , mustBeInViewport , res; if (this.verticalRenderReverse) { mustBeInViewport = offsetRow; } var noPartial = false; if (this.verticalRenderReverse) { if (offsetRow === totalRows - this.rowFilter.fixedCount - 1) { noPartial = true; } else { this.instance.update('offsetRow', offsetRow + 1); //if we are scrolling reverse this.rowFilter.readSettings(this.instance); } } if (this.instance.cloneSource) { this.columnStrategy = this.instance.cloneSource.wtTable.columnStrategy; this.rowStrategy = this.instance.cloneSource.wtTable.rowStrategy; } //draw TBODY if (totalColumns > 0) { source_r = this.rowFilter.visibleToSource(r); var fixedRowsTop = this.instance.getSetting('fixedRowsTop'); var cloneLimit; if (this.instance.cloneSource) { //must be run after adjustAvailableNodes because otherwise this.rowStrategy is not yet defined if (this.instance.cloneOverlay instanceof WalkontableVerticalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative) { cloneLimit = fixedRowsTop; } else if (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative) { cloneLimit = this.rowStrategy.countVisible(); } //else if WalkontableDebugOverlay do nothing. No cloneLimit means render ALL rows } this.adjustAvailableNodes(); adjusted = true; if (this.instance.cloneSource && (this.instance.cloneOverlay instanceof WalkontableHorizontalScrollbarNative || this.instance.cloneOverlay instanceof WalkontableCornerScrollbarNative)) { displayTds = this.instance.getSetting('fixedColumnsLeft'); } else { displayTds = this.columnStrategy.cellCount; } if (!this.instance.cloneSource) { workspaceWidth = this.instance.wtViewport.getWorkspaceWidth(); this.columnStrategy.stretch(); } for (c = 0; c < displayTds; c++) { this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px'; } while (source_r < totalRows && source_r >= 0) { if (r > 1000) { throw new Error('Security brake: Too much TRs. Please define height for your table, which will enforce scrollbars.'); } if (cloneLimit !== void 0 && r === cloneLimit) { break; //we have as much rows as needed for this clone } if (r >= this.tbodyChildrenLength || (this.verticalRenderReverse && r >= this.rowFilter.fixedCount)) { TR = document.createElement('TR'); for (c = 0; c < displayThs; c++) { TR.appendChild(document.createElement('TH')); } if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) { this.TBODY.insertBefore(TR, this.TBODY.childNodes[this.rowFilter.fixedCount] || this.TBODY.firstChild); } else { this.TBODY.appendChild(TR); } this.tbodyChildrenLength++; } else if (r === 0) { TR = this.TBODY.firstChild; } else { TR = TR.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } //TH TH = TR.firstChild; for (c = 0; c < displayThs; c++) { //If the number of row headers increased we need to replace TD with TH if (TH.nodeName == 'TD') { TD = TH; TH = document.createElement('TH'); TR.insertBefore(TH, TD); TR.removeChild(TD); } rowHeaders[c](source_r, TH); //actually TH TH = TH.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } this.adjustColumns(TR, displayTds + displayThs); for (c = 0; c < displayTds; c++) { source_c = this.columnFilter.visibleToSource(c); if (c === 0) { TD = TR.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(source_c)]; } else { TD = TD.nextSibling; //http://jsperf.com/nextsibling-vs-indexed-childnodes } //If the number of headers has been reduced, we need to replace excess TH with TD if (TD.nodeName == 'TH') { TH = TD; TD = document.createElement('TD'); TR.insertBefore(TD, TH); TR.removeChild(TH); } TD.className = ''; TD.removeAttribute('style'); this.instance.getSetting('cellRenderer', source_r, source_c, TD); } offsetRow = this.instance.getSetting('offsetRow'); //refresh the value //after last column is rendered, check if last cell is fully displayed if (this.verticalRenderReverse && noPartial) { if (-this.wtDom.outerHeight(TR.firstChild) < this.rowStrategy.remainingSize) { this.TBODY.removeChild(TR); this.instance.update('offsetRow', offsetRow + 1); this.tbodyChildrenLength--; this.rowFilter.readSettings(this.instance); break; } else if (!this.instance.cloneSource) { res = this.rowStrategy.add(r, TD, this.verticalRenderReverse); if (res === false) { this.rowStrategy.removeOutstanding(); } } } else if (!this.instance.cloneSource) { res = this.rowStrategy.add(r, TD, this.verticalRenderReverse); if (res === false) { if (!this.instance.getSetting('nativeScrollbars')) { this.rowStrategy.removeOutstanding(); } } if (this.rowStrategy.isLastIncomplete()) { if (this.verticalRenderReverse && !this.isRowInViewport(mustBeInViewport)) { //we failed because one of the cells was by far too large. Recover by rendering from top this.verticalRenderReverse = false; this.instance.update('offsetRow', mustBeInViewport); this.draw(); return; } break; } } if (this.instance.getSetting('nativeScrollbars')) { if (this.instance.cloneSource) { TR.style.height = this.instance.getSetting('rowHeight', source_r) + 'px'; //if I have 2 fixed columns with one-line content and the 3rd column has a multiline content, this is the way to make sure that the overlay will has same row height } else { this.instance.getSetting('rowHeight', source_r, TD); //this trick saves rowHeight in rowHeightCache. It is then read in WalkontableVerticalScrollbarNative.prototype.sumCellSizes and reset in Walkontable constructor } } if (this.verticalRenderReverse && r >= this.rowFilter.fixedCount) { if (offsetRow === 0) { break; } this.instance.update('offsetRow', offsetRow - 1); this.rowFilter.readSettings(this.instance); } else { r++; } source_r = this.rowFilter.visibleToSource(r); } } if (!adjusted) { this.adjustAvailableNodes(); } if (!(this.instance.cloneOverlay instanceof WalkontableDebugOverlay)) { r = this.rowStrategy.countVisible(); while (this.tbodyChildrenLength > r) { this.TBODY.removeChild(this.TBODY.lastChild); this.tbodyChildrenLength--; } } this.instance.wtScrollbars && this.instance.wtScrollbars.refresh(false); if (!this.instance.cloneSource) { if (workspaceWidth !== this.instance.wtViewport.getWorkspaceWidth()) { //workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching this.columnStrategy.stretch(); for (c = 0; c < this.columnStrategy.cellCount; c++) { this.COLGROUP.childNodes[c + displayThs].style.width = this.columnStrategy.getSize(c) + 'px'; } } } this.verticalRenderReverse = false; }; WalkontableTable.prototype.refreshPositions = function (selectionsOnly) { this.refreshHiderDimensions(); this.refreshSelections(selectionsOnly); }; WalkontableTable.prototype.refreshSelections = function (selectionsOnly) { var vr , r , vc , c , s , slen , classNames = [] , visibleRows = this.rowStrategy.countVisible() , visibleColumns = this.columnStrategy.countVisible(); this.oldCellCache = this.currentCellCache; this.currentCellCache = new WalkontableClassNameCache(); if (this.instance.selections) { for (r in this.instance.selections) { if (this.instance.selections.hasOwnProperty(r)) { this.instance.selections[r].draw(); if (this.instance.selections[r].settings.className) { classNames.push(this.instance.selections[r].settings.className); } if (this.instance.selections[r].settings.highlightRowClassName) { classNames.push(this.instance.selections[r].settings.highlightRowClassName); } if (this.instance.selections[r].settings.highlightColumnClassName) { classNames.push(this.instance.selections[r].settings.highlightColumnClassName); } } } } slen = classNames.length; for (vr = 0; vr < visibleRows; vr++) { for (vc = 0; vc < visibleColumns; vc++) { r = this.rowFilter.visibleToSource(vr); c = this.columnFilter.visibleToSource(vc); for (s = 0; s < slen; s++) { if (this.currentCellCache.test(vr, vc, classNames[s])) { this.wtDom.addClass(this.getCell([r, c]), classNames[s]); } else if (selectionsOnly && this.oldCellCache.test(vr, vc, classNames[s])) { this.wtDom.removeClass(this.getCell([r, c]), classNames[s]); } } } } }; /** * getCell * @param {Array} coords * @return {Object} HTMLElement on success or {Number} one of the exit codes on error: * -1 row before viewport * -2 row after viewport * -3 column before viewport * -4 column after viewport * */ WalkontableTable.prototype.getCell = function (coords) { if (this.isRowBeforeViewport(coords[0])) { return -1; //row before viewport } else if (this.isRowAfterViewport(coords[0])) { return -2; //row after viewport } else { if (this.isColumnBeforeViewport(coords[1])) { return -3; //column before viewport } else if (this.isColumnAfterViewport(coords[1])) { return -4; //column after viewport } else { return this.TBODY.childNodes[this.rowFilter.sourceToVisible(coords[0])].childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(coords[1])]; } } }; WalkontableTable.prototype.getCoords = function (TD) { return [ this.rowFilter.visibleToSource(this.wtDom.index(TD.parentNode)), this.columnFilter.visibleRowHeadedColumnToSourceColumn(TD.cellIndex) ]; }; //returns -1 if no row is visible WalkontableTable.prototype.getLastVisibleRow = function () { return this.rowFilter.visibleToSource(this.rowStrategy.cellCount - 1); }; //returns -1 if no column is visible WalkontableTable.prototype.getLastVisibleColumn = function () { return this.columnFilter.visibleToSource(this.columnStrategy.cellCount - 1); }; WalkontableTable.prototype.isRowBeforeViewport = function (r) { return (this.rowFilter.sourceToVisible(r) < this.rowFilter.fixedCount && r >= this.rowFilter.fixedCount); }; WalkontableTable.prototype.isRowAfterViewport = function (r) { return (r > this.getLastVisibleRow()); }; WalkontableTable.prototype.isColumnBeforeViewport = function (c) { return (this.columnFilter.sourceToVisible(c) < this.columnFilter.fixedCount && c >= this.columnFilter.fixedCount); }; WalkontableTable.prototype.isColumnAfterViewport = function (c) { return (c > this.getLastVisibleColumn()); }; WalkontableTable.prototype.isRowInViewport = function (r) { return (!this.isRowBeforeViewport(r) && !this.isRowAfterViewport(r)); }; WalkontableTable.prototype.isColumnInViewport = function (c) { return (!this.isColumnBeforeViewport(c) && !this.isColumnAfterViewport(c)); }; WalkontableTable.prototype.isLastRowFullyVisible = function () { return (this.getLastVisibleRow() === this.instance.getSetting('totalRows') - 1 && !this.rowStrategy.isLastIncomplete()); }; WalkontableTable.prototype.isLastColumnFullyVisible = function () { return (this.getLastVisibleColumn() === this.instance.getSetting('totalColumns') - 1 && !this.columnStrategy.isLastIncomplete()); }; function WalkontableViewport(instance) { this.instance = instance; this.resetSettings(); if (this.instance.getSetting('nativeScrollbars')) { var that = this; $(window).on('resize', function () { that.clientHeight = that.getWorkspaceHeight(); }); } } /*WalkontableViewport.prototype.isInSightVertical = function () { //is table outside viewport bottom edge if (tableTop > windowHeight + scrollTop) { return -1; } //is table outside viewport top edge else if (scrollTop > tableTop + tableFakeHeight) { return -2; } //table is in viewport but how much exactly? else { } };*/ //used by scrollbar WalkontableViewport.prototype.getWorkspaceHeight = function (proposedHeight) { if (this.instance.getSetting('nativeScrollbars')) { return this.instance.wtScrollbars.vertical.windowSize; } var height = this.instance.getSetting('height'); if (height === Infinity || height === void 0 || height === null || height < 1) { if (this.instance.wtScrollbars.vertical instanceof WalkontableOverlay) { height = this.instance.wtScrollbars.vertical.availableSize(); } else { height = Infinity; } } if (height !== Infinity) { if (proposedHeight >= height) { height -= this.instance.getSetting('scrollbarHeight'); } else if (this.instance.wtScrollbars.horizontal.visible) { height -= this.instance.getSetting('scrollbarHeight'); } } return height; }; WalkontableViewport.prototype.getWorkspaceWidth = function (proposedWidth) { var width = this.instance.getSetting('width'); if (width === Infinity || width === void 0 || width === null || width < 1) { if (this.instance.wtScrollbars.horizontal instanceof WalkontableOverlay) { width = this.instance.wtScrollbars.horizontal.availableSize(); } else { width = Infinity; } } if (width !== Infinity) { if (proposedWidth >= width) { width -= this.instance.getSetting('scrollbarWidth'); } else if (this.instance.wtScrollbars.vertical.visible) { width -= this.instance.getSetting('scrollbarWidth'); } } return width; }; WalkontableViewport.prototype.getWorkspaceActualHeight = function () { return this.instance.wtDom.outerHeight(this.instance.wtTable.TABLE); }; WalkontableViewport.prototype.getWorkspaceActualWidth = function () { return this.instance.wtDom.outerWidth(this.instance.wtTable.TABLE) || this.instance.wtDom.outerWidth(this.instance.wtTable.TBODY) || this.instance.wtDom.outerWidth(this.instance.wtTable.THEAD); //IE8 reports 0 as <table> offsetWidth; }; WalkontableViewport.prototype.getColumnHeaderHeight = function () { if (isNaN(this.columnHeaderHeight)) { var cellOffset = this.instance.wtDom.offset(this.instance.wtTable.TBODY) , tableOffset = this.instance.wtTable.tableOffset; this.columnHeaderHeight = cellOffset.top - tableOffset.top; } return this.columnHeaderHeight; }; WalkontableViewport.prototype.getViewportHeight = function (proposedHeight) { var containerHeight = this.getWorkspaceHeight(proposedHeight); if (containerHeight === Infinity) { return containerHeight; } var columnHeaderHeight = this.getColumnHeaderHeight(); if (columnHeaderHeight > 0) { return containerHeight - columnHeaderHeight; } else { return containerHeight; } }; WalkontableViewport.prototype.getRowHeaderWidth = function () { if (this.instance.cloneSource) { return this.instance.cloneSource.wtViewport.getRowHeaderWidth(); } if (isNaN(this.rowHeaderWidth)) { var rowHeaders = this.instance.getSetting('rowHeaders'); if (rowHeaders.length) { var TH = this.instance.wtTable.TABLE.querySelector('TH'); this.rowHeaderWidth = 0; for (var i = 0, ilen = rowHeaders.length; i < ilen; i++) { if (TH) { this.rowHeaderWidth += this.instance.wtDom.outerWidth(TH); TH = TH.nextSibling; } else { this.rowHeaderWidth += 50; //yes this is a cheat but it worked like that before, just taking assumption from CSS instead of measuring. TODO: proper fix } } } else { this.rowHeaderWidth = 0; } } return this.rowHeaderWidth; }; WalkontableViewport.prototype.getViewportWidth = function (proposedWidth) { var containerWidth = this.getWorkspaceWidth(proposedWidth); if (containerWidth === Infinity) { return containerWidth; } var rowHeaderWidth = this.getRowHeaderWidth(); if (rowHeaderWidth > 0) { return containerWidth - rowHeaderWidth; } else { return containerWidth; } }; WalkontableViewport.prototype.resetSettings = function () { this.rowHeaderWidth = NaN; this.columnHeaderHeight = NaN; }; function WalkontableWheel(instance) { if (instance.getSetting('nativeScrollbars')) { return; } //spreader === instance.wtTable.TABLE.parentNode $(instance.wtTable.spreader).on('mousewheel', function (event, delta, deltaX, deltaY) { if (!deltaX && !deltaY && delta) { //we are in IE8, see https://github.com/brandonaaron/jquery-mousewheel/issues/53 deltaY = delta; } if (!deltaX && !deltaY) { //this happens in IE8 test case return; } if (deltaY > 0 && instance.getSetting('offsetRow') === 0) { return; //attempt to scroll up when it's already showing first row } else if (deltaY < 0 && instance.wtTable.isLastRowFullyVisible()) { return; //attempt to scroll down when it's already showing last row } else if (deltaX < 0 && instance.getSetting('offsetColumn') === 0) { return; //attempt to scroll left when it's already showing first column } else if (deltaX > 0 && instance.wtTable.isLastColumnFullyVisible()) { return; //attempt to scroll right when it's already showing last column } //now we are sure we really want to scroll clearTimeout(instance.wheelTimeout); instance.wheelTimeout = setTimeout(function () { //timeout is needed because with fast-wheel scrolling mousewheel event comes dozen times per second if (deltaY) { //ceil is needed because jquery-mousewheel reports fractional mousewheel deltas on touchpad scroll //see http://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers if (instance.wtScrollbars.vertical.visible) { // if we see scrollbar instance.scrollVertical(-Math.ceil(deltaY)).draw(); } } else if (deltaX) { if (instance.wtScrollbars.horizontal.visible) { // if we see scrollbar instance.scrollHorizontal(Math.ceil(deltaX)).draw(); } } }, 0); event.preventDefault(); }); } /** * Dragdealer JS v0.9.5 - patched by Walkontable at lines 66, 309-310, 339-340 * http://code.ovidiu.ch/dragdealer-js * * Copyright (c) 2010, Ovidiu Chereches * MIT License * http://legal.ovidiu.ch/licenses/MIT */ /* Cursor */ var Cursor = { x: 0, y: 0, init: function() { this.setEvent('mouse'); this.setEvent('touch'); }, setEvent: function(type) { var moveHandler = document['on' + type + 'move'] || function(){}; document['on' + type + 'move'] = function(e) { moveHandler(e); Cursor.refresh(e); } }, refresh: function(e) { if(!e) { e = window.event; } if(e.type == 'mousemove') { this.set(e); } else if(e.touches) { this.set(e.touches[0]); } }, set: function(e) { if(e.pageX || e.pageY) { this.x = e.pageX; this.y = e.pageY; } else if(document.body && (e.clientX || e.clientY)) //need to check whether body exists, because of IE8 issue (#1084) { this.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; this.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; } } }; Cursor.init(); /* Position */ var Position = { get: function(obj) { var curtop = 0, curleft = 0; //Walkontable patch. Original (var curleft = curtop = 0;) created curtop in global scope if(obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while((obj = obj.offsetParent)); } return [curleft, curtop]; } }; /* Dragdealer */ var Dragdealer = function(wrapper, options) { if(typeof(wrapper) == 'string') { wrapper = document.getElementById(wrapper); } if(!wrapper) { return; } var handle = wrapper.getElementsByTagName('div')[0]; if(!handle || handle.className.search(/(^|\s)handle(\s|$)/) == -1) { return; } this.init(wrapper, handle, options || {}); this.setup(); }; Dragdealer.prototype = { init: function(wrapper, handle, options) { this.wrapper = wrapper; this.handle = handle; this.options = options; this.disabled = this.getOption('disabled', false); this.horizontal = this.getOption('horizontal', true); this.vertical = this.getOption('vertical', false); this.slide = this.getOption('slide', true); this.steps = this.getOption('steps', 0); this.snap = this.getOption('snap', false); this.loose = this.getOption('loose', false); this.speed = this.getOption('speed', 10) / 100; this.xPrecision = this.getOption('xPrecision', 0); this.yPrecision = this.getOption('yPrecision', 0); this.callback = options.callback || null; this.animationCallback = options.animationCallback || null; this.bounds = { left: options.left || 0, right: -(options.right || 0), top: options.top || 0, bottom: -(options.bottom || 0), x0: 0, x1: 0, xRange: 0, y0: 0, y1: 0, yRange: 0 }; this.value = { prev: [-1, -1], current: [options.x || 0, options.y || 0], target: [options.x || 0, options.y || 0] }; this.offset = { wrapper: [0, 0], mouse: [0, 0], prev: [-999999, -999999], current: [0, 0], target: [0, 0] }; this.change = [0, 0]; this.activity = false; this.dragging = false; this.tapping = false; }, getOption: function(name, defaultValue) { return this.options[name] !== undefined ? this.options[name] : defaultValue; }, setup: function() { this.setWrapperOffset(); this.setBoundsPadding(); this.setBounds(); this.setSteps(); this.addListeners(); }, setWrapperOffset: function() { this.offset.wrapper = Position.get(this.wrapper); }, setBoundsPadding: function() { if(!this.bounds.left && !this.bounds.right) { this.bounds.left = Position.get(this.handle)[0] - this.offset.wrapper[0]; this.bounds.right = -this.bounds.left; } if(!this.bounds.top && !this.bounds.bottom) { this.bounds.top = Position.get(this.handle)[1] - this.offset.wrapper[1]; this.bounds.bottom = -this.bounds.top; } }, setBounds: function() { this.bounds.x0 = this.bounds.left; this.bounds.x1 = this.wrapper.offsetWidth + this.bounds.right; this.bounds.xRange = (this.bounds.x1 - this.bounds.x0) - this.handle.offsetWidth; this.bounds.y0 = this.bounds.top; this.bounds.y1 = this.wrapper.offsetHeight + this.bounds.bottom; this.bounds.yRange = (this.bounds.y1 - this.bounds.y0) - this.handle.offsetHeight; this.bounds.xStep = 1 / (this.xPrecision || Math.max(this.wrapper.offsetWidth, this.handle.offsetWidth)); this.bounds.yStep = 1 / (this.yPrecision || Math.max(this.wrapper.offsetHeight, this.handle.offsetHeight)); }, setSteps: function() { if(this.steps > 1) { this.stepRatios = []; for(var i = 0; i <= this.steps - 1; i++) { this.stepRatios[i] = i / (this.steps - 1); } } }, addListeners: function() { var self = this; this.wrapper.onselectstart = function() { return false; } this.handle.onmousedown = this.handle.ontouchstart = function(e) { self.handleDownHandler(e); }; this.wrapper.onmousedown = this.wrapper.ontouchstart = function(e) { self.wrapperDownHandler(e); }; var mouseUpHandler = document.onmouseup || function(){}; document.onmouseup = function(e) { mouseUpHandler(e); self.documentUpHandler(e); }; var touchEndHandler = document.ontouchend || function(){}; document.ontouchend = function(e) { touchEndHandler(e); self.documentUpHandler(e); }; var resizeHandler = window.onresize || function(){}; window.onresize = function(e) { resizeHandler(e); self.documentResizeHandler(e); }; this.wrapper.onmousemove = function(e) { self.activity = true; } this.wrapper.onclick = function(e) { return !self.activity; } this.interval = setInterval(function(){ self.animate() }, 25); self.animate(false, true); }, handleDownHandler: function(e) { this.activity = false; Cursor.refresh(e); this.preventDefaults(e, true); this.startDrag(); }, wrapperDownHandler: function(e) { Cursor.refresh(e); this.preventDefaults(e, true); this.startTap(); }, documentUpHandler: function(e) { this.stopDrag(); this.stopTap(); }, documentResizeHandler: function(e) { this.setWrapperOffset(); this.setBounds(); this.update(); }, enable: function() { this.disabled = false; this.handle.className = this.handle.className.replace(/\s?disabled/g, ''); }, disable: function() { this.disabled = true; this.handle.className += ' disabled'; }, setStep: function(x, y, snap) { this.setValue( this.steps && x > 1 ? (x - 1) / (this.steps - 1) : 0, this.steps && y > 1 ? (y - 1) / (this.steps - 1) : 0, snap ); }, setValue: function(x, y, snap) { this.setTargetValue([x, y || 0]); if(snap) { this.groupCopy(this.value.current, this.value.target); } }, startTap: function(target) { if(this.disabled) { return; } this.tapping = true; this.setWrapperOffset(); this.setBounds(); if(target === undefined) { target = [ Cursor.x - this.offset.wrapper[0] - (this.handle.offsetWidth / 2), Cursor.y - this.offset.wrapper[1] - (this.handle.offsetHeight / 2) ]; } this.setTargetOffset(target); }, stopTap: function() { if(this.disabled || !this.tapping) { return; } this.tapping = false; this.setTargetValue(this.value.current); this.result(); }, startDrag: function() { if(this.disabled) { return; } this.setWrapperOffset(); this.setBounds(); this.offset.mouse = [ Cursor.x - Position.get(this.handle)[0], Cursor.y - Position.get(this.handle)[1] ]; this.dragging = true; }, stopDrag: function() { if(this.disabled || !this.dragging) { return; } this.dragging = false; var target = this.groupClone(this.value.current); if(this.slide) { var ratioChange = this.change; target[0] += ratioChange[0] * 4; target[1] += ratioChange[1] * 4; } this.setTargetValue(target); this.result(); }, feedback: function() { var value = this.value.current; if(this.snap && this.steps > 1) { value = this.getClosestSteps(value); } if(!this.groupCompare(value, this.value.prev)) { if(typeof(this.animationCallback) == 'function') { this.animationCallback(value[0], value[1]); } this.groupCopy(this.value.prev, value); } }, result: function() { if(typeof(this.callback) == 'function') { this.callback(this.value.target[0], this.value.target[1]); } }, animate: function(direct, first) { if(direct && !this.dragging) { return; } if(this.dragging) { var prevTarget = this.groupClone(this.value.target); var offset = [ Cursor.x - this.offset.wrapper[0] - this.offset.mouse[0], Cursor.y - this.offset.wrapper[1] - this.offset.mouse[1] ]; this.setTargetOffset(offset, this.loose); this.change = [ this.value.target[0] - prevTarget[0], this.value.target[1] - prevTarget[1] ]; } if(this.dragging || first) { this.groupCopy(this.value.current, this.value.target); } if(this.dragging || this.glide() || first) { this.update(); this.feedback(); } }, glide: function() { var diff = [ this.value.target[0] - this.value.current[0], this.value.target[1] - this.value.current[1] ]; if(!diff[0] && !diff[1]) { return false; } if(Math.abs(diff[0]) > this.bounds.xStep || Math.abs(diff[1]) > this.bounds.yStep) { this.value.current[0] += diff[0] * this.speed; this.value.current[1] += diff[1] * this.speed; } else { this.groupCopy(this.value.current, this.value.target); } return true; }, update: function() { if(!this.snap) { this.offset.current = this.getOffsetsByRatios(this.value.current); } else { this.offset.current = this.getOffsetsByRatios( this.getClosestSteps(this.value.current) ); } this.show(); }, show: function() { if(!this.groupCompare(this.offset.current, this.offset.prev)) { if(this.horizontal) { this.handle.style.left = String(this.offset.current[0]) + 'px'; } if(this.vertical) { this.handle.style.top = String(this.offset.current[1]) + 'px'; } this.groupCopy(this.offset.prev, this.offset.current); } }, setTargetValue: function(value, loose) { var target = loose ? this.getLooseValue(value) : this.getProperValue(value); this.groupCopy(this.value.target, target); this.offset.target = this.getOffsetsByRatios(target); }, setTargetOffset: function(offset, loose) { var value = this.getRatiosByOffsets(offset); var target = loose ? this.getLooseValue(value) : this.getProperValue(value); this.groupCopy(this.value.target, target); this.offset.target = this.getOffsetsByRatios(target); }, getLooseValue: function(value) { var proper = this.getProperValue(value); return [ proper[0] + ((value[0] - proper[0]) / 4), proper[1] + ((value[1] - proper[1]) / 4) ]; }, getProperValue: function(value) { var proper = this.groupClone(value); proper[0] = Math.max(proper[0], 0); proper[1] = Math.max(proper[1], 0); proper[0] = Math.min(proper[0], 1); proper[1] = Math.min(proper[1], 1); if((!this.dragging && !this.tapping) || this.snap) { if(this.steps > 1) { proper = this.getClosestSteps(proper); } } return proper; }, getRatiosByOffsets: function(group) { return [ this.getRatioByOffset(group[0], this.bounds.xRange, this.bounds.x0), this.getRatioByOffset(group[1], this.bounds.yRange, this.bounds.y0) ]; }, getRatioByOffset: function(offset, range, padding) { return range ? (offset - padding) / range : 0; }, getOffsetsByRatios: function(group) { return [ this.getOffsetByRatio(group[0], this.bounds.xRange, this.bounds.x0), this.getOffsetByRatio(group[1], this.bounds.yRange, this.bounds.y0) ]; }, getOffsetByRatio: function(ratio, range, padding) { return Math.round(ratio * range) + padding; }, getClosestSteps: function(group) { return [ this.getClosestStep(group[0]), this.getClosestStep(group[1]) ]; }, getClosestStep: function(value) { var k = 0; var min = 1; for(var i = 0; i <= this.steps - 1; i++) { if(Math.abs(this.stepRatios[i] - value) < min) { min = Math.abs(this.stepRatios[i] - value); k = i; } } return this.stepRatios[k]; }, groupCompare: function(a, b) { return a[0] == b[0] && a[1] == b[1]; }, groupCopy: function(a, b) { a[0] = b[0]; a[1] = b[1]; }, groupClone: function(a) { return [a[0], a[1]]; }, preventDefaults: function(e, selection) { if(!e) { e = window.event; } if(e.preventDefault) { e.preventDefault(); } e.returnValue = false; if(selection && document.selection) { document.selection.empty(); } }, cancelEvent: function(e) { if(!e) { e = window.event; } if(e.stopPropagation) { e.stopPropagation(); } e.cancelBubble = true; } }; /*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.1.3 * * Requires: 1.2.2+ */ (function (factory) { if ( typeof define === 'function' && define.amd ) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // Node/CommonJS style for Browserify module.exports = factory; } else { // Browser globals factory(jQuery); } }(function ($) { var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; var lowestDelta, lowestDeltaXY; if ( $.event.fixHooks ) { for ( var i = toFix.length; i; ) { $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; } } $.event.special.mousewheel = { setup: function() { if ( this.addEventListener ) { for ( var i = toBind.length; i; ) { this.addEventListener( toBind[--i], handler, false ); } } else { this.onmousewheel = handler; } }, teardown: function() { if ( this.removeEventListener ) { for ( var i = toBind.length; i; ) { this.removeEventListener( toBind[--i], handler, false ); } } else { this.onmousewheel = null; } } }; $.fn.extend({ mousewheel: function(fn) { return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); }, unmousewheel: function(fn) { return this.unbind("mousewheel", fn); } }); function handler(event) { var orgEvent = event || window.event, args = [].slice.call(arguments, 1), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, absDeltaXY = 0, fn; event = $.event.fix(orgEvent); event.type = "mousewheel"; // Old school scrollwheel delta if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; } if ( orgEvent.detail ) { delta = orgEvent.detail * -1; } // New school wheel delta (wheel event) if ( orgEvent.deltaY ) { deltaY = orgEvent.deltaY * -1; delta = deltaY; } if ( orgEvent.deltaX ) { deltaX = orgEvent.deltaX; delta = deltaX * -1; } // Webkit if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; } if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; } // Look for lowest delta to normalize the delta values absDelta = Math.abs(delta); if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; } absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX)); if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; } // Get a whole value for the deltas fn = delta > 0 ? 'floor' : 'ceil'; delta = Math[fn](delta / lowestDelta); deltaX = Math[fn](deltaX / lowestDeltaXY); deltaY = Math[fn](deltaY / lowestDeltaXY); // Add event and delta to the front of the arguments args.unshift(event, delta, deltaX, deltaY); return ($.event.dispatch || $.event.handle).apply(this, args); } })); })(jQuery, window, Handsontable);
static/rest_framework/docs/js/jquery-1.10.2.min.js
mercycorps/TolaTables
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery-1.10.2.min.map */ (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t }({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
node_modules/lite-server/node_modules/browser-sync/node_modules/socket.io-client/socket.io.js
jmercer25/quickstart
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["io"] = factory(); else root["io"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * Module dependencies. */ var url = __webpack_require__(1); var parser = __webpack_require__(7); var Manager = __webpack_require__(17); var debug = __webpack_require__(3)('socket.io-client'); /** * Module exports. */ module.exports = exports = lookup; /** * Managers cache. */ var cache = exports.managers = {}; /** * Looks up an existing `Manager` for multiplexing. * If the user summons: * * `io('http://localhost/a');` * `io('http://localhost/b');` * * We reuse the existing instance based on same scheme/port/host, * and we initialize sockets for each namespace. * * @api public */ function lookup(uri, opts) { if ((typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) === 'object') { opts = uri; uri = undefined; } opts = opts || {}; var parsed = url(uri); var source = parsed.source; var id = parsed.id; var path = parsed.path; var sameNamespace = cache[id] && path in cache[id].nsps; var newConnection = opts.forceNew || opts['force new connection'] || false === opts.multiplex || sameNamespace; var io; if (newConnection) { debug('ignoring socket cache for %s', source); io = Manager(source, opts); } else { if (!cache[id]) { debug('new io instance for %s', source); cache[id] = Manager(source, opts); } io = cache[id]; } if (parsed.query && !opts.query) { opts.query = parsed.query; } else if (opts && 'object' === _typeof(opts.query)) { opts.query = encodeQueryString(opts.query); } return io.socket(parsed.path, opts); } /** * Helper method to parse query objects to string. * @param {object} query * @returns {string} */ function encodeQueryString(obj) { var str = []; for (var p in obj) { if (obj.hasOwnProperty(p)) { str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); } } return str.join('&'); } /** * Protocol version. * * @api public */ exports.protocol = parser.protocol; /** * `connect`. * * @param {String} uri * @api public */ exports.connect = lookup; /** * Expose constructors for standalone build. * * @api public */ exports.Manager = __webpack_require__(17); exports.Socket = __webpack_require__(45); /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {'use strict'; /** * Module dependencies. */ var parseuri = __webpack_require__(2); var debug = __webpack_require__(3)('socket.io-client:url'); /** * Module exports. */ module.exports = url; /** * URL parser. * * @param {String} url * @param {Object} An object meant to mimic window.location. * Defaults to window.location. * @api public */ function url(uri, loc) { var obj = uri; // default to window.location loc = loc || global.location; if (null == uri) uri = loc.protocol + '//' + loc.host; // relative path support if ('string' === typeof uri) { if ('/' === uri.charAt(0)) { if ('/' === uri.charAt(1)) { uri = loc.protocol + uri; } else { uri = loc.host + uri; } } if (!/^(https?|wss?):\/\//.test(uri)) { debug('protocol-less url %s', uri); if ('undefined' !== typeof loc) { uri = loc.protocol + '//' + uri; } else { uri = 'https://' + uri; } } // parse debug('parse %s', uri); obj = parseuri(uri); } // make sure we treat `localhost:80` and `localhost` equally if (!obj.port) { if (/^(http|ws)$/.test(obj.protocol)) { obj.port = '80'; } else if (/^(http|ws)s$/.test(obj.protocol)) { obj.port = '443'; } } obj.path = obj.path || '/'; var ipv6 = obj.host.indexOf(':') !== -1; var host = ipv6 ? '[' + obj.host + ']' : obj.host; // define unique id obj.id = obj.protocol + '://' + host + ':' + obj.port; // define href obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : ':' + obj.port); return obj; } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 2 */ /***/ function(module, exports) { /** * Parses an URI * * @author Steven Levithan <stevenlevithan.com> (MIT license) * @api private */ var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; var parts = [ 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor' ]; module.exports = function parseuri(str) { var src = str, b = str.indexOf('['), e = str.indexOf(']'); if (b != -1 && e != -1) { str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length); } var m = re.exec(str || ''), uri = {}, i = 14; while (i--) { uri[parts[i]] = m[i] || ''; } if (b != -1 && e != -1) { uri.source = src; uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':'); uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':'); uri.ipv6uri = true; } return uri; }; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) { /** * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = __webpack_require__(5); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); /** * Colors. */ exports.colors = [ 'lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson' ]; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * TODO: add a `localStorage` variable to explicitly enable/disable colors */ function useColors() { // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) || // is firebug? http://stackoverflow.com/a/398120/376773 (window.console && (console.firebug || (console.exception && console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); } /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ exports.formatters.j = function(v) { try { return JSON.stringify(v); } catch (err) { return '[UnexpectedJSONParseError]: ' + err.message; } }; /** * Colorize log arguments if enabled. * * @api public */ function formatArgs() { var args = arguments; var useColors = this.useColors; args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); if (!useColors) return args; var c = 'color: ' + this.color; args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { // we only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); return args; } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log() { // this hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (null == namespaces) { exports.storage.removeItem('debug'); } else { exports.storage.debug = namespaces; } } catch(e) {} } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { return exports.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (typeof process !== 'undefined' && 'env' in process) { return process.env.DEBUG; } } /** * Enable namespaces listed in `localStorage.debug` initially. */ exports.enable(load()); /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage(){ try { return window.localStorage; } catch (e) {} } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) /***/ }, /* 4 */ /***/ function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = debug.debug = debug; exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; exports.humanize = __webpack_require__(6); /** * The currently active debug mode names, and names to skip. */ exports.names = []; exports.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lowercased letter, i.e. "n". */ exports.formatters = {}; /** * Previously assigned color. */ var prevColor = 0; /** * Previous log timestamp. */ var prevTime; /** * Select a color. * * @return {Number} * @api private */ function selectColor() { return exports.colors[prevColor++ % exports.colors.length]; } /** * Create a debugger with the given `namespace`. * * @param {String} namespace * @return {Function} * @api public */ function debug(namespace) { // define the `disabled` version function disabled() { } disabled.enabled = false; // define the `enabled` version function enabled() { var self = enabled; // set `diff` timestamp var curr = +new Date(); var ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; // add the `color` if not set if (null == self.useColors) self.useColors = exports.useColors(); if (null == self.color && self.useColors) self.color = selectColor(); var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } args[0] = exports.coerce(args[0]); if ('string' !== typeof args[0]) { // anything else let's inspect with %o args = ['%o'].concat(args); } // apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { // if we encounter an escaped % then don't increase the array index if (match === '%%') return match; index++; var formatter = exports.formatters[format]; if ('function' === typeof formatter) { var val = args[index]; match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); // apply env-specific formatting args = exports.formatArgs.apply(self, args); var logFn = enabled.log || exports.log || console.log.bind(console); logFn.apply(self, args); } enabled.enabled = true; var fn = exports.enabled(namespace) ? enabled : disabled; fn.namespace = namespace; return fn; } /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ function enable(namespaces) { exports.save(namespaces); var split = (namespaces || '').split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { if (!split[i]) continue; // ignore empty strings namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?'); if (namespaces[0] === '-') { exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { exports.names.push(new RegExp('^' + namespaces + '$')); } } } /** * Disable debug output. * * @api public */ function disable() { exports.enable(''); } /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ function enabled(name) { var i, len; for (i = 0, len = exports.skips.length; i < len; i++) { if (exports.skips[i].test(name)) { return false; } } for (i = 0, len = exports.names.length; i < len; i++) { if (exports.names[i].test(name)) { return true; } } return false; } /** * Coerce `val`. * * @param {Mixed} val * @return {Mixed} * @api private */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } /***/ }, /* 6 */ /***/ function(module, exports) { /** * Helpers. */ var s = 1000 var m = s * 60 var h = m * 60 var d = h * 24 var y = d * 365.25 /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} options * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ module.exports = function (val, options) { options = options || {} var type = typeof val if (type === 'string' && val.length > 0) { return parse(val) } else if (type === 'number' && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val) } throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)) } /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = String(str) if (str.length > 10000) { return } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str) if (!match) { return } var n = parseFloat(match[1]) var type = (match[2] || 'ms').toLowerCase() switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y case 'days': case 'day': case 'd': return n * d case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n default: return undefined } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtShort(ms) { if (ms >= d) { return Math.round(ms / d) + 'd' } if (ms >= h) { return Math.round(ms / h) + 'h' } if (ms >= m) { return Math.round(ms / m) + 'm' } if (ms >= s) { return Math.round(ms / s) + 's' } return ms + 'ms' } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtLong(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms' } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) { return } if (ms < n * 1.5) { return Math.floor(ms / n) + ' ' + name } return Math.ceil(ms / n) + ' ' + name + 's' } /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { /** * Module dependencies. */ var debug = __webpack_require__(8)('socket.io-parser'); var json = __webpack_require__(11); var Emitter = __webpack_require__(13); var binary = __webpack_require__(14); var isBuf = __webpack_require__(16); /** * Protocol version. * * @api public */ exports.protocol = 4; /** * Packet types. * * @api public */ exports.types = [ 'CONNECT', 'DISCONNECT', 'EVENT', 'ACK', 'ERROR', 'BINARY_EVENT', 'BINARY_ACK' ]; /** * Packet type `connect`. * * @api public */ exports.CONNECT = 0; /** * Packet type `disconnect`. * * @api public */ exports.DISCONNECT = 1; /** * Packet type `event`. * * @api public */ exports.EVENT = 2; /** * Packet type `ack`. * * @api public */ exports.ACK = 3; /** * Packet type `error`. * * @api public */ exports.ERROR = 4; /** * Packet type 'binary event' * * @api public */ exports.BINARY_EVENT = 5; /** * Packet type `binary ack`. For acks with binary arguments. * * @api public */ exports.BINARY_ACK = 6; /** * Encoder constructor. * * @api public */ exports.Encoder = Encoder; /** * Decoder constructor. * * @api public */ exports.Decoder = Decoder; /** * A socket.io Encoder instance * * @api public */ function Encoder() {} /** * Encode a packet as a single string if non-binary, or as a * buffer sequence, depending on packet type. * * @param {Object} obj - packet object * @param {Function} callback - function to handle encodings (likely engine.write) * @return Calls callback with Array of encodings * @api public */ Encoder.prototype.encode = function(obj, callback){ debug('encoding packet %j', obj); if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) { encodeAsBinary(obj, callback); } else { var encoding = encodeAsString(obj); callback([encoding]); } }; /** * Encode packet as string. * * @param {Object} packet * @return {String} encoded * @api private */ function encodeAsString(obj) { var str = ''; var nsp = false; // first is type str += obj.type; // attachments if we have them if (exports.BINARY_EVENT == obj.type || exports.BINARY_ACK == obj.type) { str += obj.attachments; str += '-'; } // if we have a namespace other than `/` // we append it followed by a comma `,` if (obj.nsp && '/' != obj.nsp) { nsp = true; str += obj.nsp; } // immediately followed by the id if (null != obj.id) { if (nsp) { str += ','; nsp = false; } str += obj.id; } // json data if (null != obj.data) { if (nsp) str += ','; str += json.stringify(obj.data); } debug('encoded %j as %s', obj, str); return str; } /** * Encode packet as 'buffer sequence' by removing blobs, and * deconstructing packet into object with placeholders and * a list of buffers. * * @param {Object} packet * @return {Buffer} encoded * @api private */ function encodeAsBinary(obj, callback) { function writeEncoding(bloblessData) { var deconstruction = binary.deconstructPacket(bloblessData); var pack = encodeAsString(deconstruction.packet); var buffers = deconstruction.buffers; buffers.unshift(pack); // add packet info to beginning of data list callback(buffers); // write all the buffers } binary.removeBlobs(obj, writeEncoding); } /** * A socket.io Decoder instance * * @return {Object} decoder * @api public */ function Decoder() { this.reconstructor = null; } /** * Mix in `Emitter` with Decoder. */ Emitter(Decoder.prototype); /** * Decodes an ecoded packet string into packet JSON. * * @param {String} obj - encoded packet * @return {Object} packet * @api public */ Decoder.prototype.add = function(obj) { var packet; if ('string' == typeof obj) { packet = decodeString(obj); if (exports.BINARY_EVENT == packet.type || exports.BINARY_ACK == packet.type) { // binary packet's json this.reconstructor = new BinaryReconstructor(packet); // no attachments, labeled binary but no binary data to follow if (this.reconstructor.reconPack.attachments === 0) { this.emit('decoded', packet); } } else { // non-binary full packet this.emit('decoded', packet); } } else if (isBuf(obj) || obj.base64) { // raw binary data if (!this.reconstructor) { throw new Error('got binary data when not reconstructing a packet'); } else { packet = this.reconstructor.takeBinaryData(obj); if (packet) { // received final buffer this.reconstructor = null; this.emit('decoded', packet); } } } else { throw new Error('Unknown type: ' + obj); } }; /** * Decode a packet String (JSON data) * * @param {String} str * @return {Object} packet * @api private */ function decodeString(str) { var p = {}; var i = 0; // look up type p.type = Number(str.charAt(0)); if (null == exports.types[p.type]) return error(); // look up attachments if type binary if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) { var buf = ''; while (str.charAt(++i) != '-') { buf += str.charAt(i); if (i == str.length) break; } if (buf != Number(buf) || str.charAt(i) != '-') { throw new Error('Illegal attachments'); } p.attachments = Number(buf); } // look up namespace (if any) if ('/' == str.charAt(i + 1)) { p.nsp = ''; while (++i) { var c = str.charAt(i); if (',' == c) break; p.nsp += c; if (i == str.length) break; } } else { p.nsp = '/'; } // look up id var next = str.charAt(i + 1); if ('' !== next && Number(next) == next) { p.id = ''; while (++i) { var c = str.charAt(i); if (null == c || Number(c) != c) { --i; break; } p.id += str.charAt(i); if (i == str.length) break; } p.id = Number(p.id); } // look up json data if (str.charAt(++i)) { p = tryParse(p, str.substr(i)); } debug('decoded %s as %j', str, p); return p; } function tryParse(p, str) { try { p.data = json.parse(str); } catch(e){ return error(); } return p; }; /** * Deallocates a parser's resources * * @api public */ Decoder.prototype.destroy = function() { if (this.reconstructor) { this.reconstructor.finishedReconstruction(); } }; /** * A manager of a binary event's 'buffer sequence'. Should * be constructed whenever a packet of type BINARY_EVENT is * decoded. * * @param {Object} packet * @return {BinaryReconstructor} initialized reconstructor * @api private */ function BinaryReconstructor(packet) { this.reconPack = packet; this.buffers = []; } /** * Method to be called when binary data received from connection * after a BINARY_EVENT packet. * * @param {Buffer | ArrayBuffer} binData - the raw binary data received * @return {null | Object} returns null if more binary data is expected or * a reconstructed packet object if all buffers have been received. * @api private */ BinaryReconstructor.prototype.takeBinaryData = function(binData) { this.buffers.push(binData); if (this.buffers.length == this.reconPack.attachments) { // done with buffer list var packet = binary.reconstructPacket(this.reconPack, this.buffers); this.finishedReconstruction(); return packet; } return null; }; /** * Cleans up binary packet reconstruction variables. * * @api private */ BinaryReconstructor.prototype.finishedReconstruction = function() { this.reconPack = null; this.buffers = []; }; function error(data){ return { type: exports.ERROR, data: 'parser error' }; } /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { /** * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = __webpack_require__(9); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); /** * Colors. */ exports.colors = [ 'lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson' ]; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * TODO: add a `localStorage` variable to explicitly enable/disable colors */ function useColors() { // is webkit? http://stackoverflow.com/a/16459606/376773 return ('WebkitAppearance' in document.documentElement.style) || // is firebug? http://stackoverflow.com/a/398120/376773 (window.console && (console.firebug || (console.exception && console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); } /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ exports.formatters.j = function(v) { return JSON.stringify(v); }; /** * Colorize log arguments if enabled. * * @api public */ function formatArgs() { var args = arguments; var useColors = this.useColors; args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); if (!useColors) return args; var c = 'color: ' + this.color; args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { // we only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); return args; } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log() { // this hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (null == namespaces) { exports.storage.removeItem('debug'); } else { exports.storage.debug = namespaces; } } catch(e) {} } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { r = exports.storage.debug; } catch(e) {} return r; } /** * Enable namespaces listed in `localStorage.debug` initially. */ exports.enable(load()); /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage(){ try { return window.localStorage; } catch (e) {} } /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = debug; exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; exports.humanize = __webpack_require__(10); /** * The currently active debug mode names, and names to skip. */ exports.names = []; exports.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lowercased letter, i.e. "n". */ exports.formatters = {}; /** * Previously assigned color. */ var prevColor = 0; /** * Previous log timestamp. */ var prevTime; /** * Select a color. * * @return {Number} * @api private */ function selectColor() { return exports.colors[prevColor++ % exports.colors.length]; } /** * Create a debugger with the given `namespace`. * * @param {String} namespace * @return {Function} * @api public */ function debug(namespace) { // define the `disabled` version function disabled() { } disabled.enabled = false; // define the `enabled` version function enabled() { var self = enabled; // set `diff` timestamp var curr = +new Date(); var ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; // add the `color` if not set if (null == self.useColors) self.useColors = exports.useColors(); if (null == self.color && self.useColors) self.color = selectColor(); var args = Array.prototype.slice.call(arguments); args[0] = exports.coerce(args[0]); if ('string' !== typeof args[0]) { // anything else let's inspect with %o args = ['%o'].concat(args); } // apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { // if we encounter an escaped % then don't increase the array index if (match === '%%') return match; index++; var formatter = exports.formatters[format]; if ('function' === typeof formatter) { var val = args[index]; match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); if ('function' === typeof exports.formatArgs) { args = exports.formatArgs.apply(self, args); } var logFn = enabled.log || exports.log || console.log.bind(console); logFn.apply(self, args); } enabled.enabled = true; var fn = exports.enabled(namespace) ? enabled : disabled; fn.namespace = namespace; return fn; } /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ function enable(namespaces) { exports.save(namespaces); var split = (namespaces || '').split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { if (!split[i]) continue; // ignore empty strings namespaces = split[i].replace(/\*/g, '.*?'); if (namespaces[0] === '-') { exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { exports.names.push(new RegExp('^' + namespaces + '$')); } } } /** * Disable debug output. * * @api public */ function disable() { exports.enable(''); } /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ function enabled(name) { var i, len; for (i = 0, len = exports.skips.length; i < len; i++) { if (exports.skips[i].test(name)) { return false; } } for (i = 0, len = exports.names.length; i < len; i++) { if (exports.names[i].test(name)) { return true; } } return false; } /** * Coerce `val`. * * @param {Mixed} val * @return {Mixed} * @api private */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } /***/ }, /* 10 */ /***/ function(module, exports) { /** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} options * @return {String|Number} * @api public */ module.exports = function(val, options){ options = options || {}; if ('string' == typeof val) return parse(val); return options.long ? long(val) : short(val); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = '' + str; if (str.length > 10000) return; var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); if (!match) return; var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function short(ms) { if (ms >= d) return Math.round(ms / d) + 'd'; if (ms >= h) return Math.round(ms / h) + 'h'; if (ms >= m) return Math.round(ms / m) + 'm'; if (ms >= s) return Math.round(ms / s) + 's'; return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function long(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) return; if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; return Math.ceil(ms / n) + ' ' + name + 's'; } /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, global) {/*** IMPORTS FROM imports-loader ***/ var define = false; /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ ;(function () { // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. var isLoader = typeof define === "function" && define.amd; // A set of types used to distinguish objects from primitives. var objectTypes = { "function": true, "object": true }; // Detect the `exports` object exposed by CommonJS implementations. var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via // `insert-module-globals`), Narwhal, and Ringo as the default context, // and the `window` object in browsers. Rhino exports a `global` function // instead. var root = objectTypes[typeof window] && window || this, freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { root = freeGlobal; } // Public: Initializes JSON 3 using the given `context` object, attaching the // `stringify` and `parse` functions to the specified `exports` object. function runInContext(context, exports) { context || (context = root["Object"]()); exports || (exports = root["Object"]()); // Native constructor aliases. var Number = context["Number"] || root["Number"], String = context["String"] || root["String"], Object = context["Object"] || root["Object"], Date = context["Date"] || root["Date"], SyntaxError = context["SyntaxError"] || root["SyntaxError"], TypeError = context["TypeError"] || root["TypeError"], Math = context["Math"] || root["Math"], nativeJSON = context["JSON"] || root["JSON"]; // Delegate to the native `stringify` and `parse` implementations. if (typeof nativeJSON == "object" && nativeJSON) { exports.stringify = nativeJSON.stringify; exports.parse = nativeJSON.parse; } // Convenience aliases. var objectProto = Object.prototype, getClass = objectProto.toString, isProperty, forEach, undef; // Test the `Date#getUTC*` methods. Based on work by @Yaffle. var isExtended = new Date(-3509827334573292); try { // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical // results for certain dates in Opera >= 10.53. isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && // Safari < 2.0.2 stores the internal millisecond time value correctly, // but clips the values returned by the date methods to the range of // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; } catch (exception) {} // Internal: Determines whether the native `JSON.stringify` and `parse` // implementations are spec-compliant. Based on work by Ken Snyder. function has(name) { if (has[name] !== undef) { // Return cached feature test result. return has[name]; } var isSupported; if (name == "bug-string-char-index") { // IE <= 7 doesn't support accessing string characters using square // bracket notation. IE 8 only supports this for primitives. isSupported = "a"[0] != "a"; } else if (name == "json") { // Indicates whether both `JSON.stringify` and `JSON.parse` are // supported. isSupported = has("json-stringify") && has("json-parse"); } else { var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; // Test `JSON.stringify`. if (name == "json-stringify") { var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; if (stringifySupported) { // A test function object with a custom `toJSON` method. (value = function () { return 1; }).toJSON = value; try { stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean // primitives as object literals. stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object // literals. stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or // does not define a canonical JSON representation (this applies to // objects with `toJSON` properties as well, *unless* they are nested // within an object or array). stringify(getClass) === undef && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and // FF 3.1b3 pass this test. stringify(undef) === undef && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, // respectively, if the value is omitted entirely. stringify() === undef && // FF 3.1b1, 2 throw an error if the given value is not a number, // string, array, object, Boolean, or `null` literal. This applies to // objects with custom `toJSON` methods as well, unless they are nested // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` // methods entirely. stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of // `"[null]"`. stringify([undef]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 // elides non-JSON values from objects and arrays, unless they // define custom `toJSON` methods. stringify([undef, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences // where character escape codes are expected (e.g., `\b` => `\u0008`). stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly // serialize extended years. stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative // four-digit years instead of six-digit years. Credits: @Yaffle. stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond // values less than 1000. Credits: @Yaffle. stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; } catch (exception) { stringifySupported = false; } } isSupported = stringifySupported; } // Test `JSON.parse`. if (name == "json-parse") { var parse = exports.parse; if (typeof parse == "function") { try { // FF 3.1b1, b2 will throw an exception if a bare literal is provided. // Conforming implementations should also coerce the initial argument to // a string prior to parsing. if (parse("0") === 0 && !parse(false)) { // Simple parsing test. value = parse(serialized); var parseSupported = value["a"].length == 5 && value["a"][0] === 1; if (parseSupported) { try { // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. parseSupported = !parse('"\t"'); } catch (exception) {} if (parseSupported) { try { // FF 4.0 and 4.0.1 allow leading `+` signs and leading // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow // certain octal literals. parseSupported = parse("01") !== 1; } catch (exception) {} } if (parseSupported) { try { // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal // points. These environments, along with FF 3.1b1 and 2, // also allow trailing commas in JSON objects and arrays. parseSupported = parse("1.") !== 1; } catch (exception) {} } } } } catch (exception) { parseSupported = false; } } isSupported = parseSupported; } } return has[name] = !!isSupported; } if (!has("json")) { // Common `[[Class]]` name aliases. var functionClass = "[object Function]", dateClass = "[object Date]", numberClass = "[object Number]", stringClass = "[object String]", arrayClass = "[object Array]", booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. var charIndexBuggy = has("bug-string-char-index"); // Define additional utility methods if the `Date` methods are buggy. if (!isExtended) { var floor = Math.floor; // A mapping between the months of the year and the number of days between // January 1st and the first of the respective month. var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the // first day of the given month. var getDay = function (year, month) { return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); }; } // Internal: Determines if a property is a direct property of the given // object. Delegates to the native `Object#hasOwnProperty` method. if (!(isProperty = objectProto.hasOwnProperty)) { isProperty = function (property) { var members = {}, constructor; if ((members.__proto__ = null, members.__proto__ = { // The *proto* property cannot be set multiple times in recent // versions of Firefox and SeaMonkey. "toString": 1 }, members).toString != getClass) { // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but // supports the mutable *proto* property. isProperty = function (property) { // Capture and break the object's prototype chain (see section 8.6.2 // of the ES 5.1 spec). The parenthesized expression prevents an // unsafe transformation by the Closure Compiler. var original = this.__proto__, result = property in (this.__proto__ = null, this); // Restore the original prototype chain. this.__proto__ = original; return result; }; } else { // Capture a reference to the top-level `Object` constructor. constructor = members.constructor; // Use the `constructor` property to simulate `Object#hasOwnProperty` in // other environments. isProperty = function (property) { var parent = (this.constructor || constructor).prototype; return property in this && !(property in parent && this[property] === parent[property]); }; } members = null; return isProperty.call(this, property); }; } // Internal: Normalizes the `for...in` iteration algorithm across // environments. Each enumerated key is yielded to a `callback` function. forEach = function (object, callback) { var size = 0, Properties, members, property; // Tests for bugs in the current environment's `for...in` algorithm. The // `valueOf` property inherits the non-enumerable flag from // `Object.prototype` in older versions of IE, Netscape, and Mozilla. (Properties = function () { this.valueOf = 0; }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. members = new Properties(); for (property in members) { // Ignore all properties inherited from `Object.prototype`. if (isProperty.call(members, property)) { size++; } } Properties = members = null; // Normalize the iteration algorithm. if (!size) { // A list of non-enumerable properties inherited from `Object.prototype`. members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable // properties. forEach = function (object, callback) { var isFunction = getClass.call(object) == functionClass, property, length; var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; for (property in object) { // Gecko <= 1.0 enumerates the `prototype` property of functions under // certain conditions; IE does not. if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { callback(property); } } // Manually invoke the callback for each non-enumerable property. for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); }; } else if (size == 2) { // Safari <= 2.0.4 enumerates shadowed properties twice. forEach = function (object, callback) { // Create a set of iterated properties. var members = {}, isFunction = getClass.call(object) == functionClass, property; for (property in object) { // Store each property name to prevent double enumeration. The // `prototype` property of functions is not enumerated due to cross- // environment inconsistencies. if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { callback(property); } } }; } else { // No bugs detected; use the standard `for...in` algorithm. forEach = function (object, callback) { var isFunction = getClass.call(object) == functionClass, property, isConstructor; for (property in object) { if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { callback(property); } } // Manually invoke the callback for the `constructor` property due to // cross-environment inconsistencies. if (isConstructor || isProperty.call(object, (property = "constructor"))) { callback(property); } }; } return forEach(object, callback); }; // Public: Serializes a JavaScript `value` as a JSON string. The optional // `filter` argument may specify either a function that alters how object and // array members are serialized, or an array of strings and numbers that // indicates which properties should be serialized. The optional `width` // argument may be either a string or number that specifies the indentation // level of the output. if (!has("json-stringify")) { // Internal: A map of control characters and their escaped equivalents. var Escapes = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }; // Internal: Converts `value` into a zero-padded string such that its // length is at least equal to `width`. The `width` must be <= 6. var leadingZeroes = "000000"; var toPaddedString = function (width, value) { // The `|| 0` expression is necessary to work around a bug in // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. return (leadingZeroes + (value || 0)).slice(-width); }; // Internal: Double-quotes a string `value`, replacing all ASCII control // characters (characters with code unit values between 0 and 31) with // their escaped equivalents. This is an implementation of the // `Quote(value)` operation defined in ES 5.1 section 15.12.3. var unicodePrefix = "\\u00"; var quote = function (value) { var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); for (; index < length; index++) { var charCode = value.charCodeAt(index); // If the character is a control character, append its Unicode or // shorthand escape sequence; otherwise, append the character as-is. switch (charCode) { case 8: case 9: case 10: case 12: case 13: case 34: case 92: result += Escapes[charCode]; break; default: if (charCode < 32) { result += unicodePrefix + toPaddedString(2, charCode.toString(16)); break; } result += useCharIndex ? symbols[index] : value.charAt(index); } } return result + '"'; }; // Internal: Recursively serializes an object. Implements the // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; try { // Necessary for host object support. value = object[property]; } catch (exception) {} if (typeof value == "object" && value) { className = getClass.call(value); if (className == dateClass && !isProperty.call(value, "toJSON")) { if (value > -1 / 0 && value < 1 / 0) { // Dates are serialized according to the `Date#toJSON` method // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 // for the ISO 8601 date time string format. if (getDay) { // Manually compute the year, month, date, hours, minutes, // seconds, and milliseconds if the `getUTC*` methods are // buggy. Adapted from @Yaffle's `date-shim` project. date = floor(value / 864e5); for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used // to compute `A modulo B`, as the `%` operator does not // correspond to the `modulo` operation for negative numbers. time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by // decomposing the time within the day. See section 15.9.1.10. hours = floor(time / 36e5) % 24; minutes = floor(time / 6e4) % 60; seconds = floor(time / 1e3) % 60; milliseconds = time % 1e3; } else { year = value.getUTCFullYear(); month = value.getUTCMonth(); date = value.getUTCDate(); hours = value.getUTCHours(); minutes = value.getUTCMinutes(); seconds = value.getUTCSeconds(); milliseconds = value.getUTCMilliseconds(); } // Serialize extended years correctly. value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two // digits; milliseconds should have three. "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. "." + toPaddedString(3, milliseconds) + "Z"; } else { value = null; } } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 // ignores all `toJSON` methods on these objects unless they are // defined directly on an instance. value = value.toJSON(property); } } if (callback) { // If a replacement function was provided, call it to obtain the value // for serialization. value = callback.call(object, property, value); } if (value === null) { return "null"; } className = getClass.call(value); if (className == booleanClass) { // Booleans are represented literally. return "" + value; } else if (className == numberClass) { // JSON numbers must be finite. `Infinity` and `NaN` are serialized as // `"null"`. return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; } else if (className == stringClass) { // Strings are double-quoted and escaped. return quote("" + value); } // Recursively serialize objects and arrays. if (typeof value == "object") { // Check for cyclic structures. This is a linear search; performance // is inversely proportional to the number of unique nested objects. for (length = stack.length; length--;) { if (stack[length] === value) { // Cyclic structures cannot be serialized by `JSON.stringify`. throw TypeError(); } } // Add the object to the stack of traversed objects. stack.push(value); results = []; // Save the current indentation level and indent one additional level. prefix = indentation; indentation += whitespace; if (className == arrayClass) { // Recursively serialize array elements. for (index = 0, length = value.length; index < length; index++) { element = serialize(index, value, callback, properties, whitespace, indentation, stack); results.push(element === undef ? "null" : element); } result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; } else { // Recursively serialize object members. Members are selected from // either a user-specified list of property names, or the object // itself. forEach(properties || value, function (property) { var element = serialize(property, value, callback, properties, whitespace, indentation, stack); if (element !== undef) { // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} // is not the empty string, let `member` {quote(property) + ":"} // be the concatenation of `member` and the `space` character." // The "`space` character" refers to the literal space // character, not the `space` {width} argument provided to // `JSON.stringify`. results.push(quote(property) + ":" + (whitespace ? " " : "") + element); } }); result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; } // Remove the object from the traversed object stack. stack.pop(); return result; } }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. exports.stringify = function (source, filter, width) { var whitespace, callback, properties, className; if (objectTypes[typeof filter] && filter) { if ((className = getClass.call(filter)) == functionClass) { callback = filter; } else if (className == arrayClass) { // Convert the property names array into a makeshift set. properties = {}; for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); } } if (width) { if ((className = getClass.call(width)) == numberClass) { // Convert the `width` to an integer and create a string containing // `width` number of space characters. if ((width -= width % 1) > 0) { for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); } } else if (className == stringClass) { whitespace = width.length <= 10 ? width : width.slice(0, 10); } } // Opera <= 7.54u2 discards the values associated with empty string keys // (`""`) only if they are used directly within an object member list // (e.g., `!("" in { "": 1})`). return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); }; } // Public: Parses a JSON source string. if (!has("json-parse")) { var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped // equivalents. var Unescapes = { 92: "\\", 34: '"', 47: "/", 98: "\b", 116: "\t", 110: "\n", 102: "\f", 114: "\r" }; // Internal: Stores the parser state. var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. var abort = function () { Index = Source = null; throw SyntaxError(); }; // Internal: Returns the next token, or `"$"` if the parser has reached // the end of the source string. A token may be a string, number, `null` // literal, or Boolean literal. var lex = function () { var source = Source, length = source.length, value, begin, position, isSigned, charCode; while (Index < length) { charCode = source.charCodeAt(Index); switch (charCode) { case 9: case 10: case 13: case 32: // Skip whitespace tokens, including tabs, carriage returns, line // feeds, and space characters. Index++; break; case 123: case 125: case 91: case 93: case 58: case 44: // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at // the current position. value = charIndexBuggy ? source.charAt(Index) : source[Index]; Index++; return value; case 34: // `"` delimits a JSON string; advance to the next character and // begin parsing the string. String tokens are prefixed with the // sentinel `@` character to distinguish them from punctuators and // end-of-string tokens. for (value = "@", Index++; Index < length;) { charCode = source.charCodeAt(Index); if (charCode < 32) { // Unescaped ASCII control characters (those with a code unit // less than the space character) are not permitted. abort(); } else if (charCode == 92) { // A reverse solidus (`\`) marks the beginning of an escaped // control character (including `"`, `\`, and `/`) or Unicode // escape sequence. charCode = source.charCodeAt(++Index); switch (charCode) { case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: // Revive escaped control characters. value += Unescapes[charCode]; Index++; break; case 117: // `\u` marks the beginning of a Unicode escape sequence. // Advance to the first character and validate the // four-digit code point. begin = ++Index; for (position = Index + 4; Index < position; Index++) { charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- // insensitive) that form a single hexadecimal value. if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { // Invalid Unicode escape sequence. abort(); } } // Revive the escaped character. value += fromCharCode("0x" + source.slice(begin, Index)); break; default: // Invalid escape sequence. abort(); } } else { if (charCode == 34) { // An unescaped double-quote character marks the end of the // string. break; } charCode = source.charCodeAt(Index); begin = Index; // Optimize for the common case where a string is valid. while (charCode >= 32 && charCode != 92 && charCode != 34) { charCode = source.charCodeAt(++Index); } // Append the string as-is. value += source.slice(begin, Index); } } if (source.charCodeAt(Index) == 34) { // Advance to the next character and return the revived string. Index++; return value; } // Unterminated string. abort(); default: // Parse numbers and literals. begin = Index; // Advance past the negative sign, if one is specified. if (charCode == 45) { isSigned = true; charCode = source.charCodeAt(++Index); } // Parse an integer or floating-point value. if (charCode >= 48 && charCode <= 57) { // Leading zeroes are interpreted as octal literals. if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { // Illegal octal literal. abort(); } isSigned = false; // Parse the integer component. for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); // Floats cannot contain a leading decimal point; however, this // case is already accounted for by the parser. if (source.charCodeAt(Index) == 46) { position = ++Index; // Parse the decimal component. for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); if (position == Index) { // Illegal trailing decimal. abort(); } Index = position; } // Parse exponents. The `e` denoting the exponent is // case-insensitive. charCode = source.charCodeAt(Index); if (charCode == 101 || charCode == 69) { charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is // specified. if (charCode == 43 || charCode == 45) { Index++; } // Parse the exponential component. for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); if (position == Index) { // Illegal empty exponent. abort(); } Index = position; } // Coerce the parsed value to a JavaScript number. return +source.slice(begin, Index); } // A negative sign may only precede numbers. if (isSigned) { abort(); } // `true`, `false`, and `null` literals. if (source.slice(Index, Index + 4) == "true") { Index += 4; return true; } else if (source.slice(Index, Index + 5) == "false") { Index += 5; return false; } else if (source.slice(Index, Index + 4) == "null") { Index += 4; return null; } // Unrecognized token. abort(); } } // Return the sentinel `$` character if the parser has reached the end // of the source string. return "$"; }; // Internal: Parses a JSON `value` token. var get = function (value) { var results, hasMembers; if (value == "$") { // Unexpected end of input. abort(); } if (typeof value == "string") { if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { // Remove the sentinel `@` character. return value.slice(1); } // Parse object and array literals. if (value == "[") { // Parses a JSON array, returning a new JavaScript array. results = []; for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing square bracket marks the end of the array literal. if (value == "]") { break; } // If the array literal contains elements, the current token // should be a comma separating the previous element from the // next. if (hasMembers) { if (value == ",") { value = lex(); if (value == "]") { // Unexpected trailing `,` in array literal. abort(); } } else { // A `,` must separate each array element. abort(); } } // Elisions and leading commas are not permitted. if (value == ",") { abort(); } results.push(get(value)); } return results; } else if (value == "{") { // Parses a JSON object, returning a new JavaScript object. results = {}; for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing curly brace marks the end of the object literal. if (value == "}") { break; } // If the object literal contains members, the current token // should be a comma separator. if (hasMembers) { if (value == ",") { value = lex(); if (value == "}") { // Unexpected trailing `,` in object literal. abort(); } } else { // A `,` must separate each object member. abort(); } } // Leading commas are not permitted, object property names must be // double-quoted strings, and a `:` must separate each property // name and value. if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { abort(); } results[value.slice(1)] = get(lex()); } return results; } // Unexpected token encountered. abort(); } return value; }; // Internal: Updates a traversed object member. var update = function (source, property, callback) { var element = walk(source, property, callback); if (element === undef) { delete source[property]; } else { source[property] = element; } }; // Internal: Recursively traverses a parsed JSON object, invoking the // `callback` function for each value. This is an implementation of the // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. var walk = function (source, property, callback) { var value = source[property], length; if (typeof value == "object" && value) { // `forEach` can't be used to traverse an array in Opera <= 8.54 // because its `Object#hasOwnProperty` implementation returns `false` // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). if (getClass.call(value) == arrayClass) { for (length = value.length; length--;) { update(value, length, callback); } } else { forEach(value, function (property) { update(value, property, callback); }); } } return callback.call(source, property, value); }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. exports.parse = function (source, callback) { var result, value; Index = 0; Source = "" + source; result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. if (lex() != "$") { abort(); } // Reset the parser state. Index = Source = null; return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; }; } } exports["runInContext"] = runInContext; return exports; } if (freeExports && !isLoader) { // Export for CommonJS environments. runInContext(root, freeExports); } else { // Export for web browsers and JavaScript engines. var nativeJSON = root.JSON, previousJSON = root["JSON3"], isRestored = false; var JSON3 = runInContext(root, (root["JSON3"] = { // Public: Restores the original value of the global `JSON` object and // returns a reference to the `JSON3` object. "noConflict": function () { if (!isRestored) { isRestored = true; root.JSON = nativeJSON; root["JSON3"] = previousJSON; nativeJSON = previousJSON = null; } return JSON3; } })); root.JSON = { "parse": JSON3.parse, "stringify": JSON3.stringify }; } // Export for asynchronous module loaders. if (isLoader) { define(function () { return JSON3; }); } }).call(this); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)(module), (function() { return this; }()))) /***/ }, /* 12 */ /***/ function(module, exports) { module.exports = function(module) { if(!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default module.children = []; module.webpackPolyfill = 1; } return module; } /***/ }, /* 13 */ /***/ function(module, exports) { /** * Expose `Emitter`. */ module.exports = Emitter; /** * Initialize a new `Emitter`. * * @api public */ function Emitter(obj) { if (obj) return mixin(obj); }; /** * Mixin the emitter properties. * * @param {Object} obj * @return {Object} * @api private */ function mixin(obj) { for (var key in Emitter.prototype) { obj[key] = Emitter.prototype[key]; } return obj; } /** * Listen on the given `event` with `fn`. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; (this._callbacks[event] = this._callbacks[event] || []) .push(fn); return this; }; /** * Adds an `event` listener that will be invoked a single * time then automatically removed. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.once = function(event, fn){ var self = this; this._callbacks = this._callbacks || {}; function on() { self.off(event, on); fn.apply(this, arguments); } on.fn = fn; this.on(event, on); return this; }; /** * Remove the given callback for `event` or all * registered callbacks. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; // all if (0 == arguments.length) { this._callbacks = {}; return this; } // specific event var callbacks = this._callbacks[event]; if (!callbacks) return this; // remove all handlers if (1 == arguments.length) { delete this._callbacks[event]; return this; } // remove specific handler var cb; for (var i = 0; i < callbacks.length; i++) { cb = callbacks[i]; if (cb === fn || cb.fn === fn) { callbacks.splice(i, 1); break; } } return this; }; /** * Emit `event` with the given args. * * @param {String} event * @param {Mixed} ... * @return {Emitter} */ Emitter.prototype.emit = function(event){ this._callbacks = this._callbacks || {}; var args = [].slice.call(arguments, 1) , callbacks = this._callbacks[event]; if (callbacks) { callbacks = callbacks.slice(0); for (var i = 0, len = callbacks.length; i < len; ++i) { callbacks[i].apply(this, args); } } return this; }; /** * Return array of callbacks for `event`. * * @param {String} event * @return {Array} * @api public */ Emitter.prototype.listeners = function(event){ this._callbacks = this._callbacks || {}; return this._callbacks[event] || []; }; /** * Check if this emitter has `event` handlers. * * @param {String} event * @return {Boolean} * @api public */ Emitter.prototype.hasListeners = function(event){ return !! this.listeners(event).length; }; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/*global Blob,File*/ /** * Module requirements */ var isArray = __webpack_require__(15); var isBuf = __webpack_require__(16); /** * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder. * Anything with blobs or files should be fed through removeBlobs before coming * here. * * @param {Object} packet - socket.io event packet * @return {Object} with deconstructed packet and list of buffers * @api public */ exports.deconstructPacket = function(packet){ var buffers = []; var packetData = packet.data; function _deconstructPacket(data) { if (!data) return data; if (isBuf(data)) { var placeholder = { _placeholder: true, num: buffers.length }; buffers.push(data); return placeholder; } else if (isArray(data)) { var newData = new Array(data.length); for (var i = 0; i < data.length; i++) { newData[i] = _deconstructPacket(data[i]); } return newData; } else if ('object' == typeof data && !(data instanceof Date)) { var newData = {}; for (var key in data) { newData[key] = _deconstructPacket(data[key]); } return newData; } return data; } var pack = packet; pack.data = _deconstructPacket(packetData); pack.attachments = buffers.length; // number of binary 'attachments' return {packet: pack, buffers: buffers}; }; /** * Reconstructs a binary packet from its placeholder packet and buffers * * @param {Object} packet - event packet with placeholders * @param {Array} buffers - binary buffers to put in placeholder positions * @return {Object} reconstructed packet * @api public */ exports.reconstructPacket = function(packet, buffers) { var curPlaceHolder = 0; function _reconstructPacket(data) { if (data && data._placeholder) { var buf = buffers[data.num]; // appropriate buffer (should be natural order anyway) return buf; } else if (isArray(data)) { for (var i = 0; i < data.length; i++) { data[i] = _reconstructPacket(data[i]); } return data; } else if (data && 'object' == typeof data) { for (var key in data) { data[key] = _reconstructPacket(data[key]); } return data; } return data; } packet.data = _reconstructPacket(packet.data); packet.attachments = undefined; // no longer useful return packet; }; /** * Asynchronously removes Blobs or Files from data via * FileReader's readAsArrayBuffer method. Used before encoding * data as msgpack. Calls callback with the blobless data. * * @param {Object} data * @param {Function} callback * @api private */ exports.removeBlobs = function(data, callback) { function _removeBlobs(obj, curKey, containingObject) { if (!obj) return obj; // convert any blob if ((global.Blob && obj instanceof Blob) || (global.File && obj instanceof File)) { pendingBlobs++; // async filereader var fileReader = new FileReader(); fileReader.onload = function() { // this.result == arraybuffer if (containingObject) { containingObject[curKey] = this.result; } else { bloblessData = this.result; } // if nothing pending its callback time if(! --pendingBlobs) { callback(bloblessData); } }; fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer } else if (isArray(obj)) { // handle array for (var i = 0; i < obj.length; i++) { _removeBlobs(obj[i], i, obj); } } else if (obj && 'object' == typeof obj && !isBuf(obj)) { // and object for (var key in obj) { _removeBlobs(obj[key], key, obj); } } } var pendingBlobs = 0; var bloblessData = data; _removeBlobs(bloblessData); if (!pendingBlobs) { callback(bloblessData); } }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 15 */ /***/ function(module, exports) { module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; /***/ }, /* 16 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) { module.exports = isBuf; /** * Returns true if obj is a buffer or an arraybuffer. * * @api private */ function isBuf(obj) { return (global.Buffer && global.Buffer.isBuffer(obj)) || (global.ArrayBuffer && obj instanceof ArrayBuffer); } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * Module dependencies. */ var eio = __webpack_require__(18); var Socket = __webpack_require__(45); var Emitter = __webpack_require__(36); var parser = __webpack_require__(7); var on = __webpack_require__(47); var bind = __webpack_require__(48); var debug = __webpack_require__(3)('socket.io-client:manager'); var indexOf = __webpack_require__(43); var Backoff = __webpack_require__(51); /** * IE6+ hasOwnProperty */ var has = Object.prototype.hasOwnProperty; /** * Module exports */ module.exports = Manager; /** * `Manager` constructor. * * @param {String} engine instance or engine uri/opts * @param {Object} options * @api public */ function Manager(uri, opts) { if (!(this instanceof Manager)) return new Manager(uri, opts); if (uri && 'object' === (typeof uri === 'undefined' ? 'undefined' : _typeof(uri))) { opts = uri; uri = undefined; } opts = opts || {}; opts.path = opts.path || '/socket.io'; this.nsps = {}; this.subs = []; this.opts = opts; this.reconnection(opts.reconnection !== false); this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); this.reconnectionDelay(opts.reconnectionDelay || 1000); this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); this.randomizationFactor(opts.randomizationFactor || 0.5); this.backoff = new Backoff({ min: this.reconnectionDelay(), max: this.reconnectionDelayMax(), jitter: this.randomizationFactor() }); this.timeout(null == opts.timeout ? 20000 : opts.timeout); this.readyState = 'closed'; this.uri = uri; this.connecting = []; this.lastPing = null; this.encoding = false; this.packetBuffer = []; this.encoder = new parser.Encoder(); this.decoder = new parser.Decoder(); this.autoConnect = opts.autoConnect !== false; if (this.autoConnect) this.open(); } /** * Propagate given event to sockets and emit on `this` * * @api private */ Manager.prototype.emitAll = function () { this.emit.apply(this, arguments); for (var nsp in this.nsps) { if (has.call(this.nsps, nsp)) { this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); } } }; /** * Update `socket.id` of all sockets * * @api private */ Manager.prototype.updateSocketIds = function () { for (var nsp in this.nsps) { if (has.call(this.nsps, nsp)) { this.nsps[nsp].id = this.engine.id; } } }; /** * Mix in `Emitter`. */ Emitter(Manager.prototype); /** * Sets the `reconnection` config. * * @param {Boolean} true/false if it should automatically reconnect * @return {Manager} self or value * @api public */ Manager.prototype.reconnection = function (v) { if (!arguments.length) return this._reconnection; this._reconnection = !!v; return this; }; /** * Sets the reconnection attempts config. * * @param {Number} max reconnection attempts before giving up * @return {Manager} self or value * @api public */ Manager.prototype.reconnectionAttempts = function (v) { if (!arguments.length) return this._reconnectionAttempts; this._reconnectionAttempts = v; return this; }; /** * Sets the delay between reconnections. * * @param {Number} delay * @return {Manager} self or value * @api public */ Manager.prototype.reconnectionDelay = function (v) { if (!arguments.length) return this._reconnectionDelay; this._reconnectionDelay = v; this.backoff && this.backoff.setMin(v); return this; }; Manager.prototype.randomizationFactor = function (v) { if (!arguments.length) return this._randomizationFactor; this._randomizationFactor = v; this.backoff && this.backoff.setJitter(v); return this; }; /** * Sets the maximum delay between reconnections. * * @param {Number} delay * @return {Manager} self or value * @api public */ Manager.prototype.reconnectionDelayMax = function (v) { if (!arguments.length) return this._reconnectionDelayMax; this._reconnectionDelayMax = v; this.backoff && this.backoff.setMax(v); return this; }; /** * Sets the connection timeout. `false` to disable * * @return {Manager} self or value * @api public */ Manager.prototype.timeout = function (v) { if (!arguments.length) return this._timeout; this._timeout = v; return this; }; /** * Starts trying to reconnect if reconnection is enabled and we have not * started reconnecting yet * * @api private */ Manager.prototype.maybeReconnectOnOpen = function () { // Only try to reconnect if it's the first time we're connecting if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) { // keeps reconnection from firing twice for the same reconnection loop this.reconnect(); } }; /** * Sets the current transport `socket`. * * @param {Function} optional, callback * @return {Manager} self * @api public */ Manager.prototype.open = Manager.prototype.connect = function (fn, opts) { debug('readyState %s', this.readyState); if (~this.readyState.indexOf('open')) return this; debug('opening %s', this.uri); this.engine = eio(this.uri, this.opts); var socket = this.engine; var self = this; this.readyState = 'opening'; this.skipReconnect = false; // emit `open` var openSub = on(socket, 'open', function () { self.onopen(); fn && fn(); }); // emit `connect_error` var errorSub = on(socket, 'error', function (data) { debug('connect_error'); self.cleanup(); self.readyState = 'closed'; self.emitAll('connect_error', data); if (fn) { var err = new Error('Connection error'); err.data = data; fn(err); } else { // Only do this if there is no fn to handle the error self.maybeReconnectOnOpen(); } }); // emit `connect_timeout` if (false !== this._timeout) { var timeout = this._timeout; debug('connect attempt will timeout after %d', timeout); // set timer var timer = setTimeout(function () { debug('connect attempt timed out after %d', timeout); openSub.destroy(); socket.close(); socket.emit('error', 'timeout'); self.emitAll('connect_timeout', timeout); }, timeout); this.subs.push({ destroy: function destroy() { clearTimeout(timer); } }); } this.subs.push(openSub); this.subs.push(errorSub); return this; }; /** * Called upon transport open. * * @api private */ Manager.prototype.onopen = function () { debug('open'); // clear old subs this.cleanup(); // mark as open this.readyState = 'open'; this.emit('open'); // add new subs var socket = this.engine; this.subs.push(on(socket, 'data', bind(this, 'ondata'))); this.subs.push(on(socket, 'ping', bind(this, 'onping'))); this.subs.push(on(socket, 'pong', bind(this, 'onpong'))); this.subs.push(on(socket, 'error', bind(this, 'onerror'))); this.subs.push(on(socket, 'close', bind(this, 'onclose'))); this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); }; /** * Called upon a ping. * * @api private */ Manager.prototype.onping = function () { this.lastPing = new Date(); this.emitAll('ping'); }; /** * Called upon a packet. * * @api private */ Manager.prototype.onpong = function () { this.emitAll('pong', new Date() - this.lastPing); }; /** * Called with data. * * @api private */ Manager.prototype.ondata = function (data) { this.decoder.add(data); }; /** * Called when parser fully decodes a packet. * * @api private */ Manager.prototype.ondecoded = function (packet) { this.emit('packet', packet); }; /** * Called upon socket error. * * @api private */ Manager.prototype.onerror = function (err) { debug('error', err); this.emitAll('error', err); }; /** * Creates a new socket for the given `nsp`. * * @return {Socket} * @api public */ Manager.prototype.socket = function (nsp, opts) { var socket = this.nsps[nsp]; if (!socket) { socket = new Socket(this, nsp, opts); this.nsps[nsp] = socket; var self = this; socket.on('connecting', onConnecting); socket.on('connect', function () { socket.id = self.engine.id; }); if (this.autoConnect) { // manually call here since connecting evnet is fired before listening onConnecting(); } } function onConnecting() { if (!~indexOf(self.connecting, socket)) { self.connecting.push(socket); } } return socket; }; /** * Called upon a socket close. * * @param {Socket} socket */ Manager.prototype.destroy = function (socket) { var index = indexOf(this.connecting, socket); if (~index) this.connecting.splice(index, 1); if (this.connecting.length) return; this.close(); }; /** * Writes a packet. * * @param {Object} packet * @api private */ Manager.prototype.packet = function (packet) { debug('writing packet %j', packet); var self = this; if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query; if (!self.encoding) { // encode, then write to engine with result self.encoding = true; this.encoder.encode(packet, function (encodedPackets) { for (var i = 0; i < encodedPackets.length; i++) { self.engine.write(encodedPackets[i], packet.options); } self.encoding = false; self.processPacketQueue(); }); } else { // add packet to the queue self.packetBuffer.push(packet); } }; /** * If packet buffer is non-empty, begins encoding the * next packet in line. * * @api private */ Manager.prototype.processPacketQueue = function () { if (this.packetBuffer.length > 0 && !this.encoding) { var pack = this.packetBuffer.shift(); this.packet(pack); } }; /** * Clean up transport subscriptions and packet buffer. * * @api private */ Manager.prototype.cleanup = function () { debug('cleanup'); var subsLength = this.subs.length; for (var i = 0; i < subsLength; i++) { var sub = this.subs.shift(); sub.destroy(); } this.packetBuffer = []; this.encoding = false; this.lastPing = null; this.decoder.destroy(); }; /** * Close the current socket. * * @api private */ Manager.prototype.close = Manager.prototype.disconnect = function () { debug('disconnect'); this.skipReconnect = true; this.reconnecting = false; if ('opening' === this.readyState) { // `onclose` will not fire because // an open event never happened this.cleanup(); } this.backoff.reset(); this.readyState = 'closed'; if (this.engine) this.engine.close(); }; /** * Called upon engine close. * * @api private */ Manager.prototype.onclose = function (reason) { debug('onclose'); this.cleanup(); this.backoff.reset(); this.readyState = 'closed'; this.emit('close', reason); if (this._reconnection && !this.skipReconnect) { this.reconnect(); } }; /** * Attempt a reconnection. * * @api private */ Manager.prototype.reconnect = function () { if (this.reconnecting || this.skipReconnect) return this; var self = this; if (this.backoff.attempts >= this._reconnectionAttempts) { debug('reconnect failed'); this.backoff.reset(); this.emitAll('reconnect_failed'); this.reconnecting = false; } else { var delay = this.backoff.duration(); debug('will wait %dms before reconnect attempt', delay); this.reconnecting = true; var timer = setTimeout(function () { if (self.skipReconnect) return; debug('attempting reconnect'); self.emitAll('reconnect_attempt', self.backoff.attempts); self.emitAll('reconnecting', self.backoff.attempts); // check again for the case socket closed in above events if (self.skipReconnect) return; self.open(function (err) { if (err) { debug('reconnect attempt error'); self.reconnecting = false; self.reconnect(); self.emitAll('reconnect_error', err.data); } else { debug('reconnect success'); self.onreconnect(); } }); }, delay); this.subs.push({ destroy: function destroy() { clearTimeout(timer); } }); } }; /** * Called upon successful reconnect. * * @api private */ Manager.prototype.onreconnect = function () { var attempt = this.backoff.attempts; this.reconnecting = false; this.backoff.reset(); this.updateSocketIds(); this.emitAll('reconnect', attempt); }; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(19); /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(20); /** * Exports parser * * @api public * */ module.exports.parser = __webpack_require__(27); /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module dependencies. */ var transports = __webpack_require__(21); var Emitter = __webpack_require__(36); var debug = __webpack_require__(3)('engine.io-client:socket'); var index = __webpack_require__(43); var parser = __webpack_require__(27); var parseuri = __webpack_require__(2); var parsejson = __webpack_require__(44); var parseqs = __webpack_require__(37); /** * Module exports. */ module.exports = Socket; /** * Socket constructor. * * @param {String|Object} uri or options * @param {Object} options * @api public */ function Socket (uri, opts) { if (!(this instanceof Socket)) return new Socket(uri, opts); opts = opts || {}; if (uri && 'object' === typeof uri) { opts = uri; uri = null; } if (uri) { uri = parseuri(uri); opts.hostname = uri.host; opts.secure = uri.protocol === 'https' || uri.protocol === 'wss'; opts.port = uri.port; if (uri.query) opts.query = uri.query; } else if (opts.host) { opts.hostname = parseuri(opts.host).host; } this.secure = null != opts.secure ? opts.secure : (global.location && 'https:' === location.protocol); if (opts.hostname && !opts.port) { // if no port is specified manually, use the protocol default opts.port = this.secure ? '443' : '80'; } this.agent = opts.agent || false; this.hostname = opts.hostname || (global.location ? location.hostname : 'localhost'); this.port = opts.port || (global.location && location.port ? location.port : (this.secure ? 443 : 80)); this.query = opts.query || {}; if ('string' === typeof this.query) this.query = parseqs.decode(this.query); this.upgrade = false !== opts.upgrade; this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; this.forceJSONP = !!opts.forceJSONP; this.jsonp = false !== opts.jsonp; this.forceBase64 = !!opts.forceBase64; this.enablesXDR = !!opts.enablesXDR; this.timestampParam = opts.timestampParam || 't'; this.timestampRequests = opts.timestampRequests; this.transports = opts.transports || ['polling', 'websocket']; this.readyState = ''; this.writeBuffer = []; this.prevBufferLen = 0; this.policyPort = opts.policyPort || 843; this.rememberUpgrade = opts.rememberUpgrade || false; this.binaryType = null; this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; if (true === this.perMessageDeflate) this.perMessageDeflate = {}; if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { this.perMessageDeflate.threshold = 1024; } // SSL options for Node.js client this.pfx = opts.pfx || null; this.key = opts.key || null; this.passphrase = opts.passphrase || null; this.cert = opts.cert || null; this.ca = opts.ca || null; this.ciphers = opts.ciphers || null; this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? null : opts.rejectUnauthorized; this.forceNode = !!opts.forceNode; // other options for Node.js client var freeGlobal = typeof global === 'object' && global; if (freeGlobal.global === freeGlobal) { if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { this.extraHeaders = opts.extraHeaders; } if (opts.localAddress) { this.localAddress = opts.localAddress; } } // set on handshake this.id = null; this.upgrades = null; this.pingInterval = null; this.pingTimeout = null; // set on heartbeat this.pingIntervalTimer = null; this.pingTimeoutTimer = null; this.open(); } Socket.priorWebsocketSuccess = false; /** * Mix in `Emitter`. */ Emitter(Socket.prototype); /** * Protocol version. * * @api public */ Socket.protocol = parser.protocol; // this is an int /** * Expose deps for legacy compatibility * and standalone browser access. */ Socket.Socket = Socket; Socket.Transport = __webpack_require__(26); Socket.transports = __webpack_require__(21); Socket.parser = __webpack_require__(27); /** * Creates transport of the given type. * * @param {String} transport name * @return {Transport} * @api private */ Socket.prototype.createTransport = function (name) { debug('creating transport "%s"', name); var query = clone(this.query); // append engine.io protocol identifier query.EIO = parser.protocol; // transport name query.transport = name; // session id if we already have one if (this.id) query.sid = this.id; var transport = new transports[name]({ agent: this.agent, hostname: this.hostname, port: this.port, secure: this.secure, path: this.path, query: query, forceJSONP: this.forceJSONP, jsonp: this.jsonp, forceBase64: this.forceBase64, enablesXDR: this.enablesXDR, timestampRequests: this.timestampRequests, timestampParam: this.timestampParam, policyPort: this.policyPort, socket: this, pfx: this.pfx, key: this.key, passphrase: this.passphrase, cert: this.cert, ca: this.ca, ciphers: this.ciphers, rejectUnauthorized: this.rejectUnauthorized, perMessageDeflate: this.perMessageDeflate, extraHeaders: this.extraHeaders, forceNode: this.forceNode, localAddress: this.localAddress }); return transport; }; function clone (obj) { var o = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { o[i] = obj[i]; } } return o; } /** * Initializes transport to use and starts probe. * * @api private */ Socket.prototype.open = function () { var transport; if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) { transport = 'websocket'; } else if (0 === this.transports.length) { // Emit error on next tick so it can be listened to var self = this; setTimeout(function () { self.emit('error', 'No transports available'); }, 0); return; } else { transport = this.transports[0]; } this.readyState = 'opening'; // Retry with the next transport if the transport is disabled (jsonp: false) try { transport = this.createTransport(transport); } catch (e) { this.transports.shift(); this.open(); return; } transport.open(); this.setTransport(transport); }; /** * Sets the current transport. Disables the existing one (if any). * * @api private */ Socket.prototype.setTransport = function (transport) { debug('setting transport %s', transport.name); var self = this; if (this.transport) { debug('clearing existing transport %s', this.transport.name); this.transport.removeAllListeners(); } // set up transport this.transport = transport; // set up transport listeners transport .on('drain', function () { self.onDrain(); }) .on('packet', function (packet) { self.onPacket(packet); }) .on('error', function (e) { self.onError(e); }) .on('close', function () { self.onClose('transport close'); }); }; /** * Probes a transport. * * @param {String} transport name * @api private */ Socket.prototype.probe = function (name) { debug('probing transport "%s"', name); var transport = this.createTransport(name, { probe: 1 }); var failed = false; var self = this; Socket.priorWebsocketSuccess = false; function onTransportOpen () { if (self.onlyBinaryUpgrades) { var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; failed = failed || upgradeLosesBinary; } if (failed) return; debug('probe transport "%s" opened', name); transport.send([{ type: 'ping', data: 'probe' }]); transport.once('packet', function (msg) { if (failed) return; if ('pong' === msg.type && 'probe' === msg.data) { debug('probe transport "%s" pong', name); self.upgrading = true; self.emit('upgrading', transport); if (!transport) return; Socket.priorWebsocketSuccess = 'websocket' === transport.name; debug('pausing current transport "%s"', self.transport.name); self.transport.pause(function () { if (failed) return; if ('closed' === self.readyState) return; debug('changing transport and sending upgrade packet'); cleanup(); self.setTransport(transport); transport.send([{ type: 'upgrade' }]); self.emit('upgrade', transport); transport = null; self.upgrading = false; self.flush(); }); } else { debug('probe transport "%s" failed', name); var err = new Error('probe error'); err.transport = transport.name; self.emit('upgradeError', err); } }); } function freezeTransport () { if (failed) return; // Any callback called by transport should be ignored since now failed = true; cleanup(); transport.close(); transport = null; } // Handle any error that happens while probing function onerror (err) { var error = new Error('probe error: ' + err); error.transport = transport.name; freezeTransport(); debug('probe transport "%s" failed because of error: %s', name, err); self.emit('upgradeError', error); } function onTransportClose () { onerror('transport closed'); } // When the socket is closed while we're probing function onclose () { onerror('socket closed'); } // When the socket is upgraded while we're probing function onupgrade (to) { if (transport && to.name !== transport.name) { debug('"%s" works - aborting "%s"', to.name, transport.name); freezeTransport(); } } // Remove all listeners on the transport and on self function cleanup () { transport.removeListener('open', onTransportOpen); transport.removeListener('error', onerror); transport.removeListener('close', onTransportClose); self.removeListener('close', onclose); self.removeListener('upgrading', onupgrade); } transport.once('open', onTransportOpen); transport.once('error', onerror); transport.once('close', onTransportClose); this.once('close', onclose); this.once('upgrading', onupgrade); transport.open(); }; /** * Called when connection is deemed open. * * @api public */ Socket.prototype.onOpen = function () { debug('socket open'); this.readyState = 'open'; Socket.priorWebsocketSuccess = 'websocket' === this.transport.name; this.emit('open'); this.flush(); // we check for `readyState` in case an `open` // listener already closed the socket if ('open' === this.readyState && this.upgrade && this.transport.pause) { debug('starting upgrade probes'); for (var i = 0, l = this.upgrades.length; i < l; i++) { this.probe(this.upgrades[i]); } } }; /** * Handles a packet. * * @api private */ Socket.prototype.onPacket = function (packet) { if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { debug('socket receive: type "%s", data "%s"', packet.type, packet.data); this.emit('packet', packet); // Socket is live - any packet counts this.emit('heartbeat'); switch (packet.type) { case 'open': this.onHandshake(parsejson(packet.data)); break; case 'pong': this.setPing(); this.emit('pong'); break; case 'error': var err = new Error('server error'); err.code = packet.data; this.onError(err); break; case 'message': this.emit('data', packet.data); this.emit('message', packet.data); break; } } else { debug('packet received with socket readyState "%s"', this.readyState); } }; /** * Called upon handshake completion. * * @param {Object} handshake obj * @api private */ Socket.prototype.onHandshake = function (data) { this.emit('handshake', data); this.id = data.sid; this.transport.query.sid = data.sid; this.upgrades = this.filterUpgrades(data.upgrades); this.pingInterval = data.pingInterval; this.pingTimeout = data.pingTimeout; this.onOpen(); // In case open handler closes socket if ('closed' === this.readyState) return; this.setPing(); // Prolong liveness of socket on heartbeat this.removeListener('heartbeat', this.onHeartbeat); this.on('heartbeat', this.onHeartbeat); }; /** * Resets ping timeout. * * @api private */ Socket.prototype.onHeartbeat = function (timeout) { clearTimeout(this.pingTimeoutTimer); var self = this; self.pingTimeoutTimer = setTimeout(function () { if ('closed' === self.readyState) return; self.onClose('ping timeout'); }, timeout || (self.pingInterval + self.pingTimeout)); }; /** * Pings server every `this.pingInterval` and expects response * within `this.pingTimeout` or closes connection. * * @api private */ Socket.prototype.setPing = function () { var self = this; clearTimeout(self.pingIntervalTimer); self.pingIntervalTimer = setTimeout(function () { debug('writing ping packet - expecting pong within %sms', self.pingTimeout); self.ping(); self.onHeartbeat(self.pingTimeout); }, self.pingInterval); }; /** * Sends a ping packet. * * @api private */ Socket.prototype.ping = function () { var self = this; this.sendPacket('ping', function () { self.emit('ping'); }); }; /** * Called on `drain` event * * @api private */ Socket.prototype.onDrain = function () { this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important // for example, when upgrading, upgrade packet is sent over, // and a nonzero prevBufferLen could cause problems on `drain` this.prevBufferLen = 0; if (0 === this.writeBuffer.length) { this.emit('drain'); } else { this.flush(); } }; /** * Flush write buffers. * * @api private */ Socket.prototype.flush = function () { if ('closed' !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) { debug('flushing %d packets in socket', this.writeBuffer.length); this.transport.send(this.writeBuffer); // keep track of current length of writeBuffer // splice writeBuffer and callbackBuffer on `drain` this.prevBufferLen = this.writeBuffer.length; this.emit('flush'); } }; /** * Sends a message. * * @param {String} message. * @param {Function} callback function. * @param {Object} options. * @return {Socket} for chaining. * @api public */ Socket.prototype.write = Socket.prototype.send = function (msg, options, fn) { this.sendPacket('message', msg, options, fn); return this; }; /** * Sends a packet. * * @param {String} packet type. * @param {String} data. * @param {Object} options. * @param {Function} callback function. * @api private */ Socket.prototype.sendPacket = function (type, data, options, fn) { if ('function' === typeof data) { fn = data; data = undefined; } if ('function' === typeof options) { fn = options; options = null; } if ('closing' === this.readyState || 'closed' === this.readyState) { return; } options = options || {}; options.compress = false !== options.compress; var packet = { type: type, data: data, options: options }; this.emit('packetCreate', packet); this.writeBuffer.push(packet); if (fn) this.once('flush', fn); this.flush(); }; /** * Closes the connection. * * @api private */ Socket.prototype.close = function () { if ('opening' === this.readyState || 'open' === this.readyState) { this.readyState = 'closing'; var self = this; if (this.writeBuffer.length) { this.once('drain', function () { if (this.upgrading) { waitForUpgrade(); } else { close(); } }); } else if (this.upgrading) { waitForUpgrade(); } else { close(); } } function close () { self.onClose('forced close'); debug('socket closing - telling transport to close'); self.transport.close(); } function cleanupAndClose () { self.removeListener('upgrade', cleanupAndClose); self.removeListener('upgradeError', cleanupAndClose); close(); } function waitForUpgrade () { // wait for upgrade to finish since we can't send packets while pausing a transport self.once('upgrade', cleanupAndClose); self.once('upgradeError', cleanupAndClose); } return this; }; /** * Called upon transport error * * @api private */ Socket.prototype.onError = function (err) { debug('socket error %j', err); Socket.priorWebsocketSuccess = false; this.emit('error', err); this.onClose('transport error', err); }; /** * Called upon transport close. * * @api private */ Socket.prototype.onClose = function (reason, desc) { if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) { debug('socket close with reason: "%s"', reason); var self = this; // clear timers clearTimeout(this.pingIntervalTimer); clearTimeout(this.pingTimeoutTimer); // stop event from firing again for transport this.transport.removeAllListeners('close'); // ensure transport won't stay open this.transport.close(); // ignore further transport communication this.transport.removeAllListeners(); // set ready state this.readyState = 'closed'; // clear session id this.id = null; // emit close event this.emit('close', reason, desc); // clean buffers after, so users can still // grab the buffers on `close` event self.writeBuffer = []; self.prevBufferLen = 0; } }; /** * Filters upgrades, returning only those matching client transports. * * @param {Array} server upgrades * @api private * */ Socket.prototype.filterUpgrades = function (upgrades) { var filteredUpgrades = []; for (var i = 0, j = upgrades.length; i < j; i++) { if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]); } return filteredUpgrades; }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module dependencies */ var XMLHttpRequest = __webpack_require__(22); var XHR = __webpack_require__(24); var JSONP = __webpack_require__(40); var websocket = __webpack_require__(41); /** * Export transports. */ exports.polling = polling; exports.websocket = websocket; /** * Polling transport polymorphic constructor. * Decides on xhr vs jsonp based on feature detection. * * @api private */ function polling (opts) { var xhr; var xd = false; var xs = false; var jsonp = false !== opts.jsonp; if (global.location) { var isSSL = 'https:' === location.protocol; var port = location.port; // some user agents have empty `location.port` if (!port) { port = isSSL ? 443 : 80; } xd = opts.hostname !== location.hostname || port !== opts.port; xs = opts.secure !== isSSL; } opts.xdomain = xd; opts.xscheme = xs; xhr = new XMLHttpRequest(opts); if ('open' in xhr && !opts.forceJSONP) { return new XHR(opts); } else { if (!jsonp) throw new Error('JSONP disabled'); return new JSONP(opts); } } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {// browser shim for xmlhttprequest module var hasCORS = __webpack_require__(23); module.exports = function (opts) { var xdomain = opts.xdomain; // scheme must be same when usign XDomainRequest // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx var xscheme = opts.xscheme; // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. // https://github.com/Automattic/engine.io-client/pull/217 var enablesXDR = opts.enablesXDR; // XMLHttpRequest can be disabled on IE try { if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { return new XMLHttpRequest(); } } catch (e) { } // Use XDomainRequest for IE8 if enablesXDR is true // because loading bar keeps flashing when using jsonp-polling // https://github.com/yujiosaka/socke.io-ie8-loading-example try { if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { return new XDomainRequest(); } } catch (e) { } if (!xdomain) { try { return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); } catch (e) { } } }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 23 */ /***/ function(module, exports) { /** * Module exports. * * Logic borrowed from Modernizr: * * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js */ try { module.exports = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XMLHttpRequest(); } catch (err) { // if XMLHttp support is disabled in IE then it will throw // when trying to create module.exports = false; } /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module requirements. */ var XMLHttpRequest = __webpack_require__(22); var Polling = __webpack_require__(25); var Emitter = __webpack_require__(36); var inherit = __webpack_require__(38); var debug = __webpack_require__(3)('engine.io-client:polling-xhr'); /** * Module exports. */ module.exports = XHR; module.exports.Request = Request; /** * Empty function */ function empty () {} /** * XHR Polling constructor. * * @param {Object} opts * @api public */ function XHR (opts) { Polling.call(this, opts); this.requestTimeout = opts.requestTimeout; if (global.location) { var isSSL = 'https:' === location.protocol; var port = location.port; // some user agents have empty `location.port` if (!port) { port = isSSL ? 443 : 80; } this.xd = opts.hostname !== global.location.hostname || port !== opts.port; this.xs = opts.secure !== isSSL; } else { this.extraHeaders = opts.extraHeaders; } } /** * Inherits from Polling. */ inherit(XHR, Polling); /** * XHR supports binary */ XHR.prototype.supportsBinary = true; /** * Creates a request. * * @param {String} method * @api private */ XHR.prototype.request = function (opts) { opts = opts || {}; opts.uri = this.uri(); opts.xd = this.xd; opts.xs = this.xs; opts.agent = this.agent || false; opts.supportsBinary = this.supportsBinary; opts.enablesXDR = this.enablesXDR; // SSL options for Node.js client opts.pfx = this.pfx; opts.key = this.key; opts.passphrase = this.passphrase; opts.cert = this.cert; opts.ca = this.ca; opts.ciphers = this.ciphers; opts.rejectUnauthorized = this.rejectUnauthorized; opts.requestTimeout = this.requestTimeout; // other options for Node.js client opts.extraHeaders = this.extraHeaders; return new Request(opts); }; /** * Sends data. * * @param {String} data to send. * @param {Function} called upon flush. * @api private */ XHR.prototype.doWrite = function (data, fn) { var isBinary = typeof data !== 'string' && data !== undefined; var req = this.request({ method: 'POST', data: data, isBinary: isBinary }); var self = this; req.on('success', fn); req.on('error', function (err) { self.onError('xhr post error', err); }); this.sendXhr = req; }; /** * Starts a poll cycle. * * @api private */ XHR.prototype.doPoll = function () { debug('xhr poll'); var req = this.request(); var self = this; req.on('data', function (data) { self.onData(data); }); req.on('error', function (err) { self.onError('xhr poll error', err); }); this.pollXhr = req; }; /** * Request constructor * * @param {Object} options * @api public */ function Request (opts) { this.method = opts.method || 'GET'; this.uri = opts.uri; this.xd = !!opts.xd; this.xs = !!opts.xs; this.async = false !== opts.async; this.data = undefined !== opts.data ? opts.data : null; this.agent = opts.agent; this.isBinary = opts.isBinary; this.supportsBinary = opts.supportsBinary; this.enablesXDR = opts.enablesXDR; this.requestTimeout = opts.requestTimeout; // SSL options for Node.js client this.pfx = opts.pfx; this.key = opts.key; this.passphrase = opts.passphrase; this.cert = opts.cert; this.ca = opts.ca; this.ciphers = opts.ciphers; this.rejectUnauthorized = opts.rejectUnauthorized; // other options for Node.js client this.extraHeaders = opts.extraHeaders; this.create(); } /** * Mix in `Emitter`. */ Emitter(Request.prototype); /** * Creates the XHR object and sends the request. * * @api private */ Request.prototype.create = function () { var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR }; // SSL options for Node.js client opts.pfx = this.pfx; opts.key = this.key; opts.passphrase = this.passphrase; opts.cert = this.cert; opts.ca = this.ca; opts.ciphers = this.ciphers; opts.rejectUnauthorized = this.rejectUnauthorized; var xhr = this.xhr = new XMLHttpRequest(opts); var self = this; try { debug('xhr open %s: %s', this.method, this.uri); xhr.open(this.method, this.uri, this.async); try { if (this.extraHeaders) { xhr.setDisableHeaderCheck(true); for (var i in this.extraHeaders) { if (this.extraHeaders.hasOwnProperty(i)) { xhr.setRequestHeader(i, this.extraHeaders[i]); } } } } catch (e) {} if (this.supportsBinary) { // This has to be done after open because Firefox is stupid // http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension xhr.responseType = 'arraybuffer'; } if ('POST' === this.method) { try { if (this.isBinary) { xhr.setRequestHeader('Content-type', 'application/octet-stream'); } else { xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8'); } } catch (e) {} } try { xhr.setRequestHeader('Accept', '*/*'); } catch (e) {} // ie6 check if ('withCredentials' in xhr) { xhr.withCredentials = true; } if (this.requestTimeout) { xhr.timeout = this.requestTimeout; } if (this.hasXDR()) { xhr.onload = function () { self.onLoad(); }; xhr.onerror = function () { self.onError(xhr.responseText); }; } else { xhr.onreadystatechange = function () { if (4 !== xhr.readyState) return; if (200 === xhr.status || 1223 === xhr.status) { self.onLoad(); } else { // make sure the `error` event handler that's user-set // does not throw in the same tick and gets caught here setTimeout(function () { self.onError(xhr.status); }, 0); } }; } debug('xhr data %s', this.data); xhr.send(this.data); } catch (e) { // Need to defer since .create() is called directly fhrom the constructor // and thus the 'error' event can only be only bound *after* this exception // occurs. Therefore, also, we cannot throw here at all. setTimeout(function () { self.onError(e); }, 0); return; } if (global.document) { this.index = Request.requestsCount++; Request.requests[this.index] = this; } }; /** * Called upon successful response. * * @api private */ Request.prototype.onSuccess = function () { this.emit('success'); this.cleanup(); }; /** * Called if we have data. * * @api private */ Request.prototype.onData = function (data) { this.emit('data', data); this.onSuccess(); }; /** * Called upon error. * * @api private */ Request.prototype.onError = function (err) { this.emit('error', err); this.cleanup(true); }; /** * Cleans up house. * * @api private */ Request.prototype.cleanup = function (fromError) { if ('undefined' === typeof this.xhr || null === this.xhr) { return; } // xmlhttprequest if (this.hasXDR()) { this.xhr.onload = this.xhr.onerror = empty; } else { this.xhr.onreadystatechange = empty; } if (fromError) { try { this.xhr.abort(); } catch (e) {} } if (global.document) { delete Request.requests[this.index]; } this.xhr = null; }; /** * Called upon load. * * @api private */ Request.prototype.onLoad = function () { var data; try { var contentType; try { contentType = this.xhr.getResponseHeader('Content-Type').split(';')[0]; } catch (e) {} if (contentType === 'application/octet-stream') { data = this.xhr.response || this.xhr.responseText; } else { if (!this.supportsBinary) { data = this.xhr.responseText; } else { try { data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response)); } catch (e) { var ui8Arr = new Uint8Array(this.xhr.response); var dataArray = []; for (var idx = 0, length = ui8Arr.length; idx < length; idx++) { dataArray.push(ui8Arr[idx]); } data = String.fromCharCode.apply(null, dataArray); } } } } catch (e) { this.onError(e); } if (null != data) { this.onData(data); } }; /** * Check if it has XDomainRequest. * * @api private */ Request.prototype.hasXDR = function () { return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR; }; /** * Aborts the request. * * @api public */ Request.prototype.abort = function () { this.cleanup(); }; /** * Aborts pending requests when unloading the window. This is needed to prevent * memory leaks (e.g. when using IE) and to ensure that no spurious error is * emitted. */ Request.requestsCount = 0; Request.requests = {}; if (global.document) { if (global.attachEvent) { global.attachEvent('onunload', unloadHandler); } else if (global.addEventListener) { global.addEventListener('beforeunload', unloadHandler, false); } } function unloadHandler () { for (var i in Request.requests) { if (Request.requests.hasOwnProperty(i)) { Request.requests[i].abort(); } } } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { /** * Module dependencies. */ var Transport = __webpack_require__(26); var parseqs = __webpack_require__(37); var parser = __webpack_require__(27); var inherit = __webpack_require__(38); var yeast = __webpack_require__(39); var debug = __webpack_require__(3)('engine.io-client:polling'); /** * Module exports. */ module.exports = Polling; /** * Is XHR2 supported? */ var hasXHR2 = (function () { var XMLHttpRequest = __webpack_require__(22); var xhr = new XMLHttpRequest({ xdomain: false }); return null != xhr.responseType; })(); /** * Polling interface. * * @param {Object} opts * @api private */ function Polling (opts) { var forceBase64 = (opts && opts.forceBase64); if (!hasXHR2 || forceBase64) { this.supportsBinary = false; } Transport.call(this, opts); } /** * Inherits from Transport. */ inherit(Polling, Transport); /** * Transport name. */ Polling.prototype.name = 'polling'; /** * Opens the socket (triggers polling). We write a PING message to determine * when the transport is open. * * @api private */ Polling.prototype.doOpen = function () { this.poll(); }; /** * Pauses polling. * * @param {Function} callback upon buffers are flushed and transport is paused * @api private */ Polling.prototype.pause = function (onPause) { var self = this; this.readyState = 'pausing'; function pause () { debug('paused'); self.readyState = 'paused'; onPause(); } if (this.polling || !this.writable) { var total = 0; if (this.polling) { debug('we are currently polling - waiting to pause'); total++; this.once('pollComplete', function () { debug('pre-pause polling complete'); --total || pause(); }); } if (!this.writable) { debug('we are currently writing - waiting to pause'); total++; this.once('drain', function () { debug('pre-pause writing complete'); --total || pause(); }); } } else { pause(); } }; /** * Starts polling cycle. * * @api public */ Polling.prototype.poll = function () { debug('polling'); this.polling = true; this.doPoll(); this.emit('poll'); }; /** * Overloads onData to detect payloads. * * @api private */ Polling.prototype.onData = function (data) { var self = this; debug('polling got data %s', data); var callback = function (packet, index, total) { // if its the first message we consider the transport open if ('opening' === self.readyState) { self.onOpen(); } // if its a close packet, we close the ongoing requests if ('close' === packet.type) { self.onClose(); return false; } // otherwise bypass onData and handle the message self.onPacket(packet); }; // decode payload parser.decodePayload(data, this.socket.binaryType, callback); // if an event did not trigger closing if ('closed' !== this.readyState) { // if we got data we're not polling this.polling = false; this.emit('pollComplete'); if ('open' === this.readyState) { this.poll(); } else { debug('ignoring poll - transport state "%s"', this.readyState); } } }; /** * For polling, send a close packet. * * @api private */ Polling.prototype.doClose = function () { var self = this; function close () { debug('writing close packet'); self.write([{ type: 'close' }]); } if ('open' === this.readyState) { debug('transport open - closing'); close(); } else { // in case we're trying to close while // handshaking is in progress (GH-164) debug('transport not open - deferring close'); this.once('open', close); } }; /** * Writes a packets payload. * * @param {Array} data packets * @param {Function} drain callback * @api private */ Polling.prototype.write = function (packets) { var self = this; this.writable = false; var callbackfn = function () { self.writable = true; self.emit('drain'); }; parser.encodePayload(packets, this.supportsBinary, function (data) { self.doWrite(data, callbackfn); }); }; /** * Generates uri for connection. * * @api private */ Polling.prototype.uri = function () { var query = this.query || {}; var schema = this.secure ? 'https' : 'http'; var port = ''; // cache busting is forced if (false !== this.timestampRequests) { query[this.timestampParam] = yeast(); } if (!this.supportsBinary && !query.sid) { query.b64 = 1; } query = parseqs.encode(query); // avoid port if default for schema if (this.port && (('https' === schema && Number(this.port) !== 443) || ('http' === schema && Number(this.port) !== 80))) { port = ':' + this.port; } // prepend ? to query if (query.length) { query = '?' + query; } var ipv6 = this.hostname.indexOf(':') !== -1; return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; }; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { /** * Module dependencies. */ var parser = __webpack_require__(27); var Emitter = __webpack_require__(36); /** * Module exports. */ module.exports = Transport; /** * Transport abstract constructor. * * @param {Object} options. * @api private */ function Transport (opts) { this.path = opts.path; this.hostname = opts.hostname; this.port = opts.port; this.secure = opts.secure; this.query = opts.query; this.timestampParam = opts.timestampParam; this.timestampRequests = opts.timestampRequests; this.readyState = ''; this.agent = opts.agent || false; this.socket = opts.socket; this.enablesXDR = opts.enablesXDR; // SSL options for Node.js client this.pfx = opts.pfx; this.key = opts.key; this.passphrase = opts.passphrase; this.cert = opts.cert; this.ca = opts.ca; this.ciphers = opts.ciphers; this.rejectUnauthorized = opts.rejectUnauthorized; this.forceNode = opts.forceNode; // other options for Node.js client this.extraHeaders = opts.extraHeaders; this.localAddress = opts.localAddress; } /** * Mix in `Emitter`. */ Emitter(Transport.prototype); /** * Emits an error. * * @param {String} str * @return {Transport} for chaining * @api public */ Transport.prototype.onError = function (msg, desc) { var err = new Error(msg); err.type = 'TransportError'; err.description = desc; this.emit('error', err); return this; }; /** * Opens the transport. * * @api public */ Transport.prototype.open = function () { if ('closed' === this.readyState || '' === this.readyState) { this.readyState = 'opening'; this.doOpen(); } return this; }; /** * Closes the transport. * * @api private */ Transport.prototype.close = function () { if ('opening' === this.readyState || 'open' === this.readyState) { this.doClose(); this.onClose(); } return this; }; /** * Sends multiple packets. * * @param {Array} packets * @api private */ Transport.prototype.send = function (packets) { if ('open' === this.readyState) { this.write(packets); } else { throw new Error('Transport not open'); } }; /** * Called upon open * * @api private */ Transport.prototype.onOpen = function () { this.readyState = 'open'; this.writable = true; this.emit('open'); }; /** * Called with data. * * @param {String} data * @api private */ Transport.prototype.onData = function (data) { var packet = parser.decodePacket(data, this.socket.binaryType); this.onPacket(packet); }; /** * Called with a decoded packet. */ Transport.prototype.onPacket = function (packet) { this.emit('packet', packet); }; /** * Called upon close. * * @api private */ Transport.prototype.onClose = function () { this.readyState = 'closed'; this.emit('close'); }; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module dependencies. */ var keys = __webpack_require__(28); var hasBinary = __webpack_require__(29); var sliceBuffer = __webpack_require__(31); var after = __webpack_require__(32); var utf8 = __webpack_require__(33); var base64encoder; if (global && global.ArrayBuffer) { base64encoder = __webpack_require__(34); } /** * Check if we are running an android browser. That requires us to use * ArrayBuffer with polling transports... * * http://ghinda.net/jpeg-blob-ajax-android/ */ var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); /** * Check if we are running in PhantomJS. * Uploading a Blob with PhantomJS does not work correctly, as reported here: * https://github.com/ariya/phantomjs/issues/11395 * @type boolean */ var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); /** * When true, avoids using Blobs to encode payloads. * @type boolean */ var dontSendBlobs = isAndroid || isPhantomJS; /** * Current protocol version. */ exports.protocol = 3; /** * Packet types. */ var packets = exports.packets = { open: 0 // non-ws , close: 1 // non-ws , ping: 2 , pong: 3 , message: 4 , upgrade: 5 , noop: 6 }; var packetslist = keys(packets); /** * Premade error packet. */ var err = { type: 'error', data: 'parser error' }; /** * Create a blob api even for blob builder when vendor prefixes exist */ var Blob = __webpack_require__(35); /** * Encodes a packet. * * <packet type id> [ <data> ] * * Example: * * 5hello world * 3 * 4 * * Binary is encoded in an identical principle * * @api private */ exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { if ('function' == typeof supportsBinary) { callback = supportsBinary; supportsBinary = false; } if ('function' == typeof utf8encode) { callback = utf8encode; utf8encode = null; } var data = (packet.data === undefined) ? undefined : packet.data.buffer || packet.data; if (global.ArrayBuffer && data instanceof ArrayBuffer) { return encodeArrayBuffer(packet, supportsBinary, callback); } else if (Blob && data instanceof global.Blob) { return encodeBlob(packet, supportsBinary, callback); } // might be an object with { base64: true, data: dataAsBase64String } if (data && data.base64) { return encodeBase64Object(packet, callback); } // Sending data as a utf-8 string var encoded = packets[packet.type]; // data fragment is optional if (undefined !== packet.data) { encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data); } return callback('' + encoded); }; function encodeBase64Object(packet, callback) { // packet data is an object { base64: true, data: dataAsBase64String } var message = 'b' + exports.packets[packet.type] + packet.data.data; return callback(message); } /** * Encode packet helpers for binary types */ function encodeArrayBuffer(packet, supportsBinary, callback) { if (!supportsBinary) { return exports.encodeBase64Packet(packet, callback); } var data = packet.data; var contentArray = new Uint8Array(data); var resultBuffer = new Uint8Array(1 + data.byteLength); resultBuffer[0] = packets[packet.type]; for (var i = 0; i < contentArray.length; i++) { resultBuffer[i+1] = contentArray[i]; } return callback(resultBuffer.buffer); } function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { if (!supportsBinary) { return exports.encodeBase64Packet(packet, callback); } var fr = new FileReader(); fr.onload = function() { packet.data = fr.result; exports.encodePacket(packet, supportsBinary, true, callback); }; return fr.readAsArrayBuffer(packet.data); } function encodeBlob(packet, supportsBinary, callback) { if (!supportsBinary) { return exports.encodeBase64Packet(packet, callback); } if (dontSendBlobs) { return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); } var length = new Uint8Array(1); length[0] = packets[packet.type]; var blob = new Blob([length.buffer, packet.data]); return callback(blob); } /** * Encodes a packet with binary data in a base64 string * * @param {Object} packet, has `type` and `data` * @return {String} base64 encoded message */ exports.encodeBase64Packet = function(packet, callback) { var message = 'b' + exports.packets[packet.type]; if (Blob && packet.data instanceof global.Blob) { var fr = new FileReader(); fr.onload = function() { var b64 = fr.result.split(',')[1]; callback(message + b64); }; return fr.readAsDataURL(packet.data); } var b64data; try { b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); } catch (e) { // iPhone Safari doesn't let you apply with typed arrays var typed = new Uint8Array(packet.data); var basic = new Array(typed.length); for (var i = 0; i < typed.length; i++) { basic[i] = typed[i]; } b64data = String.fromCharCode.apply(null, basic); } message += global.btoa(b64data); return callback(message); }; /** * Decodes a packet. Changes format to Blob if requested. * * @return {Object} with `type` and `data` (if any) * @api private */ exports.decodePacket = function (data, binaryType, utf8decode) { if (data === undefined) { return err; } // String data if (typeof data == 'string') { if (data.charAt(0) == 'b') { return exports.decodeBase64Packet(data.substr(1), binaryType); } if (utf8decode) { data = tryDecode(data); if (data === false) { return err; } } var type = data.charAt(0); if (Number(type) != type || !packetslist[type]) { return err; } if (data.length > 1) { return { type: packetslist[type], data: data.substring(1) }; } else { return { type: packetslist[type] }; } } var asArray = new Uint8Array(data); var type = asArray[0]; var rest = sliceBuffer(data, 1); if (Blob && binaryType === 'blob') { rest = new Blob([rest]); } return { type: packetslist[type], data: rest }; }; function tryDecode(data) { try { data = utf8.decode(data); } catch (e) { return false; } return data; } /** * Decodes a packet encoded in a base64 string * * @param {String} base64 encoded message * @return {Object} with `type` and `data` (if any) */ exports.decodeBase64Packet = function(msg, binaryType) { var type = packetslist[msg.charAt(0)]; if (!base64encoder) { return { type: type, data: { base64: true, data: msg.substr(1) } }; } var data = base64encoder.decode(msg.substr(1)); if (binaryType === 'blob' && Blob) { data = new Blob([data]); } return { type: type, data: data }; }; /** * Encodes multiple messages (payload). * * <length>:data * * Example: * * 11:hello world2:hi * * If any contents are binary, they will be encoded as base64 strings. Base64 * encoded strings are marked with a b before the length specifier * * @param {Array} packets * @api private */ exports.encodePayload = function (packets, supportsBinary, callback) { if (typeof supportsBinary == 'function') { callback = supportsBinary; supportsBinary = null; } var isBinary = hasBinary(packets); if (supportsBinary && isBinary) { if (Blob && !dontSendBlobs) { return exports.encodePayloadAsBlob(packets, callback); } return exports.encodePayloadAsArrayBuffer(packets, callback); } if (!packets.length) { return callback('0:'); } function setLengthHeader(message) { return message.length + ':' + message; } function encodeOne(packet, doneCallback) { exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) { doneCallback(null, setLengthHeader(message)); }); } map(packets, encodeOne, function(err, results) { return callback(results.join('')); }); }; /** * Async array map using after */ function map(ary, each, done) { var result = new Array(ary.length); var next = after(ary.length, done); var eachWithIndex = function(i, el, cb) { each(el, function(error, msg) { result[i] = msg; cb(error, result); }); }; for (var i = 0; i < ary.length; i++) { eachWithIndex(i, ary[i], next); } } /* * Decodes data when a payload is maybe expected. Possible binary contents are * decoded from their base64 representation * * @param {String} data, callback method * @api public */ exports.decodePayload = function (data, binaryType, callback) { if (typeof data != 'string') { return exports.decodePayloadAsBinary(data, binaryType, callback); } if (typeof binaryType === 'function') { callback = binaryType; binaryType = null; } var packet; if (data == '') { // parser error - ignoring payload return callback(err, 0, 1); } var length = '' , n, msg; for (var i = 0, l = data.length; i < l; i++) { var chr = data.charAt(i); if (':' != chr) { length += chr; } else { if ('' == length || (length != (n = Number(length)))) { // parser error - ignoring payload return callback(err, 0, 1); } msg = data.substr(i + 1, n); if (length != msg.length) { // parser error - ignoring payload return callback(err, 0, 1); } if (msg.length) { packet = exports.decodePacket(msg, binaryType, true); if (err.type == packet.type && err.data == packet.data) { // parser error in individual packet - ignoring payload return callback(err, 0, 1); } var ret = callback(packet, i + n, l); if (false === ret) return; } // advance cursor i += n; length = ''; } } if (length != '') { // parser error - ignoring payload return callback(err, 0, 1); } }; /** * Encodes multiple messages (payload) as binary. * * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number * 255><data> * * Example: * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers * * @param {Array} packets * @return {ArrayBuffer} encoded payload * @api private */ exports.encodePayloadAsArrayBuffer = function(packets, callback) { if (!packets.length) { return callback(new ArrayBuffer(0)); } function encodeOne(packet, doneCallback) { exports.encodePacket(packet, true, true, function(data) { return doneCallback(null, data); }); } map(packets, encodeOne, function(err, encodedPackets) { var totalLength = encodedPackets.reduce(function(acc, p) { var len; if (typeof p === 'string'){ len = p.length; } else { len = p.byteLength; } return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 }, 0); var resultArray = new Uint8Array(totalLength); var bufferIndex = 0; encodedPackets.forEach(function(p) { var isString = typeof p === 'string'; var ab = p; if (isString) { var view = new Uint8Array(p.length); for (var i = 0; i < p.length; i++) { view[i] = p.charCodeAt(i); } ab = view.buffer; } if (isString) { // not true binary resultArray[bufferIndex++] = 0; } else { // true binary resultArray[bufferIndex++] = 1; } var lenStr = ab.byteLength.toString(); for (var i = 0; i < lenStr.length; i++) { resultArray[bufferIndex++] = parseInt(lenStr[i]); } resultArray[bufferIndex++] = 255; var view = new Uint8Array(ab); for (var i = 0; i < view.length; i++) { resultArray[bufferIndex++] = view[i]; } }); return callback(resultArray.buffer); }); }; /** * Encode as Blob */ exports.encodePayloadAsBlob = function(packets, callback) { function encodeOne(packet, doneCallback) { exports.encodePacket(packet, true, true, function(encoded) { var binaryIdentifier = new Uint8Array(1); binaryIdentifier[0] = 1; if (typeof encoded === 'string') { var view = new Uint8Array(encoded.length); for (var i = 0; i < encoded.length; i++) { view[i] = encoded.charCodeAt(i); } encoded = view.buffer; binaryIdentifier[0] = 0; } var len = (encoded instanceof ArrayBuffer) ? encoded.byteLength : encoded.size; var lenStr = len.toString(); var lengthAry = new Uint8Array(lenStr.length + 1); for (var i = 0; i < lenStr.length; i++) { lengthAry[i] = parseInt(lenStr[i]); } lengthAry[lenStr.length] = 255; if (Blob) { var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); doneCallback(null, blob); } }); } map(packets, encodeOne, function(err, results) { return callback(new Blob(results)); }); }; /* * Decodes data when a payload is maybe expected. Strings are decoded by * interpreting each byte as a key code for entries marked to start with 0. See * description of encodePayloadAsBinary * * @param {ArrayBuffer} data, callback method * @api public */ exports.decodePayloadAsBinary = function (data, binaryType, callback) { if (typeof binaryType === 'function') { callback = binaryType; binaryType = null; } var bufferTail = data; var buffers = []; var numberTooLong = false; while (bufferTail.byteLength > 0) { var tailArray = new Uint8Array(bufferTail); var isString = tailArray[0] === 0; var msgLength = ''; for (var i = 1; ; i++) { if (tailArray[i] == 255) break; if (msgLength.length > 310) { numberTooLong = true; break; } msgLength += tailArray[i]; } if(numberTooLong) return callback(err, 0, 1); bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); msgLength = parseInt(msgLength); var msg = sliceBuffer(bufferTail, 0, msgLength); if (isString) { try { msg = String.fromCharCode.apply(null, new Uint8Array(msg)); } catch (e) { // iPhone Safari doesn't let you apply to typed arrays var typed = new Uint8Array(msg); msg = ''; for (var i = 0; i < typed.length; i++) { msg += String.fromCharCode(typed[i]); } } } buffers.push(msg); bufferTail = sliceBuffer(bufferTail, msgLength); } var total = buffers.length; buffers.forEach(function(buffer, i) { callback(exports.decodePacket(buffer, binaryType, true), i, total); }); }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 28 */ /***/ function(module, exports) { /** * Gets the keys for an object. * * @return {Array} keys * @api private */ module.exports = Object.keys || function keys (obj){ var arr = []; var has = Object.prototype.hasOwnProperty; for (var i in obj) { if (has.call(obj, i)) { arr.push(i); } } return arr; }; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { /* * Module requirements. */ var isArray = __webpack_require__(30); /** * Module exports. */ module.exports = hasBinary; /** * Checks for binary data. * * Right now only Buffer and ArrayBuffer are supported.. * * @param {Object} anything * @api public */ function hasBinary(data) { function _hasBinary(obj) { if (!obj) return false; if ( (global.Buffer && global.Buffer.isBuffer(obj)) || (global.ArrayBuffer && obj instanceof ArrayBuffer) || (global.Blob && obj instanceof Blob) || (global.File && obj instanceof File) ) { return true; } if (isArray(obj)) { for (var i = 0; i < obj.length; i++) { if (_hasBinary(obj[i])) { return true; } } } else if (obj && 'object' == typeof obj) { if (obj.toJSON) { obj = obj.toJSON(); } for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) { return true; } } } return false; } return _hasBinary(data); } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 30 */ /***/ function(module, exports) { module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; /***/ }, /* 31 */ /***/ function(module, exports) { /** * An abstraction for slicing an arraybuffer even when * ArrayBuffer.prototype.slice is not supported * * @api public */ module.exports = function(arraybuffer, start, end) { var bytes = arraybuffer.byteLength; start = start || 0; end = end || bytes; if (arraybuffer.slice) { return arraybuffer.slice(start, end); } if (start < 0) { start += bytes; } if (end < 0) { end += bytes; } if (end > bytes) { end = bytes; } if (start >= bytes || start >= end || bytes === 0) { return new ArrayBuffer(0); } var abv = new Uint8Array(arraybuffer); var result = new Uint8Array(end - start); for (var i = start, ii = 0; i < end; i++, ii++) { result[ii] = abv[i]; } return result.buffer; }; /***/ }, /* 32 */ /***/ function(module, exports) { module.exports = after function after(count, callback, err_cb) { var bail = false err_cb = err_cb || noop proxy.count = count return (count === 0) ? callback() : proxy function proxy(err, result) { if (proxy.count <= 0) { throw new Error('after called too many times') } --proxy.count // after first error, rest are passed to err_cb if (err) { bail = true callback(err) // future error callbacks will go to error handler callback = err_cb } else if (proxy.count === 0 && !bail) { callback(null, result) } } } function noop() {} /***/ }, /* 33 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/wtf8 v1.0.0 by @mathias */ ;(function(root) { // Detect free variables `exports` var freeExports = typeof exports == 'object' && exports; // Detect free variable `module` var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; // Detect free variable `global`, from Node.js or Browserified code, // and use it as `root` var freeGlobal = typeof global == 'object' && global; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { root = freeGlobal; } /*--------------------------------------------------------------------------*/ var stringFromCharCode = String.fromCharCode; // Taken from https://mths.be/punycode function ucs2decode(string) { var output = []; var counter = 0; var length = string.length; var value; var extra; while (counter < length) { value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // high surrogate, and there is a next character extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // low surrogate output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // unmatched surrogate; only append this code unit, in case the next // code unit is the high surrogate of a surrogate pair output.push(value); counter--; } } else { output.push(value); } } return output; } // Taken from https://mths.be/punycode function ucs2encode(array) { var length = array.length; var index = -1; var value; var output = ''; while (++index < length) { value = array[index]; if (value > 0xFFFF) { value -= 0x10000; output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); value = 0xDC00 | value & 0x3FF; } output += stringFromCharCode(value); } return output; } /*--------------------------------------------------------------------------*/ function createByte(codePoint, shift) { return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); } function encodeCodePoint(codePoint) { if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence return stringFromCharCode(codePoint); } var symbol = ''; if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); } else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); symbol += createByte(codePoint, 6); } else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); symbol += createByte(codePoint, 12); symbol += createByte(codePoint, 6); } symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); return symbol; } function wtf8encode(string) { var codePoints = ucs2decode(string); var length = codePoints.length; var index = -1; var codePoint; var byteString = ''; while (++index < length) { codePoint = codePoints[index]; byteString += encodeCodePoint(codePoint); } return byteString; } /*--------------------------------------------------------------------------*/ function readContinuationByte() { if (byteIndex >= byteCount) { throw Error('Invalid byte index'); } var continuationByte = byteArray[byteIndex] & 0xFF; byteIndex++; if ((continuationByte & 0xC0) == 0x80) { return continuationByte & 0x3F; } // If we end up here, it’s not a continuation byte. throw Error('Invalid continuation byte'); } function decodeSymbol() { var byte1; var byte2; var byte3; var byte4; var codePoint; if (byteIndex > byteCount) { throw Error('Invalid byte index'); } if (byteIndex == byteCount) { return false; } // Read the first byte. byte1 = byteArray[byteIndex] & 0xFF; byteIndex++; // 1-byte sequence (no continuation bytes) if ((byte1 & 0x80) == 0) { return byte1; } // 2-byte sequence if ((byte1 & 0xE0) == 0xC0) { var byte2 = readContinuationByte(); codePoint = ((byte1 & 0x1F) << 6) | byte2; if (codePoint >= 0x80) { return codePoint; } else { throw Error('Invalid continuation byte'); } } // 3-byte sequence (may include unpaired surrogates) if ((byte1 & 0xF0) == 0xE0) { byte2 = readContinuationByte(); byte3 = readContinuationByte(); codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; if (codePoint >= 0x0800) { return codePoint; } else { throw Error('Invalid continuation byte'); } } // 4-byte sequence if ((byte1 & 0xF8) == 0xF0) { byte2 = readContinuationByte(); byte3 = readContinuationByte(); byte4 = readContinuationByte(); codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) | (byte3 << 0x06) | byte4; if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { return codePoint; } } throw Error('Invalid WTF-8 detected'); } var byteArray; var byteCount; var byteIndex; function wtf8decode(byteString) { byteArray = ucs2decode(byteString); byteCount = byteArray.length; byteIndex = 0; var codePoints = []; var tmp; while ((tmp = decodeSymbol()) !== false) { codePoints.push(tmp); } return ucs2encode(codePoints); } /*--------------------------------------------------------------------------*/ var wtf8 = { 'version': '1.0.0', 'encode': wtf8encode, 'decode': wtf8decode }; // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( true ) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return wtf8; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (freeExports && !freeExports.nodeType) { if (freeModule) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = wtf8; } else { // in Narwhal or RingoJS v0.7.0- var object = {}; var hasOwnProperty = object.hasOwnProperty; for (var key in wtf8) { hasOwnProperty.call(wtf8, key) && (freeExports[key] = wtf8[key]); } } } else { // in Rhino or a web browser root.wtf8 = wtf8; } }(this)); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12)(module), (function() { return this; }()))) /***/ }, /* 34 */ /***/ function(module, exports) { /* * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer * * Copyright (c) 2012 Niklas von Hertzen * Licensed under the MIT license. */ (function(){ "use strict"; var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; // Use a lookup table to find the index. var lookup = new Uint8Array(256); for (var i = 0; i < chars.length; i++) { lookup[chars.charCodeAt(i)] = i; } exports.encode = function(arraybuffer) { var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = ""; for (i = 0; i < len; i+=3) { base64 += chars[bytes[i] >> 2]; base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; base64 += chars[bytes[i + 2] & 63]; } if ((len % 3) === 2) { base64 = base64.substring(0, base64.length - 1) + "="; } else if (len % 3 === 1) { base64 = base64.substring(0, base64.length - 2) + "=="; } return base64; }; exports.decode = function(base64) { var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; if (base64[base64.length - 1] === "=") { bufferLength--; if (base64[base64.length - 2] === "=") { bufferLength--; } } var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer); for (i = 0; i < len; i+=4) { encoded1 = lookup[base64.charCodeAt(i)]; encoded2 = lookup[base64.charCodeAt(i+1)]; encoded3 = lookup[base64.charCodeAt(i+2)]; encoded4 = lookup[base64.charCodeAt(i+3)]; bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); } return arraybuffer; }; })(); /***/ }, /* 35 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/** * Create a blob builder even when vendor prefixes exist */ var BlobBuilder = global.BlobBuilder || global.WebKitBlobBuilder || global.MSBlobBuilder || global.MozBlobBuilder; /** * Check if Blob constructor is supported */ var blobSupported = (function() { try { var a = new Blob(['hi']); return a.size === 2; } catch(e) { return false; } })(); /** * Check if Blob constructor supports ArrayBufferViews * Fails in Safari 6, so we need to map to ArrayBuffers there. */ var blobSupportsArrayBufferView = blobSupported && (function() { try { var b = new Blob([new Uint8Array([1,2])]); return b.size === 2; } catch(e) { return false; } })(); /** * Check if BlobBuilder is supported */ var blobBuilderSupported = BlobBuilder && BlobBuilder.prototype.append && BlobBuilder.prototype.getBlob; /** * Helper function that maps ArrayBufferViews to ArrayBuffers * Used by BlobBuilder constructor and old browsers that didn't * support it in the Blob constructor. */ function mapArrayBufferViews(ary) { for (var i = 0; i < ary.length; i++) { var chunk = ary[i]; if (chunk.buffer instanceof ArrayBuffer) { var buf = chunk.buffer; // if this is a subarray, make a copy so we only // include the subarray region from the underlying buffer if (chunk.byteLength !== buf.byteLength) { var copy = new Uint8Array(chunk.byteLength); copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); buf = copy.buffer; } ary[i] = buf; } } } function BlobBuilderConstructor(ary, options) { options = options || {}; var bb = new BlobBuilder(); mapArrayBufferViews(ary); for (var i = 0; i < ary.length; i++) { bb.append(ary[i]); } return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); }; function BlobConstructor(ary, options) { mapArrayBufferViews(ary); return new Blob(ary, options || {}); }; module.exports = (function() { if (blobSupported) { return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; } else if (blobBuilderSupported) { return BlobBuilderConstructor; } else { return undefined; } })(); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 36 */ /***/ function(module, exports, __webpack_require__) { /** * Expose `Emitter`. */ if (true) { module.exports = Emitter; } /** * Initialize a new `Emitter`. * * @api public */ function Emitter(obj) { if (obj) return mixin(obj); }; /** * Mixin the emitter properties. * * @param {Object} obj * @return {Object} * @api private */ function mixin(obj) { for (var key in Emitter.prototype) { obj[key] = Emitter.prototype[key]; } return obj; } /** * Listen on the given `event` with `fn`. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; (this._callbacks['$' + event] = this._callbacks['$' + event] || []) .push(fn); return this; }; /** * Adds an `event` listener that will be invoked a single * time then automatically removed. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.once = function(event, fn){ function on() { this.off(event, on); fn.apply(this, arguments); } on.fn = fn; this.on(event, on); return this; }; /** * Remove the given callback for `event` or all * registered callbacks. * * @param {String} event * @param {Function} fn * @return {Emitter} * @api public */ Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; // all if (0 == arguments.length) { this._callbacks = {}; return this; } // specific event var callbacks = this._callbacks['$' + event]; if (!callbacks) return this; // remove all handlers if (1 == arguments.length) { delete this._callbacks['$' + event]; return this; } // remove specific handler var cb; for (var i = 0; i < callbacks.length; i++) { cb = callbacks[i]; if (cb === fn || cb.fn === fn) { callbacks.splice(i, 1); break; } } return this; }; /** * Emit `event` with the given args. * * @param {String} event * @param {Mixed} ... * @return {Emitter} */ Emitter.prototype.emit = function(event){ this._callbacks = this._callbacks || {}; var args = [].slice.call(arguments, 1) , callbacks = this._callbacks['$' + event]; if (callbacks) { callbacks = callbacks.slice(0); for (var i = 0, len = callbacks.length; i < len; ++i) { callbacks[i].apply(this, args); } } return this; }; /** * Return array of callbacks for `event`. * * @param {String} event * @return {Array} * @api public */ Emitter.prototype.listeners = function(event){ this._callbacks = this._callbacks || {}; return this._callbacks['$' + event] || []; }; /** * Check if this emitter has `event` handlers. * * @param {String} event * @return {Boolean} * @api public */ Emitter.prototype.hasListeners = function(event){ return !! this.listeners(event).length; }; /***/ }, /* 37 */ /***/ function(module, exports) { /** * Compiles a querystring * Returns string representation of the object * * @param {Object} * @api private */ exports.encode = function (obj) { var str = ''; for (var i in obj) { if (obj.hasOwnProperty(i)) { if (str.length) str += '&'; str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); } } return str; }; /** * Parses a simple querystring into an object * * @param {String} qs * @api private */ exports.decode = function(qs){ var qry = {}; var pairs = qs.split('&'); for (var i = 0, l = pairs.length; i < l; i++) { var pair = pairs[i].split('='); qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); } return qry; }; /***/ }, /* 38 */ /***/ function(module, exports) { module.exports = function(a, b){ var fn = function(){}; fn.prototype = b.prototype; a.prototype = new fn; a.prototype.constructor = a; }; /***/ }, /* 39 */ /***/ function(module, exports) { 'use strict'; var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('') , length = 64 , map = {} , seed = 0 , i = 0 , prev; /** * Return a string representing the specified number. * * @param {Number} num The number to convert. * @returns {String} The string representation of the number. * @api public */ function encode(num) { var encoded = ''; do { encoded = alphabet[num % length] + encoded; num = Math.floor(num / length); } while (num > 0); return encoded; } /** * Return the integer value specified by the given string. * * @param {String} str The string to convert. * @returns {Number} The integer value represented by the string. * @api public */ function decode(str) { var decoded = 0; for (i = 0; i < str.length; i++) { decoded = decoded * length + map[str.charAt(i)]; } return decoded; } /** * Yeast: A tiny growing id generator. * * @returns {String} A unique id. * @api public */ function yeast() { var now = encode(+new Date()); if (now !== prev) return seed = 0, prev = now; return now +'.'+ encode(seed++); } // // Map each character to its index. // for (; i < length; i++) map[alphabet[i]] = i; // // Expose the `yeast`, `encode` and `decode` functions. // yeast.encode = encode; yeast.decode = decode; module.exports = yeast; /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { /** * Module requirements. */ var Polling = __webpack_require__(25); var inherit = __webpack_require__(38); /** * Module exports. */ module.exports = JSONPPolling; /** * Cached regular expressions. */ var rNewline = /\n/g; var rEscapedNewline = /\\n/g; /** * Global JSONP callbacks. */ var callbacks; /** * Noop. */ function empty () { } /** * JSONP Polling constructor. * * @param {Object} opts. * @api public */ function JSONPPolling (opts) { Polling.call(this, opts); this.query = this.query || {}; // define global callbacks array if not present // we do this here (lazily) to avoid unneeded global pollution if (!callbacks) { // we need to consider multiple engines in the same page if (!global.___eio) global.___eio = []; callbacks = global.___eio; } // callback identifier this.index = callbacks.length; // add callback to jsonp global var self = this; callbacks.push(function (msg) { self.onData(msg); }); // append to query string this.query.j = this.index; // prevent spurious errors from being emitted when the window is unloaded if (global.document && global.addEventListener) { global.addEventListener('beforeunload', function () { if (self.script) self.script.onerror = empty; }, false); } } /** * Inherits from Polling. */ inherit(JSONPPolling, Polling); /* * JSONP only supports binary as base64 encoded strings */ JSONPPolling.prototype.supportsBinary = false; /** * Closes the socket. * * @api private */ JSONPPolling.prototype.doClose = function () { if (this.script) { this.script.parentNode.removeChild(this.script); this.script = null; } if (this.form) { this.form.parentNode.removeChild(this.form); this.form = null; this.iframe = null; } Polling.prototype.doClose.call(this); }; /** * Starts a poll cycle. * * @api private */ JSONPPolling.prototype.doPoll = function () { var self = this; var script = document.createElement('script'); if (this.script) { this.script.parentNode.removeChild(this.script); this.script = null; } script.async = true; script.src = this.uri(); script.onerror = function (e) { self.onError('jsonp poll error', e); }; var insertAt = document.getElementsByTagName('script')[0]; if (insertAt) { insertAt.parentNode.insertBefore(script, insertAt); } else { (document.head || document.body).appendChild(script); } this.script = script; var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent); if (isUAgecko) { setTimeout(function () { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); document.body.removeChild(iframe); }, 100); } }; /** * Writes with a hidden iframe. * * @param {String} data to send * @param {Function} called upon flush. * @api private */ JSONPPolling.prototype.doWrite = function (data, fn) { var self = this; if (!this.form) { var form = document.createElement('form'); var area = document.createElement('textarea'); var id = this.iframeId = 'eio_iframe_' + this.index; var iframe; form.className = 'socketio'; form.style.position = 'absolute'; form.style.top = '-1000px'; form.style.left = '-1000px'; form.target = id; form.method = 'POST'; form.setAttribute('accept-charset', 'utf-8'); area.name = 'd'; form.appendChild(area); document.body.appendChild(form); this.form = form; this.area = area; } this.form.action = this.uri(); function complete () { initIframe(); fn(); } function initIframe () { if (self.iframe) { try { self.form.removeChild(self.iframe); } catch (e) { self.onError('jsonp polling iframe removal error', e); } } try { // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) var html = '<iframe src="javascript:0" name="' + self.iframeId + '">'; iframe = document.createElement(html); } catch (e) { iframe = document.createElement('iframe'); iframe.name = self.iframeId; iframe.src = 'javascript:0'; } iframe.id = self.iframeId; self.form.appendChild(iframe); self.iframe = iframe; } initIframe(); // escape \n to prevent it from being converted into \r\n by some UAs // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side data = data.replace(rEscapedNewline, '\\\n'); this.area.value = data.replace(rNewline, '\\n'); try { this.form.submit(); } catch (e) {} if (this.iframe.attachEvent) { this.iframe.onreadystatechange = function () { if (self.iframe.readyState === 'complete') { complete(); } }; } else { this.iframe.onload = complete; } }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 41 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Module dependencies. */ var Transport = __webpack_require__(26); var parser = __webpack_require__(27); var parseqs = __webpack_require__(37); var inherit = __webpack_require__(38); var yeast = __webpack_require__(39); var debug = __webpack_require__(3)('engine.io-client:websocket'); var BrowserWebSocket = global.WebSocket || global.MozWebSocket; var NodeWebSocket; if (typeof window === 'undefined') { try { NodeWebSocket = __webpack_require__(42); } catch (e) { } } /** * Get either the `WebSocket` or `MozWebSocket` globals * in the browser or try to resolve WebSocket-compatible * interface exposed by `ws` for Node-like environment. */ var WebSocket = BrowserWebSocket; if (!WebSocket && typeof window === 'undefined') { WebSocket = NodeWebSocket; } /** * Module exports. */ module.exports = WS; /** * WebSocket transport constructor. * * @api {Object} connection options * @api public */ function WS (opts) { var forceBase64 = (opts && opts.forceBase64); if (forceBase64) { this.supportsBinary = false; } this.perMessageDeflate = opts.perMessageDeflate; this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode; if (!this.usingBrowserWebSocket) { WebSocket = NodeWebSocket; } Transport.call(this, opts); } /** * Inherits from Transport. */ inherit(WS, Transport); /** * Transport name. * * @api public */ WS.prototype.name = 'websocket'; /* * WebSockets support binary */ WS.prototype.supportsBinary = true; /** * Opens socket. * * @api private */ WS.prototype.doOpen = function () { if (!this.check()) { // let probe timeout return; } var uri = this.uri(); var protocols = void (0); var opts = { agent: this.agent, perMessageDeflate: this.perMessageDeflate }; // SSL options for Node.js client opts.pfx = this.pfx; opts.key = this.key; opts.passphrase = this.passphrase; opts.cert = this.cert; opts.ca = this.ca; opts.ciphers = this.ciphers; opts.rejectUnauthorized = this.rejectUnauthorized; if (this.extraHeaders) { opts.headers = this.extraHeaders; } if (this.localAddress) { opts.localAddress = this.localAddress; } try { this.ws = this.usingBrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts); } catch (err) { return this.emit('error', err); } if (this.ws.binaryType === undefined) { this.supportsBinary = false; } if (this.ws.supports && this.ws.supports.binary) { this.supportsBinary = true; this.ws.binaryType = 'nodebuffer'; } else { this.ws.binaryType = 'arraybuffer'; } this.addEventListeners(); }; /** * Adds event listeners to the socket * * @api private */ WS.prototype.addEventListeners = function () { var self = this; this.ws.onopen = function () { self.onOpen(); }; this.ws.onclose = function () { self.onClose(); }; this.ws.onmessage = function (ev) { self.onData(ev.data); }; this.ws.onerror = function (e) { self.onError('websocket error', e); }; }; /** * Writes data to socket. * * @param {Array} array of packets. * @api private */ WS.prototype.write = function (packets) { var self = this; this.writable = false; // encodePacket efficient as it uses WS framing // no need for encodePayload var total = packets.length; for (var i = 0, l = total; i < l; i++) { (function (packet) { parser.encodePacket(packet, self.supportsBinary, function (data) { if (!self.usingBrowserWebSocket) { // always create a new object (GH-437) var opts = {}; if (packet.options) { opts.compress = packet.options.compress; } if (self.perMessageDeflate) { var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length; if (len < self.perMessageDeflate.threshold) { opts.compress = false; } } } // Sometimes the websocket has already been closed but the browser didn't // have a chance of informing us about it yet, in that case send will // throw an error try { if (self.usingBrowserWebSocket) { // TypeError is thrown when passing the second argument on Safari self.ws.send(data); } else { self.ws.send(data, opts); } } catch (e) { debug('websocket closed before onclose event'); } --total || done(); }); })(packets[i]); } function done () { self.emit('flush'); // fake drain // defer to next tick to allow Socket to clear writeBuffer setTimeout(function () { self.writable = true; self.emit('drain'); }, 0); } }; /** * Called upon close * * @api private */ WS.prototype.onClose = function () { Transport.prototype.onClose.call(this); }; /** * Closes socket. * * @api private */ WS.prototype.doClose = function () { if (typeof this.ws !== 'undefined') { this.ws.close(); } }; /** * Generates uri for connection. * * @api private */ WS.prototype.uri = function () { var query = this.query || {}; var schema = this.secure ? 'wss' : 'ws'; var port = ''; // avoid port if default for schema if (this.port && (('wss' === schema && Number(this.port) !== 443) || ('ws' === schema && Number(this.port) !== 80))) { port = ':' + this.port; } // append timestamp to URI if (this.timestampRequests) { query[this.timestampParam] = yeast(); } // communicate binary support capabilities if (!this.supportsBinary) { query.b64 = 1; } query = parseqs.encode(query); // prepend ? to query if (query.length) { query = '?' + query; } var ipv6 = this.hostname.indexOf(':') !== -1; return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query; }; /** * Feature detection for WebSocket. * * @return {Boolean} whether this transport is available. * @api public */ WS.prototype.check = function () { return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name); }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 42 */ /***/ function(module, exports) { /* (ignored) */ /***/ }, /* 43 */ /***/ function(module, exports) { var indexOf = [].indexOf; module.exports = function(arr, obj){ if (indexOf) return arr.indexOf(obj); for (var i = 0; i < arr.length; ++i) { if (arr[i] === obj) return i; } return -1; }; /***/ }, /* 44 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/** * JSON parse. * * @see Based on jQuery#parseJSON (MIT) and JSON2 * @api private */ var rvalidchars = /^[\],:{}\s]*$/; var rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g; var rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g; var rtrimLeft = /^\s+/; var rtrimRight = /\s+$/; module.exports = function parsejson(data) { if ('string' != typeof data || !data) { return null; } data = data.replace(rtrimLeft, '').replace(rtrimRight, ''); // Attempt to parse using the native JSON parser first if (global.JSON && JSON.parse) { return JSON.parse(data); } if (rvalidchars.test(data.replace(rvalidescape, '@') .replace(rvalidtokens, ']') .replace(rvalidbraces, ''))) { return (new Function('return ' + data))(); } }; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 45 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /** * Module dependencies. */ var parser = __webpack_require__(7); var Emitter = __webpack_require__(36); var toArray = __webpack_require__(46); var on = __webpack_require__(47); var bind = __webpack_require__(48); var debug = __webpack_require__(3)('socket.io-client:socket'); var hasBin = __webpack_require__(49); /** * Module exports. */ module.exports = exports = Socket; /** * Internal events (blacklisted). * These events can't be emitted by the user. * * @api private */ var events = { connect: 1, connect_error: 1, connect_timeout: 1, connecting: 1, disconnect: 1, error: 1, reconnect: 1, reconnect_attempt: 1, reconnect_failed: 1, reconnect_error: 1, reconnecting: 1, ping: 1, pong: 1 }; /** * Shortcut to `Emitter#emit`. */ var emit = Emitter.prototype.emit; /** * `Socket` constructor. * * @api public */ function Socket(io, nsp, opts) { this.io = io; this.nsp = nsp; this.json = this; // compat this.ids = 0; this.acks = {}; this.receiveBuffer = []; this.sendBuffer = []; this.connected = false; this.disconnected = true; if (opts && opts.query) { this.query = opts.query; } if (this.io.autoConnect) this.open(); } /** * Mix in `Emitter`. */ Emitter(Socket.prototype); /** * Subscribe to open, close and packet events * * @api private */ Socket.prototype.subEvents = function () { if (this.subs) return; var io = this.io; this.subs = [on(io, 'open', bind(this, 'onopen')), on(io, 'packet', bind(this, 'onpacket')), on(io, 'close', bind(this, 'onclose'))]; }; /** * "Opens" the socket. * * @api public */ Socket.prototype.open = Socket.prototype.connect = function () { if (this.connected) return this; this.subEvents(); this.io.open(); // ensure open if ('open' === this.io.readyState) this.onopen(); this.emit('connecting'); return this; }; /** * Sends a `message` event. * * @return {Socket} self * @api public */ Socket.prototype.send = function () { var args = toArray(arguments); args.unshift('message'); this.emit.apply(this, args); return this; }; /** * Override `emit`. * If the event is in `events`, it's emitted normally. * * @param {String} event name * @return {Socket} self * @api public */ Socket.prototype.emit = function (ev) { if (events.hasOwnProperty(ev)) { emit.apply(this, arguments); return this; } var args = toArray(arguments); var parserType = parser.EVENT; // default if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary var packet = { type: parserType, data: args }; packet.options = {}; packet.options.compress = !this.flags || false !== this.flags.compress; // event ack callback if ('function' === typeof args[args.length - 1]) { debug('emitting packet with ack id %d', this.ids); this.acks[this.ids] = args.pop(); packet.id = this.ids++; } if (this.connected) { this.packet(packet); } else { this.sendBuffer.push(packet); } delete this.flags; return this; }; /** * Sends a packet. * * @param {Object} packet * @api private */ Socket.prototype.packet = function (packet) { packet.nsp = this.nsp; this.io.packet(packet); }; /** * Called upon engine `open`. * * @api private */ Socket.prototype.onopen = function () { debug('transport is open - connecting'); // write connect packet if necessary if ('/' !== this.nsp) { if (this.query) { this.packet({ type: parser.CONNECT, query: this.query }); } else { this.packet({ type: parser.CONNECT }); } } }; /** * Called upon engine `close`. * * @param {String} reason * @api private */ Socket.prototype.onclose = function (reason) { debug('close (%s)', reason); this.connected = false; this.disconnected = true; delete this.id; this.emit('disconnect', reason); }; /** * Called with socket packet. * * @param {Object} packet * @api private */ Socket.prototype.onpacket = function (packet) { if (packet.nsp !== this.nsp) return; switch (packet.type) { case parser.CONNECT: this.onconnect(); break; case parser.EVENT: this.onevent(packet); break; case parser.BINARY_EVENT: this.onevent(packet); break; case parser.ACK: this.onack(packet); break; case parser.BINARY_ACK: this.onack(packet); break; case parser.DISCONNECT: this.ondisconnect(); break; case parser.ERROR: this.emit('error', packet.data); break; } }; /** * Called upon a server event. * * @param {Object} packet * @api private */ Socket.prototype.onevent = function (packet) { var args = packet.data || []; debug('emitting event %j', args); if (null != packet.id) { debug('attaching ack callback to event'); args.push(this.ack(packet.id)); } if (this.connected) { emit.apply(this, args); } else { this.receiveBuffer.push(args); } }; /** * Produces an ack callback to emit with an event. * * @api private */ Socket.prototype.ack = function (id) { var self = this; var sent = false; return function () { // prevent double callbacks if (sent) return; sent = true; var args = toArray(arguments); debug('sending ack %j', args); var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; self.packet({ type: type, id: id, data: args }); }; }; /** * Called upon a server acknowlegement. * * @param {Object} packet * @api private */ Socket.prototype.onack = function (packet) { var ack = this.acks[packet.id]; if ('function' === typeof ack) { debug('calling ack %s with %j', packet.id, packet.data); ack.apply(this, packet.data); delete this.acks[packet.id]; } else { debug('bad ack %s', packet.id); } }; /** * Called upon server connect. * * @api private */ Socket.prototype.onconnect = function () { this.connected = true; this.disconnected = false; this.emit('connect'); this.emitBuffered(); }; /** * Emit buffered events (received and emitted). * * @api private */ Socket.prototype.emitBuffered = function () { var i; for (i = 0; i < this.receiveBuffer.length; i++) { emit.apply(this, this.receiveBuffer[i]); } this.receiveBuffer = []; for (i = 0; i < this.sendBuffer.length; i++) { this.packet(this.sendBuffer[i]); } this.sendBuffer = []; }; /** * Called upon server disconnect. * * @api private */ Socket.prototype.ondisconnect = function () { debug('server disconnect (%s)', this.nsp); this.destroy(); this.onclose('io server disconnect'); }; /** * Called upon forced client/server side disconnections, * this method ensures the manager stops tracking us and * that reconnections don't get triggered for this. * * @api private. */ Socket.prototype.destroy = function () { if (this.subs) { // clean subscriptions to avoid reconnections for (var i = 0; i < this.subs.length; i++) { this.subs[i].destroy(); } this.subs = null; } this.io.destroy(this); }; /** * Disconnects the socket manually. * * @return {Socket} self * @api public */ Socket.prototype.close = Socket.prototype.disconnect = function () { if (this.connected) { debug('performing disconnect (%s)', this.nsp); this.packet({ type: parser.DISCONNECT }); } // remove socket from pool this.destroy(); if (this.connected) { // fire events this.onclose('io client disconnect'); } return this; }; /** * Sets the compress flag. * * @param {Boolean} if `true`, compresses the sending data * @return {Socket} self * @api public */ Socket.prototype.compress = function (compress) { this.flags = this.flags || {}; this.flags.compress = compress; return this; }; /***/ }, /* 46 */ /***/ function(module, exports) { module.exports = toArray function toArray(list, index) { var array = [] index = index || 0 for (var i = index || 0; i < list.length; i++) { array[i - index] = list[i] } return array } /***/ }, /* 47 */ /***/ function(module, exports) { "use strict"; /** * Module exports. */ module.exports = on; /** * Helper for subscriptions. * * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` * @param {String} event name * @param {Function} callback * @api public */ function on(obj, ev, fn) { obj.on(ev, fn); return { destroy: function destroy() { obj.removeListener(ev, fn); } }; } /***/ }, /* 48 */ /***/ function(module, exports) { /** * Slice reference. */ var slice = [].slice; /** * Bind `obj` to `fn`. * * @param {Object} obj * @param {Function|String} fn or string * @return {Function} * @api public */ module.exports = function(obj, fn){ if ('string' == typeof fn) fn = obj[fn]; if ('function' != typeof fn) throw new Error('bind() requires a function'); var args = slice.call(arguments, 2); return function(){ return fn.apply(obj, args.concat(slice.call(arguments))); } }; /***/ }, /* 49 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { /* * Module requirements. */ var isArray = __webpack_require__(50); /** * Module exports. */ module.exports = hasBinary; /** * Checks for binary data. * * Right now only Buffer and ArrayBuffer are supported.. * * @param {Object} anything * @api public */ function hasBinary(data) { function _hasBinary(obj) { if (!obj) return false; if ( (global.Buffer && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) || (global.ArrayBuffer && obj instanceof ArrayBuffer) || (global.Blob && obj instanceof Blob) || (global.File && obj instanceof File) ) { return true; } if (isArray(obj)) { for (var i = 0; i < obj.length; i++) { if (_hasBinary(obj[i])) { return true; } } } else if (obj && 'object' == typeof obj) { // see: https://github.com/Automattic/has-binary/pull/4 if (obj.toJSON && 'function' == typeof obj.toJSON) { obj = obj.toJSON(); } for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) { return true; } } } return false; } return _hasBinary(data); } /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 50 */ /***/ function(module, exports) { module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; /***/ }, /* 51 */ /***/ function(module, exports) { /** * Expose `Backoff`. */ module.exports = Backoff; /** * Initialize backoff timer with `opts`. * * - `min` initial timeout in milliseconds [100] * - `max` max timeout [10000] * - `jitter` [0] * - `factor` [2] * * @param {Object} opts * @api public */ function Backoff(opts) { opts = opts || {}; this.ms = opts.min || 100; this.max = opts.max || 10000; this.factor = opts.factor || 2; this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; this.attempts = 0; } /** * Return the backoff duration. * * @return {Number} * @api public */ Backoff.prototype.duration = function(){ var ms = this.ms * Math.pow(this.factor, this.attempts++); if (this.jitter) { var rand = Math.random(); var deviation = Math.floor(rand * this.jitter * ms); ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; } return Math.min(ms, this.max) | 0; }; /** * Reset the number of attempts. * * @api public */ Backoff.prototype.reset = function(){ this.attempts = 0; }; /** * Set the minimum duration * * @api public */ Backoff.prototype.setMin = function(min){ this.ms = min; }; /** * Set the maximum duration * * @api public */ Backoff.prototype.setMax = function(max){ this.max = max; }; /** * Set the jitter * * @api public */ Backoff.prototype.setJitter = function(jitter){ this.jitter = jitter; }; /***/ } /******/ ]) }); ; //# sourceMappingURL=socket.io.js.map
js/App/Components/TabViews/SubViews/Device/ShowMoreButton.js
telldus/telldus-live-mobile-v3
/** * Copyright 2016-present Telldus Technologies AB. * * This file is part of the Telldus Live! app. * * Telldus Live! app is free : you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Telldus Live! app is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Telldus Live! app. If not, see <http://www.gnu.org/licenses/>. */ // @flow 'use strict'; import React from 'react'; import { TouchableOpacity } from 'react-native'; import { View } from '../../../../../BaseComponents'; import Theme from '../../../../Theme'; import i18n from '../../../../Translations/common'; import { withTheme, PropsThemedComponent, } from '../../../HOC/withTheme'; type Props = PropsThemedComponent & { onPress: () => void, intl: Object, name: string, style: Object | Array<any>, dotStyle: Array<any> | Object, dBTileDisplayMode?: string, }; class ShowMoreButton extends View<Props, null> { props: Props; onPress: () => void; constructor(props: Props) { super(props); this.onPress = this.onPress.bind(this); let { formatMessage } = this.props.intl; this.labelShowMore = formatMessage(i18n.moreMethods); this.labelButton = formatMessage(i18n.button); this.defaultDescriptionButton = formatMessage(i18n.defaultDescriptionButton); } onPress() { let { onPress } = this.props; if (onPress) { onPress(); } } render(): Object { const { name, style, dotStyle } = this.props; const accessibilityLabel = `${this.labelShowMore} ${this.labelButton}, ${name}. ${this.defaultDescriptionButton}`; const styles = this.getStyles(); return ( <TouchableOpacity style={[styles.moreButtonsCover, style]} onPress={this.onPress} accessibilityLabel={accessibilityLabel}> <View level={15} style={[styles.moreButtons, dotStyle]}/> <View level={15} style={[styles.moreButtons, {marginHorizontal: 5}, dotStyle]}/> <View level={15} style={[styles.moreButtons, dotStyle]}/> </TouchableOpacity> ); } getStyles = (): Object => { const { colorOnInActiveBg, buttonSeparatorColor, } = this.props.colors; return { moreButtonsCover: { flexDirection: 'row', width: Theme.Core.buttonWidth, height: Theme.Core.rowHeight, justifyContent: 'center', alignItems: 'center', borderLeftWidth: 1, borderLeftColor: buttonSeparatorColor, backgroundColor: colorOnInActiveBg, }, moreButtons: { height: 6, width: 6, borderRadius: 3, }, }; } } export default (withTheme(ShowMoreButton): Object);
packages/material-ui-icons/src/SyncTwoTone.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M.01 0h24v24h-24V0z" /><path d="M12.01 4V1l-4 4 4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46c.78-1.23 1.24-2.69 1.24-4.26 0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.25 7.74C4.47 8.97 4.01 10.43 4.01 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z" /></React.Fragment> , 'SyncTwoTone');
modules/gui/src/app/home/body/process/recipe/remapping/panels/inputImagery/assetSection.js
openforis/sepal
import {AssetInput} from 'widget/assetInput' import {msg} from 'translate' import PropTypes from 'prop-types' import React from 'react' import style from './inputImage.module.css' export default class AssetSection extends React.Component { render() { const {input, onLoading} = this.props return ( <AssetInput className={style.inputComponent} input={input} label={msg('process.classChange.panel.inputImage.asset.label')} placeholder={msg('process.classChange.panel.inputImage.asset.placeholder')} autoFocus onLoading={onLoading} onLoaded={({asset, metadata, visualizations}) => { this.onLoaded({asset, metadata, visualizations}) }} /> ) } onLoaded({asset, metadata, visualizations}) { const {onLoaded} = this.props const bands = {} const categoricalVisualizations = visualizations.filter(({type}) => type === 'categorical') metadata.bands.forEach(bandName => { const visualization = categoricalVisualizations .find(({bands}) => bands[0] === bandName) || {} bands[bandName] = { values: visualization.values || [], labels: visualization.labels || [], palette: visualization.palette } }) onLoaded({ id: asset, bands, metadata, visualizations, recipe: { type: 'ASSET', id: asset } }) } } AssetSection.propTypes = { input: PropTypes.object.isRequired, onLoaded: PropTypes.func.isRequired, onLoading: PropTypes.func.isRequired }
5.3.1/src/index.js
erikras/redux-form-docs
import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' import store from 'redux/store' import DevTools from './components/DevTools' import component from './routes' import Perf from 'react-addons-perf' import devToolsEnabled from './devToolsEnabled' const dest = document.getElementById('content') window.Perf = Perf render( (<Provider store={store}> <div> {component} {devToolsEnabled && !window.devToolsExtension && <DevTools/>} </div> </Provider>), dest )
src/docs/ComponentPage.js
choudlet/ps-react-choudlet
import React from 'react'; import PropTypes from 'prop-types'; import Example from './Example'; import Props from './Props'; const ComponentPage = ({component}) => { const {name, description, props, examples} = component; return ( <div className="componentpage"> <h2>{name}</h2> <p>{description}</p> <h3>Example{examples.length > 1 && "s"}</h3> { examples.length > 0 ? examples.map( example => <Example key={example.code} example={example} componentName={name} /> ) : "No examples exist." } <h3>Props</h3> { props ? <Props props={props} /> : "This component accepts no props." } </div> ) }; ComponentPage.propTypes = { component: PropTypes.object.isRequired }; export default ComponentPage;
ajax/libs/yui/3.17.1/event-focus/event-focus.js
tambien/cdnjs
/* YUI 3.17.1 (build 0eb5a52) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('event-focus', function (Y, NAME) { /** * Adds bubbling and delegation support to DOM events focus and blur. * * @module event * @submodule event-focus */ var Event = Y.Event, YLang = Y.Lang, isString = YLang.isString, arrayIndex = Y.Array.indexOf, useActivate = (function() { // Changing the structure of this test, so that it doesn't use inline JS in HTML, // which throws an exception in Win8 packaged apps, due to additional security restrictions: // http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences var supported = false, doc = Y.config.doc, p; if (doc) { p = doc.createElement("p"); p.setAttribute("onbeforeactivate", ";"); // onbeforeactivate is a function in IE8+. // onbeforeactivate is a string in IE6,7 (unfortunate, otherwise we could have just checked for function below). // onbeforeactivate is a function in IE10, in a Win8 App environment (no exception running the test). // onbeforeactivate is undefined in Webkit/Gecko. // onbeforeactivate is a function in Webkit/Gecko if it's a supported event (e.g. onclick). supported = (p.onbeforeactivate !== undefined); } return supported; }()); function define(type, proxy, directEvent) { var nodeDataKey = '_' + type + 'Notifiers'; Y.Event.define(type, { _useActivate : useActivate, _attach: function (el, notifier, delegate) { if (Y.DOM.isWindow(el)) { return Event._attach([type, function (e) { notifier.fire(e); }, el]); } else { return Event._attach( [proxy, this._proxy, el, this, notifier, delegate], { capture: true }); } }, _proxy: function (e, notifier, delegate) { var target = e.target, currentTarget = e.currentTarget, notifiers = target.getData(nodeDataKey), yuid = Y.stamp(currentTarget._node), defer = (useActivate || target !== currentTarget), directSub; notifier.currentTarget = (delegate) ? target : currentTarget; notifier.container = (delegate) ? currentTarget : null; // Maintain a list to handle subscriptions from nested // containers div#a>div#b>input #a.on(focus..) #b.on(focus..), // use one focus or blur subscription that fires notifiers from // #b then #a to emulate bubble sequence. if (!notifiers) { notifiers = {}; target.setData(nodeDataKey, notifiers); // only subscribe to the element's focus if the target is // not the current target ( if (defer) { directSub = Event._attach( [directEvent, this._notify, target._node]).sub; directSub.once = true; } } else { // In old IE, defer is always true. In capture-phase browsers, // The delegate subscriptions will be encountered first, which // will establish the notifiers data and direct subscription // on the node. If there is also a direct subscription to the // node's focus/blur, it should not call _notify because the // direct subscription from the delegate sub(s) exists, which // will call _notify. So this avoids _notify being called // twice, unnecessarily. defer = true; } if (!notifiers[yuid]) { notifiers[yuid] = []; } notifiers[yuid].push(notifier); if (!defer) { this._notify(e); } }, _notify: function (e, container) { var currentTarget = e.currentTarget, notifierData = currentTarget.getData(nodeDataKey), axisNodes = currentTarget.ancestors(), doc = currentTarget.get('ownerDocument'), delegates = [], // Used to escape loops when there are no more // notifiers to consider count = notifierData ? Y.Object.keys(notifierData).length : 0, target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret; // clear the notifications list (mainly for delegation) currentTarget.clearData(nodeDataKey); // Order the delegate subs by their placement in the parent axis axisNodes.push(currentTarget); // document.get('ownerDocument') returns null // which we'll use to prevent having duplicate Nodes in the list if (doc) { axisNodes.unshift(doc); } // ancestors() returns the Nodes from top to bottom axisNodes._nodes.reverse(); if (count) { // Store the count for step 2 tmp = count; axisNodes.some(function (node) { var yuid = Y.stamp(node), notifiers = notifierData[yuid], i, len; if (notifiers) { count--; for (i = 0, len = notifiers.length; i < len; ++i) { if (notifiers[i].handle.sub.filter) { delegates.push(notifiers[i]); } } } return !count; }); count = tmp; } // Walk up the parent axis, notifying direct subscriptions and // testing delegate filters. while (count && (target = axisNodes.shift())) { yuid = Y.stamp(target); notifiers = notifierData[yuid]; if (notifiers) { for (i = 0, len = notifiers.length; i < len; ++i) { notifier = notifiers[i]; sub = notifier.handle.sub; match = true; e.currentTarget = target; if (sub.filter) { match = sub.filter.apply(target, [target, e].concat(sub.args || [])); // No longer necessary to test against this // delegate subscription for the nodes along // the parent axis. delegates.splice( arrayIndex(delegates, notifier), 1); } if (match) { // undefined for direct subs e.container = notifier.container; ret = notifier.fire(e); } if (ret === false || e.stopped === 2) { break; } } delete notifiers[yuid]; count--; } if (e.stopped !== 2) { // delegates come after subs targeting this specific node // because they would not normally report until they'd // bubbled to the container node. for (i = 0, len = delegates.length; i < len; ++i) { notifier = delegates[i]; sub = notifier.handle.sub; if (sub.filter.apply(target, [target, e].concat(sub.args || []))) { e.container = notifier.container; e.currentTarget = target; ret = notifier.fire(e); } if (ret === false || e.stopped === 2 || // If e.stopPropagation() is called, notify any // delegate subs from the same container, but break // once the container changes. This emulates // delegate() behavior for events like 'click' which // won't notify delegates higher up the parent axis. (e.stopped && delegates[i+1] && delegates[i+1].container !== notifier.container)) { break; } } } if (e.stopped) { break; } } }, on: function (node, sub, notifier) { sub.handle = this._attach(node._node, notifier); }, detach: function (node, sub) { sub.handle.detach(); }, delegate: function (node, sub, notifier, filter) { if (isString(filter)) { sub.filter = function (target) { return Y.Selector.test(target._node, filter, node === target ? null : node._node); }; } sub.handle = this._attach(node._node, notifier, true); }, detachDelegate: function (node, sub) { sub.handle.detach(); } }, true); } // For IE, we need to defer to focusin rather than focus because // `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate, // el.onfocusin, doSomething, then el.onfocus. All others support capture // phase focus, which executes before doSomething. To guarantee consistent // behavior for this use case, IE's direct subscriptions are made against // focusin so subscribers will be notified before js following el.focus() is // executed. if (useActivate) { // name capture phase direct subscription define("focus", "beforeactivate", "focusin"); define("blur", "beforedeactivate", "focusout"); } else { define("focus", "focus", "focus"); define("blur", "blur", "blur"); } }, '3.17.1', {"requires": ["event-synthetic"]});
src/containers/page2/page2.js
roshanraj/react-redux-starter
import React, { Component } from 'react'; import './messaging.scss'; export default class Messaging extends Component { render() { return ( <div> Messaging </div> ); } }
ajax/libs/jqwidgets/14.0.0/jqwidgets-react-tsx/jqxgrid/react_jqxgrid.esm.js
cdnjs/cdnjs
import * as jqxcore from '../../jqwidgets/jqxcore'; import * as jqxdata from '../../jqwidgets/jqxdata'; import * as jqxdataexport from '../../jqwidgets/jqxdata.export'; import * as jqxbuttons from '../../jqwidgets/jqxbuttons'; import * as jqxbuttongroup from '../../jqwidgets/jqxbuttongroup'; import * as jqxscrollbar from '../../jqwidgets/jqxscrollbar'; import * as jqxmenu from '../../jqwidgets/jqxmenu'; import * as jqxlistbox from '../../jqwidgets/jqxlistbox'; import * as jqxdropdownlist from '../../jqwidgets/jqxdropdownlist'; import * as jqxcombobox from '../../jqwidgets/jqxcombobox'; import * as jqxnumberinput from '../../jqwidgets/jqxnumberinput'; import * as jqxcheckbox from '../../jqwidgets/jqxcheckbox'; import * as globalize from '../../jqwidgets/globalization/globalize'; import * as jqxcalendar from '../../jqwidgets/jqxcalendar'; import * as jqxdatetimeinput from '../../jqwidgets/jqxdatetimeinput'; import * as jqxgrid from '../../jqwidgets/jqxgrid'; import * as jqxgridedit from '../../jqwidgets/jqxgrid.edit'; import * as jqxgridpager from '../../jqwidgets/jqxgrid.pager'; import * as jqxgridselection from '../../jqwidgets/jqxgrid.selection'; import * as jqxgridfilter from '../../jqwidgets/jqxgrid.filter'; import * as jqxgridsort from '../../jqwidgets/jqxgrid.sort'; import * as jqxgridstorage from '../../jqwidgets/jqxgrid.storage'; import * as jqxgridgrouping from '../../jqwidgets/jqxgrid.grouping'; import * as jqxgridexport from '../../jqwidgets/jqxgrid.export'; import * as jqxgridcolumnsresiz from '../../jqwidgets/jqxgrid.columnsresize'; import * as jqxgridcolumnsreorder from '../../jqwidgets/jqxgrid.columnsreorder'; import * as jqxgridaggregates from '../../jqwidgets/jqxgrid.aggregates'; import * as jqxgridchart from '../../jqwidgets/jqxgrid.chart'; import { createElement, PureComponent } from 'react'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var JqxGrid = /** @class */ (function (_super) { __extends(JqxGrid, _super); function JqxGrid(props) { var _this = _super.call(this, props) || this; /* tslint:disable:variable-name */ _this._jqx = JQXLite; _this._id = 'JqxGrid' + _this._jqx.generateID(); _this._componentSelector = '#' + _this._id; _this.state = { lastProps: props }; return _this; } JqxGrid.getDerivedStateFromProps = function (props, state) { if (!Object.is) { Object.is = function (x, y) { if (x === y) { return x !== 0 || 1 / x === 1 / y; } else { return x !== x && y !== y; } }; } var areEqual = Object.is(props, state.lastProps); if (!areEqual) { var newState = { lastProps: props }; return newState; } return null; }; JqxGrid.prototype.componentDidMount = function () { var widgetOptions = this._manageProps(); this._jqx(this._componentSelector).jqxGrid(widgetOptions); this._wireEvents(); }; JqxGrid.prototype.componentDidUpdate = function () { var widgetOptions = this._manageProps(); this.setOptions(widgetOptions); this._wireEvents(); }; JqxGrid.prototype.render = function () { return (createElement("div", { id: this._id, className: this.props.className, style: this.props.style }, this.props.children)); }; JqxGrid.prototype.setOptions = function (options) { this._jqx(this._componentSelector).jqxGrid(options); }; JqxGrid.prototype.getOptions = function (option) { return this._jqx(this._componentSelector).jqxGrid(option); }; JqxGrid.prototype.autoresizecolumns = function (type) { this._jqx(this._componentSelector).jqxGrid('autoresizecolumns', type); }; JqxGrid.prototype.autoresizecolumn = function (dataField, type) { this._jqx(this._componentSelector).jqxGrid('autoresizecolumn', dataField, type); }; JqxGrid.prototype.beginupdate = function () { this._jqx(this._componentSelector).jqxGrid('beginupdate'); }; JqxGrid.prototype.clear = function () { this._jqx(this._componentSelector).jqxGrid('clear'); }; JqxGrid.prototype.createChart = function (type, dataSource) { this._jqx(this._componentSelector).jqxGrid('createChart', type, dataSource); }; JqxGrid.prototype.destroy = function () { this._jqx(this._componentSelector).jqxGrid('destroy'); }; JqxGrid.prototype.endupdate = function () { this._jqx(this._componentSelector).jqxGrid('endupdate'); }; JqxGrid.prototype.ensurerowvisible = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('ensurerowvisible', rowBoundIndex); }; JqxGrid.prototype.focus = function () { this._jqx(this._componentSelector).jqxGrid('focus'); }; JqxGrid.prototype.getcolumnindex = function (dataField) { return this._jqx(this._componentSelector).jqxGrid('getcolumnindex', dataField); }; JqxGrid.prototype.getcolumn = function (dataField) { return this._jqx(this._componentSelector).jqxGrid('getcolumn', dataField); }; JqxGrid.prototype.getcolumnproperty = function (dataField, propertyName) { return this._jqx(this._componentSelector).jqxGrid('getcolumnproperty', dataField, propertyName); }; JqxGrid.prototype.getrowid = function (rowBoundIndex) { return this._jqx(this._componentSelector).jqxGrid('getrowid', rowBoundIndex); }; JqxGrid.prototype.getrowdata = function (rowBoundIndex) { return this._jqx(this._componentSelector).jqxGrid('getrowdata', rowBoundIndex); }; JqxGrid.prototype.getrowdatabyid = function (rowID) { return this._jqx(this._componentSelector).jqxGrid('getrowdatabyid', rowID); }; JqxGrid.prototype.getrowboundindexbyid = function (rowID) { return this._jqx(this._componentSelector).jqxGrid('getrowboundindexbyid', rowID); }; JqxGrid.prototype.getrowboundindex = function (rowDisplayIndex) { return this._jqx(this._componentSelector).jqxGrid('getrowboundindex', rowDisplayIndex); }; JqxGrid.prototype.getrows = function () { return this._jqx(this._componentSelector).jqxGrid('getrows'); }; JqxGrid.prototype.getboundrows = function () { return this._jqx(this._componentSelector).jqxGrid('getboundrows'); }; JqxGrid.prototype.getdisplayrows = function () { return this._jqx(this._componentSelector).jqxGrid('getdisplayrows'); }; JqxGrid.prototype.getdatainformation = function () { return this._jqx(this._componentSelector).jqxGrid('getdatainformation'); }; JqxGrid.prototype.getsortinformation = function () { return this._jqx(this._componentSelector).jqxGrid('getsortinformation'); }; JqxGrid.prototype.getpaginginformation = function () { return this._jqx(this._componentSelector).jqxGrid('getpaginginformation'); }; JqxGrid.prototype.hidecolumn = function (dataField) { this._jqx(this._componentSelector).jqxGrid('hidecolumn', dataField); }; JqxGrid.prototype.hideloadelement = function () { this._jqx(this._componentSelector).jqxGrid('hideloadelement'); }; JqxGrid.prototype.hiderowdetails = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('hiderowdetails', rowBoundIndex); }; JqxGrid.prototype.iscolumnvisible = function (dataField) { return this._jqx(this._componentSelector).jqxGrid('iscolumnvisible', dataField); }; JqxGrid.prototype.iscolumnpinned = function (dataField) { return this._jqx(this._componentSelector).jqxGrid('iscolumnpinned', dataField); }; JqxGrid.prototype.localizestrings = function (localizationobject) { this._jqx(this._componentSelector).jqxGrid('localizestrings', localizationobject); }; JqxGrid.prototype.pincolumn = function (dataField) { this._jqx(this._componentSelector).jqxGrid('pincolumn', dataField); }; JqxGrid.prototype.refreshdata = function () { this._jqx(this._componentSelector).jqxGrid('refreshdata'); }; JqxGrid.prototype.refresh = function () { this._jqx(this._componentSelector).jqxGrid('refresh'); }; JqxGrid.prototype.renderWidget = function () { this._jqx(this._componentSelector).jqxGrid('render'); }; JqxGrid.prototype.scrolloffset = function (top, left) { this._jqx(this._componentSelector).jqxGrid('scrolloffset', top, left); }; JqxGrid.prototype.scrollposition = function () { return this._jqx(this._componentSelector).jqxGrid('scrollposition'); }; JqxGrid.prototype.showloadelement = function () { this._jqx(this._componentSelector).jqxGrid('showloadelement'); }; JqxGrid.prototype.showrowdetails = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('showrowdetails', rowBoundIndex); }; JqxGrid.prototype.setcolumnindex = function (dataField, index) { this._jqx(this._componentSelector).jqxGrid('setcolumnindex', dataField, index); }; JqxGrid.prototype.setcolumnproperty = function (dataField, propertyName, propertyValue) { this._jqx(this._componentSelector).jqxGrid('setcolumnproperty', dataField, propertyName, propertyValue); }; JqxGrid.prototype.showcolumn = function (dataField) { this._jqx(this._componentSelector).jqxGrid('showcolumn', dataField); }; JqxGrid.prototype.unpincolumn = function (dataField) { this._jqx(this._componentSelector).jqxGrid('unpincolumn', dataField); }; JqxGrid.prototype.updatebounddata = function (type) { this._jqx(this._componentSelector).jqxGrid('updatebounddata', type); }; JqxGrid.prototype.updating = function () { return this._jqx(this._componentSelector).jqxGrid('updating'); }; JqxGrid.prototype.getsortcolumn = function () { return this._jqx(this._componentSelector).jqxGrid('getsortcolumn'); }; JqxGrid.prototype.removesort = function () { this._jqx(this._componentSelector).jqxGrid('removesort'); }; JqxGrid.prototype.sortby = function (dataField, sortOrder) { this._jqx(this._componentSelector).jqxGrid('sortby', dataField, sortOrder); }; JqxGrid.prototype.addgroup = function (dataField) { this._jqx(this._componentSelector).jqxGrid('addgroup', dataField); }; JqxGrid.prototype.cleargroups = function () { this._jqx(this._componentSelector).jqxGrid('cleargroups'); }; JqxGrid.prototype.collapsegroup = function (group) { this._jqx(this._componentSelector).jqxGrid('collapsegroup', group); }; JqxGrid.prototype.collapseallgroups = function () { this._jqx(this._componentSelector).jqxGrid('collapseallgroups'); }; JqxGrid.prototype.expandallgroups = function () { this._jqx(this._componentSelector).jqxGrid('expandallgroups'); }; JqxGrid.prototype.expandgroup = function (group) { this._jqx(this._componentSelector).jqxGrid('expandgroup', group); }; JqxGrid.prototype.getrootgroupscount = function () { return this._jqx(this._componentSelector).jqxGrid('getrootgroupscount'); }; JqxGrid.prototype.getgroup = function (groupIndex) { return this._jqx(this._componentSelector).jqxGrid('getgroup', groupIndex); }; JqxGrid.prototype.insertgroup = function (groupIndex, dataField) { this._jqx(this._componentSelector).jqxGrid('insertgroup', groupIndex, dataField); }; JqxGrid.prototype.iscolumngroupable = function () { return this._jqx(this._componentSelector).jqxGrid('iscolumngroupable'); }; JqxGrid.prototype.removegroupat = function (groupIndex) { this._jqx(this._componentSelector).jqxGrid('removegroupat', groupIndex); }; JqxGrid.prototype.removegroup = function (dataField) { this._jqx(this._componentSelector).jqxGrid('removegroup', dataField); }; JqxGrid.prototype.addfilter = function (dataField, filterGroup, refreshGrid) { this._jqx(this._componentSelector).jqxGrid('addfilter', dataField, filterGroup, refreshGrid); }; JqxGrid.prototype.applyfilters = function () { this._jqx(this._componentSelector).jqxGrid('applyfilters'); }; JqxGrid.prototype.clearfilters = function () { this._jqx(this._componentSelector).jqxGrid('clearfilters'); }; JqxGrid.prototype.getfilterinformation = function () { return this._jqx(this._componentSelector).jqxGrid('getfilterinformation'); }; JqxGrid.prototype.getcolumnat = function (index) { return this._jqx(this._componentSelector).jqxGrid('getcolumnat', index); }; JqxGrid.prototype.removefilter = function (dataField, refreshGrid) { this._jqx(this._componentSelector).jqxGrid('removefilter', dataField, refreshGrid); }; JqxGrid.prototype.refreshfilterrow = function () { this._jqx(this._componentSelector).jqxGrid('refreshfilterrow'); }; JqxGrid.prototype.gotopage = function (pagenumber) { this._jqx(this._componentSelector).jqxGrid('gotopage', pagenumber); }; JqxGrid.prototype.gotoprevpage = function () { this._jqx(this._componentSelector).jqxGrid('gotoprevpage'); }; JqxGrid.prototype.gotonextpage = function () { this._jqx(this._componentSelector).jqxGrid('gotonextpage'); }; JqxGrid.prototype.addrow = function (rowIds, data, rowPosition) { this._jqx(this._componentSelector).jqxGrid('addrow', rowIds, data, rowPosition); }; JqxGrid.prototype.begincelledit = function (rowBoundIndex, dataField) { this._jqx(this._componentSelector).jqxGrid('begincelledit', rowBoundIndex, dataField); }; JqxGrid.prototype.beginrowedit = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('beginrowedit', rowBoundIndex); }; JqxGrid.prototype.closemenu = function () { this._jqx(this._componentSelector).jqxGrid('closemenu'); }; JqxGrid.prototype.deleterow = function (rowIds) { this._jqx(this._componentSelector).jqxGrid('deleterow', rowIds); }; JqxGrid.prototype.endcelledit = function (rowBoundIndex, dataField, confirmChanges) { this._jqx(this._componentSelector).jqxGrid('endcelledit', rowBoundIndex, dataField, confirmChanges); }; JqxGrid.prototype.endrowedit = function (rowBoundIndex, confirmChanges) { this._jqx(this._componentSelector).jqxGrid('endrowedit', rowBoundIndex, confirmChanges); }; JqxGrid.prototype.getcell = function (rowBoundIndex, datafield) { return this._jqx(this._componentSelector).jqxGrid('getcell', rowBoundIndex, datafield); }; JqxGrid.prototype.getcellatposition = function (left, top) { return this._jqx(this._componentSelector).jqxGrid('getcellatposition', left, top); }; JqxGrid.prototype.getcelltext = function (rowBoundIndex, dataField) { return this._jqx(this._componentSelector).jqxGrid('getcelltext', rowBoundIndex, dataField); }; JqxGrid.prototype.getcelltextbyid = function (rowID, dataField) { return this._jqx(this._componentSelector).jqxGrid('getcelltextbyid', rowID, dataField); }; JqxGrid.prototype.getcellvaluebyid = function (rowID, dataField) { return this._jqx(this._componentSelector).jqxGrid('getcellvaluebyid', rowID, dataField); }; JqxGrid.prototype.getcellvalue = function (rowBoundIndex, dataField) { return this._jqx(this._componentSelector).jqxGrid('getcellvalue', rowBoundIndex, dataField); }; JqxGrid.prototype.isBindingCompleted = function () { return this._jqx(this._componentSelector).jqxGrid('isBindingCompleted'); }; JqxGrid.prototype.openmenu = function (dataField) { this._jqx(this._componentSelector).jqxGrid('openmenu', dataField); }; JqxGrid.prototype.setcellvalue = function (rowBoundIndex, dataField, value) { this._jqx(this._componentSelector).jqxGrid('setcellvalue', rowBoundIndex, dataField, value); }; JqxGrid.prototype.setcellvaluebyid = function (rowID, dataField, value) { this._jqx(this._componentSelector).jqxGrid('setcellvaluebyid', rowID, dataField, value); }; JqxGrid.prototype.showvalidationpopup = function (rowBoundIndex, dataField, validationMessage) { this._jqx(this._componentSelector).jqxGrid('showvalidationpopup', rowBoundIndex, dataField, validationMessage); }; JqxGrid.prototype.updaterow = function (rowIds, data) { this._jqx(this._componentSelector).jqxGrid('updaterow', rowIds, data); }; JqxGrid.prototype.clearselection = function () { this._jqx(this._componentSelector).jqxGrid('clearselection'); }; JqxGrid.prototype.getselectedrowindex = function () { return this._jqx(this._componentSelector).jqxGrid('getselectedrowindex'); }; JqxGrid.prototype.getselectedrowindexes = function () { return this._jqx(this._componentSelector).jqxGrid('getselectedrowindexes'); }; JqxGrid.prototype.getselectedcell = function () { return this._jqx(this._componentSelector).jqxGrid('getselectedcell'); }; JqxGrid.prototype.getselectedcells = function () { return this._jqx(this._componentSelector).jqxGrid('getselectedcells'); }; JqxGrid.prototype.selectcell = function (rowBoundIndex, dataField) { this._jqx(this._componentSelector).jqxGrid('selectcell', rowBoundIndex, dataField); }; JqxGrid.prototype.selectallrows = function () { this._jqx(this._componentSelector).jqxGrid('selectallrows'); }; JqxGrid.prototype.selectrow = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('selectrow', rowBoundIndex); }; JqxGrid.prototype.unselectrow = function (rowBoundIndex) { this._jqx(this._componentSelector).jqxGrid('unselectrow', rowBoundIndex); }; JqxGrid.prototype.unselectcell = function (rowBoundIndex, dataField) { this._jqx(this._componentSelector).jqxGrid('unselectcell', rowBoundIndex, dataField); }; JqxGrid.prototype.getcolumnaggregateddata = function (dataField, aggregates) { return this._jqx(this._componentSelector).jqxGrid('getcolumnaggregateddata', dataField, aggregates); }; JqxGrid.prototype.refreshaggregates = function () { this._jqx(this._componentSelector).jqxGrid('refreshaggregates'); }; JqxGrid.prototype.renderaggregates = function () { this._jqx(this._componentSelector).jqxGrid('renderaggregates'); }; JqxGrid.prototype.exportdata = function (dataType, fileName, exportHeader, rows, exportHiddenColumns, serverURL, charSet) { return this._jqx(this._componentSelector).jqxGrid('exportdata', dataType, fileName, exportHeader, rows, exportHiddenColumns, serverURL, charSet); }; JqxGrid.prototype.exportview = function (dataType, fileName) { return this._jqx(this._componentSelector).jqxGrid('exportview', dataType, fileName); }; JqxGrid.prototype.openColumnChooser = function (columns, header) { this._jqx(this._componentSelector).jqxGrid('openColumnChooser', columns, header); }; JqxGrid.prototype.getstate = function () { return this._jqx(this._componentSelector).jqxGrid('getstate'); }; JqxGrid.prototype.loadstate = function (stateobject) { this._jqx(this._componentSelector).jqxGrid('loadstate', stateobject); }; JqxGrid.prototype.savestate = function () { return this._jqx(this._componentSelector).jqxGrid('savestate'); }; JqxGrid.prototype._manageProps = function () { var widgetProps = ['altrows', 'altstart', 'altstep', 'autoshowloadelement', 'autoshowfiltericon', 'autoshowcolumnsmenubutton', 'showcolumnlines', 'showrowlines', 'showcolumnheaderlines', 'adaptive', 'adaptivewidth', 'commandcolumn', 'commandcolumnrenderer', 'clipboard', 'closeablegroups', 'columnsmenuwidth', 'columnmenuopening', 'columnmenuclosing', 'cellhover', 'enablekeyboarddelete', 'enableellipsis', 'enablemousewheel', 'enableanimations', 'enabletooltips', 'enablehover', 'enablebrowserselection', 'everpresentrowposition', 'everpresentrowheight', 'everpresentrowactions', 'everpresentrowactionsmode', 'filterrowheight', 'filtermode', 'groupsrenderer', 'groupcolumnrenderer', 'groupsexpandedbydefault', 'handlekeyboardnavigation', 'pagerrenderer', 'rtl', 'showdefaultloadelement', 'showfiltercolumnbackground', 'showfiltermenuitems', 'showpinnedcolumnbackground', 'showsortcolumnbackground', 'showsortmenuitems', 'showgroupmenuitems', 'showrowdetailscolumn', 'showheader', 'showgroupsheader', 'showaggregates', 'showgroupaggregates', 'showeverpresentrow', 'showfilterrow', 'showemptyrow', 'showstatusbar', 'statusbarheight', 'showtoolbar', 'showfilterbar', 'filterbarmode', 'selectionmode', 'updatefilterconditions', 'updatefilterpanel', 'theme', 'toolbarheight', 'autoheight', 'autorowheight', 'columnsheight', 'deferreddatafields', 'groupsheaderheight', 'groupindentwidth', 'height', 'pagerheight', 'rowsheight', 'scrollbarsize', 'scrollmode', 'scrollfeedback', 'width', 'autosavestate', 'autoloadstate', 'columns', 'enableSanitize', 'cardview', 'cardviewcolumns', 'cardheight', 'cardsize', 'columngroups', 'columnsmenu', 'columnsresize', 'columnsautoresize', 'columnsreorder', 'charting', 'disabled', 'editable', 'batcheditable', 'editmode', 'filter', 'filterable', 'groupable', 'groups', 'horizontalscrollbarstep', 'horizontalscrollbarlargestep', 'initrowdetails', 'keyboardnavigation', 'localization', 'pagesize', 'pagesizeoptions', 'pagermode', 'pagerbuttonscount', 'pageable', 'autofill', 'rowdetails', 'rowdetailstemplate', 'ready', 'rendered', 'renderstatusbar', 'rendertoolbar', 'rendergridrows', 'sortable', 'sortmode', 'selectedrowindex', 'selectedrowindexes', 'source', 'sorttogglestates', 'updatedelay', 'virtualmode', 'verticalscrollbarstep', 'verticalscrollbarlargestep']; var options = {}; for (var prop in this.props) { if (widgetProps.indexOf(prop) !== -1) { options[prop] = this.props[prop]; } } return options; }; JqxGrid.prototype._wireEvents = function () { for (var prop in this.props) { if (prop.indexOf('on') === 0) { var originalEventName = prop.slice(2); originalEventName = originalEventName.charAt(0).toLowerCase() + originalEventName.slice(1); this._jqx(this._componentSelector).off(originalEventName); this._jqx(this._componentSelector).on(originalEventName, this.props[prop]); } } }; return JqxGrid; }(PureComponent)); var jqx = window.jqx; var JQXLite = window.JQXLite; export default JqxGrid; export { jqx, JQXLite };
ajax/libs/openlayers/6.0.0-dev.9/PluggableMap.js
cdnjs/cdnjs
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @module ol/PluggableMap */ import { getUid } from './util.js'; import Collection from './Collection.js'; import CollectionEventType from './CollectionEventType.js'; import MapBrowserEvent from './MapBrowserEvent.js'; import MapBrowserEventHandler from './MapBrowserEventHandler.js'; import MapBrowserEventType from './MapBrowserEventType.js'; import MapEvent from './MapEvent.js'; import MapEventType from './MapEventType.js'; import MapProperty from './MapProperty.js'; import RenderEventType from './render/EventType.js'; import BaseObject, { getChangeEventType } from './Object.js'; import ObjectEventType from './ObjectEventType.js'; import TileQueue from './TileQueue.js'; import View from './View.js'; import ViewHint from './ViewHint.js'; import { assert } from './asserts.js'; import { removeNode } from './dom.js'; import { listen, unlistenByKey } from './events.js'; import EventType from './events/EventType.js'; import { createEmpty, clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty } from './extent.js'; import { TRUE } from './functions.js'; import { DEVICE_PIXEL_RATIO, IMAGE_DECODE } from './has.js'; import LayerGroup from './layer/Group.js'; import { hasArea } from './size.js'; import { DROP } from './structs/PriorityQueue.js'; import { create as createTransform, apply as applyTransform } from './transform.js'; /** * State of the current frame. Only `pixelRatio`, `time` and `viewState` should * be used in applications. * @typedef {Object} FrameState * @property {number} pixelRatio The pixel ratio of the frame. * @property {number} time The time when rendering of the frame was requested. * @property {import("./View.js").State} viewState The state of the current view. * @property {boolean} animate * @property {import("./transform.js").Transform} coordinateToPixelTransform * @property {null|import("./extent.js").Extent} extent * @property {Array<DeclutterItems>} declutterItems * @property {import("./coordinate.js").Coordinate} focus * @property {number} index * @property {Array<import("./layer/Layer.js").State>} layerStatesArray * @property {number} layerIndex * @property {import("./transform.js").Transform} pixelToCoordinateTransform * @property {Array<PostRenderFunction>} postRenderFunctions * @property {import("./size.js").Size} size * @property {!Object<string, boolean>} skippedFeatureUids * @property {TileQueue} tileQueue * @property {!Object<string, Object<string, boolean>>} usedTiles * @property {Array<number>} viewHints * @property {!Object<string, Object<string, boolean>>} wantedTiles */ /** * @typedef {Object} DeclutterItems * @property {Array<*>} items Declutter items of an executor. * @property {number} opacity Layer opacity. */ /** * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction */ /** * @typedef {Object} AtPixelOptions * @property {undefined|function(import("./layer/Layer.js").default): boolean} [layerFilter] Layer filter * function. The filter function will receive one argument, the * {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value. * Only layers which are visible and for which this function returns `true` * will be tested for features. By default, all visible layers will be tested. * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels * inside the radius around the given position will be checked for features. */ /** * @typedef {Object} MapOptionsInternal * @property {Collection<import("./control/Control.js").default>} [controls] * @property {Collection<import("./interaction/Interaction.js").default>} [interactions] * @property {HTMLElement|Document} keyboardEventTarget * @property {Collection<import("./Overlay.js").default>} overlays * @property {Object<string, *>} values */ /** * Object literal with config options for the map. * @typedef {Object} MapOptions * @property {Collection<import("./control/Control.js").default>|Array<import("./control/Control.js").default>} [controls] * Controls initially added to the map. If not specified, * {@link module:ol/control~defaults} is used. * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between * physical pixels and device-independent pixels (dips) on the device. * @property {Collection<import("./interaction/Interaction.js").default>|Array<import("./interaction/Interaction.js").default>} [interactions] * Interactions that are initially added to the map. If not specified, * {@link module:ol/interaction~defaults} is used. * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to * listen to keyboard events on. This determines when the `KeyboardPan` and * `KeyboardZoom` interactions trigger. For example, if this option is set to * `document` the keyboard interactions will always trigger. If this option is * not specified, the element the library listens to keyboard events on is the * map target (i.e. the user-provided div for the map). If this is not * `document`, the target element needs to be focused for key events to be * emitted, requiring that the target element has a `tabindex` attribute. * @property {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>|LayerGroup} [layers] * Layers. If this is not defined, a map with no layers will be rendered. Note * that layers are rendered in the order supplied, so if you want, for example, * a vector layer to appear on top of a tile layer, it must come after the tile * layer. * @property {number} [maxTilesLoading=16] Maximum number tiles to load * simultaneously. * @property {number} [moveTolerance=1] The minimum distance in pixels the * cursor must move to be detected as a map move event instead of a click. * Increasing this value can make it easier to click on the map. * @property {Collection<import("./Overlay.js").default>|Array<import("./Overlay.js").default>} [overlays] * Overlays initially added to the map. By default, no overlays are added. * @property {HTMLElement|string} [target] The container for the map, either the * element itself or the `id` of the element. If not specified at construction * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be * rendered. * @property {View} [view] The map's view. No layer sources will be * fetched unless this is specified at construction time or through * {@link module:ol/Map~Map#setView}. */ /** * @fires import("./MapBrowserEvent.js").MapBrowserEvent * @fires import("./MapEvent.js").MapEvent * @fires import("./render/Event.js").default#precompose * @fires import("./render/Event.js").default#postcompose * @fires import("./render/Event.js").default#rendercomplete * @api */ var PluggableMap = /** @class */ (function (_super) { __extends(PluggableMap, _super); /** * @param {MapOptions} options Map options. */ function PluggableMap(options) { var _this = _super.call(this) || this; var optionsInternal = createOptionsInternal(options); /** @private */ _this.boundHandleBrowserEvent_ = _this.handleBrowserEvent.bind(_this); /** * @type {number} * @private */ _this.maxTilesLoading_ = options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16; /** * @private * @type {number} */ _this.pixelRatio_ = options.pixelRatio !== undefined ? options.pixelRatio : DEVICE_PIXEL_RATIO; /** * @private * @type {*} */ _this.postRenderTimeoutHandle_; /** * @private * @type {number|undefined} */ _this.animationDelayKey_; /** * @private */ _this.animationDelay_ = function () { this.animationDelayKey_ = undefined; this.renderFrame_(Date.now()); }.bind(_this); /** * @private * @type {import("./transform.js").Transform} */ _this.coordinateToPixelTransform_ = createTransform(); /** * @private * @type {import("./transform.js").Transform} */ _this.pixelToCoordinateTransform_ = createTransform(); /** * @private * @type {number} */ _this.frameIndex_ = 0; /** * @private * @type {?FrameState} */ _this.frameState_ = null; /** * The extent at the previous 'moveend' event. * @private * @type {import("./extent.js").Extent} */ _this.previousExtent_ = null; /** * @private * @type {?import("./events.js").EventsKey} */ _this.viewPropertyListenerKey_ = null; /** * @private * @type {?import("./events.js").EventsKey} */ _this.viewChangeListenerKey_ = null; /** * @private * @type {Array<import("./events.js").EventsKey>} */ _this.layerGroupPropertyListenerKeys_ = null; /** * @private * @type {!HTMLElement} */ _this.viewport_ = document.createElement('div'); _this.viewport_.className = 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : ''); _this.viewport_.style.position = 'relative'; _this.viewport_.style.overflow = 'hidden'; _this.viewport_.style.width = '100%'; _this.viewport_.style.height = '100%'; // prevent page zoom on IE >= 10 browsers _this.viewport_.style.msTouchAction = 'none'; _this.viewport_.style.touchAction = 'none'; /** * @private * @type {!HTMLElement} */ _this.overlayContainer_ = document.createElement('div'); _this.overlayContainer_.style.position = 'absolute'; _this.overlayContainer_.style.zIndex = '0'; _this.overlayContainer_.style.width = '100%'; _this.overlayContainer_.style.height = '100%'; _this.overlayContainer_.className = 'ol-overlaycontainer'; _this.viewport_.appendChild(_this.overlayContainer_); /** * @private * @type {!HTMLElement} */ _this.overlayContainerStopEvent_ = document.createElement('div'); _this.overlayContainerStopEvent_.style.position = 'absolute'; _this.overlayContainerStopEvent_.style.zIndex = '0'; _this.overlayContainerStopEvent_.style.width = '100%'; _this.overlayContainerStopEvent_.style.height = '100%'; _this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent'; _this.viewport_.appendChild(_this.overlayContainerStopEvent_); /** * @private * @type {MapBrowserEventHandler} */ _this.mapBrowserEventHandler_ = new MapBrowserEventHandler(_this, options.moveTolerance); var handleMapBrowserEvent = _this.handleMapBrowserEvent.bind(_this); for (var key in MapBrowserEventType) { _this.mapBrowserEventHandler_.addEventListener(MapBrowserEventType[key], handleMapBrowserEvent); } /** * @private * @type {HTMLElement|Document} */ _this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget; /** * @private * @type {Array<import("./events.js").EventsKey>} */ _this.keyHandlerKeys_ = null; var handleBrowserEvent = _this.handleBrowserEvent.bind(_this); _this.viewport_.addEventListener(EventType.CONTEXTMENU, handleBrowserEvent, false); _this.viewport_.addEventListener(EventType.WHEEL, handleBrowserEvent, false); /** * @type {Collection<import("./control/Control.js").default>} * @protected */ _this.controls = optionsInternal.controls || new Collection(); /** * @type {Collection<import("./interaction/Interaction.js").default>} * @protected */ _this.interactions = optionsInternal.interactions || new Collection(); /** * @type {import("./events/Target.js").default} */ _this.labelCache_ = null; /** * @type {import("./events.js").EventsKey} */ _this.labelCacheListenerKey_; /** * @type {Collection<import("./Overlay.js").default>} * @private */ _this.overlays_ = optionsInternal.overlays; /** * A lookup of overlays by id. * @private * @type {Object<string, import("./Overlay.js").default>} */ _this.overlayIdIndex_ = {}; /** * @type {import("./renderer/Map.js").default} * @private */ _this.renderer_ = null; /** * @type {function(Event): void|undefined} * @private */ _this.handleResize_; /** * @private * @type {import("./coordinate.js").Coordinate} */ _this.focus_ = null; /** * @private * @type {!Array<PostRenderFunction>} */ _this.postRenderFunctions_ = []; /** * @private * @type {TileQueue} */ _this.tileQueue_ = new TileQueue(_this.getTilePriority.bind(_this), _this.handleTileChange_.bind(_this)); /** * Uids of features to skip at rendering time. * @type {Object<string, boolean>} * @private */ _this.skippedFeatureUids_ = {}; _this.addEventListener(getChangeEventType(MapProperty.LAYERGROUP), _this.handleLayerGroupChanged_); _this.addEventListener(getChangeEventType(MapProperty.VIEW), _this.handleViewChanged_); _this.addEventListener(getChangeEventType(MapProperty.SIZE), _this.handleSizeChanged_); _this.addEventListener(getChangeEventType(MapProperty.TARGET), _this.handleTargetChanged_); // setProperties will trigger the rendering of the map if the map // is "defined" already. _this.setProperties(optionsInternal.values); _this.controls.forEach( /** * @param {import("./control/Control.js").default} control Control. * @this {PluggableMap} */ (function (control) { control.setMap(this); }).bind(_this)); _this.controls.addEventListener(CollectionEventType.ADD, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { event.element.setMap(this); }.bind(_this)); _this.controls.addEventListener(CollectionEventType.REMOVE, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { event.element.setMap(null); }.bind(_this)); _this.interactions.forEach( /** * @param {import("./interaction/Interaction.js").default} interaction Interaction. * @this {PluggableMap} */ (function (interaction) { interaction.setMap(this); }).bind(_this)); _this.interactions.addEventListener(CollectionEventType.ADD, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { event.element.setMap(this); }.bind(_this)); _this.interactions.addEventListener(CollectionEventType.REMOVE, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { event.element.setMap(null); }.bind(_this)); _this.overlays_.forEach(_this.addOverlayInternal_.bind(_this)); _this.overlays_.addEventListener(CollectionEventType.ADD, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { this.addOverlayInternal_(/** @type {import("./Overlay.js").default} */ (event.element)); }.bind(_this)); _this.overlays_.addEventListener(CollectionEventType.REMOVE, /** * @param {import("./Collection.js").CollectionEvent} event CollectionEvent. */ function (event) { var overlay = /** @type {import("./Overlay.js").default} */ (event.element); var id = overlay.getId(); if (id !== undefined) { delete this.overlayIdIndex_[id.toString()]; } event.element.setMap(null); }.bind(_this)); return _this; } /** * @abstract * @return {import("./renderer/Map.js").default} The map renderer */ PluggableMap.prototype.createRenderer = function () { throw new Error('Use a map type that has a createRenderer method'); }; /** * Add the given control to the map. * @param {import("./control/Control.js").default} control Control. * @api */ PluggableMap.prototype.addControl = function (control) { this.getControls().push(control); }; /** * Add the given interaction to the map. If you want to add an interaction * at another point of the collection use `getInteraction()` and the methods * available on {@link module:ol/Collection~Collection}. This can be used to * stop the event propagation from the handleEvent function. The interactions * get to handle the events in the reverse order of this collection. * @param {import("./interaction/Interaction.js").default} interaction Interaction to add. * @api */ PluggableMap.prototype.addInteraction = function (interaction) { this.getInteractions().push(interaction); }; /** * Adds the given layer to the top of this map. If you want to add a layer * elsewhere in the stack, use `getLayers()` and the methods available on * {@link module:ol/Collection~Collection}. * @param {import("./layer/Base.js").default} layer Layer. * @api */ PluggableMap.prototype.addLayer = function (layer) { var layers = this.getLayerGroup().getLayers(); layers.push(layer); }; /** * Add the given overlay to the map. * @param {import("./Overlay.js").default} overlay Overlay. * @api */ PluggableMap.prototype.addOverlay = function (overlay) { this.getOverlays().push(overlay); }; /** * This deals with map's overlay collection changes. * @param {import("./Overlay.js").default} overlay Overlay. * @private */ PluggableMap.prototype.addOverlayInternal_ = function (overlay) { var id = overlay.getId(); if (id !== undefined) { this.overlayIdIndex_[id.toString()] = overlay; } overlay.setMap(this); }; /** * * @inheritDoc */ PluggableMap.prototype.disposeInternal = function () { this.mapBrowserEventHandler_.dispose(); this.viewport_.removeEventListener(EventType.CONTEXTMENU, this.boundHandleBrowserEvent_); this.viewport_.removeEventListener(EventType.WHEEL, this.boundHandleBrowserEvent_); if (this.handleResize_ !== undefined) { removeEventListener(EventType.RESIZE, this.handleResize_, false); this.handleResize_ = undefined; } this.setTarget(null); _super.prototype.disposeInternal.call(this); }; /** * Detect features that intersect a pixel on the viewport, and execute a * callback with each intersecting feature. Layers included in the detection can * be configured through the `layerFilter` option in `opt_options`. * @param {import("./pixel.js").Pixel} pixel Pixel. * @param {function(this: S, import("./Feature.js").FeatureLike, * import("./layer/Layer.js").default): T} callback Feature callback. The callback will be * called with two arguments. The first argument is one * {@link module:ol/Feature feature} or * {@link module:ol/render/Feature render feature} at the pixel, the second is * the {@link module:ol/layer/Layer layer} of the feature and will be null for * unmanaged layers. To stop detection, callback functions can return a * truthy value. * @param {AtPixelOptions=} opt_options Optional options. * @return {T|undefined} Callback result, i.e. the return value of last * callback execution, or the first truthy callback return value. * @template S,T * @api */ PluggableMap.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options) { if (!this.frameState_) { return; } var coordinate = this.getCoordinateFromPixel(pixel); opt_options = opt_options !== undefined ? opt_options : /** @type {AtPixelOptions} */ ({}); var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance * this.frameState_.pixelRatio : 0; var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE; return this.renderer_.forEachFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, callback, null, layerFilter, null); }; /** * Get all features that intersect a pixel on the viewport. * @param {import("./pixel.js").Pixel} pixel Pixel. * @param {AtPixelOptions=} opt_options Optional options. * @return {Array<import("./Feature.js").FeatureLike>} The detected features or * `null` if none were found. * @api */ PluggableMap.prototype.getFeaturesAtPixel = function (pixel, opt_options) { var features = null; this.forEachFeatureAtPixel(pixel, function (feature) { if (!features) { features = []; } features.push(feature); }, opt_options); return features; }; /** * Detect layers that have a color value at a pixel on the viewport, and * execute a callback with each matching layer. Layers included in the * detection can be configured through `opt_layerFilter`. * @param {import("./pixel.js").Pixel} pixel Pixel. * @param {function(this: S, import("./layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback * Layer callback. This callback will receive two arguments: first is the * {@link module:ol/layer/Layer layer}, second argument is an array representing * [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types * that do not currently support this argument. To stop detection, callback * functions can return a truthy value. * @param {AtPixelOptions=} opt_options Configuration options. * @return {T|undefined} Callback result, i.e. the return value of last * callback execution, or the first truthy callback return value. * @template S,T * @api */ PluggableMap.prototype.forEachLayerAtPixel = function (pixel, callback, opt_options) { if (!this.frameState_) { return; } var options = opt_options || /** @type {AtPixelOptions} */ ({}); var hitTolerance = options.hitTolerance !== undefined ? opt_options.hitTolerance * this.frameState_.pixelRatio : 0; var layerFilter = options.layerFilter || TRUE; return this.renderer_.forEachLayerAtPixel(pixel, this.frameState_, hitTolerance, callback, layerFilter); }; /** * Detect if features intersect a pixel on the viewport. Layers included in the * detection can be configured through `opt_layerFilter`. * @param {import("./pixel.js").Pixel} pixel Pixel. * @param {AtPixelOptions=} opt_options Optional options. * @return {boolean} Is there a feature at the given pixel? * @api */ PluggableMap.prototype.hasFeatureAtPixel = function (pixel, opt_options) { if (!this.frameState_) { return false; } var coordinate = this.getCoordinateFromPixel(pixel); opt_options = opt_options !== undefined ? opt_options : /** @type {AtPixelOptions} */ ({}); var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE; var hitTolerance = opt_options.hitTolerance !== undefined ? opt_options.hitTolerance * this.frameState_.pixelRatio : 0; return this.renderer_.hasFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, layerFilter, null); }; /** * Returns the coordinate in view projection for a browser event. * @param {Event} event Event. * @return {import("./coordinate.js").Coordinate} Coordinate. * @api */ PluggableMap.prototype.getEventCoordinate = function (event) { return this.getCoordinateFromPixel(this.getEventPixel(event)); }; /** * Returns the map pixel position for a browser event relative to the viewport. * @param {Event|TouchEvent} event Event. * @return {import("./pixel.js").Pixel} Pixel. * @api */ PluggableMap.prototype.getEventPixel = function (event) { var viewportPosition = this.viewport_.getBoundingClientRect(); var eventPosition = 'changedTouches' in event ? /** @type {TouchEvent} */ (event).changedTouches[0] : /** @type {MouseEvent} */ (event); return [ eventPosition.clientX - viewportPosition.left, eventPosition.clientY - viewportPosition.top ]; }; /** * Get the target in which this map is rendered. * Note that this returns what is entered as an option or in setTarget: * if that was an element, it returns an element; if a string, it returns that. * @return {HTMLElement|string|undefined} The Element or id of the Element that the * map is rendered in. * @observable * @api */ PluggableMap.prototype.getTarget = function () { return /** @type {HTMLElement|string|undefined} */ (this.get(MapProperty.TARGET)); }; /** * Get the DOM element into which this map is rendered. In contrast to * `getTarget` this method always return an `Element`, or `null` if the * map has no target. * @return {HTMLElement} The element that the map is rendered in. * @api */ PluggableMap.prototype.getTargetElement = function () { var target = this.getTarget(); if (target !== undefined) { return typeof target === 'string' ? document.getElementById(target) : target; } else { return null; } }; /** * Get the coordinate for a given pixel. This returns a coordinate in the * map view projection. * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport. * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position. * @api */ PluggableMap.prototype.getCoordinateFromPixel = function (pixel) { var frameState = this.frameState_; if (!frameState) { return null; } else { return applyTransform(frameState.pixelToCoordinateTransform, pixel.slice()); } }; /** * Get the map controls. Modifying this collection changes the controls * associated with the map. * @return {Collection<import("./control/Control.js").default>} Controls. * @api */ PluggableMap.prototype.getControls = function () { return this.controls; }; /** * Get the map overlays. Modifying this collection changes the overlays * associated with the map. * @return {Collection<import("./Overlay.js").default>} Overlays. * @api */ PluggableMap.prototype.getOverlays = function () { return this.overlays_; }; /** * Get an overlay by its identifier (the value returned by overlay.getId()). * Note that the index treats string and numeric identifiers as the same. So * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`. * @param {string|number} id Overlay identifier. * @return {import("./Overlay.js").default} Overlay. * @api */ PluggableMap.prototype.getOverlayById = function (id) { var overlay = this.overlayIdIndex_[id.toString()]; return overlay !== undefined ? overlay : null; }; /** * Get the map interactions. Modifying this collection changes the interactions * associated with the map. * * Interactions are used for e.g. pan, zoom and rotate. * @return {Collection<import("./interaction/Interaction.js").default>} Interactions. * @api */ PluggableMap.prototype.getInteractions = function () { return this.interactions; }; /** * Get the layergroup associated with this map. * @return {LayerGroup} A layer group containing the layers in this map. * @observable * @api */ PluggableMap.prototype.getLayerGroup = function () { return ( /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP))); }; /** * Get the collection of layers associated with this map. * @return {!Collection<import("./layer/Base.js").default>} Layers. * @api */ PluggableMap.prototype.getLayers = function () { var layers = this.getLayerGroup().getLayers(); return layers; }; /** * @return {boolean} Layers have sources that are still loading. */ PluggableMap.prototype.getLoading = function () { var layerStatesArray = this.getLayerGroup().getLayerStatesArray(); for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) { var layer = layerStatesArray[i].layer; var source = /** @type {import("./layer/Layer.js").default} */ (layer).getSource(); if (source && source.loading) { return true; } } return false; }; /** * Get the pixel for a coordinate. This takes a coordinate in the map view * projection and returns the corresponding pixel. * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate. * @return {import("./pixel.js").Pixel} A pixel position in the map viewport. * @api */ PluggableMap.prototype.getPixelFromCoordinate = function (coordinate) { var frameState = this.frameState_; if (!frameState) { return null; } else { return applyTransform(frameState.coordinateToPixelTransform, coordinate.slice(0, 2)); } }; /** * Get the map renderer. * @return {import("./renderer/Map.js").default} Renderer */ PluggableMap.prototype.getRenderer = function () { return this.renderer_; }; /** * Get the size of this map. * @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM. * @observable * @api */ PluggableMap.prototype.getSize = function () { return ( /** @type {import("./size.js").Size|undefined} */ (this.get(MapProperty.SIZE))); }; /** * Get the view associated with this map. A view manages properties such as * center and resolution. * @return {View} The view that controls this map. * @observable * @api */ PluggableMap.prototype.getView = function () { return ( /** @type {View} */ (this.get(MapProperty.VIEW))); }; /** * Get the element that serves as the map viewport. * @return {HTMLElement} Viewport. * @api */ PluggableMap.prototype.getViewport = function () { return this.viewport_; }; /** * Get the element that serves as the container for overlays. Elements added to * this container will let mousedown and touchstart events through to the map, * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent} * events. * @return {!HTMLElement} The map's overlay container. */ PluggableMap.prototype.getOverlayContainer = function () { return this.overlayContainer_; }; /** * Get the element that serves as a container for overlays that don't allow * event propagation. Elements added to this container won't let mousedown and * touchstart events through to the map, so clicks and gestures on an overlay * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}. * @return {!HTMLElement} The map's overlay container that stops events. */ PluggableMap.prototype.getOverlayContainerStopEvent = function () { return this.overlayContainerStopEvent_; }; /** * @param {import("./Tile.js").default} tile Tile. * @param {string} tileSourceKey Tile source key. * @param {import("./coordinate.js").Coordinate} tileCenter Tile center. * @param {number} tileResolution Tile resolution. * @return {number} Tile priority. */ PluggableMap.prototype.getTilePriority = function (tile, tileSourceKey, tileCenter, tileResolution) { // Filter out tiles at higher zoom levels than the current zoom level, or that // are outside the visible extent. var frameState = this.frameState_; if (!frameState || !(tileSourceKey in frameState.wantedTiles)) { return DROP; } if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) { return DROP; } // Prioritize the highest zoom level tiles closest to the focus. // Tiles at higher zoom levels are prioritized using Math.log(tileResolution). // Within a zoom level, tiles are prioritized by the distance in pixels // between the center of the tile and the focus. The factor of 65536 means // that the prioritization should behave as desired for tiles up to // 65536 * Math.log(2) = 45426 pixels from the focus. var deltaX = tileCenter[0] - frameState.focus[0]; var deltaY = tileCenter[1] - frameState.focus[1]; return 65536 * Math.log(tileResolution) + Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution; }; /** * @param {Event} browserEvent Browser event. * @param {string=} opt_type Type. */ PluggableMap.prototype.handleBrowserEvent = function (browserEvent, opt_type) { var type = opt_type || browserEvent.type; var mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent); this.handleMapBrowserEvent(mapBrowserEvent); }; /** * @param {MapBrowserEvent} mapBrowserEvent The event to handle. */ PluggableMap.prototype.handleMapBrowserEvent = function (mapBrowserEvent) { if (!this.frameState_) { // With no view defined, we cannot translate pixels into geographical // coordinates so interactions cannot be used. return; } var target = mapBrowserEvent.originalEvent.target; while (target instanceof HTMLElement) { if (target.parentElement === this.overlayContainerStopEvent_) { return; } target = target.parentElement; } this.focus_ = mapBrowserEvent.coordinate; mapBrowserEvent.frameState = this.frameState_; var interactionsArray = this.getInteractions().getArray(); if (this.dispatchEvent(mapBrowserEvent) !== false) { for (var i = interactionsArray.length - 1; i >= 0; i--) { var interaction = interactionsArray[i]; if (!interaction.getActive()) { continue; } var cont = interaction.handleEvent(mapBrowserEvent); if (!cont) { break; } } } }; /** * @protected */ PluggableMap.prototype.handlePostRender = function () { var frameState = this.frameState_; // Manage the tile queue // Image loads are expensive and a limited resource, so try to use them // efficiently: // * When the view is static we allow a large number of parallel tile loads // to complete the frame as quickly as possible. // * When animating or interacting, image loads can cause janks, so we reduce // the maximum number of loads per frame and limit the number of parallel // tile loads to remain reactive to view changes and to reduce the chance of // loading tiles that will quickly disappear from view. var tileQueue = this.tileQueue_; if (!tileQueue.isEmpty()) { var maxTotalLoading = this.maxTilesLoading_; var maxNewLoads = maxTotalLoading; if (frameState) { var hints = frameState.viewHints; if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) { var lowOnFrameBudget = !IMAGE_DECODE && Date.now() - frameState.time > 8; maxTotalLoading = lowOnFrameBudget ? 0 : 8; maxNewLoads = lowOnFrameBudget ? 0 : 2; } } if (tileQueue.getTilesLoading() < maxTotalLoading) { tileQueue.reprioritize(); // FIXME only call if view has changed tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads); } } if (frameState && this.hasListener(RenderEventType.RENDERCOMPLETE) && !frameState.animate && !this.tileQueue_.getTilesLoading() && !this.getLoading()) { this.renderer_.dispatchRenderEvent(RenderEventType.RENDERCOMPLETE, frameState); } var postRenderFunctions = this.postRenderFunctions_; for (var i = 0, ii = postRenderFunctions.length; i < ii; ++i) { postRenderFunctions[i](this, frameState); } postRenderFunctions.length = 0; }; /** * @private */ PluggableMap.prototype.handleSizeChanged_ = function () { if (this.getView()) { this.getView().resolveConstraints(0); } this.render(); }; /** * @private */ PluggableMap.prototype.handleTargetChanged_ = function () { // target may be undefined, null, a string or an Element. // If it's a string we convert it to an Element before proceeding. // If it's not now an Element we remove the viewport from the DOM. // If it's an Element we append the viewport element to it. var targetElement; if (this.getTarget()) { targetElement = this.getTargetElement(); } if (this.keyHandlerKeys_) { for (var i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) { unlistenByKey(this.keyHandlerKeys_[i]); } this.keyHandlerKeys_ = null; } if (!targetElement) { if (this.renderer_) { clearTimeout(this.postRenderTimeoutHandle_); this.postRenderFunctions_.length = 0; this.renderer_.dispose(); this.renderer_ = null; } if (this.animationDelayKey_) { cancelAnimationFrame(this.animationDelayKey_); this.animationDelayKey_ = undefined; } removeNode(this.viewport_); if (this.handleResize_ !== undefined) { removeEventListener(EventType.RESIZE, this.handleResize_, false); this.handleResize_ = undefined; } } else { targetElement.appendChild(this.viewport_); if (!this.renderer_) { this.renderer_ = this.createRenderer(); } var keyboardEventTarget = !this.keyboardEventTarget_ ? targetElement : this.keyboardEventTarget_; this.keyHandlerKeys_ = [ listen(keyboardEventTarget, EventType.KEYDOWN, this.handleBrowserEvent, this), listen(keyboardEventTarget, EventType.KEYPRESS, this.handleBrowserEvent, this) ]; if (!this.handleResize_) { this.handleResize_ = this.updateSize.bind(this); window.addEventListener(EventType.RESIZE, this.handleResize_, false); } } this.updateSize(); // updateSize calls setSize, so no need to call this.render // ourselves here. }; /** * @private */ PluggableMap.prototype.handleTileChange_ = function () { this.render(); }; /** * @private */ PluggableMap.prototype.handleViewPropertyChanged_ = function () { this.render(); }; /** * @private */ PluggableMap.prototype.handleViewChanged_ = function () { if (this.viewPropertyListenerKey_) { unlistenByKey(this.viewPropertyListenerKey_); this.viewPropertyListenerKey_ = null; } if (this.viewChangeListenerKey_) { unlistenByKey(this.viewChangeListenerKey_); this.viewChangeListenerKey_ = null; } var view = this.getView(); if (view) { this.viewport_.setAttribute('data-view', getUid(view)); this.viewPropertyListenerKey_ = listen(view, ObjectEventType.PROPERTYCHANGE, this.handleViewPropertyChanged_, this); this.viewChangeListenerKey_ = listen(view, EventType.CHANGE, this.handleViewPropertyChanged_, this); view.resolveConstraints(0); } this.render(); }; /** * @private */ PluggableMap.prototype.handleLayerGroupChanged_ = function () { if (this.layerGroupPropertyListenerKeys_) { this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey); this.layerGroupPropertyListenerKeys_ = null; } var layerGroup = this.getLayerGroup(); if (layerGroup) { this.layerGroupPropertyListenerKeys_ = [ listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this), listen(layerGroup, EventType.CHANGE, this.render, this) ]; } this.render(); }; /** * @return {boolean} Is rendered. */ PluggableMap.prototype.isRendered = function () { return !!this.frameState_; }; /** * Requests an immediate render in a synchronous manner. * @api */ PluggableMap.prototype.renderSync = function () { if (this.animationDelayKey_) { cancelAnimationFrame(this.animationDelayKey_); } this.animationDelay_(); }; /** * Redraws all text after new fonts have loaded */ PluggableMap.prototype.redrawText = function () { var layerStates = this.getLayerGroup().getLayerStatesArray(); for (var i = 0, ii = layerStates.length; i < ii; ++i) { var layer = layerStates[i].layer; if (layer.hasRenderer()) { layer.getRenderer().handleFontsChanged(); } } }; /** * Request a map rendering (at the next animation frame). * @api */ PluggableMap.prototype.render = function () { if (this.renderer_ && this.animationDelayKey_ === undefined) { this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_); } }; /** * Remove the given control from the map. * @param {import("./control/Control.js").default} control Control. * @return {import("./control/Control.js").default|undefined} The removed control (or undefined * if the control was not found). * @api */ PluggableMap.prototype.removeControl = function (control) { return this.getControls().remove(control); }; /** * Remove the given interaction from the map. * @param {import("./interaction/Interaction.js").default} interaction Interaction to remove. * @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or * undefined if the interaction was not found). * @api */ PluggableMap.prototype.removeInteraction = function (interaction) { return this.getInteractions().remove(interaction); }; /** * Removes the given layer from the map. * @param {import("./layer/Base.js").default} layer Layer. * @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the * layer was not found). * @api */ PluggableMap.prototype.removeLayer = function (layer) { var layers = this.getLayerGroup().getLayers(); return layers.remove(layer); }; /** * Remove the given overlay from the map. * @param {import("./Overlay.js").default} overlay Overlay. * @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined * if the overlay was not found). * @api */ PluggableMap.prototype.removeOverlay = function (overlay) { return this.getOverlays().remove(overlay); }; /** * @param {number} time Time. * @private */ PluggableMap.prototype.renderFrame_ = function (time) { var viewState; var size = this.getSize(); var view = this.getView(); var extent = createEmpty(); var previousFrameState = this.frameState_; /** @type {?FrameState} */ var frameState = null; if (size !== undefined && hasArea(size) && view && view.isDef()) { var viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined); viewState = view.getState(); frameState = { animate: false, coordinateToPixelTransform: this.coordinateToPixelTransform_, declutterItems: previousFrameState ? previousFrameState.declutterItems : [], extent: extent, focus: this.focus_ ? this.focus_ : viewState.center, index: this.frameIndex_++, layerIndex: 0, layerStatesArray: this.getLayerGroup().getLayerStatesArray(), pixelRatio: this.pixelRatio_, pixelToCoordinateTransform: this.pixelToCoordinateTransform_, postRenderFunctions: [], size: size, skippedFeatureUids: this.skippedFeatureUids_, tileQueue: this.tileQueue_, time: time, usedTiles: {}, viewState: viewState, viewHints: viewHints, wantedTiles: {} }; } if (frameState) { frameState.extent = getForViewAndSize(viewState.center, viewState.resolution, viewState.rotation, frameState.size, extent); } this.frameState_ = frameState; this.renderer_.renderFrame(frameState); if (frameState) { if (frameState.animate) { this.render(); } Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions); if (previousFrameState) { var moveStart = !this.previousExtent_ || (!isEmpty(this.previousExtent_) && !equals(frameState.extent, this.previousExtent_)); if (moveStart) { this.dispatchEvent(new MapEvent(MapEventType.MOVESTART, this, previousFrameState)); this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_); } } var idle = this.previousExtent_ && !frameState.viewHints[ViewHint.ANIMATING] && !frameState.viewHints[ViewHint.INTERACTING] && !equals(frameState.extent, this.previousExtent_); if (idle) { this.dispatchEvent(new MapEvent(MapEventType.MOVEEND, this, frameState)); clone(frameState.extent, this.previousExtent_); } } this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState)); this.postRenderTimeoutHandle_ = setTimeout(this.handlePostRender.bind(this), 0); }; /** * Sets the layergroup of this map. * @param {LayerGroup} layerGroup A layer group containing the layers in this map. * @observable * @api */ PluggableMap.prototype.setLayerGroup = function (layerGroup) { this.set(MapProperty.LAYERGROUP, layerGroup); }; /** * Set the size of this map. * @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM. * @observable * @api */ PluggableMap.prototype.setSize = function (size) { this.set(MapProperty.SIZE, size); }; /** * Set the target element to render this map into. * @param {HTMLElement|string|undefined} target The Element or id of the Element * that the map is rendered in. * @observable * @api */ PluggableMap.prototype.setTarget = function (target) { this.set(MapProperty.TARGET, target); }; /** * Set the view for this map. * @param {View} view The view that controls this map. * @observable * @api */ PluggableMap.prototype.setView = function (view) { this.set(MapProperty.VIEW, view); }; /** * @param {import("./Feature.js").default} feature Feature. */ PluggableMap.prototype.skipFeature = function (feature) { this.skippedFeatureUids_[getUid(feature)] = true; this.render(); }; /** * Force a recalculation of the map viewport size. This should be called when * third-party code changes the size of the map viewport. * @api */ PluggableMap.prototype.updateSize = function () { var targetElement = this.getTargetElement(); if (!targetElement) { this.setSize(undefined); } else { var computedStyle = getComputedStyle(targetElement); this.setSize([ targetElement.offsetWidth - parseFloat(computedStyle['borderLeftWidth']) - parseFloat(computedStyle['paddingLeft']) - parseFloat(computedStyle['paddingRight']) - parseFloat(computedStyle['borderRightWidth']), targetElement.offsetHeight - parseFloat(computedStyle['borderTopWidth']) - parseFloat(computedStyle['paddingTop']) - parseFloat(computedStyle['paddingBottom']) - parseFloat(computedStyle['borderBottomWidth']) ]); } }; /** * @param {import("./Feature.js").default} feature Feature. */ PluggableMap.prototype.unskipFeature = function (feature) { delete this.skippedFeatureUids_[getUid(feature)]; this.render(); }; return PluggableMap; }(BaseObject)); /** * @param {MapOptions} options Map options. * @return {MapOptionsInternal} Internal map options. */ function createOptionsInternal(options) { /** * @type {HTMLElement|Document} */ var keyboardEventTarget = null; if (options.keyboardEventTarget !== undefined) { keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ? document.getElementById(options.keyboardEventTarget) : options.keyboardEventTarget; } /** * @type {Object<string, *>} */ var values = {}; var layerGroup = options.layers && typeof /** @type {?} */ (options.layers).getLayers === 'function' ? /** @type {LayerGroup} */ (options.layers) : new LayerGroup({ layers: /** @type {Collection} */ (options.layers) }); values[MapProperty.LAYERGROUP] = layerGroup; values[MapProperty.TARGET] = options.target; values[MapProperty.VIEW] = options.view !== undefined ? options.view : new View(); var controls; if (options.controls !== undefined) { if (Array.isArray(options.controls)) { controls = new Collection(options.controls.slice()); } else { assert(typeof /** @type {?} */ (options.controls).getArray === 'function', 47); // Expected `controls` to be an array or an `import("./Collection.js").Collection` controls = /** @type {Collection} */ (options.controls); } } var interactions; if (options.interactions !== undefined) { if (Array.isArray(options.interactions)) { interactions = new Collection(options.interactions.slice()); } else { assert(typeof /** @type {?} */ (options.interactions).getArray === 'function', 48); // Expected `interactions` to be an array or an `import("./Collection.js").Collection` interactions = /** @type {Collection} */ (options.interactions); } } var overlays; if (options.overlays !== undefined) { if (Array.isArray(options.overlays)) { overlays = new Collection(options.overlays.slice()); } else { assert(typeof /** @type {?} */ (options.overlays).getArray === 'function', 49); // Expected `overlays` to be an array or an `import("./Collection.js").Collection` overlays = options.overlays; } } else { overlays = new Collection(); } return { controls: controls, interactions: interactions, keyboardEventTarget: keyboardEventTarget, overlays: overlays, values: values }; } export default PluggableMap; //# sourceMappingURL=PluggableMap.js.map
test/BootstrapMixinSpec.js
rapilabs/react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import BootstrapMixin from '../src/BootstrapMixin'; import styleMaps from '../src/styleMaps'; let Component; describe('BootstrapMixin', function () { beforeEach(function() { Component = React.createClass({ mixins: [BootstrapMixin], render() { return React.DOM.button(this.props); } }); }); describe('#getBsClassSet', function () { it('should return blank', function () { let instance = ReactTestUtils.renderIntoDocument( <Component> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {}); }); it('should return "col"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='column'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'col': true}); }); it('should return "btn"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true}); }); it('should return "btn-group"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button-group'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn-group': true}); }); it('should return "label"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='label'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'label': true}); }); it('should return "alert"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='alert'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'alert': true}); }); it('should return "input-group"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='input-group'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'input-group': true}); }); it('should return "form"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='form'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'form': true}); }); it('should return "panel"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='panel'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'panel': true}); }); it('should return "btn btn-default"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='default'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-default': true}); }); it('should return "btn btn-primary"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='primary'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-primary': true}); }); it('should return "btn btn-success"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='success'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-success': true}); }); it('should return "btn btn-info"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='info'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-info': true}); }); it('should return "btn btn-link"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='link'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-link': true}); }); it('should return "btn btn-inline"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='inline'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-inline': true}); }); it('should return "btn btn-lg"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsSize='large'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-lg': true}); }); it('should return "btn btn-md"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsSize='medium'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-md': true}); }); it('should return "btn btn-sm"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsSize='small'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-sm': true}); }); it('should return "btn btn-xs"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsSize='xsmall'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-xs': true}); }); it('should return "btn-title"', function () { let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button'> content </Component> ); assert.equal(instance.prefixClass('title'), 'btn-title'); }); it('should return "btn btn-wacky"', function () { styleMaps.addStyle('wacky'); let instance = ReactTestUtils.renderIntoDocument( <Component bsClass='button' bsStyle='wacky'> content </Component> ); assert.deepEqual(instance.getBsClassSet(), {'btn': true, 'btn-wacky': true}); }); }); });
docs/components/Demo.js
tianyingchun/docs
import React, { Component } from 'react'; import UI, { Table } from '../../shared/react'; class Demo extends Component { } class DemoRender extends Component { } class DemoContainer extends Component { } class DemoApiTable extends Component { render () { return ( <Table bordered> <thead> <tr> <th>网站名称</th> <th>网址</th> <th>创建时间</th> </tr> </thead> <tbody> <tr> <td>Amaze UI</td> <td>http://amazeui.org</td> <td>2012-10-01</td> </tr> <tr className="am-active"> <td>Amaze UI(Active)</td> <td>http://amazeui.org</td> <td>2012-10-01</td> </tr> <tr> <td>Amaze UI</td> <td>http://amazeui.org</td> <td>2012-10-01</td> </tr> </tbody> </Table> ); } } Demo.Render = DemoRender ; Demo.Container = DemoContainer; Demo.ApiTable = DemoApiTable; export default Demo;
public/admin/build/SysFile.admin.chunk.js
dreamllq/koa-web-framework
webpackJsonp([21],[ /* 0 */, /* 1 */, /* 2 */, /* 3 */, /* 4 */, /* 5 */, /* 6 */, /* 7 */, /* 8 */, /* 9 */, /* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.warning = undefined; var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); exports.format = format; exports.isEmptyValue = isEmptyValue; exports.isEmptyObject = isEmptyObject; exports.asyncMap = asyncMap; exports.complementError = complementError; exports.deepMerge = deepMerge; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var formatRegExp = /%[sdj%]/g; var warning = exports.warning = function warning() {}; // don't print warning message when in production env or node runtime if (("dev") !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') { exports.warning = warning = function warning(type, errors) { if (typeof console !== 'undefined' && console.warn) { if (errors.every(function (e) { return typeof e === 'string'; })) { console.warn(type, errors); } } }; } function format() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var i = 1; var f = args[0]; var len = args.length; if (typeof f === 'function') { return f.apply(null, args.slice(1)); } if (typeof f === 'string') { var str = String(f).replace(formatRegExp, function (x) { if (x === '%%') { return '%'; } if (i >= len) { return x; } switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); case '%j': try { return JSON.stringify(args[i++]); } catch (_) { return '[Circular]'; } break; default: return x; } }); for (var arg = args[i]; i < len; arg = args[++i]) { str += ' ' + arg; } return str; } return f; } function isNativeStringType(type) { return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern'; } function isEmptyValue(value, type) { if (value === undefined || value === null) { return true; } if (type === 'array' && Array.isArray(value) && !value.length) { return true; } if (isNativeStringType(type) && typeof value === 'string' && !value) { return true; } return false; } function isEmptyObject(obj) { return Object.keys(obj).length === 0; } function asyncParallelArray(arr, func, callback) { var results = []; var total = 0; var arrLength = arr.length; function count(errors) { results.push.apply(results, errors); total++; if (total === arrLength) { callback(results); } } arr.forEach(function (a) { func(a, count); }); } function asyncSerialArray(arr, func, callback) { var index = 0; var arrLength = arr.length; function next(errors) { if (errors && errors.length) { callback(errors); return; } var original = index; index = index + 1; if (original < arrLength) { func(arr[original], next); } else { callback([]); } } next([]); } function flattenObjArr(objArr) { var ret = []; Object.keys(objArr).forEach(function (k) { ret.push.apply(ret, objArr[k]); }); return ret; } function asyncMap(objArr, option, func, callback) { if (option.first) { var flattenArr = flattenObjArr(objArr); return asyncSerialArray(flattenArr, func, callback); } var firstFields = option.firstFields || []; if (firstFields === true) { firstFields = Object.keys(objArr); } var objArrKeys = Object.keys(objArr); var objArrLength = objArrKeys.length; var total = 0; var results = []; var next = function next(errors) { results.push.apply(results, errors); total++; if (total === objArrLength) { callback(results); } }; objArrKeys.forEach(function (key) { var arr = objArr[key]; if (firstFields.indexOf(key) !== -1) { asyncSerialArray(arr, func, next); } else { asyncParallelArray(arr, func, next); } }); } function complementError(rule) { return function (oe) { if (oe && oe.message) { oe.field = oe.field || rule.fullField; return oe; } return { message: oe, field: oe.field || rule.fullField }; }; } function deepMerge(target, source) { if (source) { for (var s in source) { if (source.hasOwnProperty(s)) { var value = source[s]; if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && (0, _typeof3['default'])(target[s]) === 'object') { target[s] = (0, _extends3['default'])({}, target[s], value); } else { target[s] = value; } } } } return target; } /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _required = __webpack_require__(77); var _required2 = _interopRequireDefault(_required); var _whitespace = __webpack_require__(183); var _whitespace2 = _interopRequireDefault(_whitespace); var _type = __webpack_require__(182); var _type2 = _interopRequireDefault(_type); var _range = __webpack_require__(181); var _range2 = _interopRequireDefault(_range); var _enum = __webpack_require__(179); var _enum2 = _interopRequireDefault(_enum); var _pattern = __webpack_require__(180); var _pattern2 = _interopRequireDefault(_pattern); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = { required: _required2['default'], whitespace: _whitespace2['default'], type: _type2['default'], range: _range2['default'], 'enum': _enum2['default'], pattern: _pattern2['default'] }; module.exports = exports['default']; /***/ }, /* 12 */, /* 13 */, /* 14 */, /* 15 */, /* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _warning = __webpack_require__(51); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var warned = {}; exports['default'] = function (valid, message) { if (!valid && !warned[message]) { (0, _warning2['default'])(false, message); warned[message] = true; } }; module.exports = exports['default']; /***/ }, /* 17 */, /* 18 */, /* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _propertyUtils = __webpack_require__(112); var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; var getComputedStyleX = void 0; function force(x, y) { return x + y; } function css(el, name, v) { var value = v; if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { for (var i in name) { if (name.hasOwnProperty(i)) { css(el, i, name[i]); } } return undefined; } if (typeof value !== 'undefined') { if (typeof value === 'number') { value = value + 'px'; } el.style[name] = value; return undefined; } return getComputedStyleX(el, name); } function getClientPosition(elem) { var box = void 0; var x = void 0; var y = void 0; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 box = elem.getBoundingClientRect(); // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin x = box.left; y = box.top; // In IE, most of the time, 2 extra pixels are added to the top and left // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and // IE6 standards mode, this border can be overridden by setting the // document element's border to zero -- thus, we cannot rely on the // offset always being 2 pixels. // In quirks mode, the offset can be determined by querying the body's // clientLeft/clientTop, but in standards mode, it is found by querying // the document element's clientLeft/clientTop. Since we already called // getClientBoundingRect we have already forced a reflow, so it is not // too expensive just to query them all. // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 // 窗口边框标准是设 documentElement ,quirks 时设置 body // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 // 标准 ie 下 docElem.clientTop 就是 border-top // ie7 html 即窗口边框改变不了。永远为 2 // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 x -= docElem.clientLeft || body.clientLeft || 0; y -= docElem.clientTop || body.clientTop || 0; return { left: x, top: y }; } function getScroll(w, top) { var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; var method = 'scroll' + (top ? 'Top' : 'Left'); if (typeof ret !== 'number') { var d = w.document; // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { // quirks mode ret = d.body[method]; } } return ret; } function getScrollLeft(w) { return getScroll(w); } function getScrollTop(w) { return getScroll(w, true); } function getOffset(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; var w = doc.defaultView || doc.parentWindow; pos.left += getScrollLeft(w); pos.top += getScrollTop(w); return pos; } /** * A crude way of determining if an object is a window * @member util */ function isWindow(obj) { // must use == for ie8 /* eslint eqeqeq:0 */ return obj !== null && obj !== undefined && obj == obj.window; } function getDocument(node) { if (isWindow(node)) { return node.document; } if (node.nodeType === 9) { return node; } return node.ownerDocument; } function _getComputedStyle(elem, name, cs) { var computedStyle = cs; var val = ''; var d = getDocument(elem); computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); // https://github.com/kissyteam/kissy/issues/61 if (computedStyle) { val = computedStyle.getPropertyValue(name) || computedStyle[name]; } return val; } var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); var RE_POS = /^(top|right|bottom|left)$/; var CURRENT_STYLE = 'currentStyle'; var RUNTIME_STYLE = 'runtimeStyle'; var LEFT = 'left'; var PX = 'px'; function _getComputedStyleIE(elem, name) { // currentStyle maybe null // http://msdn.microsoft.com/en-us/library/ms535231.aspx var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 // 在 ie 下不对,需要直接用 offset 方式 // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // exclude left right for relativity if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { // Remember the original values var style = elem.style; var left = style[LEFT]; var rsLeft = elem[RUNTIME_STYLE][LEFT]; // prevent flashing of content elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; // Put in the new values to get a computed value out style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; ret = style.pixelLeft + PX; // Revert the changed values style[LEFT] = left; elem[RUNTIME_STYLE][LEFT] = rsLeft; } return ret === '' ? 'auto' : ret; } if (typeof window !== 'undefined') { getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; } function getOffsetDirection(dir, option) { if (dir === 'left') { return option.useCssRight ? 'right' : dir; } return option.useCssBottom ? 'bottom' : dir; } function oppositeOffsetDirection(dir) { if (dir === 'left') { return 'right'; } else if (dir === 'right') { return 'left'; } else if (dir === 'top') { return 'bottom'; } else if (dir === 'bottom') { return 'top'; } } // 设置 elem 相对 elem.ownerDocument 的坐标 function setLeftTop(elem, offset, option) { // set position first, in-case top/left are set even on static elem if (css(elem, 'position') === 'static') { elem.style.position = 'relative'; } var presetH = -999; var presetV = -999; var horizontalProperty = getOffsetDirection('left', option); var verticalProperty = getOffsetDirection('top', option); var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); if (horizontalProperty !== 'left') { presetH = 999; } if (verticalProperty !== 'top') { presetV = 999; } var originalTransition = ''; var originalOffset = getOffset(elem); if ('left' in offset || 'top' in offset) { originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || ''; (0, _propertyUtils.setTransitionProperty)(elem, 'none'); } if ('left' in offset) { elem.style[oppositeHorizontalProperty] = ''; elem.style[horizontalProperty] = presetH + 'px'; } if ('top' in offset) { elem.style[oppositeVerticalProperty] = ''; elem.style[verticalProperty] = presetV + 'px'; } var old = getOffset(elem); var originalStyle = {}; for (var key in offset) { if (offset.hasOwnProperty(key)) { var dir = getOffsetDirection(key, option); var preset = key === 'left' ? presetH : presetV; var off = originalOffset[key] - old[key]; if (dir === key) { originalStyle[dir] = preset + off; } else { originalStyle[dir] = preset - off; } } } css(elem, originalStyle); // force relayout force(elem.offsetTop, elem.offsetLeft); if ('left' in offset || 'top' in offset) { (0, _propertyUtils.setTransitionProperty)(elem, originalTransition); } var ret = {}; for (var _key in offset) { if (offset.hasOwnProperty(_key)) { var _dir = getOffsetDirection(_key, option); var _off = offset[_key] - originalOffset[_key]; if (_key === _dir) { ret[_dir] = originalStyle[_dir] + _off; } else { ret[_dir] = originalStyle[_dir] - _off; } } } css(elem, ret); } function setTransform(elem, offset) { var originalOffset = getOffset(elem); var originalXY = (0, _propertyUtils.getTransformXY)(elem); var resultXY = { x: originalXY.x, y: originalXY.y }; if ('left' in offset) { resultXY.x = originalXY.x + offset.left - originalOffset.left; } if ('top' in offset) { resultXY.y = originalXY.y + offset.top - originalOffset.top; } (0, _propertyUtils.setTransformXY)(elem, resultXY); } function setOffset(elem, offset, option) { if (option.useCssRight || option.useCssBottom) { setLeftTop(elem, offset, option); } else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) { setTransform(elem, offset, option); } else { setLeftTop(elem, offset, option); } } function each(arr, fn) { for (var i = 0; i < arr.length; i++) { fn(arr[i]); } } function isBorderBoxFn(elem) { return getComputedStyleX(elem, 'boxSizing') === 'border-box'; } var BOX_MODELS = ['margin', 'border', 'padding']; var CONTENT_INDEX = -1; var PADDING_INDEX = 2; var BORDER_INDEX = 1; var MARGIN_INDEX = 0; function swap(elem, options, callback) { var old = {}; var style = elem.style; var name = void 0; // Remember the old values, and insert the new ones for (name in options) { if (options.hasOwnProperty(name)) { old[name] = style[name]; style[name] = options[name]; } } callback.call(elem); // Revert the old values for (name in options) { if (options.hasOwnProperty(name)) { style[name] = old[name]; } } } function getPBMWidth(elem, props, which) { var value = 0; var prop = void 0; var j = void 0; var i = void 0; for (j = 0; j < props.length; j++) { prop = props[j]; if (prop) { for (i = 0; i < which.length; i++) { var cssProp = void 0; if (prop === 'border') { cssProp = '' + prop + which[i] + 'Width'; } else { cssProp = prop + which[i]; } value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; } } } return value; } var domUtils = {}; each(['Width', 'Height'], function (name) { domUtils['doc' + name] = function (refWin) { var d = refWin.document; return Math.max( // firefox chrome documentElement.scrollHeight< body.scrollHeight // ie standard mode : documentElement.scrollHeight> body.scrollHeight d.documentElement['scroll' + name], // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? d.body['scroll' + name], domUtils['viewport' + name](d)); }; domUtils['viewport' + name] = function (win) { // pc browser includes scrollbar in window.innerWidth var prop = 'client' + name; var doc = win.document; var body = doc.body; var documentElement = doc.documentElement; var documentElementProp = documentElement[prop]; // 标准模式取 documentElement // backcompat 取 body return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; }; }); /* 得到元素的大小信息 @param elem @param name @param {String} [extra] 'padding' : (css width) + padding 'border' : (css width) + padding + border 'margin' : (css width) + padding + border + margin */ function getWH(elem, name, ex) { var extra = ex; if (isWindow(elem)) { return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); } else if (elem.nodeType === 9) { return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); } var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem, computedStyle); var cssBoxValue = 0; if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { borderBoxValue = undefined; // Fall back to computed then un computed css if necessary cssBoxValue = getComputedStyleX(elem, name); if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { cssBoxValue = elem.style[name] || 0; } // Normalize '', auto, and prepare for extra cssBoxValue = parseFloat(cssBoxValue) || 0; } if (extra === undefined) { extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; } var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; var val = borderBoxValue || cssBoxValue; if (extra === CONTENT_INDEX) { if (borderBoxValueOrIsBorderBox) { return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); } return cssBoxValue; } else if (borderBoxValueOrIsBorderBox) { if (extra === BORDER_INDEX) { return val; } return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); } return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); } var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; // fix #119 : https://github.com/kissyteam/kissy/issues/119 function getWHIgnoreDisplay() { for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { args[_key2] = arguments[_key2]; } var val = void 0; var elem = args[0]; // in case elem is window // elem.offsetWidth === undefined if (elem.offsetWidth !== 0) { val = getWH.apply(undefined, args); } else { swap(elem, cssShow, function () { val = getWH.apply(undefined, args); }); } return val; } each(['width', 'height'], function (name) { var first = name.charAt(0).toUpperCase() + name.slice(1); domUtils['outer' + first] = function (el, includeMargin) { return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); }; var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; domUtils[name] = function (elem, v) { var val = v; if (val !== undefined) { if (elem) { var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem); if (isBorderBox) { val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); } return css(elem, name, val); } return undefined; } return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); }; }); function mix(to, from) { for (var i in from) { if (from.hasOwnProperty(i)) { to[i] = from[i]; } } return to; } var utils = { getWindow: function getWindow(node) { if (node && node.document && node.setTimeout) { return node; } var doc = node.ownerDocument || node; return doc.defaultView || doc.parentWindow; }, getDocument: getDocument, offset: function offset(el, value, option) { if (typeof value !== 'undefined') { setOffset(el, value, option || {}); } else { return getOffset(el); } }, isWindow: isWindow, each: each, css: css, clone: function clone(obj) { var i = void 0; var ret = {}; for (i in obj) { if (obj.hasOwnProperty(i)) { ret[i] = obj[i]; } } var overflow = obj.overflow; if (overflow) { for (i in obj) { if (obj.hasOwnProperty(i)) { ret.overflow[i] = obj.overflow[i]; } } } return ret; }, mix: mix, getWindowScrollLeft: function getWindowScrollLeft(w) { return getScrollLeft(w); }, getWindowScrollTop: function getWindowScrollTop(w) { return getScrollTop(w); }, merge: function merge() { var ret = {}; for (var _len2 = arguments.length, args = Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { args[_key3] = arguments[_key3]; } for (var i = 0; i < args.length; i++) { utils.mix(ret, args[i]); } return ret; }, viewportWidth: 0, viewportHeight: 0 }; mix(utils, domUtils); exports['default'] = utils; module.exports = exports['default']; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Divider = exports.ItemGroup = exports.MenuItemGroup = exports.MenuItem = exports.Item = exports.SubMenu = undefined; var _Menu = __webpack_require__(135); var _Menu2 = _interopRequireDefault(_Menu); var _SubMenu = __webpack_require__(138); var _SubMenu2 = _interopRequireDefault(_SubMenu); var _MenuItem = __webpack_require__(136); var _MenuItem2 = _interopRequireDefault(_MenuItem); var _MenuItemGroup = __webpack_require__(137); var _MenuItemGroup2 = _interopRequireDefault(_MenuItemGroup); var _Divider = __webpack_require__(134); var _Divider2 = _interopRequireDefault(_Divider); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports.SubMenu = _SubMenu2["default"]; exports.Item = _MenuItem2["default"]; exports.MenuItem = _MenuItem2["default"]; exports.MenuItemGroup = _MenuItemGroup2["default"]; exports.ItemGroup = _MenuItemGroup2["default"]; exports.Divider = _Divider2["default"]; exports["default"] = _Menu2["default"]; /***/ }, /* 21 */, /* 22 */, /* 23 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.noop = noop; exports.getKeyFromChildrenIndex = getKeyFromChildrenIndex; exports.loopMenuItem = loopMenuItem; exports.loopMenuItemRecusively = loopMenuItemRecusively; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function noop() {} function getKeyFromChildrenIndex(child, menuEventKey, index) { var prefix = menuEventKey || ''; return child.key || prefix + 'item_' + index; } function loopMenuItem(children, cb) { var index = -1; _react2["default"].Children.forEach(children, function (c) { index++; if (c && c.type && c.type.isMenuItemGroup) { _react2["default"].Children.forEach(c.props.children, function (c2) { index++; cb(c2, index); }); } else { cb(c, index); } }); } function loopMenuItemRecusively(children, keys, ret) { if (!children || ret.find) { return; } _react2["default"].Children.forEach(children, function (c) { if (ret.find) { return; } if (c) { var construt = c.type; if (!construt || !(construt.isSubMenu || construt.isMenuItem || construt.isMenuItemGroup)) { return; } if (keys.indexOf(c.key) !== -1) { ret.find = true; } else if (c.props.children) { loopMenuItemRecusively(c.props.children, keys, ret); } } }); } /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(95); /***/ }, /* 25 */, /* 26 */, /* 27 */ /***/ function(module, exports, __webpack_require__) { var eq = __webpack_require__(80); /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } module.exports = assocIndexOf; /***/ }, /* 28 */ /***/ function(module, exports, __webpack_require__) { var isKeyable = __webpack_require__(235); /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } module.exports = getMapData; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { var getNative = __webpack_require__(42); /* Built-in method references that are verified to be native. */ var nativeCreate = getNative(Object, 'create'); module.exports = nativeCreate; /***/ }, /* 30 */ /***/ function(module, exports) { /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.UNSELECTABLE_ATTRIBUTE = exports.UNSELECTABLE_STYLE = undefined; exports.getValuePropValue = getValuePropValue; exports.getPropValue = getPropValue; exports.isCombobox = isCombobox; exports.isMultipleOrTags = isMultipleOrTags; exports.isMultipleOrTagsOrCombobox = isMultipleOrTagsOrCombobox; exports.isSingleMode = isSingleMode; exports.toArray = toArray; exports.preventDefaultEvent = preventDefaultEvent; exports.findIndexInValueByKey = findIndexInValueByKey; exports.findIndexInValueByLabel = findIndexInValueByLabel; exports.getSelectKeys = getSelectKeys; exports.findFirstMenuItem = findFirstMenuItem; exports.includesSeparators = includesSeparators; exports.splitBySeparators = splitBySeparators; exports.defaultFilterFn = defaultFilterFn; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function getValuePropValue(child) { var props = child.props; if ('value' in props) { return props.value; } if (child.key) { return child.key; } if (child.type && child.type.isSelectOptGroup && props.label) { return props.label; } throw new Error('Need at least a key or a value or a label (only for OptGroup) for ' + child); } function getPropValue(child, prop) { if (prop === 'value') { return getValuePropValue(child); } return child.props[prop]; } function isCombobox(props) { return props.combobox; } function isMultipleOrTags(props) { return props.multiple || props.tags; } function isMultipleOrTagsOrCombobox(props) { return isMultipleOrTags(props) || isCombobox(props); } function isSingleMode(props) { return !isMultipleOrTagsOrCombobox(props); } function toArray(value) { var ret = value; if (value === undefined) { ret = []; } else if (!Array.isArray(value)) { ret = [value]; } return ret; } function preventDefaultEvent(e) { e.preventDefault(); } function findIndexInValueByKey(value, key) { var index = -1; for (var i = 0; i < value.length; i++) { if (value[i].key === key) { index = i; break; } } return index; } function findIndexInValueByLabel(value, label) { var index = -1; for (var i = 0; i < value.length; i++) { if (toArray(value[i].label).join('') === label) { index = i; break; } } return index; } function getSelectKeys(menuItems, value) { if (value === null || value === undefined) { return []; } var selectedKeys = []; _react2['default'].Children.forEach(menuItems, function (item) { if (item.type.isMenuItemGroup) { selectedKeys = selectedKeys.concat(getSelectKeys(item.props.children, value)); } else { var itemValue = getValuePropValue(item); var itemKey = item.key; if (findIndexInValueByKey(value, itemValue) !== -1 && itemKey) { selectedKeys.push(itemKey); } } }); return selectedKeys; } var UNSELECTABLE_STYLE = exports.UNSELECTABLE_STYLE = { userSelect: 'none', WebkitUserSelect: 'none' }; var UNSELECTABLE_ATTRIBUTE = exports.UNSELECTABLE_ATTRIBUTE = { unselectable: 'unselectable' }; function findFirstMenuItem(children) { for (var i = 0; i < children.length; i++) { var child = children[i]; if (child.type.isMenuItemGroup) { var found = findFirstMenuItem(child.props.children); if (found) { return found; } } else if (!child.props.disabled) { return child; } } return null; } function includesSeparators(string, separators) { for (var i = 0; i < separators.length; ++i) { if (string.lastIndexOf(separators[i]) > 0) { return true; } } return false; } function splitBySeparators(string, separators) { var reg = new RegExp('[' + separators.join() + ']'); var array = string.split(reg); while (array[0] === '') { array.shift(); } while (array[array.length - 1] === '') { array.pop(); } return array; } function defaultFilterFn(input, child) { return String(getPropValue(child, this.props.optionFilterProp)).indexOf(input) > -1; } /***/ }, /* 32 */ /***/ function(module, exports) { module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if(ret !== void 0) { return !!ret; } if(objA === objB) { return true; } if(typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if(keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for(var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if(!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if(ret === false || ret === void 0 && valueA !== valueB) { return false; } } return true; }; /***/ }, /* 33 */, /* 34 */, /* 35 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(121).nextTick; var apply = Function.prototype.apply; var slice = Array.prototype.slice; var immediateIds = {}; var nextImmediateId = 0; // DOM APIs, for completeness exports.setTimeout = function() { return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); }; exports.setInterval = function() { return new Timeout(apply.call(setInterval, window, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function(timeout) { timeout.close(); }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function() {}; Timeout.prototype.close = function() { this._clearFn.call(window, this._id); }; // Does not start the time, just sets up the members needed. exports.enroll = function(item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function(item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function(item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; // That's not how node.js implements it but the exposed api is the same. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { var id = nextImmediateId++; var args = arguments.length < 2 ? false : slice.call(arguments, 1); immediateIds[id] = true; nextTick(function onNextTick() { if (immediateIds[id]) { // fn.call() is faster so we optimize for the common use-case // @see http://jsperf.com/call-apply-segu if (args) { fn.apply(null, args); } else { fn.call(null); } // Prevent ids from leaking exports.clearImmediate(id); } }); return id; }; exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { delete immediateIds[id]; }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35).setImmediate, __webpack_require__(35).clearImmediate)) /***/ }, /* 36 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; module.exports = __webpack_require__(92); /***/ }, /* 37 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _contains = __webpack_require__(59); var _contains2 = _interopRequireDefault(_contains); var _addEventListener = __webpack_require__(34); var _addEventListener2 = _interopRequireDefault(_addEventListener); var _Popup = __webpack_require__(119); var _Popup2 = _interopRequireDefault(_Popup); var _utils = __webpack_require__(57); var _getContainerRenderMixin = __webpack_require__(296); var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function noop() {} function returnEmptyString() { return ''; } function returnDocument() { return window.document; } var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur']; var Trigger = (0, _createReactClass2['default'])({ displayName: 'Trigger', propTypes: { children: _propTypes2['default'].any, action: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].arrayOf(_propTypes2['default'].string)]), showAction: _propTypes2['default'].any, hideAction: _propTypes2['default'].any, getPopupClassNameFromAlign: _propTypes2['default'].any, onPopupVisibleChange: _propTypes2['default'].func, afterPopupVisibleChange: _propTypes2['default'].func, popup: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].func]).isRequired, popupStyle: _propTypes2['default'].object, prefixCls: _propTypes2['default'].string, popupClassName: _propTypes2['default'].string, popupPlacement: _propTypes2['default'].string, builtinPlacements: _propTypes2['default'].object, popupTransitionName: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]), popupAnimation: _propTypes2['default'].any, mouseEnterDelay: _propTypes2['default'].number, mouseLeaveDelay: _propTypes2['default'].number, zIndex: _propTypes2['default'].number, focusDelay: _propTypes2['default'].number, blurDelay: _propTypes2['default'].number, getPopupContainer: _propTypes2['default'].func, getDocument: _propTypes2['default'].func, destroyPopupOnHide: _propTypes2['default'].bool, mask: _propTypes2['default'].bool, maskClosable: _propTypes2['default'].bool, onPopupAlign: _propTypes2['default'].func, popupAlign: _propTypes2['default'].object, popupVisible: _propTypes2['default'].bool, maskTransitionName: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].object]), maskAnimation: _propTypes2['default'].string }, mixins: [(0, _getContainerRenderMixin2['default'])({ autoMount: false, isVisible: function isVisible(instance) { return instance.state.popupVisible; }, getContainer: function getContainer(instance) { var props = instance.props; var popupContainer = document.createElement('div'); // Make sure default popup container will never cause scrollbar appearing // https://github.com/react-component/trigger/issues/41 popupContainer.style.position = 'absolute'; popupContainer.style.top = '0'; popupContainer.style.left = '0'; popupContainer.style.width = '100%'; var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : props.getDocument().body; mountNode.appendChild(popupContainer); return popupContainer; } })], getDefaultProps: function getDefaultProps() { return { prefixCls: 'rc-trigger-popup', getPopupClassNameFromAlign: returnEmptyString, getDocument: returnDocument, onPopupVisibleChange: noop, afterPopupVisibleChange: noop, onPopupAlign: noop, popupClassName: '', mouseEnterDelay: 0, mouseLeaveDelay: 0.1, focusDelay: 0, blurDelay: 0.15, popupStyle: {}, destroyPopupOnHide: false, popupAlign: {}, defaultPopupVisible: false, mask: false, maskClosable: true, action: [], showAction: [], hideAction: [] }; }, getInitialState: function getInitialState() { var props = this.props; var popupVisible = void 0; if ('popupVisible' in props) { popupVisible = !!props.popupVisible; } else { popupVisible = !!props.defaultPopupVisible; } return { popupVisible: popupVisible }; }, componentWillMount: function componentWillMount() { var _this = this; ALL_HANDLERS.forEach(function (h) { _this['fire' + h] = function (e) { _this.fireEvents(h, e); }; }); }, componentDidMount: function componentDidMount() { this.componentDidUpdate({}, { popupVisible: this.state.popupVisible }); }, componentWillReceiveProps: function componentWillReceiveProps(_ref) { var popupVisible = _ref.popupVisible; if (popupVisible !== undefined) { this.setState({ popupVisible: popupVisible }); } }, componentDidUpdate: function componentDidUpdate(_, prevState) { var props = this.props; var state = this.state; this.renderComponent(null, function () { if (prevState.popupVisible !== state.popupVisible) { props.afterPopupVisibleChange(state.popupVisible); } }); // We must listen to `mousedown` or `touchstart`, edge case: // https://github.com/ant-design/ant-design/issues/5804 // https://github.com/react-component/calendar/issues/250 // https://github.com/react-component/trigger/issues/50 if (state.popupVisible) { var currentDocument = void 0; if (!this.clickOutsideHandler && this.isClickToHide()) { currentDocument = props.getDocument(); this.clickOutsideHandler = (0, _addEventListener2['default'])(currentDocument, 'mousedown', this.onDocumentClick); } // always hide on mobile if (!this.touchOutsideHandler) { currentDocument = currentDocument || props.getDocument(); this.touchOutsideHandler = (0, _addEventListener2['default'])(currentDocument, 'touchstart', this.onDocumentClick); } return; } this.clearOutsideHandler(); }, componentWillUnmount: function componentWillUnmount() { this.clearDelayTimer(); this.clearOutsideHandler(); }, onMouseEnter: function onMouseEnter(e) { this.fireEvents('onMouseEnter', e); this.delaySetPopupVisible(true, this.props.mouseEnterDelay); }, onMouseLeave: function onMouseLeave(e) { this.fireEvents('onMouseLeave', e); this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); }, onPopupMouseEnter: function onPopupMouseEnter() { this.clearDelayTimer(); }, onPopupMouseLeave: function onPopupMouseLeave(e) { // https://github.com/react-component/trigger/pull/13 // react bug? if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2['default'])(this._component.getPopupDomNode(), e.relatedTarget)) { return; } this.delaySetPopupVisible(false, this.props.mouseLeaveDelay); }, onFocus: function onFocus(e) { this.fireEvents('onFocus', e); // incase focusin and focusout this.clearDelayTimer(); if (this.isFocusToShow()) { this.focusTime = Date.now(); this.delaySetPopupVisible(true, this.props.focusDelay); } }, onMouseDown: function onMouseDown(e) { this.fireEvents('onMouseDown', e); this.preClickTime = Date.now(); }, onTouchStart: function onTouchStart(e) { this.fireEvents('onTouchStart', e); this.preTouchTime = Date.now(); }, onBlur: function onBlur(e) { this.fireEvents('onBlur', e); this.clearDelayTimer(); if (this.isBlurToHide()) { this.delaySetPopupVisible(false, this.props.blurDelay); } }, onClick: function onClick(event) { this.fireEvents('onClick', event); // focus will trigger click if (this.focusTime) { var preTime = void 0; if (this.preClickTime && this.preTouchTime) { preTime = Math.min(this.preClickTime, this.preTouchTime); } else if (this.preClickTime) { preTime = this.preClickTime; } else if (this.preTouchTime) { preTime = this.preTouchTime; } if (Math.abs(preTime - this.focusTime) < 20) { return; } this.focusTime = 0; } this.preClickTime = 0; this.preTouchTime = 0; event.preventDefault(); var nextVisible = !this.state.popupVisible; if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) { this.setPopupVisible(!this.state.popupVisible); } }, onDocumentClick: function onDocumentClick(event) { if (this.props.mask && !this.props.maskClosable) { return; } var target = event.target; var root = (0, _reactDom.findDOMNode)(this); var popupNode = this.getPopupDomNode(); if (!(0, _contains2['default'])(root, target) && !(0, _contains2['default'])(popupNode, target)) { this.close(); } }, getPopupDomNode: function getPopupDomNode() { // for test if (this._component && this._component.getPopupDomNode) { return this._component.getPopupDomNode(); } return null; }, getRootDomNode: function getRootDomNode() { return (0, _reactDom.findDOMNode)(this); }, getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) { var className = []; var props = this.props; var popupPlacement = props.popupPlacement, builtinPlacements = props.builtinPlacements, prefixCls = props.prefixCls; if (popupPlacement && builtinPlacements) { className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align)); } if (props.getPopupClassNameFromAlign) { className.push(props.getPopupClassNameFromAlign(align)); } return className.join(' '); }, getPopupAlign: function getPopupAlign() { var props = this.props; var popupPlacement = props.popupPlacement, popupAlign = props.popupAlign, builtinPlacements = props.builtinPlacements; if (popupPlacement && builtinPlacements) { return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign); } return popupAlign; }, getComponent: function getComponent() { var props = this.props, state = this.state; var mouseProps = {}; if (this.isMouseEnterToShow()) { mouseProps.onMouseEnter = this.onPopupMouseEnter; } if (this.isMouseLeaveToHide()) { mouseProps.onMouseLeave = this.onPopupMouseLeave; } return _react2['default'].createElement( _Popup2['default'], (0, _extends3['default'])({ prefixCls: props.prefixCls, destroyPopupOnHide: props.destroyPopupOnHide, visible: state.popupVisible, className: props.popupClassName, action: props.action, align: this.getPopupAlign(), onAlign: props.onPopupAlign, animation: props.popupAnimation, getClassNameFromAlign: this.getPopupClassNameFromAlign }, mouseProps, { getRootDomNode: this.getRootDomNode, style: props.popupStyle, mask: props.mask, zIndex: props.zIndex, transitionName: props.popupTransitionName, maskAnimation: props.maskAnimation, maskTransitionName: props.maskTransitionName }), typeof props.popup === 'function' ? props.popup() : props.popup ); }, setPopupVisible: function setPopupVisible(popupVisible) { this.clearDelayTimer(); if (this.state.popupVisible !== popupVisible) { if (!('popupVisible' in this.props)) { this.setState({ popupVisible: popupVisible }); } this.props.onPopupVisibleChange(popupVisible); } }, delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) { var _this2 = this; var delay = delayS * 1000; this.clearDelayTimer(); if (delay) { this.delayTimer = setTimeout(function () { _this2.setPopupVisible(visible); _this2.clearDelayTimer(); }, delay); } else { this.setPopupVisible(visible); } }, clearDelayTimer: function clearDelayTimer() { if (this.delayTimer) { clearTimeout(this.delayTimer); this.delayTimer = null; } }, clearOutsideHandler: function clearOutsideHandler() { if (this.clickOutsideHandler) { this.clickOutsideHandler.remove(); this.clickOutsideHandler = null; } if (this.touchOutsideHandler) { this.touchOutsideHandler.remove(); this.touchOutsideHandler = null; } }, createTwoChains: function createTwoChains(event) { var childPros = this.props.children.props; var props = this.props; if (childPros[event] && props[event]) { return this['fire' + event]; } return childPros[event] || props[event]; }, isClickToShow: function isClickToShow() { var _props = this.props, action = _props.action, showAction = _props.showAction; return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1; }, isClickToHide: function isClickToHide() { var _props2 = this.props, action = _props2.action, hideAction = _props2.hideAction; return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1; }, isMouseEnterToShow: function isMouseEnterToShow() { var _props3 = this.props, action = _props3.action, showAction = _props3.showAction; return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1; }, isMouseLeaveToHide: function isMouseLeaveToHide() { var _props4 = this.props, action = _props4.action, hideAction = _props4.hideAction; return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1; }, isFocusToShow: function isFocusToShow() { var _props5 = this.props, action = _props5.action, showAction = _props5.showAction; return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1; }, isBlurToHide: function isBlurToHide() { var _props6 = this.props, action = _props6.action, hideAction = _props6.hideAction; return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1; }, forcePopupAlign: function forcePopupAlign() { if (this.state.popupVisible && this._component && this._component.alignInstance) { this._component.alignInstance.forceAlign(); } }, fireEvents: function fireEvents(type, e) { var childCallback = this.props.children.props[type]; if (childCallback) { childCallback(e); } var callback = this.props[type]; if (callback) { callback(e); } }, close: function close() { this.setPopupVisible(false); }, render: function render() { var props = this.props; var children = props.children; var child = _react2['default'].Children.only(children); var newChildProps = {}; if (this.isClickToHide() || this.isClickToShow()) { newChildProps.onClick = this.onClick; newChildProps.onMouseDown = this.onMouseDown; newChildProps.onTouchStart = this.onTouchStart; } else { newChildProps.onClick = this.createTwoChains('onClick'); newChildProps.onMouseDown = this.createTwoChains('onMouseDown'); newChildProps.onTouchStart = this.createTwoChains('onTouchStart'); } if (this.isMouseEnterToShow()) { newChildProps.onMouseEnter = this.onMouseEnter; } else { newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter'); } if (this.isMouseLeaveToHide()) { newChildProps.onMouseLeave = this.onMouseLeave; } else { newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave'); } if (this.isFocusToShow() || this.isBlurToHide()) { newChildProps.onFocus = this.onFocus; newChildProps.onBlur = this.onBlur; } else { newChildProps.onFocus = this.createTwoChains('onFocus'); newChildProps.onBlur = this.createTwoChains('onBlur'); } return _react2['default'].cloneElement(child, newChildProps); } }); exports['default'] = Trigger; module.exports = exports['default']; /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactComponentWithPureRenderMixin */ var shallowEqual = __webpack_require__(100); function shallowCompare(instance, nextProps, nextState) { return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState); } /** * If your React component's render function is "pure", e.g. it will render the * same result given the same props and state, provide this mixin for a * considerable performance boost. * * Most React components have pure render functions. * * Example: * * var ReactComponentWithPureRenderMixin = * require('ReactComponentWithPureRenderMixin'); * React.createClass({ * mixins: [ReactComponentWithPureRenderMixin], * * render: function() { * return <div className={this.props.className}>foo</div>; * } * }); * * Note: This only checks shallow equality for props and state. If these contain * complex data structures this mixin may have false-negatives for deeper * differences. Only mixin to components which have simple props and state, or * use `forceUpdate()` when you know deep data structures have changed. * * See https://facebook.github.io/react/docs/pure-render-mixin.html */ var ReactComponentWithPureRenderMixin = { shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { return shallowCompare(this, nextProps, nextState); } }; module.exports = ReactComponentWithPureRenderMixin; /***/ }, /* 39 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Checkbox = __webpack_require__(71); var _Checkbox2 = _interopRequireDefault(_Checkbox); var _Group = __webpack_require__(148); var _Group2 = _interopRequireDefault(_Group); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _Checkbox2['default'].Group = _Group2['default']; exports['default'] = _Checkbox2['default']; module.exports = exports['default']; /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _rcCheckbox = __webpack_require__(83); var _rcCheckbox2 = _interopRequireDefault(_rcCheckbox); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _shallowequal = __webpack_require__(32); var _shallowequal2 = _interopRequireDefault(_shallowequal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Radio = function (_React$Component) { (0, _inherits3['default'])(Radio, _React$Component); function Radio() { (0, _classCallCheck3['default'])(this, Radio); return (0, _possibleConstructorReturn3['default'])(this, (Radio.__proto__ || Object.getPrototypeOf(Radio)).apply(this, arguments)); } (0, _createClass3['default'])(Radio, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState, nextContext) { return !(0, _shallowequal2['default'])(this.props, nextProps) || !(0, _shallowequal2['default'])(this.state, nextState) || !(0, _shallowequal2['default'])(this.context.radioGroup, nextContext.radioGroup); } }, { key: 'render', value: function render() { var _classNames; var props = this.props, context = this.context; var prefixCls = props.prefixCls, className = props.className, children = props.children, style = props.style, restProps = __rest(props, ["prefixCls", "className", "children", "style"]); var radioGroup = context.radioGroup; var radioProps = (0, _extends3['default'])({}, restProps); if (radioGroup) { radioProps.onChange = radioGroup.onChange; radioProps.checked = props.value === radioGroup.value; radioProps.disabled = props.disabled || radioGroup.disabled; } var wrapperClassString = (0, _classnames2['default'])(className, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-wrapper', true), (0, _defineProperty3['default'])(_classNames, prefixCls + '-wrapper-checked', radioProps.checked), (0, _defineProperty3['default'])(_classNames, prefixCls + '-wrapper-disabled', radioProps.disabled), _classNames)); return _react2['default'].createElement( 'label', { className: wrapperClassString, style: style, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave }, _react2['default'].createElement(_rcCheckbox2['default'], (0, _extends3['default'])({}, radioProps, { prefixCls: prefixCls })), children !== undefined ? _react2['default'].createElement( 'span', null, children ) : null ); } }]); return Radio; }(_react2['default'].Component); exports['default'] = Radio; Radio.defaultProps = { prefixCls: 'ant-radio', type: 'radio' }; Radio.contextTypes = { radioGroup: _propTypes2['default'].any }; module.exports = exports['default']; /***/ }, /* 41 */ /***/ function(module, exports, __webpack_require__) { var isArray = __webpack_require__(30), isKey = __webpack_require__(234), stringToPath = __webpack_require__(248), toString = __webpack_require__(254); /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } module.exports = castPath; /***/ }, /* 42 */ /***/ function(module, exports, __webpack_require__) { var baseIsNative = __webpack_require__(222), getValue = __webpack_require__(227); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } module.exports = getNative; /***/ }, /* 43 */ /***/ function(module, exports, __webpack_require__) { var isSymbol = __webpack_require__(46); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = toKey; /***/ }, /* 44 */ /***/ function(module, exports, __webpack_require__) { var baseHas = __webpack_require__(220), hasPath = __webpack_require__(228); /** * Checks if `path` is a direct property of `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': 2 } }; * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b'); * // => true * * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { return object != null && hasPath(object, path, baseHas); } module.exports = has; /***/ }, /* 45 */ /***/ function(module, exports) { /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }, /* 46 */ /***/ function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(67), isObjectLike = __webpack_require__(68); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } module.exports = isSymbol; /***/ }, /* 47 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports.argumentContainer = argumentContainer; exports.getValueFromEvent = getValueFromEvent; exports.getErrorStrs = getErrorStrs; exports.isEmptyObject = isEmptyObject; exports.flattenArray = flattenArray; exports.mirror = mirror; exports.hasRules = hasRules; exports.startsWith = startsWith; exports.getParams = getParams; exports.getNameIfNested = getNameIfNested; exports.flatFieldNames = flatFieldNames; exports.clearVirtualField = clearVirtualField; exports.getVirtualPaths = getVirtualPaths; exports.normalizeValidateRules = normalizeValidateRules; var _hoistNonReactStatics = __webpack_require__(303); var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function getDisplayName(WrappedComponent) { return WrappedComponent.displayName || WrappedComponent.name || 'WrappedComponent'; } function argumentContainer(Container, WrappedComponent) { /* eslint no-param-reassign:0 */ Container.displayName = 'Form(' + getDisplayName(WrappedComponent) + ')'; Container.WrappedComponent = WrappedComponent; return (0, _hoistNonReactStatics2['default'])(Container, WrappedComponent); } function getValueFromEvent(e) { // support custom element if (!e || !e.target) { return e; } var target = e.target; return target.type === 'checkbox' ? target.checked : target.value; } function getErrorStrs(errors) { if (errors) { return errors.map(function (e) { if (e && e.message) { return e.message; } return e; }); } return errors; } function isEmptyObject(obj) { return Object.keys(obj).length === 0; } function flattenArray(arr) { return Array.prototype.concat.apply([], arr); } function mirror(obj) { return obj; } function hasRules(validate) { if (validate) { return validate.some(function (item) { return !!item.rules && item.rules.length; }); } return false; } function startsWith(str, prefix) { return str.lastIndexOf(prefix, 0) === 0; } function getParams(ns, opt, cb) { var names = ns; var callback = cb; var options = opt; if (cb === undefined) { if (typeof names === 'function') { callback = names; options = {}; names = undefined; } else if (Array.isArray(ns)) { if (typeof options === 'function') { callback = options; options = {}; } else { options = options || {}; } } else { callback = options; options = names || {}; names = undefined; } } return { names: names, callback: callback, options: options }; } var NAME_KEY_SEP = '.'; var NAME_INDEX_OPEN_SEP = '['; function getNameIfNested(str) { var keyIndex = str.indexOf(NAME_KEY_SEP); var arrayIndex = str.indexOf(NAME_INDEX_OPEN_SEP); var index = void 0; if (keyIndex === -1 && arrayIndex === -1) { return { name: str }; } else if (keyIndex === -1) { index = arrayIndex; } else if (arrayIndex === -1) { index = keyIndex; } else { index = Math.min(keyIndex, arrayIndex); } return { name: str.slice(0, index), isNested: true }; } function flatFieldNames(names) { var ret = {}; names.forEach(function (n) { ret[getNameIfNested(n).name] = 1; }); return Object.keys(ret); } function clearVirtualField(name, fields, fieldsMeta) { if (fieldsMeta[name] && fieldsMeta[name].virtual) { /* eslint no-loop-func:0 */ Object.keys(fields).forEach(function (ok) { if (getNameIfNested(ok).name === name) { delete fields[ok]; } }); } } function getVirtualPaths(fieldsMeta) { var virtualPaths = {}; Object.keys(fieldsMeta).forEach(function (name) { var leadingName = fieldsMeta[name].leadingName; if (leadingName && fieldsMeta[leadingName].virtual) { if (leadingName in virtualPaths) { virtualPaths[leadingName].push(name); } else { virtualPaths[leadingName] = [name]; } } }); return virtualPaths; } function normalizeValidateRules(validate, rules, validateTrigger) { var validateRules = validate.map(function (item) { var newItem = (0, _extends3['default'])({}, item, { trigger: item.trigger || [] }); if (typeof newItem.trigger === 'string') { newItem.trigger = [newItem.trigger]; } return newItem; }); if (rules) { validateRules.push({ trigger: validateTrigger ? [].concat(validateTrigger) : [], rules: rules }); } return validateRules; } /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var fetchKeys = __webpack_require__(54); module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = fetchKeys(objA); var keysB = fetchKeys(objB); var len = keysA.length; if (len !== keysB.length) { return false; } compareContext = compareContext || null; // Test for A's keys different from B. var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); for (var i = 0; i < len; i++) { var key = keysA[i]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (_ret === false || _ret === void 0 && valueA !== valueB) { return false; } } return true; }; /***/ }, /* 49 */, /* 50 */, /* 51 */, /* 52 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * 获取 node 上的 align 对齐点 相对于页面的坐标 */ function getAlignOffset(region, align) { var V = align.charAt(0); var H = align.charAt(1); var w = region.width; var h = region.height; var x = void 0; var y = void 0; x = region.left; y = region.top; if (V === 'c') { y += h / 2; } else if (V === 'b') { y += h; } if (H === 'c') { x += w / 2; } else if (H === 'r') { x += w; } return { left: x, top: y }; } exports['default'] = getAlignOffset; module.exports = exports['default']; /***/ }, /* 53 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(19); var _utils2 = _interopRequireDefault(_utils); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * 得到会导致元素显示不全的祖先元素 */ function getOffsetParent(element) { if (_utils2['default'].isWindow(element) || element.nodeType === 9) { return null; } // ie 这个也不是完全可行 /* <div style="width: 50px;height: 100px;overflow: hidden"> <div style="width: 50px;height: 100px;position: relative;" id="d6"> 元素 6 高 100px 宽 50px<br/> </div> </div> */ // element.offsetParent does the right thing in ie7 and below. Return parent with layout! // In other browsers it only includes elements with position absolute, relative or // fixed, not elements with overflow set to auto or scroll. // if (UA.ie && ieMode < 8) { // return element.offsetParent; // } // 统一的 offsetParent 方法 var doc = _utils2['default'].getDocument(element); var body = doc.body; var parent = void 0; var positionStyle = _utils2['default'].css(element, 'position'); var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; if (!skipStatic) { return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; } for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { positionStyle = _utils2['default'].css(parent, 'position'); if (positionStyle !== 'static') { return parent; } } return null; } exports['default'] = getOffsetParent; module.exports = exports['default']; /***/ }, /* 54 */ /***/ function(module, exports, __webpack_require__) { /** * lodash 3.1.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var getNative = __webpack_require__(96), isArguments = __webpack_require__(97), isArray = __webpack_require__(98); /** Used to detect unsigned integer values. */ var reIsUint = /^\d+$/; /** Used for native method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /* Native method references for those with the same name as other `lodash` methods. */ var nativeKeys = getNative(Object, 'keys'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Checks if `value` is array-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. */ function isArrayLike(value) { return value != null && isLength(getLength(value)); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function shimKeys(object) { var props = keysIn(object), propsLength = props.length, length = propsLength && object.length; var allowIndexes = !!length && isLength(length) && (isArray(object) || isArguments(object)); var index = -1, result = []; while (++index < propsLength) { var key = props[index]; if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { result.push(key); } } return result; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { var Ctor = object == null ? undefined : object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; }; /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { if (object == null) { return []; } if (!isObject(object)) { object = Object(object); } var length = object.length; length = (length && isLength(length) && (isArray(object) || isArguments(object)) && length) || 0; var Ctor = object.constructor, index = -1, isProto = typeof Ctor == 'function' && Ctor.prototype === object, result = Array(length), skipIndexes = length > 0; while (++index < length) { result[index] = (index + ''); } for (var key in object) { if (!(skipIndexes && isIndex(key, length)) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } module.exports = keys; /***/ }, /* 55 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var autoAdjustOverflow = { adjustX: 1, adjustY: 1 }; var targetOffset = [0, 0]; var placements = exports.placements = { left: { points: ['cr', 'cl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset }, right: { points: ['cl', 'cr'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, top: { points: ['bc', 'tc'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, bottom: { points: ['tc', 'bc'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, topLeft: { points: ['bl', 'tl'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, leftTop: { points: ['tr', 'tl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset }, topRight: { points: ['br', 'tr'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, rightTop: { points: ['tl', 'tr'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, bottomRight: { points: ['tr', 'br'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, rightBottom: { points: ['bl', 'br'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, bottomLeft: { points: ['tl', 'bl'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, leftBottom: { points: ['br', 'bl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset } }; exports['default'] = placements; /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _objectWithoutProperties2 = __webpack_require__(21); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var LazyRenderBox = function (_Component) { (0, _inherits3['default'])(LazyRenderBox, _Component); function LazyRenderBox() { (0, _classCallCheck3['default'])(this, LazyRenderBox); return (0, _possibleConstructorReturn3['default'])(this, (LazyRenderBox.__proto__ || Object.getPrototypeOf(LazyRenderBox)).apply(this, arguments)); } (0, _createClass3['default'])(LazyRenderBox, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { return nextProps.hiddenClassName || nextProps.visible; } }, { key: 'render', value: function render() { var _props = this.props, hiddenClassName = _props.hiddenClassName, visible = _props.visible, props = (0, _objectWithoutProperties3['default'])(_props, ['hiddenClassName', 'visible']); if (hiddenClassName || _react2['default'].Children.count(props.children) > 1) { if (!visible && hiddenClassName) { props.className += ' ' + hiddenClassName; } return _react2['default'].createElement('div', props); } return _react2['default'].Children.only(props.children); } }]); return LazyRenderBox; }(_react.Component); LazyRenderBox.propTypes = { children: _propTypes2['default'].any, className: _propTypes2['default'].string, visible: _propTypes2['default'].bool, hiddenClassName: _propTypes2['default'].string }; exports['default'] = LazyRenderBox; module.exports = exports['default']; /***/ }, /* 57 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports.getAlignFromPlacement = getAlignFromPlacement; exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; exports.saveRef = saveRef; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function isPointsEq(a1, a2) { return a1[0] === a2[0] && a1[1] === a2[1]; } function getAlignFromPlacement(builtinPlacements, placementStr, align) { var baseAlign = builtinPlacements[placementStr] || {}; return (0, _extends3['default'])({}, baseAlign, align); } function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { var points = align.points; for (var placement in builtinPlacements) { if (builtinPlacements.hasOwnProperty(placement)) { if (isPointsEq(builtinPlacements[placement].points, points)) { return prefixCls + '-placement-' + placement; } } } return ''; } function saveRef(name, component) { this[name] = component; } /***/ }, /* 58 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 59 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = contains; function contains(root, n) { var node = n; while (node) { if (node === root) { return true; } node = node.parentNode; } return false; } module.exports = exports['default']; /***/ }, /* 60 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _rcSelect = __webpack_require__(273); var _rcSelect2 = _interopRequireDefault(_rcSelect); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; // => It is needless to export the declaration of below two inner components. // export { Option, OptGroup }; var Select = function (_React$Component) { (0, _inherits3['default'])(Select, _React$Component); function Select() { (0, _classCallCheck3['default'])(this, Select); return (0, _possibleConstructorReturn3['default'])(this, (Select.__proto__ || Object.getPrototypeOf(Select)).apply(this, arguments)); } (0, _createClass3['default'])(Select, [{ key: 'getLocale', value: function getLocale() { var antLocale = this.context.antLocale; if (antLocale && antLocale.Select) { return antLocale.Select; } return { notFoundContent: '无匹配结果' }; } }, { key: 'render', value: function render() { var _classNames; var _a = this.props, prefixCls = _a.prefixCls, _a$className = _a.className, className = _a$className === undefined ? '' : _a$className, size = _a.size, mode = _a.mode, multiple = _a.multiple, tags = _a.tags, combobox = _a.combobox, restProps = __rest(_a, ["prefixCls", "className", "size", "mode", "multiple", "tags", "combobox"]); (0, _warning2['default'])(!multiple && !tags && !combobox, '`Select[multiple|tags|combobox]` is deprecated, please use `Select[mode]` instead.'); var cls = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-lg', size === 'large'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-sm', size === 'small'), _classNames), className); var locale = this.getLocale(); var _props = this.props, _props$notFoundConten = _props.notFoundContent, notFoundContent = _props$notFoundConten === undefined ? locale.notFoundContent : _props$notFoundConten, optionLabelProp = _props.optionLabelProp; var isCombobox = mode === 'combobox' || combobox; if (isCombobox) { notFoundContent = null; // children 带 dom 结构时,无法填入输入框 optionLabelProp = optionLabelProp || 'value'; } var modeConfig = { multiple: mode === 'multiple' || multiple, tags: mode === 'tags' || tags, combobox: isCombobox }; return _react2['default'].createElement(_rcSelect2['default'], (0, _extends3['default'])({}, restProps, modeConfig, { prefixCls: prefixCls, className: cls, optionLabelProp: optionLabelProp || 'children', notFoundContent: notFoundContent })); } }]); return Select; }(_react2['default'].Component); exports['default'] = Select; Select.Option = _rcSelect.Option; Select.OptGroup = _rcSelect.OptGroup; Select.defaultProps = { prefixCls: 'ant-select', showSearch: false, transitionName: 'slide-up', choiceTransitionName: 'zoom' }; Select.propTypes = { prefixCls: _propTypes2['default'].string, className: _propTypes2['default'].string, size: _propTypes2['default'].oneOf(['default', 'large', 'small']), combobox: _propTypes2['default'].bool, notFoundContent: _propTypes2['default'].any, showSearch: _propTypes2['default'].bool, optionLabelProp: _propTypes2['default'].string, transitionName: _propTypes2['default'].string, choiceTransitionName: _propTypes2['default'].string }; Select.contextTypes = { antLocale: _propTypes2['default'].object }; module.exports = exports['default']; /***/ }, /* 61 */, /* 62 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Form = __webpack_require__(152); var _Form2 = _interopRequireDefault(_Form); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = _Form2['default']; module.exports = exports['default']; /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(205); __webpack_require__(154); /***/ }, /* 64 */, /* 65 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _KeyCode = __webpack_require__(22); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _createChainedFunction = __webpack_require__(305); var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _domScrollIntoView = __webpack_require__(36); var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView); var _util = __webpack_require__(23); var _DOMWrap = __webpack_require__(133); var _DOMWrap2 = _interopRequireDefault(_DOMWrap); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function allDisabled(arr) { if (!arr.length) { return true; } return arr.every(function (c) { return !!c.props.disabled; }); } function getActiveKey(props, originalActiveKey) { var activeKey = originalActiveKey; var children = props.children, eventKey = props.eventKey; if (activeKey) { var found = void 0; (0, _util.loopMenuItem)(children, function (c, i) { if (c && !c.props.disabled && activeKey === (0, _util.getKeyFromChildrenIndex)(c, eventKey, i)) { found = true; } }); if (found) { return activeKey; } } activeKey = null; if (props.defaultActiveFirst) { (0, _util.loopMenuItem)(children, function (c, i) { if (!activeKey && c && !c.props.disabled) { activeKey = (0, _util.getKeyFromChildrenIndex)(c, eventKey, i); } }); return activeKey; } return activeKey; } function saveRef(index, subIndex, c) { if (c) { if (subIndex !== undefined) { this.instanceArray[index] = this.instanceArray[index] || []; this.instanceArray[index][subIndex] = c; } else { this.instanceArray[index] = c; } } } var MenuMixin = { propTypes: { focusable: _propTypes2["default"].bool, multiple: _propTypes2["default"].bool, style: _propTypes2["default"].object, defaultActiveFirst: _propTypes2["default"].bool, visible: _propTypes2["default"].bool, activeKey: _propTypes2["default"].string, selectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultSelectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultOpenKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), children: _propTypes2["default"].any }, getDefaultProps: function getDefaultProps() { return { prefixCls: 'rc-menu', className: '', mode: 'vertical', level: 1, inlineIndent: 24, visible: true, focusable: true, style: {} }; }, getInitialState: function getInitialState() { var props = this.props; return { activeKey: getActiveKey(props, props.activeKey) }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var props = void 0; if ('activeKey' in nextProps) { props = { activeKey: getActiveKey(nextProps, nextProps.activeKey) }; } else { var originalActiveKey = this.state.activeKey; var activeKey = getActiveKey(nextProps, originalActiveKey); // fix: this.setState(), parent.render(), if (activeKey !== originalActiveKey) { props = { activeKey: activeKey }; } } if (props) { this.setState(props); } }, shouldComponentUpdate: function shouldComponentUpdate(nextProps) { return this.props.visible || nextProps.visible; }, componentWillMount: function componentWillMount() { this.instanceArray = []; }, // all keyboard events callbacks run from here at first onKeyDown: function onKeyDown(e) { var _this = this; var keyCode = e.keyCode; var handled = void 0; this.getFlatInstanceArray().forEach(function (obj) { if (obj && obj.props.active) { handled = obj.onKeyDown(e); } }); if (handled) { return 1; } var activeItem = null; if (keyCode === _KeyCode2["default"].UP || keyCode === _KeyCode2["default"].DOWN) { activeItem = this.step(keyCode === _KeyCode2["default"].UP ? -1 : 1); } if (activeItem) { e.preventDefault(); this.setState({ activeKey: activeItem.props.eventKey }, function () { (0, _domScrollIntoView2["default"])(_reactDom2["default"].findDOMNode(activeItem), _reactDom2["default"].findDOMNode(_this), { onlyScrollIfNeeded: true }); }); return 1; } else if (activeItem === undefined) { e.preventDefault(); this.setState({ activeKey: null }); return 1; } }, getOpenChangesOnItemHover: function getOpenChangesOnItemHover(e) { var mode = this.props.mode; var key = e.key, hover = e.hover, trigger = e.trigger; var activeKey = this.state.activeKey; if (!trigger || hover || this.props.closeSubMenuOnMouseLeave || !e.item.isSubMenu || mode === 'inline') { this.setState({ activeKey: hover ? key : null }); } else {} // keep active for sub menu for click active // empty // clear last open status if (hover && mode !== 'inline') { var activeItem = this.getFlatInstanceArray().filter(function (c) { return c && c.props.eventKey === activeKey; })[0]; if (activeItem && activeItem.isSubMenu && activeItem.props.eventKey !== key) { return { item: activeItem, originalEvent: e, key: activeItem.props.eventKey, open: false }; } } return []; }, getFlatInstanceArray: function getFlatInstanceArray() { var instanceArray = this.instanceArray; var hasInnerArray = instanceArray.some(function (a) { return Array.isArray(a); }); if (hasInnerArray) { instanceArray = []; this.instanceArray.forEach(function (a) { if (Array.isArray(a)) { instanceArray.push.apply(instanceArray, a); } else { instanceArray.push(a); } }); this.instanceArray = instanceArray; } return instanceArray; }, renderCommonMenuItem: function renderCommonMenuItem(child, i, subIndex, extraProps) { var state = this.state; var props = this.props; var key = (0, _util.getKeyFromChildrenIndex)(child, props.eventKey, i); var childProps = child.props; var isActive = key === state.activeKey; var newChildProps = (0, _extends3["default"])({ mode: props.mode, level: props.level, inlineIndent: props.inlineIndent, renderMenuItem: this.renderMenuItem, rootPrefixCls: props.prefixCls, index: i, parentMenu: this, ref: childProps.disabled ? undefined : (0, _createChainedFunction2["default"])(child.ref, saveRef.bind(this, i, subIndex)), eventKey: key, closeSubMenuOnMouseLeave: props.closeSubMenuOnMouseLeave, onItemHover: this.onItemHover, active: !childProps.disabled && isActive, multiple: props.multiple, onClick: this.onClick, openTransitionName: this.getOpenTransitionName(), openAnimation: props.openAnimation, onOpenChange: this.onOpenChange, onDeselect: this.onDeselect, onDestroy: this.onDestroy, onSelect: this.onSelect }, extraProps); if (props.mode === 'inline') { newChildProps.closeSubMenuOnMouseLeave = newChildProps.openSubMenuOnMouseEnter = false; } return _react2["default"].cloneElement(child, newChildProps); }, renderRoot: function renderRoot(props) { var _classes; this.instanceArray = []; var classes = (_classes = {}, (0, _defineProperty3["default"])(_classes, props.prefixCls, 1), (0, _defineProperty3["default"])(_classes, props.prefixCls + '-' + props.mode, 1), (0, _defineProperty3["default"])(_classes, props.className, !!props.className), _classes); var domProps = { className: (0, _classnames2["default"])(classes), role: 'menu', 'aria-activedescendant': '' }; if (props.id) { domProps.id = props.id; } if (props.focusable) { domProps.tabIndex = '0'; domProps.onKeyDown = this.onKeyDown; } return ( // ESLint is not smart enough to know that the type of `children` was checked. /* eslint-disable */ _react2["default"].createElement( _DOMWrap2["default"], (0, _extends3["default"])({ style: props.style, tag: 'ul', hiddenClassName: props.prefixCls + '-hidden', visible: props.visible }, domProps), _react2["default"].Children.map(props.children, this.renderMenuItem) ) /*eslint-enable */ ); }, step: function step(direction) { var children = this.getFlatInstanceArray(); var activeKey = this.state.activeKey; var len = children.length; if (!len) { return null; } if (direction < 0) { children = children.concat().reverse(); } // find current activeIndex var activeIndex = -1; children.every(function (c, ci) { if (c && c.props.eventKey === activeKey) { activeIndex = ci; return false; } return true; }); if (!this.props.defaultActiveFirst && activeIndex !== -1) { if (allDisabled(children.slice(activeIndex, len - 1))) { return undefined; } } var start = (activeIndex + 1) % len; var i = start; for (;;) { var child = children[i]; if (!child || child.props.disabled) { i = (i + 1 + len) % len; // complete a loop if (i === start) { return null; } } else { return child; } } } }; exports["default"] = MenuMixin; module.exports = exports['default']; /***/ }, /* 66 */, /* 67 */, /* 68 */, /* 69 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _dropdown = __webpack_require__(72); var _dropdown2 = _interopRequireDefault(_dropdown); var _dropdownButton = __webpack_require__(151); var _dropdownButton2 = _interopRequireDefault(_dropdownButton); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _dropdown2['default'].Button = _dropdownButton2['default']; exports['default'] = _dropdown2['default']; module.exports = exports['default']; /***/ }, /* 70 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Input = __webpack_require__(74); var _Input2 = _interopRequireDefault(_Input); var _Group = __webpack_require__(156); var _Group2 = _interopRequireDefault(_Group); var _Search = __webpack_require__(157); var _Search2 = _interopRequireDefault(_Search); var _TextArea = __webpack_require__(75); var _TextArea2 = _interopRequireDefault(_TextArea); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _Input2['default'].Group = _Group2['default']; _Input2['default'].Search = _Search2['default']; _Input2['default'].TextArea = _TextArea2['default']; exports['default'] = _Input2['default']; module.exports = exports['default']; /***/ }, /* 71 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _rcCheckbox = __webpack_require__(83); var _rcCheckbox2 = _interopRequireDefault(_rcCheckbox); var _shallowequal = __webpack_require__(32); var _shallowequal2 = _interopRequireDefault(_shallowequal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Checkbox = function (_React$Component) { (0, _inherits3['default'])(Checkbox, _React$Component); function Checkbox() { (0, _classCallCheck3['default'])(this, Checkbox); return (0, _possibleConstructorReturn3['default'])(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).apply(this, arguments)); } (0, _createClass3['default'])(Checkbox, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState, nextContext) { return !(0, _shallowequal2['default'])(this.props, nextProps) || !(0, _shallowequal2['default'])(this.state, nextState) || !(0, _shallowequal2['default'])(this.context.checkboxGroup, nextContext.checkboxGroup); } }, { key: 'render', value: function render() { var props = this.props, context = this.context; var prefixCls = props.prefixCls, className = props.className, children = props.children, indeterminate = props.indeterminate, style = props.style, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, restProps = __rest(props, ["prefixCls", "className", "children", "indeterminate", "style", "onMouseEnter", "onMouseLeave"]); var checkboxGroup = context.checkboxGroup; var checkboxProps = (0, _extends3['default'])({}, restProps); if (checkboxGroup) { checkboxProps.onChange = function () { return checkboxGroup.toggleOption({ label: children, value: props.value }); }; checkboxProps.checked = checkboxGroup.value.indexOf(props.value) !== -1; checkboxProps.disabled = 'disabled' in props ? props.disabled : checkboxGroup.disabled; } var classString = (0, _classnames2['default'])(className, (0, _defineProperty3['default'])({}, prefixCls + '-wrapper', true)); var checkboxClass = (0, _classnames2['default'])((0, _defineProperty3['default'])({}, prefixCls + '-indeterminate', indeterminate)); return _react2['default'].createElement( 'label', { className: classString, style: style, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, _react2['default'].createElement(_rcCheckbox2['default'], (0, _extends3['default'])({}, checkboxProps, { prefixCls: prefixCls, className: checkboxClass })), children !== undefined ? _react2['default'].createElement( 'span', null, children ) : null ); } }]); return Checkbox; }(_react2['default'].Component); exports['default'] = Checkbox; Checkbox.defaultProps = { prefixCls: 'ant-checkbox', indeterminate: false }; Checkbox.contextTypes = { checkboxGroup: _propTypes2['default'].any }; module.exports = exports['default']; /***/ }, /* 72 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcDropdown = __webpack_require__(257); var _rcDropdown2 = _interopRequireDefault(_rcDropdown); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Dropdown = function (_React$Component) { (0, _inherits3['default'])(Dropdown, _React$Component); function Dropdown() { (0, _classCallCheck3['default'])(this, Dropdown); return (0, _possibleConstructorReturn3['default'])(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).apply(this, arguments)); } (0, _createClass3['default'])(Dropdown, [{ key: 'getTransitionName', value: function getTransitionName() { var _props$placement = this.props.placement, placement = _props$placement === undefined ? '' : _props$placement; if (placement.indexOf('top') >= 0) { return 'slide-down'; } return 'slide-up'; } }, { key: 'componentDidMount', value: function componentDidMount() { var overlay = this.props.overlay; var overlayProps = overlay.props; (0, _warning2['default'])(!overlayProps.mode || overlayProps.mode === 'vertical', 'mode="' + overlayProps.mode + '" is not supported for Dropdown\'s Menu.'); } }, { key: 'render', value: function render() { var _props = this.props, children = _props.children, prefixCls = _props.prefixCls, overlay = _props.overlay; var dropdownTrigger = (0, _react.cloneElement)(children, { className: (0, _classnames2['default'])(children.props.className, prefixCls + '-trigger') }); var fixedModeOverlay = (0, _react.cloneElement)(overlay, { mode: 'vertical' }); return _react2['default'].createElement( _rcDropdown2['default'], (0, _extends3['default'])({ transitionName: this.getTransitionName() }, this.props, { overlay: fixedModeOverlay }), dropdownTrigger ); } }]); return Dropdown; }(_react2['default'].Component); exports['default'] = Dropdown; Dropdown.defaultProps = { prefixCls: 'ant-dropdown', mouseEnterDelay: 0.15, mouseLeaveDelay: 0.1, placement: 'bottomLeft' }; module.exports = exports['default']; /***/ }, /* 73 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var FIELD_META_PROP = exports.FIELD_META_PROP = 'data-__meta'; /***/ }, /* 74 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _omit = __webpack_require__(33); var _omit2 = _interopRequireDefault(_omit); var _TextArea = __webpack_require__(75); var _TextArea2 = _interopRequireDefault(_TextArea); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function fixControlledValue(value) { if (typeof value === 'undefined' || value === null) { return ''; } return value; } var Input = function (_Component) { (0, _inherits3['default'])(Input, _Component); function Input() { (0, _classCallCheck3['default'])(this, Input); var _this = (0, _possibleConstructorReturn3['default'])(this, (Input.__proto__ || Object.getPrototypeOf(Input)).apply(this, arguments)); _this.handleKeyDown = function (e) { var _this$props = _this.props, onPressEnter = _this$props.onPressEnter, onKeyDown = _this$props.onKeyDown; if (e.keyCode === 13 && onPressEnter) { onPressEnter(e); } if (onKeyDown) { onKeyDown(e); } }; return _this; } (0, _createClass3['default'])(Input, [{ key: 'focus', value: function focus() { this.refs.input.focus(); } }, { key: 'blur', value: function blur() { this.refs.input.blur(); } }, { key: 'getInputClassName', value: function getInputClassName() { var _classNames; var _props = this.props, prefixCls = _props.prefixCls, size = _props.size, disabled = _props.disabled; return (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-sm', size === 'small'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-lg', size === 'large'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-disabled', disabled), _classNames)); } }, { key: 'renderLabeledInput', value: function renderLabeledInput(children) { var props = this.props; // Not wrap when there is not addons if (!props.addonBefore && !props.addonAfter) { return children; } var wrapperClassName = props.prefixCls + '-group'; var addonClassName = wrapperClassName + '-addon'; var addonBefore = props.addonBefore ? _react2['default'].createElement( 'span', { className: addonClassName }, props.addonBefore ) : null; var addonAfter = props.addonAfter ? _react2['default'].createElement( 'span', { className: addonClassName }, props.addonAfter ) : null; var className = (0, _classnames2['default'])(props.prefixCls + '-wrapper', (0, _defineProperty3['default'])({}, wrapperClassName, addonBefore || addonAfter)); // Need another wrapper for changing display:table to display:inline-block // and put style prop in wrapper if (addonBefore || addonAfter) { return _react2['default'].createElement( 'span', { className: props.prefixCls + '-group-wrapper', style: props.style }, _react2['default'].createElement( 'span', { className: className }, addonBefore, (0, _react.cloneElement)(children, { style: null }), addonAfter ) ); } return _react2['default'].createElement( 'span', { className: className }, addonBefore, children, addonAfter ); } }, { key: 'renderLabeledIcon', value: function renderLabeledIcon(children) { var props = this.props; if (!('prefix' in props || 'suffix' in props)) { return children; } var prefix = props.prefix ? _react2['default'].createElement( 'span', { className: props.prefixCls + '-prefix' }, props.prefix ) : null; var suffix = props.suffix ? _react2['default'].createElement( 'span', { className: props.prefixCls + '-suffix' }, props.suffix ) : null; return _react2['default'].createElement( 'span', { className: (0, _classnames2['default'])(props.className, props.prefixCls + '-affix-wrapper'), style: props.style }, prefix, (0, _react.cloneElement)(children, { style: null, className: this.getInputClassName() }), suffix ); } }, { key: 'renderInput', value: function renderInput() { var _props2 = this.props, value = _props2.value, className = _props2.className; // Fix https://fb.me/react-unknown-prop var otherProps = (0, _omit2['default'])(this.props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix']); if ('value' in this.props) { otherProps.value = fixControlledValue(value); // Input elements must be either controlled or uncontrolled, // specify either the value prop, or the defaultValue prop, but not both. delete otherProps.defaultValue; } return this.renderLabeledIcon(_react2['default'].createElement('input', (0, _extends3['default'])({}, otherProps, { className: (0, _classnames2['default'])(this.getInputClassName(), className), onKeyDown: this.handleKeyDown, ref: 'input' }))); } }, { key: 'render', value: function render() { if (this.props.type === 'textarea') { return _react2['default'].createElement(_TextArea2['default'], (0, _extends3['default'])({}, this.props, { ref: 'input' })); } return this.renderLabeledInput(this.renderInput()); } }]); return Input; }(_react.Component); exports['default'] = Input; Input.defaultProps = { prefixCls: 'ant-input', type: 'text', disabled: false }; Input.propTypes = { type: _propTypes2['default'].string, id: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number]), size: _propTypes2['default'].oneOf(['small', 'default', 'large']), disabled: _propTypes2['default'].bool, value: _propTypes2['default'].any, defaultValue: _propTypes2['default'].any, className: _propTypes2['default'].string, addonBefore: _propTypes2['default'].node, addonAfter: _propTypes2['default'].node, prefixCls: _propTypes2['default'].string, autosize: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].object]), onPressEnter: _propTypes2['default'].func, onKeyDown: _propTypes2['default'].func, onFocus: _propTypes2['default'].func, onBlur: _propTypes2['default'].func, prefix: _propTypes2['default'].node, suffix: _propTypes2['default'].node }; module.exports = exports['default']; /***/ }, /* 75 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _omit = __webpack_require__(33); var _omit2 = _interopRequireDefault(_omit); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _calculateNodeHeight = __webpack_require__(158); var _calculateNodeHeight2 = _interopRequireDefault(_calculateNodeHeight); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function onNextFrame(cb) { if (window.requestAnimationFrame) { return window.requestAnimationFrame(cb); } return window.setTimeout(cb, 1); } function clearNextFrameAction(nextFrameId) { if (window.cancelAnimationFrame) { window.cancelAnimationFrame(nextFrameId); } else { window.clearTimeout(nextFrameId); } } var TextArea = function (_React$Component) { (0, _inherits3['default'])(TextArea, _React$Component); function TextArea() { (0, _classCallCheck3['default'])(this, TextArea); var _this = (0, _possibleConstructorReturn3['default'])(this, (TextArea.__proto__ || Object.getPrototypeOf(TextArea)).apply(this, arguments)); _this.state = { textareaStyles: null }; _this.resizeTextarea = function () { var autosize = _this.props.autosize; if (!autosize || !_this.textAreaRef) { return; } var minRows = autosize ? autosize.minRows : null; var maxRows = autosize ? autosize.maxRows : null; var textareaStyles = (0, _calculateNodeHeight2['default'])(_this.textAreaRef, false, minRows, maxRows); _this.setState({ textareaStyles: textareaStyles }); }; _this.handleTextareaChange = function (e) { if (!('value' in _this.props)) { _this.resizeTextarea(); } var onChange = _this.props.onChange; if (onChange) { onChange(e); } }; _this.handleKeyDown = function (e) { var _this$props = _this.props, onPressEnter = _this$props.onPressEnter, onKeyDown = _this$props.onKeyDown; if (e.keyCode === 13 && onPressEnter) { onPressEnter(e); } if (onKeyDown) { onKeyDown(e); } }; _this.saveTextAreaRef = function (textArea) { _this.textAreaRef = textArea; }; return _this; } (0, _createClass3['default'])(TextArea, [{ key: 'componentDidMount', value: function componentDidMount() { this.resizeTextarea(); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { // Re-render with the new content then recalculate the height as required. if (this.props.value !== nextProps.value) { if (this.nextFrameActionId) { clearNextFrameAction(this.nextFrameActionId); } this.nextFrameActionId = onNextFrame(this.resizeTextarea); } } }, { key: 'focus', value: function focus() { this.textAreaRef.focus(); } }, { key: 'blur', value: function blur() { this.textAreaRef.blur(); } }, { key: 'getTextAreaClassName', value: function getTextAreaClassName() { var _props = this.props, prefixCls = _props.prefixCls, disabled = _props.disabled; return (0, _classnames2['default'])(prefixCls, (0, _defineProperty3['default'])({}, prefixCls + '-disabled', disabled)); } }, { key: 'render', value: function render() { var props = this.props; var otherProps = (0, _omit2['default'])(props, ['prefixCls', 'onPressEnter', 'autosize']); var style = (0, _extends3['default'])({}, props.style, this.state.textareaStyles); // Fix https://github.com/ant-design/ant-design/issues/6776 // Make sure it could be reset when using form.getFieldDecorator if ('value' in otherProps) { otherProps.value = otherProps.value || ''; } return _react2['default'].createElement('textarea', (0, _extends3['default'])({}, otherProps, { className: (0, _classnames2['default'])(this.getTextAreaClassName(), props.className), style: style, onKeyDown: this.handleKeyDown, onChange: this.handleTextareaChange, ref: this.saveTextAreaRef })); } }]); return TextArea; }(_react2['default'].Component); exports['default'] = TextArea; TextArea.defaultProps = { prefixCls: 'ant-input' }; module.exports = exports['default']; /***/ }, /* 76 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Group = exports.Button = undefined; var _radio = __webpack_require__(40); var _radio2 = _interopRequireDefault(_radio); var _group = __webpack_require__(161); var _group2 = _interopRequireDefault(_group); var _radioButton = __webpack_require__(162); var _radioButton2 = _interopRequireDefault(_radioButton); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _radio2['default'].Button = _radioButton2['default']; _radio2['default'].Group = _group2['default']; exports.Button = _radioButton2['default']; exports.Group = _group2['default']; exports['default'] = _radio2['default']; /***/ }, /* 77 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } /** * Rule for validating required fields. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function required(rule, value, source, errors, options, type) { if (rule.required && (!source.hasOwnProperty(rule.field) || util.isEmptyValue(value, type || rule.type))) { errors.push(util.format(options.messages.required, rule.fullField)); } } exports['default'] = required; module.exports = exports['default']; /***/ }, /* 78 */, /* 79 */ /***/ function(module, exports) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex; /***/ }, /* 80 */ /***/ function(module, exports) { /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } module.exports = eq; /***/ }, /* 81 */ /***/ function(module, exports, __webpack_require__) { var baseGet = __webpack_require__(219); /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } module.exports = get; /***/ }, /* 82 */ /***/ function(module, exports, __webpack_require__) { var baseSet = __webpack_require__(223); /** * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, ['x', '0', 'y', 'z'], 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } module.exports = set; /***/ }, /* 83 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Checkbox = __webpack_require__(255); Object.defineProperty(exports, 'default', { enumerable: true, get: function get() { return _interopRequireDefault(_Checkbox)['default']; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } module.exports = exports['default']; /***/ }, /* 84 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _objectWithoutProperties2 = __webpack_require__(21); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _toConsumableArray2 = __webpack_require__(25); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _asyncValidator = __webpack_require__(177); var _asyncValidator2 = _interopRequireDefault(_asyncValidator); var _warning = __webpack_require__(51); var _warning2 = _interopRequireDefault(_warning); var _get = __webpack_require__(81); var _get2 = _interopRequireDefault(_get); var _has = __webpack_require__(44); var _has2 = _interopRequireDefault(_has); var _set = __webpack_require__(82); var _set2 = _interopRequireDefault(_set); var _createFieldsStore = __webpack_require__(260); var _createFieldsStore2 = _interopRequireDefault(_createFieldsStore); var _utils = __webpack_require__(47); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var DEFAULT_TRIGGER = 'onChange'; function createBaseForm() { var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var mixins = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var mapPropsToFields = option.mapPropsToFields, onFieldsChange = option.onFieldsChange, onValuesChange = option.onValuesChange, fieldNameProp = option.fieldNameProp, fieldMetaProp = option.fieldMetaProp, validateMessages = option.validateMessages, _option$mapProps = option.mapProps, mapProps = _option$mapProps === undefined ? _utils.mirror : _option$mapProps, _option$formPropName = option.formPropName, formPropName = _option$formPropName === undefined ? 'form' : _option$formPropName, withRef = option.withRef; function decorate(WrappedComponent) { var Form = (0, _createReactClass2['default'])({ displayName: 'Form', mixins: mixins, getInitialState: function getInitialState() { var _this = this; var fields = mapPropsToFields && mapPropsToFields(this.props); this.fieldsStore = (0, _createFieldsStore2['default'])(fields || {}); this.instances = {}; this.cachedBind = {}; // HACK: https://github.com/ant-design/ant-design/issues/6406 ['getFieldsValue', 'getFieldValue', 'setFieldsInitialValue', 'getFieldsError', 'getFieldError', 'isFieldValidating', 'isFieldsValidating', 'isFieldsTouched', 'isFieldTouched'].forEach(function (key) { return _this[key] = function () { var _fieldsStore; (0, _warning2['default'])(false, 'you should not use `ref` on enhanced form, please use `wrappedComponentRef`. ' + 'See: https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140'); return (_fieldsStore = _this.fieldsStore)[key].apply(_fieldsStore, arguments); }; }); return { submitting: false }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (mapPropsToFields) { this.fieldsStore.replaceFields(mapPropsToFields(nextProps)); } }, onCollectCommon: function onCollectCommon(name_, action, args) { var name = name_; var fieldMeta = this.fieldsStore.getFieldMeta(name); if (fieldMeta[action]) { fieldMeta[action].apply(fieldMeta, (0, _toConsumableArray3['default'])(args)); } else if (fieldMeta.originalProps && fieldMeta.originalProps[action]) { var _fieldMeta$originalPr; (_fieldMeta$originalPr = fieldMeta.originalProps)[action].apply(_fieldMeta$originalPr, (0, _toConsumableArray3['default'])(args)); } var value = fieldMeta.getValueFromEvent ? fieldMeta.getValueFromEvent.apply(fieldMeta, (0, _toConsumableArray3['default'])(args)) : _utils.getValueFromEvent.apply(undefined, (0, _toConsumableArray3['default'])(args)); if (onValuesChange && value !== this.fieldsStore.getFieldValue(name)) { onValuesChange(this.props, (0, _set2['default'])({}, name, value)); } var nameKeyObj = (0, _utils.getNameIfNested)(name); if (this.fieldsStore.getFieldMeta(nameKeyObj.name).exclusive) { name = nameKeyObj.name; } var field = this.fieldsStore.getField(name); return { name: name, field: (0, _extends3['default'])({}, field, { value: value, touched: true }), fieldMeta: fieldMeta }; }, onCollect: function onCollect(name_, action) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } var _onCollectCommon = this.onCollectCommon(name_, action, args), name = _onCollectCommon.name, field = _onCollectCommon.field, fieldMeta = _onCollectCommon.fieldMeta; var validate = fieldMeta.validate; var fieldContent = (0, _extends3['default'])({}, field, { dirty: (0, _utils.hasRules)(validate) }); this.setFields((0, _defineProperty3['default'])({}, name, fieldContent)); }, onCollectValidate: function onCollectValidate(name_, action) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } var _onCollectCommon2 = this.onCollectCommon(name_, action, args), field = _onCollectCommon2.field, fieldMeta = _onCollectCommon2.fieldMeta; var fieldContent = (0, _extends3['default'])({}, field, { dirty: true }); this.validateFieldsInternal([fieldContent], { action: action, options: { firstFields: !!fieldMeta.validateFirst } }); }, getCacheBind: function getCacheBind(name, action, fn) { var cache = this.cachedBind[name] = this.cachedBind[name] || {}; if (!cache[action]) { cache[action] = fn.bind(this, name, action); } return cache[action]; }, getFieldDecorator: function getFieldDecorator(name, fieldOption) { var _this2 = this; var props = this.getFieldProps(name, fieldOption); return function (fieldElem) { var fieldMeta = _this2.fieldsStore.getFieldMeta(name); var originalProps = fieldElem.props; if (true) { var valuePropName = fieldMeta.valuePropName; (0, _warning2['default'])(!(valuePropName in originalProps), '`getFieldDecorator` will override `' + valuePropName + '`, ' + ('so please don\'t set `' + valuePropName + '` directly ') + 'and use `setFieldsValue` to set it.'); var defaultValuePropName = 'default' + valuePropName[0].toUpperCase() + valuePropName.slice(1); (0, _warning2['default'])(!(defaultValuePropName in originalProps), '`' + defaultValuePropName + '` is invalid ' + ('for `getFieldDecorator` will set `' + valuePropName + '`,') + ' please use `option.initialValue` instead.'); } fieldMeta.originalProps = originalProps; fieldMeta.ref = fieldElem.ref; return _react2['default'].cloneElement(fieldElem, (0, _extends3['default'])({}, props, _this2.fieldsStore.getFieldValuePropValue(fieldMeta))); }; }, getFieldProps: function getFieldProps(name) { var _this3 = this; var usersFieldOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!name) { throw new Error('Must call `getFieldProps` with valid name string!'); } var nameIfNested = (0, _utils.getNameIfNested)(name); var leadingName = nameIfNested.name; var fieldOption = (0, _extends3['default'])({ valuePropName: 'value', validate: [], trigger: DEFAULT_TRIGGER, leadingName: leadingName, name: name }, usersFieldOption); var rules = fieldOption.rules, trigger = fieldOption.trigger, _fieldOption$validate = fieldOption.validateTrigger, validateTrigger = _fieldOption$validate === undefined ? trigger : _fieldOption$validate, exclusive = fieldOption.exclusive, validate = fieldOption.validate; var fieldMeta = this.fieldsStore.getFieldMeta(name); if ('initialValue' in fieldOption) { fieldMeta.initialValue = fieldOption.initialValue; } var leadingFieldMeta = this.fieldsStore.getFieldMeta(leadingName); if (nameIfNested.isNested) { leadingFieldMeta.virtual = !exclusive; // exclusive allow getFieldProps('x', {initialValue}) // non-exclusive does not allow getFieldProps('x', {initialValue}) leadingFieldMeta.hidden = !exclusive; leadingFieldMeta.exclusive = exclusive; } var inputProps = (0, _extends3['default'])({}, this.fieldsStore.getFieldValuePropValue(fieldOption), { ref: this.getCacheBind(name, name + '__ref', this.saveRef) }); if (fieldNameProp) { inputProps[fieldNameProp] = name; } var validateRules = (0, _utils.normalizeValidateRules)(validate, rules, validateTrigger); var validateTriggers = validateRules.filter(function (item) { return !!item.rules && item.rules.length; }).map(function (item) { return item.trigger; }).reduce(function (pre, curr) { return pre.concat(curr); }, []); validateTriggers.forEach(function (action) { if (inputProps[action]) return; inputProps[action] = _this3.getCacheBind(name, action, _this3.onCollectValidate); }); // make sure that the value will be collect if (trigger && validateTriggers.indexOf(trigger) === -1) { inputProps[trigger] = this.getCacheBind(name, trigger, this.onCollect); } var meta = (0, _extends3['default'])({}, fieldMeta, fieldOption, { validate: validateRules }); this.fieldsStore.setFieldMeta(name, meta); if (fieldMetaProp) { inputProps[fieldMetaProp] = meta; } return inputProps; }, getFieldInstance: function getFieldInstance(name) { return this.instances[name]; }, getRules: function getRules(fieldMeta, action) { var actionRules = fieldMeta.validate.filter(function (item) { return !action || item.trigger.indexOf(action) >= 0; }).map(function (item) { return item.rules; }); return (0, _utils.flattenArray)(actionRules); }, setFields: function setFields(fields) { var _this4 = this; this.fieldsStore.setFields(fields); if (onFieldsChange) { var changedFields = {}; Object.keys(fields).forEach(function (f) { changedFields[f] = _this4.fieldsStore.getField(f); }); onFieldsChange(this.props, changedFields); } this.forceUpdate(); }, resetFields: function resetFields(ns) { var newFields = this.fieldsStore.resetFields(ns); if (Object.keys(newFields).length > 0) { this.setFields(newFields); } }, setFieldsValue: function setFieldsValue(fieldsValue) { if (onValuesChange) { onValuesChange(this.props, fieldsValue); } var newFields = {}; var _fieldsStore2 = this.fieldsStore, fieldsMeta = _fieldsStore2.fieldsMeta, fields = _fieldsStore2.fields; var virtualPaths = (0, _utils.getVirtualPaths)(fieldsMeta); Object.keys(fieldsValue).forEach(function (name) { var value = fieldsValue[name]; if (fieldsMeta[name] && fieldsMeta[name].virtual) { (0, _utils.clearVirtualField)(name, fields, fieldsMeta); for (var i = 0, len = virtualPaths[name].length; i < len; i++) { var path = virtualPaths[name][i]; if ((0, _has2['default'])(fieldsValue, path)) { newFields[path] = { name: path, value: (0, _get2['default'])(fieldsValue, path) }; } } } else if (fieldsMeta[name]) { newFields[name] = { name: name, value: value }; } else { (0, _warning2['default'])(false, 'Cannot use `setFieldsValue` until ' + 'you use `getFieldDecorator` or `getFieldProps` to register it.'); } }); this.setFields(newFields); }, saveRef: function saveRef(name, _, component) { if (!component) { // after destroy, delete data this.fieldsStore.clearField(name); delete this.instances[name]; delete this.cachedBind[name]; return; } var fieldMeta = this.fieldsStore.getFieldMeta(name); if (fieldMeta) { var ref = fieldMeta.ref; if (ref) { if (typeof ref === 'string') { throw new Error('can not set ref string for ' + name); } ref(component); } } this.instances[name] = component; }, validateFieldsInternal: function validateFieldsInternal(fields, _ref, callback) { var _this5 = this; var fieldNames = _ref.fieldNames, action = _ref.action, _ref$options = _ref.options, options = _ref$options === undefined ? {} : _ref$options; var allRules = {}; var allValues = {}; var allFields = {}; var alreadyErrors = {}; fields.forEach(function (field) { var name = field.name; if (options.force !== true && field.dirty === false) { if (field.errors) { (0, _set2['default'])(alreadyErrors, name, { errors: field.errors }); } return; } var fieldMeta = _this5.fieldsStore.getFieldMeta(name); var newField = (0, _extends3['default'])({}, field); newField.errors = undefined; newField.validating = true; newField.dirty = true; allRules[name] = _this5.getRules(fieldMeta, action); allValues[name] = newField.value; allFields[name] = newField; }); this.setFields(allFields); // in case normalize Object.keys(allValues).forEach(function (f) { allValues[f] = _this5.fieldsStore.getFieldValue(f); }); if (callback && (0, _utils.isEmptyObject)(allFields)) { callback((0, _utils.isEmptyObject)(alreadyErrors) ? null : alreadyErrors, this.fieldsStore.getFieldsValue((0, _utils.flatFieldNames)(fieldNames))); return; } var validator = new _asyncValidator2['default'](allRules); if (validateMessages) { validator.messages(validateMessages); } validator.validate(allValues, options, function (errors) { var errorsGroup = (0, _extends3['default'])({}, alreadyErrors); if (errors && errors.length) { errors.forEach(function (e) { var fieldName = e.field; if (!(0, _has2['default'])(errorsGroup, fieldName)) { (0, _set2['default'])(errorsGroup, fieldName, { errors: [] }); } var fieldErrors = (0, _get2['default'])(errorsGroup, fieldName.concat('.errors')); fieldErrors.push(e); }); } var expired = []; var nowAllFields = {}; Object.keys(allRules).forEach(function (name) { var fieldErrors = (0, _get2['default'])(errorsGroup, name); var nowField = _this5.fieldsStore.getField(name); // avoid concurrency problems if (nowField.value !== allValues[name]) { expired.push({ name: name }); } else { nowField.errors = fieldErrors && fieldErrors.errors; nowField.value = allValues[name]; nowField.validating = false; nowField.dirty = false; nowAllFields[name] = nowField; } }); _this5.setFields(nowAllFields); if (callback) { if (expired.length) { expired.forEach(function (_ref2) { var name = _ref2.name; var fieldErrors = [{ message: name + ' need to revalidate', field: name }]; (0, _set2['default'])(errorsGroup, name, { expired: true, errors: fieldErrors }); }); } callback((0, _utils.isEmptyObject)(errorsGroup) ? null : errorsGroup, _this5.fieldsStore.getFieldsValue((0, _utils.flatFieldNames)(fieldNames))); } }); }, validateFields: function validateFields(ns, opt, cb) { var _this6 = this; var _getParams = (0, _utils.getParams)(ns, opt, cb), names = _getParams.names, callback = _getParams.callback, options = _getParams.options; var fieldNames = names || this.fieldsStore.getValidFieldsName(); var fields = fieldNames.filter(function (name) { var fieldMeta = _this6.fieldsStore.getFieldMeta(name); return (0, _utils.hasRules)(fieldMeta.validate); }).map(function (name) { var field = _this6.fieldsStore.getField(name); field.value = _this6.fieldsStore.getFieldValue(name); return field; }); if (!fields.length) { if (callback) { callback(null, this.fieldsStore.getFieldsValue((0, _utils.flatFieldNames)(fieldNames))); } return; } if (!('firstFields' in options)) { options.firstFields = fieldNames.filter(function (name) { var fieldMeta = _this6.fieldsStore.getFieldMeta(name); return !!fieldMeta.validateFirst; }); } this.validateFieldsInternal(fields, { fieldNames: fieldNames, options: options }, callback); }, isSubmitting: function isSubmitting() { return this.state.submitting; }, submit: function submit(callback) { var _this7 = this; var fn = function fn() { _this7.setState({ submitting: false }); }; this.setState({ submitting: true }); callback(fn); }, render: function render() { var _props = this.props, wrappedComponentRef = _props.wrappedComponentRef, restProps = (0, _objectWithoutProperties3['default'])(_props, ['wrappedComponentRef']); var formProps = (0, _defineProperty3['default'])({}, formPropName, this.getForm()); if (withRef) { (0, _warning2['default'])(false, '`withRef` is deprecated, please use `wrappedComponentRef` instead. ' + 'See: https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140'); formProps.ref = 'wrappedComponent'; } else if (wrappedComponentRef) { formProps.ref = wrappedComponentRef; } var props = mapProps.call(this, (0, _extends3['default'])({}, formProps, restProps)); return _react2['default'].createElement(WrappedComponent, props); } }); return (0, _utils.argumentContainer)(Form, WrappedComponent); } return decorate; } exports['default'] = createBaseForm; module.exports = exports['default']; /***/ }, /* 85 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = { ZERO: 48, NINE: 57, NUMPAD_ZERO: 96, NUMPAD_NINE: 105, BACKSPACE: 8, DELETE: 46, ENTER: 13, ARROW_UP: 38, ARROW_DOWN: 40 }; module.exports = exports['default']; /***/ }, /* 86 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = { // Options.jsx items_per_page: '条/页', jump_to: '跳至', page: '页', // Pagination.jsx prev_page: '上一页', next_page: '下一页', prev_5: '向前 5 页', next_5: '向后 5 页', prev_3: '向前 3 页', next_3: '向后 3 页' }; module.exports = exports['default']; /***/ }, /* 87 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends3 = __webpack_require__(2); var _extends4 = _interopRequireDefault(_extends3); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var stringOrNumber = _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number]); var objectOrNumber = _propTypes2['default'].oneOfType([_propTypes2['default'].object, _propTypes2['default'].number]); var Col = function (_React$Component) { (0, _inherits3['default'])(Col, _React$Component); function Col() { (0, _classCallCheck3['default'])(this, Col); return (0, _possibleConstructorReturn3['default'])(this, (Col.__proto__ || Object.getPrototypeOf(Col)).apply(this, arguments)); } (0, _createClass3['default'])(Col, [{ key: 'render', value: function render() { var _classNames; var props = this.props; var span = props.span, order = props.order, offset = props.offset, push = props.push, pull = props.pull, className = props.className, children = props.children, _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === undefined ? 'ant-col' : _props$prefixCls, others = __rest(props, ["span", "order", "offset", "push", "pull", "className", "children", "prefixCls"]); var sizeClassObj = {}; ['xs', 'sm', 'md', 'lg', 'xl'].forEach(function (size) { var _extends2; var sizeProps = {}; if (typeof props[size] === 'number') { sizeProps.span = props[size]; } else if ((0, _typeof3['default'])(props[size]) === 'object') { sizeProps = props[size] || {}; } delete others[size]; sizeClassObj = (0, _extends4['default'])({}, sizeClassObj, (_extends2 = {}, (0, _defineProperty3['default'])(_extends2, prefixCls + '-' + size + '-' + sizeProps.span, sizeProps.span !== undefined), (0, _defineProperty3['default'])(_extends2, prefixCls + '-' + size + '-order-' + sizeProps.order, sizeProps.order || sizeProps.order === 0), (0, _defineProperty3['default'])(_extends2, prefixCls + '-' + size + '-offset-' + sizeProps.offset, sizeProps.offset || sizeProps.offset === 0), (0, _defineProperty3['default'])(_extends2, prefixCls + '-' + size + '-push-' + sizeProps.push, sizeProps.push || sizeProps.push === 0), (0, _defineProperty3['default'])(_extends2, prefixCls + '-' + size + '-pull-' + sizeProps.pull, sizeProps.pull || sizeProps.pull === 0), _extends2)); }); var classes = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-' + span, span !== undefined), (0, _defineProperty3['default'])(_classNames, prefixCls + '-order-' + order, order), (0, _defineProperty3['default'])(_classNames, prefixCls + '-offset-' + offset, offset), (0, _defineProperty3['default'])(_classNames, prefixCls + '-push-' + push, push), (0, _defineProperty3['default'])(_classNames, prefixCls + '-pull-' + pull, pull), _classNames), className, sizeClassObj); return _react2['default'].createElement( 'div', (0, _extends4['default'])({}, others, { className: classes }), children ); } }]); return Col; }(_react2['default'].Component); exports['default'] = Col; Col.propTypes = { span: stringOrNumber, order: stringOrNumber, offset: stringOrNumber, push: stringOrNumber, pull: stringOrNumber, className: _propTypes2['default'].string, children: _propTypes2['default'].node, xs: objectOrNumber, sm: objectOrNumber, md: objectOrNumber, lg: objectOrNumber, xl: objectOrNumber }; module.exports = exports['default']; /***/ }, /* 88 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Row = function (_React$Component) { (0, _inherits3['default'])(Row, _React$Component); function Row() { (0, _classCallCheck3['default'])(this, Row); return (0, _possibleConstructorReturn3['default'])(this, (Row.__proto__ || Object.getPrototypeOf(Row)).apply(this, arguments)); } (0, _createClass3['default'])(Row, [{ key: 'render', value: function render() { var _classNames; var _a = this.props, type = _a.type, justify = _a.justify, align = _a.align, className = _a.className, gutter = _a.gutter, style = _a.style, children = _a.children, _a$prefixCls = _a.prefixCls, prefixCls = _a$prefixCls === undefined ? 'ant-row' : _a$prefixCls, others = __rest(_a, ["type", "justify", "align", "className", "gutter", "style", "children", "prefixCls"]); var classes = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls, !type), (0, _defineProperty3['default'])(_classNames, prefixCls + '-' + type, type), (0, _defineProperty3['default'])(_classNames, prefixCls + '-' + type + '-' + justify, type && justify), (0, _defineProperty3['default'])(_classNames, prefixCls + '-' + type + '-' + align, type && align), _classNames), className); var rowStyle = gutter > 0 ? (0, _extends3['default'])({ marginLeft: gutter / -2, marginRight: gutter / -2 }, style) : style; var cols = _react.Children.map(children, function (col) { if (!col) { return null; } if (col.props && gutter > 0) { return (0, _react.cloneElement)(col, { style: (0, _extends3['default'])({ paddingLeft: gutter / 2, paddingRight: gutter / 2 }, col.props.style) }); } return col; }); return _react2['default'].createElement( 'div', (0, _extends3['default'])({}, others, { className: classes, style: rowStyle }), cols ); } }]); return Row; }(_react2['default'].Component); exports['default'] = Row; Row.defaultProps = { gutter: 0 }; Row.propTypes = { type: _propTypes2['default'].string, align: _propTypes2['default'].string, justify: _propTypes2['default'].string, className: _propTypes2['default'].string, children: _propTypes2['default'].node, gutter: _propTypes2['default'].number, prefixCls: _propTypes2['default'].string }; module.exports = exports['default']; /***/ }, /* 89 */, /* 90 */, /* 91 */, /* 92 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var util = __webpack_require__(93); function scrollIntoView(elem, container, config) { config = config || {}; // document 归一化到 window if (container.nodeType === 9) { container = util.getWindow(container); } var allowHorizontalScroll = config.allowHorizontalScroll; var onlyScrollIfNeeded = config.onlyScrollIfNeeded; var alignWithTop = config.alignWithTop; var alignWithLeft = config.alignWithLeft; var offsetTop = config.offsetTop || 0; var offsetLeft = config.offsetLeft || 0; var offsetBottom = config.offsetBottom || 0; var offsetRight = config.offsetRight || 0; allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll; var isWin = util.isWindow(container); var elemOffset = util.offset(elem); var eh = util.outerHeight(elem); var ew = util.outerWidth(elem); var containerOffset = undefined; var ch = undefined; var cw = undefined; var containerScroll = undefined; var diffTop = undefined; var diffBottom = undefined; var win = undefined; var winScroll = undefined; var ww = undefined; var wh = undefined; if (isWin) { win = container; wh = util.height(win); ww = util.width(win); winScroll = { left: util.scrollLeft(win), top: util.scrollTop(win) }; // elem 相对 container 可视视窗的距离 diffTop = { left: elemOffset.left - winScroll.left - offsetLeft, top: elemOffset.top - winScroll.top - offsetTop }; diffBottom = { left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight, top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom }; containerScroll = winScroll; } else { containerOffset = util.offset(container); ch = container.clientHeight; cw = container.clientWidth; containerScroll = { left: container.scrollLeft, top: container.scrollTop }; // elem 相对 container 可视视窗的距离 // 注意边框, offset 是边框到根节点 diffTop = { left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft, top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop }; diffBottom = { left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight, top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom }; } if (diffTop.top < 0 || diffBottom.top > 0) { // 强制向上 if (alignWithTop === true) { util.scrollTop(container, containerScroll.top + diffTop.top); } else if (alignWithTop === false) { util.scrollTop(container, containerScroll.top + diffBottom.top); } else { // 自动调整 if (diffTop.top < 0) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } else { if (!onlyScrollIfNeeded) { alignWithTop = alignWithTop === undefined ? true : !!alignWithTop; if (alignWithTop) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } if (allowHorizontalScroll) { if (diffTop.left < 0 || diffBottom.left > 0) { // 强制向上 if (alignWithLeft === true) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else if (alignWithLeft === false) { util.scrollLeft(container, containerScroll.left + diffBottom.left); } else { // 自动调整 if (diffTop.left < 0) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } else { if (!onlyScrollIfNeeded) { alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft; if (alignWithLeft) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } } } module.exports = scrollIntoView; /***/ }, /* 93 */ /***/ function(module, exports) { 'use strict'; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; function getClientPosition(elem) { var box = undefined; var x = undefined; var y = undefined; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 box = elem.getBoundingClientRect(); // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin x = box.left; y = box.top; // In IE, most of the time, 2 extra pixels are added to the top and left // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and // IE6 standards mode, this border can be overridden by setting the // document element's border to zero -- thus, we cannot rely on the // offset always being 2 pixels. // In quirks mode, the offset can be determined by querying the body's // clientLeft/clientTop, but in standards mode, it is found by querying // the document element's clientLeft/clientTop. Since we already called // getClientBoundingRect we have already forced a reflow, so it is not // too expensive just to query them all. // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 // 窗口边框标准是设 documentElement ,quirks 时设置 body // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 // 标准 ie 下 docElem.clientTop 就是 border-top // ie7 html 即窗口边框改变不了。永远为 2 // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 x -= docElem.clientLeft || body.clientLeft || 0; y -= docElem.clientTop || body.clientTop || 0; return { left: x, top: y }; } function getScroll(w, top) { var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; var method = 'scroll' + (top ? 'Top' : 'Left'); if (typeof ret !== 'number') { var d = w.document; // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { // quirks mode ret = d.body[method]; } } return ret; } function getScrollLeft(w) { return getScroll(w); } function getScrollTop(w) { return getScroll(w, true); } function getOffset(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; var w = doc.defaultView || doc.parentWindow; pos.left += getScrollLeft(w); pos.top += getScrollTop(w); return pos; } function _getComputedStyle(elem, name, computedStyle_) { var val = ''; var d = elem.ownerDocument; var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null); // https://github.com/kissyteam/kissy/issues/61 if (computedStyle) { val = computedStyle.getPropertyValue(name) || computedStyle[name]; } return val; } var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); var RE_POS = /^(top|right|bottom|left)$/; var CURRENT_STYLE = 'currentStyle'; var RUNTIME_STYLE = 'runtimeStyle'; var LEFT = 'left'; var PX = 'px'; function _getComputedStyleIE(elem, name) { // currentStyle maybe null // http://msdn.microsoft.com/en-us/library/ms535231.aspx var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 // 在 ie 下不对,需要直接用 offset 方式 // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // exclude left right for relativity if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { // Remember the original values var style = elem.style; var left = style[LEFT]; var rsLeft = elem[RUNTIME_STYLE][LEFT]; // prevent flashing of content elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; // Put in the new values to get a computed value out style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; ret = style.pixelLeft + PX; // Revert the changed values style[LEFT] = left; elem[RUNTIME_STYLE][LEFT] = rsLeft; } return ret === '' ? 'auto' : ret; } var getComputedStyleX = undefined; if (typeof window !== 'undefined') { getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; } function each(arr, fn) { for (var i = 0; i < arr.length; i++) { fn(arr[i]); } } function isBorderBoxFn(elem) { return getComputedStyleX(elem, 'boxSizing') === 'border-box'; } var BOX_MODELS = ['margin', 'border', 'padding']; var CONTENT_INDEX = -1; var PADDING_INDEX = 2; var BORDER_INDEX = 1; var MARGIN_INDEX = 0; function swap(elem, options, callback) { var old = {}; var style = elem.style; var name = undefined; // Remember the old values, and insert the new ones for (name in options) { if (options.hasOwnProperty(name)) { old[name] = style[name]; style[name] = options[name]; } } callback.call(elem); // Revert the old values for (name in options) { if (options.hasOwnProperty(name)) { style[name] = old[name]; } } } function getPBMWidth(elem, props, which) { var value = 0; var prop = undefined; var j = undefined; var i = undefined; for (j = 0; j < props.length; j++) { prop = props[j]; if (prop) { for (i = 0; i < which.length; i++) { var cssProp = undefined; if (prop === 'border') { cssProp = prop + which[i] + 'Width'; } else { cssProp = prop + which[i]; } value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; } } } return value; } /** * A crude way of determining if an object is a window * @member util */ function isWindow(obj) { // must use == for ie8 /* eslint eqeqeq:0 */ return obj != null && obj == obj.window; } var domUtils = {}; each(['Width', 'Height'], function (name) { domUtils['doc' + name] = function (refWin) { var d = refWin.document; return Math.max( // firefox chrome documentElement.scrollHeight< body.scrollHeight // ie standard mode : documentElement.scrollHeight> body.scrollHeight d.documentElement['scroll' + name], // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? d.body['scroll' + name], domUtils['viewport' + name](d)); }; domUtils['viewport' + name] = function (win) { // pc browser includes scrollbar in window.innerWidth var prop = 'client' + name; var doc = win.document; var body = doc.body; var documentElement = doc.documentElement; var documentElementProp = documentElement[prop]; // 标准模式取 documentElement // backcompat 取 body return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; }; }); /* 得到元素的大小信息 @param elem @param name @param {String} [extra] 'padding' : (css width) + padding 'border' : (css width) + padding + border 'margin' : (css width) + padding + border + margin */ function getWH(elem, name, extra) { if (isWindow(elem)) { return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); } else if (elem.nodeType === 9) { return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); } var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem, computedStyle); var cssBoxValue = 0; if (borderBoxValue == null || borderBoxValue <= 0) { borderBoxValue = undefined; // Fall back to computed then un computed css if necessary cssBoxValue = getComputedStyleX(elem, name); if (cssBoxValue == null || Number(cssBoxValue) < 0) { cssBoxValue = elem.style[name] || 0; } // Normalize '', auto, and prepare for extra cssBoxValue = parseFloat(cssBoxValue) || 0; } if (extra === undefined) { extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; } var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; var val = borderBoxValue || cssBoxValue; if (extra === CONTENT_INDEX) { if (borderBoxValueOrIsBorderBox) { return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); } return cssBoxValue; } if (borderBoxValueOrIsBorderBox) { var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle); return val + (extra === BORDER_INDEX ? 0 : padding); } return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); } var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; // fix #119 : https://github.com/kissyteam/kissy/issues/119 function getWHIgnoreDisplay(elem) { var val = undefined; var args = arguments; // in case elem is window // elem.offsetWidth === undefined if (elem.offsetWidth !== 0) { val = getWH.apply(undefined, args); } else { swap(elem, cssShow, function () { val = getWH.apply(undefined, args); }); } return val; } function css(el, name, v) { var value = v; if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { for (var i in name) { if (name.hasOwnProperty(i)) { css(el, i, name[i]); } } return undefined; } if (typeof value !== 'undefined') { if (typeof value === 'number') { value += 'px'; } el.style[name] = value; return undefined; } return getComputedStyleX(el, name); } each(['width', 'height'], function (name) { var first = name.charAt(0).toUpperCase() + name.slice(1); domUtils['outer' + first] = function (el, includeMargin) { return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); }; var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; domUtils[name] = function (elem, val) { if (val !== undefined) { if (elem) { var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem); if (isBorderBox) { val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); } return css(elem, name, val); } return undefined; } return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); }; }); // 设置 elem 相对 elem.ownerDocument 的坐标 function setOffset(elem, offset) { // set position first, in-case top/left are set even on static elem if (css(elem, 'position') === 'static') { elem.style.position = 'relative'; } var old = getOffset(elem); var ret = {}; var current = undefined; var key = undefined; for (key in offset) { if (offset.hasOwnProperty(key)) { current = parseFloat(css(elem, key)) || 0; ret[key] = current + offset[key] - old[key]; } } css(elem, ret); } module.exports = _extends({ getWindow: function getWindow(node) { var doc = node.ownerDocument || node; return doc.defaultView || doc.parentWindow; }, offset: function offset(el, value) { if (typeof value !== 'undefined') { setOffset(el, value); } else { return getOffset(el); } }, isWindow: isWindow, each: each, css: css, clone: function clone(obj) { var ret = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { ret[i] = obj[i]; } } var overflow = obj.overflow; if (overflow) { for (var i in obj) { if (obj.hasOwnProperty(i)) { ret.overflow[i] = obj.overflow[i]; } } } return ret; }, scrollLeft: function scrollLeft(w, v) { if (isWindow(w)) { if (v === undefined) { return getScrollLeft(w); } window.scrollTo(v, getScrollTop(w)); } else { if (v === undefined) { return w.scrollLeft; } w.scrollLeft = v; } }, scrollTop: function scrollTop(w, v) { if (isWindow(w)) { if (v === undefined) { return getScrollTop(w); } window.scrollTo(getScrollLeft(w), v); } else { if (v === undefined) { return w.scrollTop; } w.scrollTop = v; } }, viewportWidth: 0, viewportHeight: 0 }, domUtils); /***/ }, /* 94 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcTooltip = __webpack_require__(118); var _rcTooltip2 = _interopRequireDefault(_rcTooltip); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _placements = __webpack_require__(105); var _placements2 = _interopRequireDefault(_placements); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var splitObject = function splitObject(obj, keys) { var picked = {}; var omited = (0, _extends3['default'])({}, obj); keys.forEach(function (key) { if (obj && key in obj) { picked[key] = obj[key]; delete omited[key]; } }); return { picked: picked, omited: omited }; }; var Tooltip = function (_React$Component) { (0, _inherits3['default'])(Tooltip, _React$Component); function Tooltip(props) { (0, _classCallCheck3['default'])(this, Tooltip); var _this = (0, _possibleConstructorReturn3['default'])(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, props)); _this.onVisibleChange = function (visible) { var onVisibleChange = _this.props.onVisibleChange; if (!('visible' in _this.props)) { _this.setState({ visible: _this.isNoTitle() ? false : visible }); } if (onVisibleChange && !_this.isNoTitle()) { onVisibleChange(visible); } }; // 动态设置动画点 _this.onPopupAlign = function (domNode, align) { var placements = _this.getPlacements(); // 当前返回的位置 var placement = Object.keys(placements).filter(function (key) { return placements[key].points[0] === align.points[0] && placements[key].points[1] === align.points[1]; })[0]; if (!placement) { return; } // 根据当前坐标设置动画点 var rect = domNode.getBoundingClientRect(); var transformOrigin = { top: '50%', left: '50%' }; if (placement.indexOf('top') >= 0 || placement.indexOf('Bottom') >= 0) { transformOrigin.top = rect.height - align.offset[1] + 'px'; } else if (placement.indexOf('Top') >= 0 || placement.indexOf('bottom') >= 0) { transformOrigin.top = -align.offset[1] + 'px'; } if (placement.indexOf('left') >= 0 || placement.indexOf('Right') >= 0) { transformOrigin.left = rect.width - align.offset[0] + 'px'; } else if (placement.indexOf('right') >= 0 || placement.indexOf('Left') >= 0) { transformOrigin.left = -align.offset[0] + 'px'; } domNode.style.transformOrigin = transformOrigin.left + ' ' + transformOrigin.top; }; _this.state = { visible: !!props.visible }; return _this; } (0, _createClass3['default'])(Tooltip, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('visible' in nextProps) { this.setState({ visible: nextProps.visible }); } } }, { key: 'getPopupDomNode', value: function getPopupDomNode() { return this.refs.tooltip.getPopupDomNode(); } }, { key: 'getPlacements', value: function getPlacements() { var _props = this.props, builtinPlacements = _props.builtinPlacements, arrowPointAtCenter = _props.arrowPointAtCenter, autoAdjustOverflow = _props.autoAdjustOverflow; return builtinPlacements || (0, _placements2['default'])({ arrowPointAtCenter: arrowPointAtCenter, verticalArrowShift: 8, autoAdjustOverflow: autoAdjustOverflow }); } }, { key: 'isHoverTrigger', value: function isHoverTrigger() { var trigger = this.props.trigger; if (!trigger || trigger === 'hover') { return true; } if (Array.isArray(trigger)) { return trigger.indexOf('hover') >= 0; } return false; } // Fix Tooltip won't hide at disabled button // mouse events don't trigger at disabled button in Chrome // https://github.com/react-component/tooltip/issues/18 }, { key: 'getDisabledCompatibleChildren', value: function getDisabledCompatibleChildren(element) { if ((element.type.__ANT_BUTTON || element.type === 'button') && element.props.disabled && this.isHoverTrigger()) { // Pick some layout related style properties up to span // Prevent layout bugs like https://github.com/ant-design/ant-design/issues/5254 var _splitObject = splitObject(element.props.style, ['position', 'left', 'right', 'top', 'bottom', 'float', 'display', 'zIndex']), picked = _splitObject.picked, omited = _splitObject.omited; var spanStyle = (0, _extends3['default'])({ display: 'inline-block' }, picked, { cursor: 'not-allowed' }); var buttonStyle = (0, _extends3['default'])({}, omited, { pointerEvents: 'none' }); var child = (0, _react.cloneElement)(element, { style: buttonStyle, className: null }); return _react2['default'].createElement( 'span', { style: spanStyle, className: element.props.className }, child ); } return element; } }, { key: 'isNoTitle', value: function isNoTitle() { var _props2 = this.props, title = _props2.title, overlay = _props2.overlay; return !title && !overlay; // overlay for old version compatibility } }, { key: 'render', value: function render() { var props = this.props, state = this.state; var prefixCls = props.prefixCls, title = props.title, overlay = props.overlay, openClassName = props.openClassName, getPopupContainer = props.getPopupContainer, getTooltipContainer = props.getTooltipContainer; var children = props.children; var visible = state.visible; // Hide tooltip when there is no title if (!('visible' in props) && this.isNoTitle()) { visible = false; } var child = this.getDisabledCompatibleChildren(_react2['default'].isValidElement(children) ? children : _react2['default'].createElement( 'span', null, children )); var childProps = child.props; var childCls = (0, _classnames2['default'])(childProps.className, (0, _defineProperty3['default'])({}, openClassName || prefixCls + '-open', true)); return _react2['default'].createElement( _rcTooltip2['default'], (0, _extends3['default'])({}, this.props, { getTooltipContainer: getPopupContainer || getTooltipContainer, ref: 'tooltip', builtinPlacements: this.getPlacements(), overlay: overlay || title || '', visible: visible, onVisibleChange: this.onVisibleChange, onPopupAlign: this.onPopupAlign }), visible ? (0, _react.cloneElement)(child, { className: childCls }) : child ); } }]); return Tooltip; }(_react2['default'].Component); exports['default'] = Tooltip; Tooltip.defaultProps = { prefixCls: 'ant-tooltip', placement: 'top', transitionName: 'zoom-big-fast', mouseEnterDelay: 0.1, mouseLeaveDelay: 0.1, arrowPointAtCenter: false, autoAdjustOverflow: true }; module.exports = exports['default']; /***/ }, /* 95 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 96 */ /***/ function(module, exports) { /** * lodash 3.9.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** `Object#toString` result references. */ var funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** Used for native method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(fnToString.call(value)); } return isObjectLike(value) && reIsHostCtor.test(value); } module.exports = getNative; /***/ }, /* 97 */ /***/ function(module, exports) { /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } module.exports = isArguments; /***/ }, /* 98 */ /***/ function(module, exports) { /** * lodash 3.0.4 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** `Object#toString` result references. */ var arrayTag = '[object Array]', funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** Used for native method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /* Native method references for those with the same name as other `lodash` methods. */ var nativeIsArray = getNative(Array, 'isArray'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(function() { return arguments; }()); * // => false */ var isArray = nativeIsArray || function(value) { return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; }; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(fnToString.call(value)); } return isObjectLike(value) && reIsHostCtor.test(value); } module.exports = isArray; /***/ }, /* 99 */, /* 100 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var fetchKeys = __webpack_require__(54); module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = fetchKeys(objA); var keysB = fetchKeys(objB); var len = keysA.length; if (len !== keysB.length) { return false; } compareContext = compareContext || null; // Test for A's keys different from B. var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); for (var i = 0; i < len; i++) { var key = keysA[i]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (_ret === false || _ret === void 0 && valueA !== valueB) { return false; } } return true; }; /***/ }, /* 101 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcMenu = __webpack_require__(20); var _rcMenu2 = _interopRequireDefault(_rcMenu); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _openAnimation = __webpack_require__(122); var _openAnimation2 = _interopRequireDefault(_openAnimation); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); var _MenuItem = __webpack_require__(126); var _MenuItem2 = _interopRequireDefault(_MenuItem); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Menu = function (_React$Component) { (0, _inherits3['default'])(Menu, _React$Component); function Menu(props) { (0, _classCallCheck3['default'])(this, Menu); var _this = (0, _possibleConstructorReturn3['default'])(this, (Menu.__proto__ || Object.getPrototypeOf(Menu)).call(this, props)); _this.inlineOpenKeys = []; _this.handleClick = function (e) { _this.setOpenKeys([]); var onClick = _this.props.onClick; if (onClick) { onClick(e); } }; _this.handleOpenChange = function (openKeys) { _this.setOpenKeys(openKeys); var onOpenChange = _this.props.onOpenChange; if (onOpenChange) { onOpenChange(openKeys); } }; (0, _warning2['default'])(!('onOpen' in props || 'onClose' in props), '`onOpen` and `onClose` are removed, please use `onOpenChange` instead, ' + 'see: https://u.ant.design/menu-on-open-change.'); (0, _warning2['default'])(!('inlineCollapsed' in props && props.mode !== 'inline'), '`inlineCollapsed` should only be used when Menu\'s `mode` is inline.'); var openKeys = void 0; if ('defaultOpenKeys' in props) { openKeys = props.defaultOpenKeys; } else if ('openKeys' in props) { openKeys = props.openKeys; } _this.state = { openKeys: openKeys || [] }; return _this; } (0, _createClass3['default'])(Menu, [{ key: 'getChildContext', value: function getChildContext() { return { inlineCollapsed: this.getInlineCollapsed() }; } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps, nextContext) { if (this.props.mode === 'inline' && nextProps.mode !== 'inline') { this.switchModeFromInline = true; } if (nextProps.inlineCollapsed && !this.props.inlineCollapsed || nextContext.siderCollapsed && !this.context.siderCollapsed) { this.switchModeFromInline = true; this.inlineOpenKeys = this.state.openKeys; this.setOpenKeys([]); } if (!nextProps.inlineCollapsed && this.props.inlineCollapsed || !nextContext.siderCollapsed && this.context.siderCollapsed) { this.setOpenKeys(this.inlineOpenKeys); this.inlineOpenKeys = []; } if ('openKeys' in nextProps) { this.setState({ openKeys: nextProps.openKeys }); } } }, { key: 'setOpenKeys', value: function setOpenKeys(openKeys) { if (!('openKeys' in this.props)) { this.setState({ openKeys: openKeys }); } } }, { key: 'getRealMenuMode', value: function getRealMenuMode() { var mode = this.props.mode; return this.getInlineCollapsed() ? 'vertical' : mode; } }, { key: 'getInlineCollapsed', value: function getInlineCollapsed() { var inlineCollapsed = this.props.inlineCollapsed; if (this.context.siderCollapsed !== undefined) { return this.context.siderCollapsed; } return inlineCollapsed; } }, { key: 'getMenuOpenAnimation', value: function getMenuOpenAnimation() { var _props = this.props, openAnimation = _props.openAnimation, openTransitionName = _props.openTransitionName; var menuMode = this.getRealMenuMode(); var menuOpenAnimation = openAnimation || openTransitionName; if (openAnimation === undefined && openTransitionName === undefined) { switch (menuMode) { case 'horizontal': menuOpenAnimation = 'slide-up'; break; case 'vertical': // When mode switch from inline // submenu should hide without animation if (this.switchModeFromInline) { menuOpenAnimation = ''; this.switchModeFromInline = false; } else { menuOpenAnimation = 'zoom-big'; } break; case 'inline': menuOpenAnimation = _openAnimation2['default']; break; default: } } return menuOpenAnimation; } }, { key: 'render', value: function render() { var _props2 = this.props, prefixCls = _props2.prefixCls, className = _props2.className, theme = _props2.theme; var menuMode = this.getRealMenuMode(); var menuOpenAnimation = this.getMenuOpenAnimation(); var menuClassName = (0, _classnames2['default'])(className, prefixCls + '-' + theme, (0, _defineProperty3['default'])({}, prefixCls + '-inline-collapsed', this.getInlineCollapsed())); var menuProps = { openKeys: this.state.openKeys, onOpenChange: this.handleOpenChange, className: menuClassName, mode: menuMode }; if (menuMode !== 'inline') { // closing vertical popup submenu after click it menuProps.onClick = this.handleClick; menuProps.openTransitionName = menuOpenAnimation; } else { menuProps.openAnimation = menuOpenAnimation; } return _react2['default'].createElement(_rcMenu2['default'], (0, _extends3['default'])({}, this.props, menuProps)); } }]); return Menu; }(_react2['default'].Component); exports['default'] = Menu; Menu.Divider = _rcMenu.Divider; Menu.Item = _MenuItem2['default']; Menu.SubMenu = _rcMenu.SubMenu; Menu.ItemGroup = _rcMenu.ItemGroup; Menu.defaultProps = { prefixCls: 'ant-menu', className: '', theme: 'light' }; Menu.childContextTypes = { inlineCollapsed: _propTypes2['default'].bool }; Menu.contextTypes = { siderCollapsed: _propTypes2['default'].bool }; module.exports = exports['default']; /***/ }, /* 102 */, /* 103 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = getRequestAnimationFrame; exports.cancelRequestAnimationFrame = cancelRequestAnimationFrame; var availablePrefixs = ['moz', 'ms', 'webkit']; function requestAnimationFramePolyfill() { var lastTime = 0; return function (callback) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } function getRequestAnimationFrame() { if (typeof window === 'undefined') { return function () {}; } if (window.requestAnimationFrame) { return window.requestAnimationFrame; } var prefix = availablePrefixs.filter(function (key) { return key + 'RequestAnimationFrame' in window; })[0]; return prefix ? window[prefix + 'RequestAnimationFrame'] : requestAnimationFramePolyfill(); } function cancelRequestAnimationFrame(id) { if (typeof window === 'undefined') { return null; } if (window.cancelAnimationFrame) { return window.cancelAnimationFrame(id); } var prefix = availablePrefixs.filter(function (key) { return key + 'CancelAnimationFrame' in window || key + 'CancelRequestAnimationFrame' in window; })[0]; return prefix ? (window[prefix + 'CancelAnimationFrame'] || window[prefix + 'CancelRequestAnimationFrame']).call(this, id) : clearTimeout(id); } /***/ }, /* 104 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(208); __webpack_require__(24); /***/ }, /* 105 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports.getOverflowOptions = getOverflowOptions; exports['default'] = getPlacements; var _placements = __webpack_require__(55); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var autoAdjustOverflowEnabled = { adjustX: 1, adjustY: 1 }; var autoAdjustOverflowDisabled = { adjustX: 0, adjustY: 0 }; var targetOffset = [0, 0]; function getOverflowOptions(autoAdjustOverflow) { if (typeof autoAdjustOverflow === 'boolean') { return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled; } return (0, _extends3['default'])({}, autoAdjustOverflowDisabled, autoAdjustOverflow); } function getPlacements() { var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _config$arrowWidth = config.arrowWidth, arrowWidth = _config$arrowWidth === undefined ? 5 : _config$arrowWidth, _config$horizontalArr = config.horizontalArrowShift, horizontalArrowShift = _config$horizontalArr === undefined ? 16 : _config$horizontalArr, _config$verticalArrow = config.verticalArrowShift, verticalArrowShift = _config$verticalArrow === undefined ? 12 : _config$verticalArrow, _config$autoAdjustOve = config.autoAdjustOverflow, autoAdjustOverflow = _config$autoAdjustOve === undefined ? true : _config$autoAdjustOve; var placementMap = { left: { points: ['cr', 'cl'], offset: [-4, 0] }, right: { points: ['cl', 'cr'], offset: [4, 0] }, top: { points: ['bc', 'tc'], offset: [0, -4] }, bottom: { points: ['tc', 'bc'], offset: [0, 4] }, topLeft: { points: ['bl', 'tc'], offset: [-(horizontalArrowShift + arrowWidth), -4] }, leftTop: { points: ['tr', 'cl'], offset: [-4, -(verticalArrowShift + arrowWidth)] }, topRight: { points: ['br', 'tc'], offset: [horizontalArrowShift + arrowWidth, -4] }, rightTop: { points: ['tl', 'cr'], offset: [4, -(verticalArrowShift + arrowWidth)] }, bottomRight: { points: ['tr', 'bc'], offset: [horizontalArrowShift + arrowWidth, 4] }, rightBottom: { points: ['bl', 'cr'], offset: [4, verticalArrowShift + arrowWidth] }, bottomLeft: { points: ['tl', 'bc'], offset: [-(horizontalArrowShift + arrowWidth), 4] }, leftBottom: { points: ['br', 'cl'], offset: [-4, verticalArrowShift + arrowWidth] } }; Object.keys(placementMap).forEach(function (key) { placementMap[key] = config.arrowPointAtCenter ? (0, _extends3['default'])({}, placementMap[key], { overflow: getOverflowOptions(autoAdjustOverflow), targetOffset: targetOffset }) : (0, _extends3['default'])({}, _placements.placements[key], { overflow: getOverflowOptions(autoAdjustOverflow) }); }); return placementMap; } /***/ }, /* 106 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * Created by lvliqi on 2017/2/27. */ var Q = __webpack_require__(113); var request = function request(url, data, type) { var defer = Q.defer(); data = data || {}; data.from = 'pc'; $.ajax({ url: url, data: data, type: type || 'GET', dataType: 'JSON', success: function success(data) { if (data.errno) { defer.reject(new Error(data.errdesc)); } else { defer.resolve(data); } }, error: function error() { defer.reject(new Error('网络错误')); } }); return defer.promise; }; exports.default = request; module.exports = exports['default']; /***/ }, /* 107 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(19); var _utils2 = _interopRequireDefault(_utils); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function adjustForViewport(elFuturePos, elRegion, xRect, yRect, overflow) { var pos = _utils2['default'].clone(elFuturePos); var size = { width: elRegion.width, height: elRegion.height }; if (overflow.adjustX && pos.left < xRect.left) { pos.left = xRect.left; } // Left edge inside and right edge outside viewport, try to resize it. if (overflow.resizeWidth && pos.left >= xRect.left && pos.left + size.width > xRect.right) { size.width -= pos.left + size.width - xRect.right; } // Right edge outside viewport, try to move it. if (overflow.adjustX && pos.left + size.width > xRect.right) { // 保证左边界和可视区域左边界对齐 pos.left = Math.max(xRect.right - size.width, xRect.left); } // Top edge outside viewport, try to move it. if (overflow.adjustY && pos.top < yRect.top) { pos.top = yRect.top; } // Top edge inside and bottom edge outside viewport, try to resize it. if (overflow.resizeHeight && pos.top >= yRect.top && pos.top + size.height > yRect.bottom) { size.height -= pos.top + size.height - yRect.bottom; } // Bottom edge outside viewport, try to move it. if (overflow.adjustY && pos.top + size.height > yRect.bottom) { // 保证上边界和可视区域上边界对齐 pos.top = Math.max(yRect.bottom - size.height, yRect.top); } return _utils2['default'].mix(pos, size); } exports['default'] = adjustForViewport; module.exports = exports['default']; /***/ }, /* 108 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _getAlignOffset = __webpack_require__(52); var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { var xy = void 0; var diff = void 0; var p1 = void 0; var p2 = void 0; xy = { left: elRegion.left, top: elRegion.top }; p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]); p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]); diff = [p2.left - p1.left, p2.top - p1.top]; return { left: xy.left - diff[0] + offset[0] - targetOffset[0], top: xy.top - diff[1] + offset[1] - targetOffset[1] }; } exports['default'] = getElFuturePos; module.exports = exports['default']; /***/ }, /* 109 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(19); var _utils2 = _interopRequireDefault(_utils); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function getRegion(node) { var offset = void 0; var w = void 0; var h = void 0; if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) { offset = _utils2['default'].offset(node); w = _utils2['default'].outerWidth(node); h = _utils2['default'].outerHeight(node); } else { var win = _utils2['default'].getWindow(node); offset = { left: _utils2['default'].getWindowScrollLeft(win), top: _utils2['default'].getWindowScrollTop(win) }; w = _utils2['default'].viewportWidth(win); h = _utils2['default'].viewportHeight(win); } offset.width = w; offset.height = h; return offset; } exports['default'] = getRegion; module.exports = exports['default']; /***/ }, /* 110 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(19); var _utils2 = _interopRequireDefault(_utils); var _getOffsetParent = __webpack_require__(53); var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * 获得元素的显示部分的区域 */ function getVisibleRectForElement(element) { var visibleRect = { left: 0, right: Infinity, top: 0, bottom: Infinity }; var el = (0, _getOffsetParent2['default'])(element); var scrollX = void 0; var scrollY = void 0; var winSize = void 0; var doc = _utils2['default'].getDocument(element); var win = doc.defaultView || doc.parentWindow; var body = doc.body; var documentElement = doc.documentElement; // Determine the size of the visible rect by climbing the dom accounting for // all scrollable containers. while (el) { // clientWidth is zero for inline block elements in ie. if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && // body may have overflow set on it, yet we still get the entire // viewport. In some browsers, el.offsetParent may be // document.documentElement, so check for that too. el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') { var pos = _utils2['default'].offset(el); // add border pos.left += el.clientLeft; pos.top += el.clientTop; visibleRect.top = Math.max(visibleRect.top, pos.top); visibleRect.right = Math.min(visibleRect.right, // consider area without scrollBar pos.left + el.clientWidth); visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); visibleRect.left = Math.max(visibleRect.left, pos.left); } else if (el === body || el === documentElement) { break; } el = (0, _getOffsetParent2['default'])(el); } // Clip by window's viewport. scrollX = _utils2['default'].getWindowScrollLeft(win); scrollY = _utils2['default'].getWindowScrollTop(win); visibleRect.left = Math.max(visibleRect.left, scrollX); visibleRect.top = Math.max(visibleRect.top, scrollY); winSize = { width: _utils2['default'].viewportWidth(win), height: _utils2['default'].viewportHeight(win) }; visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; } exports['default'] = getVisibleRectForElement; module.exports = exports['default']; /***/ }, /* 111 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _utils = __webpack_require__(19); var _utils2 = _interopRequireDefault(_utils); var _getOffsetParent = __webpack_require__(53); var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); var _getVisibleRectForElement = __webpack_require__(110); var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); var _adjustForViewport = __webpack_require__(107); var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); var _getRegion = __webpack_require__(109); var _getRegion2 = _interopRequireDefault(_getRegion); var _getElFuturePos = __webpack_require__(108); var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); var _getAlignOffset = __webpack_require__(52); var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** * align dom node flexibly * @author yiminghe@gmail.com */ // http://yiminghe.iteye.com/blog/1124720 function isFailX(elFuturePos, elRegion, visibleRect) { return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; } function isFailY(elFuturePos, elRegion, visibleRect) { return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; } function isCompleteFailX(elFuturePos, elRegion, visibleRect) { return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left; } function isCompleteFailY(elFuturePos, elRegion, visibleRect) { return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top; } function isOutOfVisibleRect(target) { var visibleRect = (0, _getVisibleRectForElement2['default'])(target); var targetRegion = (0, _getRegion2['default'])(target); return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom; } function flip(points, reg, map) { var ret = []; _utils2['default'].each(points, function (p) { ret.push(p.replace(reg, function (m) { return map[m]; })); }); return ret; } function flipOffset(offset, index) { offset[index] = -offset[index]; return offset; } function convertOffset(str, offsetLen) { var n = void 0; if (/%$/.test(str)) { n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; } else { n = parseInt(str, 10); } return n || 0; } function ySize(region) { return region.bottom - region.top; } function xSize(region) { return region.right - region.left; } function normalizeOffset(offset, el) { offset[0] = convertOffset(offset[0], el.width); offset[1] = convertOffset(offset[1], el.height); } function domAlign(el, refNode, align) { var points = align.points; var offset = align.offset || [0, 0]; var targetOffset = align.targetOffset || [0, 0]; var overflow = align.overflow; var target = align.target || refNode; var source = align.source || el; offset = [].concat(offset); targetOffset = [].concat(targetOffset); overflow = overflow || {}; var newOverflowCfg = {}; var fail = 0; // 当前节点可以被放置的显示区域 var visibleRect = (0, _getVisibleRectForElement2['default'])(source); // 当前节点所占的区域, left/top/width/height var elRegion = (0, _getRegion2['default'])(source); // 参照节点所占的区域, left/top/width/height var refNodeRegion = (0, _getRegion2['default'])(target); // 将 offset 转换成数值,支持百分比 normalizeOffset(offset, elRegion); normalizeOffset(targetOffset, refNodeRegion); // 当前节点将要被放置的位置 var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); // 当前节点将要所处的区域 var newElRegion = _utils2['default'].merge(elRegion, elFuturePos); var isTargetNotOutOfVisible = !isOutOfVisibleRect(target); var refNodeOffset = _utils2['default'].merge(refNodeRegion, (0, _getAlignOffset2['default'])(refNodeRegion, points[1])); var Xregion = void 0; var YRegion = void 0; var xRefPoint = points[0].charAt(1); // TODO if visibleRect.xx < refNodeOffset.left ?? if (xRefPoint === 'c') { Xregion = _utils2['default'].merge(visibleRect, { left: refNodeOffset.left - elRegion.width / 2 }); } else { Xregion = _utils2['default'].merge(visibleRect, _defineProperty({}, xRefPoint === 'l' ? 'left' : 'right', refNodeOffset.left + offset[0])); } var yRefPoint = points[0].charAt(0); if (yRefPoint === 'c') { YRegion = _utils2['default'].merge(visibleRect, { top: refNodeOffset.top - elRegion.height / 2 }); } else { YRegion = _utils2['default'].merge(visibleRect, _defineProperty({}, yRefPoint === 't' ? 'top' : 'bottom', refNodeOffset.top + offset[1])); } var realXRegion = Xregion; var realYRegion = YRegion; // 如果可视区域不能完全放置当前节点时允许调整 if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTargetNotOutOfVisible) { if (overflow.adjustX) { // 如果横向不能放下 if (isFailX(elFuturePos, elRegion, visibleRect)) { // 对齐位置反下 var newPoints = flip(points, /[lr]/ig, { l: 'r', r: 'l' }); // 偏移量也反下 var newOffset = flipOffset(offset, 0); var newTargetOffset = flipOffset(targetOffset, 0); var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset); var XregionReversal = _utils2['default'].merge(visibleRect, _defineProperty({}, newPoints[0].charAt(1) === 'l' ? 'left' : 'right', (0, _getAlignOffset2['default'])(refNodeRegion, newPoints[1]).left)); var canXFlip = xSize(XregionReversal) > xSize(Xregion); if (canXFlip && !isCompleteFailX(newElFuturePos, elRegion, visibleRect)) { fail = 1; points = newPoints; offset = newOffset; targetOffset = newTargetOffset; realXRegion = XregionReversal; } } } if (overflow.adjustY) { // 如果纵向不能放下 if (isFailY(elFuturePos, elRegion, visibleRect)) { // 对齐位置反下 var _newPoints = flip(points, /[tb]/ig, { t: 'b', b: 't' }); // 偏移量也反下 var _newOffset = flipOffset(offset, 1); var _newTargetOffset = flipOffset(targetOffset, 1); var _newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset); var YRegionReversal = _utils2['default'].merge(visibleRect, _defineProperty({}, _newPoints[0].charAt(0) === 't' ? 'top' : 'bottom', (0, _getAlignOffset2['default'])(refNodeRegion, _newPoints[1]).top)); var canYFlip = ySize(YRegionReversal) > ySize(YRegion); if (canYFlip && !isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) { fail = 1; points = _newPoints; offset = _newOffset; targetOffset = _newTargetOffset; realYRegion = YRegionReversal; } } } // 如果失败,重新计算当前节点将要被放置的位置 if (fail) { elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); _utils2['default'].mix(newElRegion, elFuturePos); } newOverflowCfg.resizeHeight = overflow.resizeHeight; newOverflowCfg.resizeWidth = overflow.resizeWidth; // 检查反下后的位置是否可以放下了 // 如果仍然放不下只有指定了可以调整当前方向才调整 newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, realXRegion); newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, realYRegion); // 确实要调整,甚至可能会调整高度宽度 if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, realXRegion, realYRegion, newOverflowCfg); } } // need judge to in case set fixed with in css on height auto element if (newElRegion.width !== elRegion.width) { _utils2['default'].css(source, 'width', _utils2['default'].width(source) + newElRegion.width - elRegion.width); } if (newElRegion.height !== elRegion.height) { _utils2['default'].css(source, 'height', _utils2['default'].height(source) + newElRegion.height - elRegion.height); } // https://github.com/kissyteam/kissy/issues/190 // 相对于屏幕位置没变,而 left/top 变了 // 例如 <div 'relative'><el absolute></div> _utils2['default'].offset(source, { left: newElRegion.left, top: newElRegion.top }, { useCssRight: align.useCssRight, useCssBottom: align.useCssBottom, useCssTransform: align.useCssTransform }); return { points: points, offset: offset, targetOffset: targetOffset, overflow: newOverflowCfg }; } domAlign.__getOffsetParent = _getOffsetParent2['default']; domAlign.__getVisibleRectForElement = _getVisibleRectForElement2['default']; exports['default'] = domAlign; /** * 2012-04-26 yiminghe@gmail.com * - 优化智能对齐算法 * - 慎用 resizeXX * * 2011-07-13 yiminghe@gmail.com note: * - 增加智能对齐,以及大小调整选项 **/ module.exports = exports['default']; /***/ }, /* 112 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTransformName = getTransformName; exports.setTransitionProperty = setTransitionProperty; exports.getTransitionProperty = getTransitionProperty; exports.getTransformXY = getTransformXY; exports.setTransformXY = setTransformXY; var vendorPrefix = void 0; var jsCssMap = { Webkit: '-webkit-', Moz: '-moz-', // IE did it wrong again ... ms: '-ms-', O: '-o-' }; function getVendorPrefix() { if (vendorPrefix !== undefined) { return vendorPrefix; } vendorPrefix = ''; var style = document.createElement('p').style; var testProp = 'Transform'; for (var key in jsCssMap) { if (key + testProp in style) { vendorPrefix = key; } } return vendorPrefix; } function getTransitionName() { return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty'; } function getTransformName() { return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform'; } function setTransitionProperty(node, value) { var name = getTransitionName(); if (name) { node.style[name] = value; if (name !== 'transitionProperty') { node.style.transitionProperty = value; } } } function setTransform(node, value) { var name = getTransformName(); if (name) { node.style[name] = value; if (name !== 'transform') { node.style.transform = value; } } } function getTransitionProperty(node) { return node.style.transitionProperty || node.style[getTransitionName()]; } function getTransformXY(node) { var style = window.getComputedStyle(node, null); var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); if (transform && transform !== 'none') { var matrix = transform.replace(/[^0-9\-.,]/g, '').split(','); return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) }; } return { x: 0, y: 0 }; } var matrix2d = /matrix\((.*)\)/; var matrix3d = /matrix3d\((.*)\)/; function setTransformXY(node, xy) { var style = window.getComputedStyle(node, null); var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName()); if (transform && transform !== 'none') { var arr = void 0; var match2d = transform.match(matrix2d); if (match2d) { match2d = match2d[1]; arr = match2d.split(',').map(function (item) { return parseFloat(item, 10); }); arr[4] = xy.x; arr[5] = xy.y; setTransform(node, 'matrix(' + arr.join(',') + ')'); } else { var match3d = transform.match(matrix3d)[1]; arr = match3d.split(',').map(function (item) { return parseFloat(item, 10); }); arr[12] = xy.x; arr[13] = xy.y; setTransform(node, 'matrix3d(' + arr.join(',') + ')'); } } else { setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)'); } } /***/ }, /* 113 */ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process, setImmediate) {// vim:ts=4:sts=4:sw=4: /*! * * Copyright 2009-2017 Kris Kowal under the terms of the MIT * license found at https://github.com/kriskowal/q/blob/v1/LICENSE * * With parts by Tyler Close * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found * at http://www.opensource.org/licenses/mit-license.html * Forked at ref_send.js version: 2009-05-11 * * With parts by Mark Miller * Copyright (C) 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ (function (definition) { "use strict"; // This file will function properly as a <script> tag, or a module // using CommonJS and NodeJS or RequireJS module formats. In // Common/Node/RequireJS, the module exports the Q API and when // executed as a simple <script>, it creates a Q global instead. // Montage Require if (typeof bootstrap === "function") { bootstrap("promise", definition); // CommonJS } else if (true) { module.exports = definition(); // RequireJS } else if (typeof define === "function" && define.amd) { define(definition); // SES (Secure EcmaScript) } else if (typeof ses !== "undefined") { if (!ses.ok()) { return; } else { ses.makeQ = definition; } // <script> } else if (typeof window !== "undefined" || typeof self !== "undefined") { // Prefer window over self for add-on scripts. Use self for // non-windowed contexts. var global = typeof window !== "undefined" ? window : self; // Get the `window` object, save the previous Q global // and initialize Q as a global. var previousQ = global.Q; global.Q = definition(); // Add a noConflict function so Q can be removed from the // global namespace. global.Q.noConflict = function () { global.Q = previousQ; return this; }; } else { throw new Error("This environment was not anticipated by Q. Please file a bug."); } })(function () { "use strict"; var hasStacks = false; try { throw new Error(); } catch (e) { hasStacks = !!e.stack; } // All code after this point will be filtered from stack traces reported // by Q. var qStartingLine = captureLine(); var qFileName; // shims // used for fallback in "allResolved" var noop = function () {}; // Use the fastest possible means to execute a task in a future turn // of the event loop. var nextTick =(function () { // linked list of tasks (single, with head node) var head = {task: void 0, next: null}; var tail = head; var flushing = false; var requestTick = void 0; var isNodeJS = false; // queue for late tasks, used by unhandled rejection tracking var laterQueue = []; function flush() { /* jshint loopfunc: true */ var task, domain; while (head.next) { head = head.next; task = head.task; head.task = void 0; domain = head.domain; if (domain) { head.domain = void 0; domain.enter(); } runSingle(task, domain); } while (laterQueue.length) { task = laterQueue.pop(); runSingle(task); } flushing = false; } // runs a single function in the async queue function runSingle(task, domain) { try { task(); } catch (e) { if (isNodeJS) { // In node, uncaught exceptions are considered fatal errors. // Re-throw them synchronously to interrupt flushing! // Ensure continuation if the uncaught exception is suppressed // listening "uncaughtException" events (as domains does). // Continue in next event to avoid tick recursion. if (domain) { domain.exit(); } setTimeout(flush, 0); if (domain) { domain.enter(); } throw e; } else { // In browsers, uncaught exceptions are not fatal. // Re-throw them asynchronously to avoid slow-downs. setTimeout(function () { throw e; }, 0); } } if (domain) { domain.exit(); } } nextTick = function (task) { tail = tail.next = { task: task, domain: isNodeJS && process.domain, next: null }; if (!flushing) { flushing = true; requestTick(); } }; if (typeof process === "object" && process.toString() === "[object process]" && process.nextTick) { // Ensure Q is in a real Node environment, with a `process.nextTick`. // To see through fake Node environments: // * Mocha test runner - exposes a `process` global without a `nextTick` // * Browserify - exposes a `process.nexTick` function that uses // `setTimeout`. In this case `setImmediate` is preferred because // it is faster. Browserify's `process.toString()` yields // "[object Object]", while in a real Node environment // `process.toString()` yields "[object process]". isNodeJS = true; requestTick = function () { process.nextTick(flush); }; } else if (typeof setImmediate === "function") { // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate if (typeof window !== "undefined") { requestTick = setImmediate.bind(window, flush); } else { requestTick = function () { setImmediate(flush); }; } } else if (typeof MessageChannel !== "undefined") { // modern browsers // http://www.nonblocking.io/2011/06/windownexttick.html var channel = new MessageChannel(); // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create // working message ports the first time a page loads. channel.port1.onmessage = function () { requestTick = requestPortTick; channel.port1.onmessage = flush; flush(); }; var requestPortTick = function () { // Opera requires us to provide a message payload, regardless of // whether we use it. channel.port2.postMessage(0); }; requestTick = function () { setTimeout(flush, 0); requestPortTick(); }; } else { // old browsers requestTick = function () { setTimeout(flush, 0); }; } // runs a task after all other tasks have been run // this is useful for unhandled rejection tracking that needs to happen // after all `then`d tasks have been run. nextTick.runAfter = function (task) { laterQueue.push(task); if (!flushing) { flushing = true; requestTick(); } }; return nextTick; })(); // Attempt to make generics safe in the face of downstream // modifications. // There is no situation where this is necessary. // If you need a security guarantee, these primordials need to be // deeply frozen anyway, and if you don’t need a security guarantee, // this is just plain paranoid. // However, this **might** have the nice side-effect of reducing the size of // the minified code by reducing x.call() to merely x() // See Mark Miller’s explanation of what this does. // http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming var call = Function.call; function uncurryThis(f) { return function () { return call.apply(f, arguments); }; } // This is equivalent, but slower: // uncurryThis = Function_bind.bind(Function_bind.call); // http://jsperf.com/uncurrythis var array_slice = uncurryThis(Array.prototype.slice); var array_reduce = uncurryThis( Array.prototype.reduce || function (callback, basis) { var index = 0, length = this.length; // concerning the initial value, if one is not provided if (arguments.length === 1) { // seek to the first value in the array, accounting // for the possibility that is is a sparse array do { if (index in this) { basis = this[index++]; break; } if (++index >= length) { throw new TypeError(); } } while (1); } // reduce for (; index < length; index++) { // account for the possibility that the array is sparse if (index in this) { basis = callback(basis, this[index], index); } } return basis; } ); var array_indexOf = uncurryThis( Array.prototype.indexOf || function (value) { // not a very good shim, but good enough for our one use of it for (var i = 0; i < this.length; i++) { if (this[i] === value) { return i; } } return -1; } ); var array_map = uncurryThis( Array.prototype.map || function (callback, thisp) { var self = this; var collect = []; array_reduce(self, function (undefined, value, index) { collect.push(callback.call(thisp, value, index, self)); }, void 0); return collect; } ); var object_create = Object.create || function (prototype) { function Type() { } Type.prototype = prototype; return new Type(); }; var object_defineProperty = Object.defineProperty || function (obj, prop, descriptor) { obj[prop] = descriptor.value; return obj; }; var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); var object_keys = Object.keys || function (object) { var keys = []; for (var key in object) { if (object_hasOwnProperty(object, key)) { keys.push(key); } } return keys; }; var object_toString = uncurryThis(Object.prototype.toString); function isObject(value) { return value === Object(value); } // generator related shims // FIXME: Remove this function once ES6 generators are in SpiderMonkey. function isStopIteration(exception) { return ( object_toString(exception) === "[object StopIteration]" || exception instanceof QReturnValue ); } // FIXME: Remove this helper and Q.return once ES6 generators are in // SpiderMonkey. var QReturnValue; if (typeof ReturnValue !== "undefined") { QReturnValue = ReturnValue; } else { QReturnValue = function (value) { this.value = value; }; } // long stack traces var STACK_JUMP_SEPARATOR = "From previous event:"; function makeStackTraceLong(error, promise) { // If possible, transform the error stack trace by removing Node and Q // cruft, then concatenating with the stack trace of `promise`. See #57. if (hasStacks && promise.stack && typeof error === "object" && error !== null && error.stack ) { var stacks = []; for (var p = promise; !!p; p = p.source) { if (p.stack && (!error.__minimumStackCounter__ || error.__minimumStackCounter__ > p.stackCounter)) { object_defineProperty(error, "__minimumStackCounter__", {value: p.stackCounter, configurable: true}); stacks.unshift(p.stack); } } stacks.unshift(error.stack); var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); var stack = filterStackString(concatedStacks); object_defineProperty(error, "stack", {value: stack, configurable: true}); } } function filterStackString(stackString) { var lines = stackString.split("\n"); var desiredLines = []; for (var i = 0; i < lines.length; ++i) { var line = lines[i]; if (!isInternalFrame(line) && !isNodeFrame(line) && line) { desiredLines.push(line); } } return desiredLines.join("\n"); } function isNodeFrame(stackLine) { return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; } function getFileNameAndLineNumber(stackLine) { // Named functions: "at functionName (filename:lineNumber:columnNumber)" // In IE10 function name can have spaces ("Anonymous function") O_o var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } // Anonymous functions: "at filename:lineNumber:columnNumber" var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } // Firefox style: "function@filename:lineNumber or @filename:lineNumber" var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } } function isInternalFrame(stackLine) { var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); if (!fileNameAndLineNumber) { return false; } var fileName = fileNameAndLineNumber[0]; var lineNumber = fileNameAndLineNumber[1]; return fileName === qFileName && lineNumber >= qStartingLine && lineNumber <= qEndingLine; } // discover own file name and line number range for filtering stack // traces function captureLine() { if (!hasStacks) { return; } try { throw new Error(); } catch (e) { var lines = e.stack.split("\n"); var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); if (!fileNameAndLineNumber) { return; } qFileName = fileNameAndLineNumber[0]; return fileNameAndLineNumber[1]; } } function deprecate(callback, name, alternative) { return function () { if (typeof console !== "undefined" && typeof console.warn === "function") { console.warn(name + " is deprecated, use " + alternative + " instead.", new Error("").stack); } return callback.apply(callback, arguments); }; } // end of shims // beginning of real work /** * Constructs a promise for an immediate reference, passes promises through, or * coerces promises from different systems. * @param value immediate reference or promise */ function Q(value) { // If the object is already a Promise, return it directly. This enables // the resolve function to both be used to created references from objects, // but to tolerably coerce non-promises to promises. if (value instanceof Promise) { return value; } // assimilate thenables if (isPromiseAlike(value)) { return coerce(value); } else { return fulfill(value); } } Q.resolve = Q; /** * Performs a task in a future turn of the event loop. * @param {Function} task */ Q.nextTick = nextTick; /** * Controls whether or not long stack traces will be on */ Q.longStackSupport = false; /** * The counter is used to determine the stopping point for building * long stack traces. In makeStackTraceLong we walk backwards through * the linked list of promises, only stacks which were created before * the rejection are concatenated. */ var longStackCounter = 1; // enable long stacks if Q_DEBUG is set if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) { Q.longStackSupport = true; } /** * Constructs a {promise, resolve, reject} object. * * `resolve` is a callback to invoke with a more resolved value for the * promise. To fulfill the promise, invoke `resolve` with any value that is * not a thenable. To reject the promise, invoke `resolve` with a rejected * thenable, or invoke `reject` with the reason directly. To resolve the * promise to another thenable, thus putting it in the same state, invoke * `resolve` with that other thenable. */ Q.defer = defer; function defer() { // if "messages" is an "Array", that indicates that the promise has not yet // been resolved. If it is "undefined", it has been resolved. Each // element of the messages array is itself an array of complete arguments to // forward to the resolved promise. We coerce the resolution value to a // promise using the `resolve` function because it handles both fully // non-thenable values and other thenables gracefully. var messages = [], progressListeners = [], resolvedPromise; var deferred = object_create(defer.prototype); var promise = object_create(Promise.prototype); promise.promiseDispatch = function (resolve, op, operands) { var args = array_slice(arguments); if (messages) { messages.push(args); if (op === "when" && operands[1]) { // progress operand progressListeners.push(operands[1]); } } else { Q.nextTick(function () { resolvedPromise.promiseDispatch.apply(resolvedPromise, args); }); } }; // XXX deprecated promise.valueOf = function () { if (messages) { return promise; } var nearerValue = nearer(resolvedPromise); if (isPromise(nearerValue)) { resolvedPromise = nearerValue; // shorten chain } return nearerValue; }; promise.inspect = function () { if (!resolvedPromise) { return { state: "pending" }; } return resolvedPromise.inspect(); }; if (Q.longStackSupport && hasStacks) { try { throw new Error(); } catch (e) { // NOTE: don't try to use `Error.captureStackTrace` or transfer the // accessor around; that causes memory leaks as per GH-111. Just // reify the stack trace as a string ASAP. // // At the same time, cut off the first line; it's always just // "[object Promise]\n", as per the `toString`. promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1); promise.stackCounter = longStackCounter++; } } // NOTE: we do the checks for `resolvedPromise` in each method, instead of // consolidating them into `become`, since otherwise we'd create new // promises with the lines `become(whatever(value))`. See e.g. GH-252. function become(newPromise) { resolvedPromise = newPromise; if (Q.longStackSupport && hasStacks) { // Only hold a reference to the new promise if long stacks // are enabled to reduce memory usage promise.source = newPromise; } array_reduce(messages, function (undefined, message) { Q.nextTick(function () { newPromise.promiseDispatch.apply(newPromise, message); }); }, void 0); messages = void 0; progressListeners = void 0; } deferred.promise = promise; deferred.resolve = function (value) { if (resolvedPromise) { return; } become(Q(value)); }; deferred.fulfill = function (value) { if (resolvedPromise) { return; } become(fulfill(value)); }; deferred.reject = function (reason) { if (resolvedPromise) { return; } become(reject(reason)); }; deferred.notify = function (progress) { if (resolvedPromise) { return; } array_reduce(progressListeners, function (undefined, progressListener) { Q.nextTick(function () { progressListener(progress); }); }, void 0); }; return deferred; } /** * Creates a Node-style callback that will resolve or reject the deferred * promise. * @returns a nodeback */ defer.prototype.makeNodeResolver = function () { var self = this; return function (error, value) { if (error) { self.reject(error); } else if (arguments.length > 2) { self.resolve(array_slice(arguments, 1)); } else { self.resolve(value); } }; }; /** * @param resolver {Function} a function that returns nothing and accepts * the resolve, reject, and notify functions for a deferred. * @returns a promise that may be resolved with the given resolve and reject * functions, or rejected by a thrown exception in resolver */ Q.Promise = promise; // ES6 Q.promise = promise; function promise(resolver) { if (typeof resolver !== "function") { throw new TypeError("resolver must be a function."); } var deferred = defer(); try { resolver(deferred.resolve, deferred.reject, deferred.notify); } catch (reason) { deferred.reject(reason); } return deferred.promise; } promise.race = race; // ES6 promise.all = all; // ES6 promise.reject = reject; // ES6 promise.resolve = Q; // ES6 // XXX experimental. This method is a way to denote that a local value is // serializable and should be immediately dispatched to a remote upon request, // instead of passing a reference. Q.passByCopy = function (object) { //freeze(object); //passByCopies.set(object, true); return object; }; Promise.prototype.passByCopy = function () { //freeze(object); //passByCopies.set(object, true); return this; }; /** * If two promises eventually fulfill to the same value, promises that value, * but otherwise rejects. * @param x {Any*} * @param y {Any*} * @returns {Any*} a promise for x and y if they are the same, but a rejection * otherwise. * */ Q.join = function (x, y) { return Q(x).join(y); }; Promise.prototype.join = function (that) { return Q([this, that]).spread(function (x, y) { if (x === y) { // TODO: "===" should be Object.is or equiv return x; } else { throw new Error("Q can't join: not the same: " + x + " " + y); } }); }; /** * Returns a promise for the first of an array of promises to become settled. * @param answers {Array[Any*]} promises to race * @returns {Any*} the first promise to be settled */ Q.race = race; function race(answerPs) { return promise(function (resolve, reject) { // Switch to this once we can assume at least ES5 // answerPs.forEach(function (answerP) { // Q(answerP).then(resolve, reject); // }); // Use this in the meantime for (var i = 0, len = answerPs.length; i < len; i++) { Q(answerPs[i]).then(resolve, reject); } }); } Promise.prototype.race = function () { return this.then(Q.race); }; /** * Constructs a Promise with a promise descriptor object and optional fallback * function. The descriptor contains methods like when(rejected), get(name), * set(name, value), post(name, args), and delete(name), which all * return either a value, a promise for a value, or a rejection. The fallback * accepts the operation name, a resolver, and any further arguments that would * have been forwarded to the appropriate method above had a method been * provided with the proper name. The API makes no guarantees about the nature * of the returned object, apart from that it is usable whereever promises are * bought and sold. */ Q.makePromise = Promise; function Promise(descriptor, fallback, inspect) { if (fallback === void 0) { fallback = function (op) { return reject(new Error( "Promise does not support operation: " + op )); }; } if (inspect === void 0) { inspect = function () { return {state: "unknown"}; }; } var promise = object_create(Promise.prototype); promise.promiseDispatch = function (resolve, op, args) { var result; try { if (descriptor[op]) { result = descriptor[op].apply(promise, args); } else { result = fallback.call(promise, op, args); } } catch (exception) { result = reject(exception); } if (resolve) { resolve(result); } }; promise.inspect = inspect; // XXX deprecated `valueOf` and `exception` support if (inspect) { var inspected = inspect(); if (inspected.state === "rejected") { promise.exception = inspected.reason; } promise.valueOf = function () { var inspected = inspect(); if (inspected.state === "pending" || inspected.state === "rejected") { return promise; } return inspected.value; }; } return promise; } Promise.prototype.toString = function () { return "[object Promise]"; }; Promise.prototype.then = function (fulfilled, rejected, progressed) { var self = this; var deferred = defer(); var done = false; // ensure the untrusted promise makes at most a // single call to one of the callbacks function _fulfilled(value) { try { return typeof fulfilled === "function" ? fulfilled(value) : value; } catch (exception) { return reject(exception); } } function _rejected(exception) { if (typeof rejected === "function") { makeStackTraceLong(exception, self); try { return rejected(exception); } catch (newException) { return reject(newException); } } return reject(exception); } function _progressed(value) { return typeof progressed === "function" ? progressed(value) : value; } Q.nextTick(function () { self.promiseDispatch(function (value) { if (done) { return; } done = true; deferred.resolve(_fulfilled(value)); }, "when", [function (exception) { if (done) { return; } done = true; deferred.resolve(_rejected(exception)); }]); }); // Progress propagator need to be attached in the current tick. self.promiseDispatch(void 0, "when", [void 0, function (value) { var newValue; var threw = false; try { newValue = _progressed(value); } catch (e) { threw = true; if (Q.onerror) { Q.onerror(e); } else { throw e; } } if (!threw) { deferred.notify(newValue); } }]); return deferred.promise; }; Q.tap = function (promise, callback) { return Q(promise).tap(callback); }; /** * Works almost like "finally", but not called for rejections. * Original resolution value is passed through callback unaffected. * Callback may return a promise that will be awaited for. * @param {Function} callback * @returns {Q.Promise} * @example * doSomething() * .then(...) * .tap(console.log) * .then(...); */ Promise.prototype.tap = function (callback) { callback = Q(callback); return this.then(function (value) { return callback.fcall(value).thenResolve(value); }); }; /** * Registers an observer on a promise. * * Guarantees: * * 1. that fulfilled and rejected will be called only once. * 2. that either the fulfilled callback or the rejected callback will be * called, but not both. * 3. that fulfilled and rejected will not be called in this turn. * * @param value promise or immediate reference to observe * @param fulfilled function to be called with the fulfilled value * @param rejected function to be called with the rejection exception * @param progressed function to be called on any progress notifications * @return promise for the return value from the invoked callback */ Q.when = when; function when(value, fulfilled, rejected, progressed) { return Q(value).then(fulfilled, rejected, progressed); } Promise.prototype.thenResolve = function (value) { return this.then(function () { return value; }); }; Q.thenResolve = function (promise, value) { return Q(promise).thenResolve(value); }; Promise.prototype.thenReject = function (reason) { return this.then(function () { throw reason; }); }; Q.thenReject = function (promise, reason) { return Q(promise).thenReject(reason); }; /** * If an object is not a promise, it is as "near" as possible. * If a promise is rejected, it is as "near" as possible too. * If it’s a fulfilled promise, the fulfillment value is nearer. * If it’s a deferred promise and the deferred has been resolved, the * resolution is "nearer". * @param object * @returns most resolved (nearest) form of the object */ // XXX should we re-do this? Q.nearer = nearer; function nearer(value) { if (isPromise(value)) { var inspected = value.inspect(); if (inspected.state === "fulfilled") { return inspected.value; } } return value; } /** * @returns whether the given object is a promise. * Otherwise it is a fulfilled value. */ Q.isPromise = isPromise; function isPromise(object) { return object instanceof Promise; } Q.isPromiseAlike = isPromiseAlike; function isPromiseAlike(object) { return isObject(object) && typeof object.then === "function"; } /** * @returns whether the given object is a pending promise, meaning not * fulfilled or rejected. */ Q.isPending = isPending; function isPending(object) { return isPromise(object) && object.inspect().state === "pending"; } Promise.prototype.isPending = function () { return this.inspect().state === "pending"; }; /** * @returns whether the given object is a value or fulfilled * promise. */ Q.isFulfilled = isFulfilled; function isFulfilled(object) { return !isPromise(object) || object.inspect().state === "fulfilled"; } Promise.prototype.isFulfilled = function () { return this.inspect().state === "fulfilled"; }; /** * @returns whether the given object is a rejected promise. */ Q.isRejected = isRejected; function isRejected(object) { return isPromise(object) && object.inspect().state === "rejected"; } Promise.prototype.isRejected = function () { return this.inspect().state === "rejected"; }; //// BEGIN UNHANDLED REJECTION TRACKING // This promise library consumes exceptions thrown in handlers so they can be // handled by a subsequent promise. The exceptions get added to this array when // they are created, and removed when they are handled. Note that in ES6 or // shimmed environments, this would naturally be a `Set`. var unhandledReasons = []; var unhandledRejections = []; var reportedUnhandledRejections = []; var trackUnhandledRejections = true; function resetUnhandledRejections() { unhandledReasons.length = 0; unhandledRejections.length = 0; if (!trackUnhandledRejections) { trackUnhandledRejections = true; } } function trackRejection(promise, reason) { if (!trackUnhandledRejections) { return; } if (typeof process === "object" && typeof process.emit === "function") { Q.nextTick.runAfter(function () { if (array_indexOf(unhandledRejections, promise) !== -1) { process.emit("unhandledRejection", reason, promise); reportedUnhandledRejections.push(promise); } }); } unhandledRejections.push(promise); if (reason && typeof reason.stack !== "undefined") { unhandledReasons.push(reason.stack); } else { unhandledReasons.push("(no stack) " + reason); } } function untrackRejection(promise) { if (!trackUnhandledRejections) { return; } var at = array_indexOf(unhandledRejections, promise); if (at !== -1) { if (typeof process === "object" && typeof process.emit === "function") { Q.nextTick.runAfter(function () { var atReport = array_indexOf(reportedUnhandledRejections, promise); if (atReport !== -1) { process.emit("rejectionHandled", unhandledReasons[at], promise); reportedUnhandledRejections.splice(atReport, 1); } }); } unhandledRejections.splice(at, 1); unhandledReasons.splice(at, 1); } } Q.resetUnhandledRejections = resetUnhandledRejections; Q.getUnhandledReasons = function () { // Make a copy so that consumers can't interfere with our internal state. return unhandledReasons.slice(); }; Q.stopUnhandledRejectionTracking = function () { resetUnhandledRejections(); trackUnhandledRejections = false; }; resetUnhandledRejections(); //// END UNHANDLED REJECTION TRACKING /** * Constructs a rejected promise. * @param reason value describing the failure */ Q.reject = reject; function reject(reason) { var rejection = Promise({ "when": function (rejected) { // note that the error has been handled if (rejected) { untrackRejection(this); } return rejected ? rejected(reason) : this; } }, function fallback() { return this; }, function inspect() { return { state: "rejected", reason: reason }; }); // Note that the reason has not been handled. trackRejection(rejection, reason); return rejection; } /** * Constructs a fulfilled promise for an immediate reference. * @param value immediate reference */ Q.fulfill = fulfill; function fulfill(value) { return Promise({ "when": function () { return value; }, "get": function (name) { return value[name]; }, "set": function (name, rhs) { value[name] = rhs; }, "delete": function (name) { delete value[name]; }, "post": function (name, args) { // Mark Miller proposes that post with no name should apply a // promised function. if (name === null || name === void 0) { return value.apply(void 0, args); } else { return value[name].apply(value, args); } }, "apply": function (thisp, args) { return value.apply(thisp, args); }, "keys": function () { return object_keys(value); } }, void 0, function inspect() { return { state: "fulfilled", value: value }; }); } /** * Converts thenables to Q promises. * @param promise thenable promise * @returns a Q promise */ function coerce(promise) { var deferred = defer(); Q.nextTick(function () { try { promise.then(deferred.resolve, deferred.reject, deferred.notify); } catch (exception) { deferred.reject(exception); } }); return deferred.promise; } /** * Annotates an object such that it will never be * transferred away from this process over any promise * communication channel. * @param object * @returns promise a wrapping of that object that * additionally responds to the "isDef" message * without a rejection. */ Q.master = master; function master(object) { return Promise({ "isDef": function () {} }, function fallback(op, args) { return dispatch(object, op, args); }, function () { return Q(object).inspect(); }); } /** * Spreads the values of a promised array of arguments into the * fulfillment callback. * @param fulfilled callback that receives variadic arguments from the * promised array * @param rejected callback that receives the exception if the promise * is rejected. * @returns a promise for the return value or thrown exception of * either callback. */ Q.spread = spread; function spread(value, fulfilled, rejected) { return Q(value).spread(fulfilled, rejected); } Promise.prototype.spread = function (fulfilled, rejected) { return this.all().then(function (array) { return fulfilled.apply(void 0, array); }, rejected); }; /** * The async function is a decorator for generator functions, turning * them into asynchronous generators. Although generators are only part * of the newest ECMAScript 6 drafts, this code does not cause syntax * errors in older engines. This code should continue to work and will * in fact improve over time as the language improves. * * ES6 generators are currently part of V8 version 3.19 with the * --harmony-generators runtime flag enabled. SpiderMonkey has had them * for longer, but under an older Python-inspired form. This function * works on both kinds of generators. * * Decorates a generator function such that: * - it may yield promises * - execution will continue when that promise is fulfilled * - the value of the yield expression will be the fulfilled value * - it returns a promise for the return value (when the generator * stops iterating) * - the decorated function returns a promise for the return value * of the generator or the first rejected promise among those * yielded. * - if an error is thrown in the generator, it propagates through * every following yield until it is caught, or until it escapes * the generator function altogether, and is translated into a * rejection for the promise returned by the decorated generator. */ Q.async = async; function async(makeGenerator) { return function () { // when verb is "send", arg is a value // when verb is "throw", arg is an exception function continuer(verb, arg) { var result; // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only // engine that has a deployed base of browsers that support generators. // However, SM's generators use the Python-inspired semantics of // outdated ES6 drafts. We would like to support ES6, but we'd also // like to make it possible to use generators in deployed browsers, so // we also support Python-style generators. At some point we can remove // this block. if (typeof StopIteration === "undefined") { // ES6 Generators try { result = generator[verb](arg); } catch (exception) { return reject(exception); } if (result.done) { return Q(result.value); } else { return when(result.value, callback, errback); } } else { // SpiderMonkey Generators // FIXME: Remove this case when SM does ES6 generators. try { result = generator[verb](arg); } catch (exception) { if (isStopIteration(exception)) { return Q(exception.value); } else { return reject(exception); } } return when(result, callback, errback); } } var generator = makeGenerator.apply(this, arguments); var callback = continuer.bind(continuer, "next"); var errback = continuer.bind(continuer, "throw"); return callback(); }; } /** * The spawn function is a small wrapper around async that immediately * calls the generator and also ends the promise chain, so that any * unhandled errors are thrown instead of forwarded to the error * handler. This is useful because it's extremely common to run * generators at the top-level to work with libraries. */ Q.spawn = spawn; function spawn(makeGenerator) { Q.done(Q.async(makeGenerator)()); } // FIXME: Remove this interface once ES6 generators are in SpiderMonkey. /** * Throws a ReturnValue exception to stop an asynchronous generator. * * This interface is a stop-gap measure to support generator return * values in older Firefox/SpiderMonkey. In browsers that support ES6 * generators like Chromium 29, just use "return" in your generator * functions. * * @param value the return value for the surrounding generator * @throws ReturnValue exception with the value. * @example * // ES6 style * Q.async(function* () { * var foo = yield getFooPromise(); * var bar = yield getBarPromise(); * return foo + bar; * }) * // Older SpiderMonkey style * Q.async(function () { * var foo = yield getFooPromise(); * var bar = yield getBarPromise(); * Q.return(foo + bar); * }) */ Q["return"] = _return; function _return(value) { throw new QReturnValue(value); } /** * The promised function decorator ensures that any promise arguments * are settled and passed as values (`this` is also settled and passed * as a value). It will also ensure that the result of a function is * always a promise. * * @example * var add = Q.promised(function (a, b) { * return a + b; * }); * add(Q(a), Q(B)); * * @param {function} callback The function to decorate * @returns {function} a function that has been decorated. */ Q.promised = promised; function promised(callback) { return function () { return spread([this, all(arguments)], function (self, args) { return callback.apply(self, args); }); }; } /** * sends a message to a value in a future turn * @param object* the recipient * @param op the name of the message operation, e.g., "when", * @param args further arguments to be forwarded to the operation * @returns result {Promise} a promise for the result of the operation */ Q.dispatch = dispatch; function dispatch(object, op, args) { return Q(object).dispatch(op, args); } Promise.prototype.dispatch = function (op, args) { var self = this; var deferred = defer(); Q.nextTick(function () { self.promiseDispatch(deferred.resolve, op, args); }); return deferred.promise; }; /** * Gets the value of a property in a future turn. * @param object promise or immediate reference for target object * @param name name of property to get * @return promise for the property value */ Q.get = function (object, key) { return Q(object).dispatch("get", [key]); }; Promise.prototype.get = function (key) { return this.dispatch("get", [key]); }; /** * Sets the value of a property in a future turn. * @param object promise or immediate reference for object object * @param name name of property to set * @param value new value of property * @return promise for the return value */ Q.set = function (object, key, value) { return Q(object).dispatch("set", [key, value]); }; Promise.prototype.set = function (key, value) { return this.dispatch("set", [key, value]); }; /** * Deletes a property in a future turn. * @param object promise or immediate reference for target object * @param name name of property to delete * @return promise for the return value */ Q.del = // XXX legacy Q["delete"] = function (object, key) { return Q(object).dispatch("delete", [key]); }; Promise.prototype.del = // XXX legacy Promise.prototype["delete"] = function (key) { return this.dispatch("delete", [key]); }; /** * Invokes a method in a future turn. * @param object promise or immediate reference for target object * @param name name of method to invoke * @param value a value to post, typically an array of * invocation arguments for promises that * are ultimately backed with `resolve` values, * as opposed to those backed with URLs * wherein the posted value can be any * JSON serializable object. * @return promise for the return value */ // bound locally because it is used by other methods Q.mapply = // XXX As proposed by "Redsandro" Q.post = function (object, name, args) { return Q(object).dispatch("post", [name, args]); }; Promise.prototype.mapply = // XXX As proposed by "Redsandro" Promise.prototype.post = function (name, args) { return this.dispatch("post", [name, args]); }; /** * Invokes a method in a future turn. * @param object promise or immediate reference for target object * @param name name of method to invoke * @param ...args array of invocation arguments * @return promise for the return value */ Q.send = // XXX Mark Miller's proposed parlance Q.mcall = // XXX As proposed by "Redsandro" Q.invoke = function (object, name /*...args*/) { return Q(object).dispatch("post", [name, array_slice(arguments, 2)]); }; Promise.prototype.send = // XXX Mark Miller's proposed parlance Promise.prototype.mcall = // XXX As proposed by "Redsandro" Promise.prototype.invoke = function (name /*...args*/) { return this.dispatch("post", [name, array_slice(arguments, 1)]); }; /** * Applies the promised function in a future turn. * @param object promise or immediate reference for target function * @param args array of application arguments */ Q.fapply = function (object, args) { return Q(object).dispatch("apply", [void 0, args]); }; Promise.prototype.fapply = function (args) { return this.dispatch("apply", [void 0, args]); }; /** * Calls the promised function in a future turn. * @param object promise or immediate reference for target function * @param ...args array of application arguments */ Q["try"] = Q.fcall = function (object /* ...args*/) { return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]); }; Promise.prototype.fcall = function (/*...args*/) { return this.dispatch("apply", [void 0, array_slice(arguments)]); }; /** * Binds the promised function, transforming return values into a fulfilled * promise and thrown errors into a rejected one. * @param object promise or immediate reference for target function * @param ...args array of application arguments */ Q.fbind = function (object /*...args*/) { var promise = Q(object); var args = array_slice(arguments, 1); return function fbound() { return promise.dispatch("apply", [ this, args.concat(array_slice(arguments)) ]); }; }; Promise.prototype.fbind = function (/*...args*/) { var promise = this; var args = array_slice(arguments); return function fbound() { return promise.dispatch("apply", [ this, args.concat(array_slice(arguments)) ]); }; }; /** * Requests the names of the owned properties of a promised * object in a future turn. * @param object promise or immediate reference for target object * @return promise for the keys of the eventually settled object */ Q.keys = function (object) { return Q(object).dispatch("keys", []); }; Promise.prototype.keys = function () { return this.dispatch("keys", []); }; /** * Turns an array of promises into a promise for an array. If any of * the promises gets rejected, the whole array is rejected immediately. * @param {Array*} an array (or promise for an array) of values (or * promises for values) * @returns a promise for an array of the corresponding values */ // By Mark Miller // http://wiki.ecmascript.org/doku.php?id=strawman:concurrency&rev=1308776521#allfulfilled Q.all = all; function all(promises) { return when(promises, function (promises) { var pendingCount = 0; var deferred = defer(); array_reduce(promises, function (undefined, promise, index) { var snapshot; if ( isPromise(promise) && (snapshot = promise.inspect()).state === "fulfilled" ) { promises[index] = snapshot.value; } else { ++pendingCount; when( promise, function (value) { promises[index] = value; if (--pendingCount === 0) { deferred.resolve(promises); } }, deferred.reject, function (progress) { deferred.notify({ index: index, value: progress }); } ); } }, void 0); if (pendingCount === 0) { deferred.resolve(promises); } return deferred.promise; }); } Promise.prototype.all = function () { return all(this); }; /** * Returns the first resolved promise of an array. Prior rejected promises are * ignored. Rejects only if all promises are rejected. * @param {Array*} an array containing values or promises for values * @returns a promise fulfilled with the value of the first resolved promise, * or a rejected promise if all promises are rejected. */ Q.any = any; function any(promises) { if (promises.length === 0) { return Q.resolve(); } var deferred = Q.defer(); var pendingCount = 0; array_reduce(promises, function (prev, current, index) { var promise = promises[index]; pendingCount++; when(promise, onFulfilled, onRejected, onProgress); function onFulfilled(result) { deferred.resolve(result); } function onRejected(err) { pendingCount--; if (pendingCount === 0) { err.message = ("Q can't get fulfillment value from any promise, all " + "promises were rejected. Last error message: " + err.message); deferred.reject(err); } } function onProgress(progress) { deferred.notify({ index: index, value: progress }); } }, undefined); return deferred.promise; } Promise.prototype.any = function () { return any(this); }; /** * Waits for all promises to be settled, either fulfilled or * rejected. This is distinct from `all` since that would stop * waiting at the first rejection. The promise returned by * `allResolved` will never be rejected. * @param promises a promise for an array (or an array) of promises * (or values) * @return a promise for an array of promises */ Q.allResolved = deprecate(allResolved, "allResolved", "allSettled"); function allResolved(promises) { return when(promises, function (promises) { promises = array_map(promises, Q); return when(all(array_map(promises, function (promise) { return when(promise, noop, noop); })), function () { return promises; }); }); } Promise.prototype.allResolved = function () { return allResolved(this); }; /** * @see Promise#allSettled */ Q.allSettled = allSettled; function allSettled(promises) { return Q(promises).allSettled(); } /** * Turns an array of promises into a promise for an array of their states (as * returned by `inspect`) when they have all settled. * @param {Array[Any*]} values an array (or promise for an array) of values (or * promises for values) * @returns {Array[State]} an array of states for the respective values. */ Promise.prototype.allSettled = function () { return this.then(function (promises) { return all(array_map(promises, function (promise) { promise = Q(promise); function regardless() { return promise.inspect(); } return promise.then(regardless, regardless); })); }); }; /** * Captures the failure of a promise, giving an oportunity to recover * with a callback. If the given promise is fulfilled, the returned * promise is fulfilled. * @param {Any*} promise for something * @param {Function} callback to fulfill the returned promise if the * given promise is rejected * @returns a promise for the return value of the callback */ Q.fail = // XXX legacy Q["catch"] = function (object, rejected) { return Q(object).then(void 0, rejected); }; Promise.prototype.fail = // XXX legacy Promise.prototype["catch"] = function (rejected) { return this.then(void 0, rejected); }; /** * Attaches a listener that can respond to progress notifications from a * promise's originating deferred. This listener receives the exact arguments * passed to ``deferred.notify``. * @param {Any*} promise for something * @param {Function} callback to receive any progress notifications * @returns the given promise, unchanged */ Q.progress = progress; function progress(object, progressed) { return Q(object).then(void 0, void 0, progressed); } Promise.prototype.progress = function (progressed) { return this.then(void 0, void 0, progressed); }; /** * Provides an opportunity to observe the settling of a promise, * regardless of whether the promise is fulfilled or rejected. Forwards * the resolution to the returned promise when the callback is done. * The callback can return a promise to defer completion. * @param {Any*} promise * @param {Function} callback to observe the resolution of the given * promise, takes no arguments. * @returns a promise for the resolution of the given promise when * ``fin`` is done. */ Q.fin = // XXX legacy Q["finally"] = function (object, callback) { return Q(object)["finally"](callback); }; Promise.prototype.fin = // XXX legacy Promise.prototype["finally"] = function (callback) { if (!callback || typeof callback.apply !== "function") { throw new Error("Q can't apply finally callback"); } callback = Q(callback); return this.then(function (value) { return callback.fcall().then(function () { return value; }); }, function (reason) { // TODO attempt to recycle the rejection with "this". return callback.fcall().then(function () { throw reason; }); }); }; /** * Terminates a chain of promises, forcing rejections to be * thrown as exceptions. * @param {Any*} promise at the end of a chain of promises * @returns nothing */ Q.done = function (object, fulfilled, rejected, progress) { return Q(object).done(fulfilled, rejected, progress); }; Promise.prototype.done = function (fulfilled, rejected, progress) { var onUnhandledError = function (error) { // forward to a future turn so that ``when`` // does not catch it and turn it into a rejection. Q.nextTick(function () { makeStackTraceLong(error, promise); if (Q.onerror) { Q.onerror(error); } else { throw error; } }); }; // Avoid unnecessary `nextTick`ing via an unnecessary `when`. var promise = fulfilled || rejected || progress ? this.then(fulfilled, rejected, progress) : this; if (typeof process === "object" && process && process.domain) { onUnhandledError = process.domain.bind(onUnhandledError); } promise.then(void 0, onUnhandledError); }; /** * Causes a promise to be rejected if it does not get fulfilled before * some milliseconds time out. * @param {Any*} promise * @param {Number} milliseconds timeout * @param {Any*} custom error message or Error object (optional) * @returns a promise for the resolution of the given promise if it is * fulfilled before the timeout, otherwise rejected. */ Q.timeout = function (object, ms, error) { return Q(object).timeout(ms, error); }; Promise.prototype.timeout = function (ms, error) { var deferred = defer(); var timeoutId = setTimeout(function () { if (!error || "string" === typeof error) { error = new Error(error || "Timed out after " + ms + " ms"); error.code = "ETIMEDOUT"; } deferred.reject(error); }, ms); this.then(function (value) { clearTimeout(timeoutId); deferred.resolve(value); }, function (exception) { clearTimeout(timeoutId); deferred.reject(exception); }, deferred.notify); return deferred.promise; }; /** * Returns a promise for the given value (or promised value), some * milliseconds after it resolved. Passes rejections immediately. * @param {Any*} promise * @param {Number} milliseconds * @returns a promise for the resolution of the given promise after milliseconds * time has elapsed since the resolution of the given promise. * If the given promise rejects, that is passed immediately. */ Q.delay = function (object, timeout) { if (timeout === void 0) { timeout = object; object = void 0; } return Q(object).delay(timeout); }; Promise.prototype.delay = function (timeout) { return this.then(function (value) { var deferred = defer(); setTimeout(function () { deferred.resolve(value); }, timeout); return deferred.promise; }); }; /** * Passes a continuation to a Node function, which is called with the given * arguments provided as an array, and returns a promise. * * Q.nfapply(FS.readFile, [__filename]) * .then(function (content) { * }) * */ Q.nfapply = function (callback, args) { return Q(callback).nfapply(args); }; Promise.prototype.nfapply = function (args) { var deferred = defer(); var nodeArgs = array_slice(args); nodeArgs.push(deferred.makeNodeResolver()); this.fapply(nodeArgs).fail(deferred.reject); return deferred.promise; }; /** * Passes a continuation to a Node function, which is called with the given * arguments provided individually, and returns a promise. * @example * Q.nfcall(FS.readFile, __filename) * .then(function (content) { * }) * */ Q.nfcall = function (callback /*...args*/) { var args = array_slice(arguments, 1); return Q(callback).nfapply(args); }; Promise.prototype.nfcall = function (/*...args*/) { var nodeArgs = array_slice(arguments); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); this.fapply(nodeArgs).fail(deferred.reject); return deferred.promise; }; /** * Wraps a NodeJS continuation passing function and returns an equivalent * version that returns a promise. * @example * Q.nfbind(FS.readFile, __filename)("utf-8") * .then(console.log) * .done() */ Q.nfbind = Q.denodeify = function (callback /*...args*/) { if (callback === undefined) { throw new Error("Q can't wrap an undefined function"); } var baseArgs = array_slice(arguments, 1); return function () { var nodeArgs = baseArgs.concat(array_slice(arguments)); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); Q(callback).fapply(nodeArgs).fail(deferred.reject); return deferred.promise; }; }; Promise.prototype.nfbind = Promise.prototype.denodeify = function (/*...args*/) { var args = array_slice(arguments); args.unshift(this); return Q.denodeify.apply(void 0, args); }; Q.nbind = function (callback, thisp /*...args*/) { var baseArgs = array_slice(arguments, 2); return function () { var nodeArgs = baseArgs.concat(array_slice(arguments)); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); function bound() { return callback.apply(thisp, arguments); } Q(bound).fapply(nodeArgs).fail(deferred.reject); return deferred.promise; }; }; Promise.prototype.nbind = function (/*thisp, ...args*/) { var args = array_slice(arguments, 0); args.unshift(this); return Q.nbind.apply(void 0, args); }; /** * Calls a method of a Node-style object that accepts a Node-style * callback with a given array of arguments, plus a provided callback. * @param object an object that has the named method * @param {String} name name of the method of object * @param {Array} args arguments to pass to the method; the callback * will be provided by Q and appended to these arguments. * @returns a promise for the value or error */ Q.nmapply = // XXX As proposed by "Redsandro" Q.npost = function (object, name, args) { return Q(object).npost(name, args); }; Promise.prototype.nmapply = // XXX As proposed by "Redsandro" Promise.prototype.npost = function (name, args) { var nodeArgs = array_slice(args || []); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); this.dispatch("post", [name, nodeArgs]).fail(deferred.reject); return deferred.promise; }; /** * Calls a method of a Node-style object that accepts a Node-style * callback, forwarding the given variadic arguments, plus a provided * callback argument. * @param object an object that has the named method * @param {String} name name of the method of object * @param ...args arguments to pass to the method; the callback will * be provided by Q and appended to these arguments. * @returns a promise for the value or error */ Q.nsend = // XXX Based on Mark Miller's proposed "send" Q.nmcall = // XXX Based on "Redsandro's" proposal Q.ninvoke = function (object, name /*...args*/) { var nodeArgs = array_slice(arguments, 2); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject); return deferred.promise; }; Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send" Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal Promise.prototype.ninvoke = function (name /*...args*/) { var nodeArgs = array_slice(arguments, 1); var deferred = defer(); nodeArgs.push(deferred.makeNodeResolver()); this.dispatch("post", [name, nodeArgs]).fail(deferred.reject); return deferred.promise; }; /** * If a function would like to support both Node continuation-passing-style and * promise-returning-style, it can end its internal promise chain with * `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user * elects to use a nodeback, the result will be sent there. If they do not * pass a nodeback, they will receive the result promise. * @param object a result (or a promise for a result) * @param {Function} nodeback a Node.js-style callback * @returns either the promise or nothing */ Q.nodeify = nodeify; function nodeify(object, nodeback) { return Q(object).nodeify(nodeback); } Promise.prototype.nodeify = function (nodeback) { if (nodeback) { this.then(function (value) { Q.nextTick(function () { nodeback(null, value); }); }, function (error) { Q.nextTick(function () { nodeback(error); }); }); } else { return this; } }; Q.noConflict = function() { throw new Error("Q.noConflict only works when Q is used as a global"); }; // All code before this point will be filtered from stack traces. var qEndingLine = captureLine(); return Q; }); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(288), __webpack_require__(35).setImmediate)) /***/ }, /* 114 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _domAlign = __webpack_require__(111); var _domAlign2 = _interopRequireDefault(_domAlign); var _addEventListener = __webpack_require__(34); var _addEventListener2 = _interopRequireDefault(_addEventListener); var _isWindow = __webpack_require__(116); var _isWindow2 = _interopRequireDefault(_isWindow); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } function buffer(fn, ms) { var timer = void 0; function clear() { if (timer) { clearTimeout(timer); timer = null; } } function bufferFn() { clear(); timer = setTimeout(fn, ms); } bufferFn.clear = clear; return bufferFn; } var Align = function (_Component) { _inherits(Align, _Component); function Align() { var _temp, _this, _ret; _classCallCheck(this, Align); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.forceAlign = function () { var props = _this.props; if (!props.disabled) { var source = _reactDom2["default"].findDOMNode(_this); props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align)); } }, _temp), _possibleConstructorReturn(_this, _ret); } Align.prototype.componentDidMount = function componentDidMount() { var props = this.props; // if parent ref not attached .... use document.getElementById this.forceAlign(); if (!props.disabled && props.monitorWindowResize) { this.startMonitorWindowResize(); } }; Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { var reAlign = false; var props = this.props; if (!props.disabled) { if (prevProps.disabled || prevProps.align !== props.align) { reAlign = true; } else { var lastTarget = prevProps.target(); var currentTarget = props.target(); if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) { reAlign = false; } else if (lastTarget !== currentTarget) { reAlign = true; } } } if (reAlign) { this.forceAlign(); } if (props.monitorWindowResize && !props.disabled) { this.startMonitorWindowResize(); } else { this.stopMonitorWindowResize(); } }; Align.prototype.componentWillUnmount = function componentWillUnmount() { this.stopMonitorWindowResize(); }; Align.prototype.startMonitorWindowResize = function startMonitorWindowResize() { if (!this.resizeHandler) { this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime); this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor); } }; Align.prototype.stopMonitorWindowResize = function stopMonitorWindowResize() { if (this.resizeHandler) { this.bufferMonitor.clear(); this.resizeHandler.remove(); this.resizeHandler = null; } }; Align.prototype.render = function render() { var _props = this.props, childrenProps = _props.childrenProps, children = _props.children; var child = _react2["default"].Children.only(children); if (childrenProps) { var newProps = {}; for (var prop in childrenProps) { if (childrenProps.hasOwnProperty(prop)) { newProps[prop] = this.props[childrenProps[prop]]; } } return _react2["default"].cloneElement(child, newProps); } return child; }; return Align; }(_react.Component); Align.propTypes = { childrenProps: _propTypes2["default"].object, align: _propTypes2["default"].object.isRequired, target: _propTypes2["default"].func, onAlign: _propTypes2["default"].func, monitorBufferTime: _propTypes2["default"].number, monitorWindowResize: _propTypes2["default"].bool, disabled: _propTypes2["default"].bool, children: _propTypes2["default"].any }; Align.defaultProps = { target: function target() { return window; }, onAlign: function onAlign() {}, monitorBufferTime: 50, monitorWindowResize: false, disabled: false }; exports["default"] = Align; module.exports = exports['default']; /***/ }, /* 115 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Align = __webpack_require__(114); var _Align2 = _interopRequireDefault(_Align); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = _Align2["default"]; // export this package's api module.exports = exports['default']; /***/ }, /* 116 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = isWindow; function isWindow(obj) { /* eslint no-eq-null: 0 */ /* eslint eqeqeq: 0 */ return obj != null && obj == obj.window; } module.exports = exports['default']; /***/ }, /* 117 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _objectWithoutProperties2 = __webpack_require__(21); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _rcTrigger = __webpack_require__(37); var _rcTrigger2 = _interopRequireDefault(_rcTrigger); var _placements = __webpack_require__(55); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Tooltip = function (_Component) { (0, _inherits3['default'])(Tooltip, _Component); function Tooltip() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3['default'])(this, Tooltip); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call.apply(_ref, [this].concat(args))), _this), _this.getPopupElement = function () { var _this$props = _this.props, arrowContent = _this$props.arrowContent, overlay = _this$props.overlay, prefixCls = _this$props.prefixCls; return [_react2['default'].createElement( 'div', { className: prefixCls + '-arrow', key: 'arrow' }, arrowContent ), _react2['default'].createElement( 'div', { className: prefixCls + '-inner', key: 'content' }, typeof overlay === 'function' ? overlay() : overlay )]; }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret); } (0, _createClass3['default'])(Tooltip, [{ key: 'getPopupDomNode', value: function getPopupDomNode() { return this.refs.trigger.getPopupDomNode(); } }, { key: 'render', value: function render() { var _props = this.props, overlayClassName = _props.overlayClassName, trigger = _props.trigger, mouseEnterDelay = _props.mouseEnterDelay, mouseLeaveDelay = _props.mouseLeaveDelay, overlayStyle = _props.overlayStyle, prefixCls = _props.prefixCls, children = _props.children, onVisibleChange = _props.onVisibleChange, afterVisibleChange = _props.afterVisibleChange, transitionName = _props.transitionName, animation = _props.animation, placement = _props.placement, align = _props.align, destroyTooltipOnHide = _props.destroyTooltipOnHide, defaultVisible = _props.defaultVisible, getTooltipContainer = _props.getTooltipContainer, restProps = (0, _objectWithoutProperties3['default'])(_props, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'afterVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']); var extraProps = (0, _extends3['default'])({}, restProps); if ('visible' in this.props) { extraProps.popupVisible = this.props.visible; } return _react2['default'].createElement( _rcTrigger2['default'], (0, _extends3['default'])({ popupClassName: overlayClassName, ref: 'trigger', prefixCls: prefixCls, popup: this.getPopupElement, action: trigger, builtinPlacements: _placements.placements, popupPlacement: placement, popupAlign: align, getPopupContainer: getTooltipContainer, onPopupVisibleChange: onVisibleChange, afterPopupVisibleChange: afterVisibleChange, popupTransitionName: transitionName, popupAnimation: animation, defaultPopupVisible: defaultVisible, destroyPopupOnHide: destroyTooltipOnHide, mouseLeaveDelay: mouseLeaveDelay, popupStyle: overlayStyle, mouseEnterDelay: mouseEnterDelay }, extraProps), children ); } }]); return Tooltip; }(_react.Component); Tooltip.propTypes = { trigger: _propTypes2['default'].any, children: _propTypes2['default'].any, defaultVisible: _propTypes2['default'].bool, visible: _propTypes2['default'].bool, placement: _propTypes2['default'].string, transitionName: _propTypes2['default'].string, animation: _propTypes2['default'].any, onVisibleChange: _propTypes2['default'].func, afterVisibleChange: _propTypes2['default'].func, overlay: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].func]).isRequired, overlayStyle: _propTypes2['default'].object, overlayClassName: _propTypes2['default'].string, prefixCls: _propTypes2['default'].string, mouseEnterDelay: _propTypes2['default'].number, mouseLeaveDelay: _propTypes2['default'].number, getTooltipContainer: _propTypes2['default'].func, destroyTooltipOnHide: _propTypes2['default'].bool, align: _propTypes2['default'].object, arrowContent: _propTypes2['default'].any }; Tooltip.defaultProps = { prefixCls: 'rc-tooltip', mouseEnterDelay: 0, destroyTooltipOnHide: false, mouseLeaveDelay: 0.1, align: {}, placement: 'right', trigger: ['hover'], arrowContent: null }; exports['default'] = Tooltip; module.exports = exports['default']; /***/ }, /* 118 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Tooltip = __webpack_require__(117); var _Tooltip2 = _interopRequireDefault(_Tooltip); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = _Tooltip2['default']; module.exports = exports['default']; /***/ }, /* 119 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _rcAlign = __webpack_require__(115); var _rcAlign2 = _interopRequireDefault(_rcAlign); var _rcAnimate = __webpack_require__(26); var _rcAnimate2 = _interopRequireDefault(_rcAnimate); var _PopupInner = __webpack_require__(120); var _PopupInner2 = _interopRequireDefault(_PopupInner); var _LazyRenderBox = __webpack_require__(56); var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); var _utils = __webpack_require__(57); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Popup = function (_Component) { (0, _inherits3['default'])(Popup, _Component); function Popup(props) { (0, _classCallCheck3['default'])(this, Popup); var _this = (0, _possibleConstructorReturn3['default'])(this, (Popup.__proto__ || Object.getPrototypeOf(Popup)).call(this, props)); _initialiseProps.call(_this); _this.savePopupRef = _utils.saveRef.bind(_this, 'popupInstance'); _this.saveAlignRef = _utils.saveRef.bind(_this, 'alignInstance'); return _this; } (0, _createClass3['default'])(Popup, [{ key: 'componentDidMount', value: function componentDidMount() { this.rootNode = this.getPopupDomNode(); } }, { key: 'getPopupDomNode', value: function getPopupDomNode() { return _reactDom2['default'].findDOMNode(this.popupInstance); } }, { key: 'getMaskTransitionName', value: function getMaskTransitionName() { var props = this.props; var transitionName = props.maskTransitionName; var animation = props.maskAnimation; if (!transitionName && animation) { transitionName = props.prefixCls + '-' + animation; } return transitionName; } }, { key: 'getTransitionName', value: function getTransitionName() { var props = this.props; var transitionName = props.transitionName; if (!transitionName && props.animation) { transitionName = props.prefixCls + '-' + props.animation; } return transitionName; } }, { key: 'getClassName', value: function getClassName(currentAlignClassName) { return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName; } }, { key: 'getPopupElement', value: function getPopupElement() { var savePopupRef = this.savePopupRef, props = this.props; var align = props.align, style = props.style, visible = props.visible, prefixCls = props.prefixCls, destroyPopupOnHide = props.destroyPopupOnHide; var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); var hiddenClassName = prefixCls + '-hidden'; if (!visible) { this.currentAlignClassName = null; } var newStyle = (0, _extends3['default'])({}, style, this.getZIndexStyle()); var popupInnerProps = { className: className, prefixCls: prefixCls, ref: savePopupRef, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, style: newStyle }; if (destroyPopupOnHide) { return _react2['default'].createElement( _rcAnimate2['default'], { component: '', exclusive: true, transitionAppear: true, transitionName: this.getTransitionName() }, visible ? _react2['default'].createElement( _rcAlign2['default'], { target: this.getTarget, key: 'popup', ref: this.saveAlignRef, monitorWindowResize: true, align: align, onAlign: this.onAlign }, _react2['default'].createElement( _PopupInner2['default'], (0, _extends3['default'])({ visible: true }, popupInnerProps), props.children ) ) : null ); } return _react2['default'].createElement( _rcAnimate2['default'], { component: '', exclusive: true, transitionAppear: true, transitionName: this.getTransitionName(), showProp: 'xVisible' }, _react2['default'].createElement( _rcAlign2['default'], { target: this.getTarget, key: 'popup', ref: this.saveAlignRef, monitorWindowResize: true, xVisible: visible, childrenProps: { visible: 'xVisible' }, disabled: !visible, align: align, onAlign: this.onAlign }, _react2['default'].createElement( _PopupInner2['default'], (0, _extends3['default'])({ hiddenClassName: hiddenClassName }, popupInnerProps), props.children ) ) ); } }, { key: 'getZIndexStyle', value: function getZIndexStyle() { var style = {}; var props = this.props; if (props.zIndex !== undefined) { style.zIndex = props.zIndex; } return style; } }, { key: 'getMaskElement', value: function getMaskElement() { var props = this.props; var maskElement = void 0; if (props.mask) { var maskTransition = this.getMaskTransitionName(); maskElement = _react2['default'].createElement(_LazyRenderBox2['default'], { style: this.getZIndexStyle(), key: 'mask', className: props.prefixCls + '-mask', hiddenClassName: props.prefixCls + '-mask-hidden', visible: props.visible }); if (maskTransition) { maskElement = _react2['default'].createElement( _rcAnimate2['default'], { key: 'mask', showProp: 'visible', transitionAppear: true, component: '', transitionName: maskTransition }, maskElement ); } } return maskElement; } }, { key: 'render', value: function render() { return _react2['default'].createElement( 'div', null, this.getMaskElement(), this.getPopupElement() ); } }]); return Popup; }(_react.Component); Popup.propTypes = { visible: _propTypes2['default'].bool, style: _propTypes2['default'].object, getClassNameFromAlign: _propTypes2['default'].func, onAlign: _propTypes2['default'].func, getRootDomNode: _propTypes2['default'].func, onMouseEnter: _propTypes2['default'].func, align: _propTypes2['default'].any, destroyPopupOnHide: _propTypes2['default'].bool, className: _propTypes2['default'].string, prefixCls: _propTypes2['default'].string, onMouseLeave: _propTypes2['default'].func }; var _initialiseProps = function _initialiseProps() { var _this2 = this; this.onAlign = function (popupDomNode, align) { var props = _this2.props; var currentAlignClassName = props.getClassNameFromAlign(align); // FIX: https://github.com/react-component/trigger/issues/56 // FIX: https://github.com/react-component/tooltip/issues/79 if (_this2.currentAlignClassName !== currentAlignClassName) { _this2.currentAlignClassName = currentAlignClassName; popupDomNode.className = _this2.getClassName(currentAlignClassName); } props.onAlign(popupDomNode, align); }; this.getTarget = function () { return _this2.props.getRootDomNode(); }; }; exports['default'] = Popup; module.exports = exports['default']; /***/ }, /* 120 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _LazyRenderBox = __webpack_require__(56); var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var PopupInner = function (_Component) { (0, _inherits3['default'])(PopupInner, _Component); function PopupInner() { (0, _classCallCheck3['default'])(this, PopupInner); return (0, _possibleConstructorReturn3['default'])(this, (PopupInner.__proto__ || Object.getPrototypeOf(PopupInner)).apply(this, arguments)); } (0, _createClass3['default'])(PopupInner, [{ key: 'render', value: function render() { var props = this.props; var className = props.className; if (!props.visible) { className += ' ' + props.hiddenClassName; } return _react2['default'].createElement( 'div', { className: className, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, style: props.style }, _react2['default'].createElement( _LazyRenderBox2['default'], { className: props.prefixCls + '-content', visible: props.visible }, props.children ) ); } }]); return PopupInner; }(_react.Component); PopupInner.propTypes = { hiddenClassName: _propTypes2['default'].string, className: _propTypes2['default'].string, prefixCls: _propTypes2['default'].string, onMouseEnter: _propTypes2['default'].func, onMouseLeave: _propTypes2['default'].func, children: _propTypes2['default'].any }; exports['default'] = PopupInner; module.exports = exports['default']; /***/ }, /* 121 */ /***/ function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }, /* 122 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _cssAnimation = __webpack_require__(302); var _cssAnimation2 = _interopRequireDefault(_cssAnimation); var _getRequestAnimationFrame = __webpack_require__(103); var _getRequestAnimationFrame2 = _interopRequireDefault(_getRequestAnimationFrame); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var reqAnimFrame = (0, _getRequestAnimationFrame2['default'])(); function animate(node, show, done) { var height = void 0; var requestAnimationFrameId = void 0; return (0, _cssAnimation2['default'])(node, 'ant-motion-collapse', { start: function start() { if (!show) { node.style.height = node.offsetHeight + 'px'; node.style.opacity = 1; } else { height = node.offsetHeight; node.style.height = 0; node.style.opacity = 0; } }, active: function active() { if (requestAnimationFrameId) { (0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); } requestAnimationFrameId = reqAnimFrame(function () { node.style.height = (show ? height : 0) + 'px'; node.style.opacity = show ? 1 : 0; }); }, end: function end() { if (requestAnimationFrameId) { (0, _getRequestAnimationFrame.cancelRequestAnimationFrame)(requestAnimationFrameId); } node.style.height = ''; node.style.opacity = ''; done(); } }); } var animation = { enter: function enter(node, done) { return animate(node, true, done); }, leave: function leave(node, done) { return animate(node, false, done); }, appear: function appear(node, done) { return animate(node, true, done); } }; exports['default'] = animation; module.exports = exports['default']; /***/ }, /* 123 */, /* 124 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(203); /***/ }, /* 125 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = function (componentName, defaultLocale) { return function (Component) { var ComponentWithStatics = Component; return _a = function (_Component) { (0, _inherits3['default'])(_a, _Component); function _a() { (0, _classCallCheck3['default'])(this, _a); return (0, _possibleConstructorReturn3['default'])(this, (_a.__proto__ || Object.getPrototypeOf(_a)).apply(this, arguments)); } (0, _createClass3['default'])(_a, [{ key: 'getLocale', value: function getLocale() { var antLocale = this.context.antLocale; var localeFromContext = antLocale && antLocale[componentName]; var localeFromProps = this.props.locale || {}; return (0, _extends3['default'])({}, defaultLocale, localeFromContext || {}, localeFromProps); } }]); return _a; }(Component), _a.propTypes = ComponentWithStatics.propTypes, _a.defaultProps = ComponentWithStatics.defaultProps, _a.contextTypes = (0, _extends3['default'])({}, ComponentWithStatics.context || {}, { antLocale: _propTypes2['default'].object }), _a; var _a; }; }; module.exports = exports['default']; /***/ }, /* 126 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcMenu = __webpack_require__(20); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _tooltip = __webpack_require__(94); var _tooltip2 = _interopRequireDefault(_tooltip); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var MenuItem = function MenuItem(props, _ref) { var inlineCollapsed = _ref.inlineCollapsed; return _react2['default'].createElement( _tooltip2['default'], { title: inlineCollapsed && props.level === 1 ? props.children : '', placement: 'right', overlayClassName: props.rootPrefixCls + '-inline-collapsed-tooltip' }, _react2['default'].createElement(_rcMenu.Item, props) ); }; MenuItem.contextTypes = { inlineCollapsed: _propTypes2['default'].bool }; exports['default'] = MenuItem; module.exports = exports['default']; /***/ }, /* 127 */, /* 128 */, /* 129 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _grid = __webpack_require__(142); exports['default'] = _grid.Row; module.exports = exports['default']; /***/ }, /* 130 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(58); /***/ }, /* 131 */, /* 132 */, /* 133 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var DOMWrap = (0, _createReactClass2["default"])({ displayName: 'DOMWrap', propTypes: { tag: _propTypes2["default"].string, hiddenClassName: _propTypes2["default"].string, visible: _propTypes2["default"].bool }, getDefaultProps: function getDefaultProps() { return { tag: 'div' }; }, render: function render() { var props = (0, _extends3["default"])({}, this.props); if (!props.visible) { props.className = props.className || ''; props.className += ' ' + props.hiddenClassName; } var Tag = props.tag; delete props.tag; delete props.hiddenClassName; delete props.visible; return _react2["default"].createElement(Tag, props); } }); exports["default"] = DOMWrap; module.exports = exports['default']; /***/ }, /* 134 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var Divider = (0, _createReactClass2["default"])({ displayName: 'Divider', propTypes: { disabled: _propTypes2["default"].bool, className: _propTypes2["default"].string, rootPrefixCls: _propTypes2["default"].string }, getDefaultProps: function getDefaultProps() { return { disabled: true }; }, render: function render() { var _props = this.props, _props$className = _props.className, className = _props$className === undefined ? '' : _props$className, rootPrefixCls = _props.rootPrefixCls; return _react2["default"].createElement('li', { className: className + ' ' + rootPrefixCls + '-item-divider' }); } }); exports["default"] = Divider; module.exports = exports['default']; /***/ }, /* 135 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _MenuMixin = __webpack_require__(65); var _MenuMixin2 = _interopRequireDefault(_MenuMixin); var _util = __webpack_require__(23); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // import React from 'react'; var Menu = (0, _createReactClass2["default"])({ displayName: 'Menu', propTypes: { openSubMenuOnMouseEnter: _propTypes2["default"].bool, closeSubMenuOnMouseLeave: _propTypes2["default"].bool, selectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultSelectedKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), defaultOpenKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), mode: _propTypes2["default"].string, onClick: _propTypes2["default"].func, onSelect: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, openTransitionName: _propTypes2["default"].string, openAnimation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), level: _propTypes2["default"].number, eventKey: _propTypes2["default"].string, selectable: _propTypes2["default"].bool, children: _propTypes2["default"].any }, mixins: [_MenuMixin2["default"]], getDefaultProps: function getDefaultProps() { return { openSubMenuOnMouseEnter: true, closeSubMenuOnMouseLeave: true, selectable: true, onClick: _util.noop, onSelect: _util.noop, onOpenChange: _util.noop, onDeselect: _util.noop, defaultSelectedKeys: [], defaultOpenKeys: [] }; }, getInitialState: function getInitialState() { var props = this.props; var selectedKeys = props.defaultSelectedKeys; var openKeys = props.defaultOpenKeys; if ('selectedKeys' in props) { selectedKeys = props.selectedKeys || []; } if ('openKeys' in props) { openKeys = props.openKeys || []; } return { selectedKeys: selectedKeys, openKeys: openKeys }; }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var props = {}; if ('selectedKeys' in nextProps) { props.selectedKeys = nextProps.selectedKeys || []; } if ('openKeys' in nextProps) { props.openKeys = nextProps.openKeys || []; } this.setState(props); }, onDestroy: function onDestroy(key) { var state = this.state; var props = this.props; var selectedKeys = state.selectedKeys; var openKeys = state.openKeys; var index = selectedKeys.indexOf(key); if (!('selectedKeys' in props) && index !== -1) { selectedKeys.splice(index, 1); } index = openKeys.indexOf(key); if (!('openKeys' in props) && index !== -1) { openKeys.splice(index, 1); } }, onItemHover: function onItemHover(e) { var _this = this; var item = e.item; var _props = this.props, mode = _props.mode, closeSubMenuOnMouseLeave = _props.closeSubMenuOnMouseLeave; var _e$openChanges = e.openChanges, openChanges = _e$openChanges === undefined ? [] : _e$openChanges; // special for top sub menu if (mode !== 'inline' && !closeSubMenuOnMouseLeave && item.isSubMenu) { (function () { var activeKey = _this.state.activeKey; var activeItem = _this.getFlatInstanceArray().filter(function (c) { return c && c.props.eventKey === activeKey; })[0]; if (activeItem && activeItem.props.open) { openChanges = openChanges.concat({ key: item.props.eventKey, item: item, originalEvent: e, open: true }); } })(); } openChanges = openChanges.concat(this.getOpenChangesOnItemHover(e)); if (openChanges.length) { this.onOpenChange(openChanges); } }, onSelect: function onSelect(selectInfo) { var props = this.props; if (props.selectable) { // root menu var selectedKeys = this.state.selectedKeys; var selectedKey = selectInfo.key; if (props.multiple) { selectedKeys = selectedKeys.concat([selectedKey]); } else { selectedKeys = [selectedKey]; } if (!('selectedKeys' in props)) { this.setState({ selectedKeys: selectedKeys }); } props.onSelect((0, _extends3["default"])({}, selectInfo, { selectedKeys: selectedKeys })); } }, onClick: function onClick(e) { this.props.onClick(e); }, onOpenChange: function onOpenChange(e_) { var props = this.props; var openKeys = this.state.openKeys.concat(); var changed = false; var processSingle = function processSingle(e) { var oneChanged = false; if (e.open) { oneChanged = openKeys.indexOf(e.key) === -1; if (oneChanged) { openKeys.push(e.key); } } else { var index = openKeys.indexOf(e.key); oneChanged = index !== -1; if (oneChanged) { openKeys.splice(index, 1); } } changed = changed || oneChanged; }; if (Array.isArray(e_)) { // batch change call e_.forEach(processSingle); } else { processSingle(e_); } if (changed) { if (!('openKeys' in this.props)) { this.setState({ openKeys: openKeys }); } props.onOpenChange(openKeys); } }, onDeselect: function onDeselect(selectInfo) { var props = this.props; if (props.selectable) { var selectedKeys = this.state.selectedKeys.concat(); var selectedKey = selectInfo.key; var index = selectedKeys.indexOf(selectedKey); if (index !== -1) { selectedKeys.splice(index, 1); } if (!('selectedKeys' in props)) { this.setState({ selectedKeys: selectedKeys }); } props.onDeselect((0, _extends3["default"])({}, selectInfo, { selectedKeys: selectedKeys })); } }, getOpenTransitionName: function getOpenTransitionName() { var props = this.props; var transitionName = props.openTransitionName; var animationName = props.openAnimation; if (!transitionName && typeof animationName === 'string') { transitionName = props.prefixCls + '-open-' + animationName; } return transitionName; }, isInlineMode: function isInlineMode() { return this.props.mode === 'inline'; }, lastOpenSubMenu: function lastOpenSubMenu() { var lastOpen = []; var openKeys = this.state.openKeys; if (openKeys.length) { lastOpen = this.getFlatInstanceArray().filter(function (c) { return c && openKeys.indexOf(c.props.eventKey) !== -1; }); } return lastOpen[0]; }, renderMenuItem: function renderMenuItem(c, i, subIndex) { if (!c) { return null; } var state = this.state; var extraProps = { openKeys: state.openKeys, selectedKeys: state.selectedKeys, openSubMenuOnMouseEnter: this.props.openSubMenuOnMouseEnter }; return this.renderCommonMenuItem(c, i, subIndex, extraProps); }, render: function render() { var props = (0, _extends3["default"])({}, this.props); props.className += ' ' + props.prefixCls + '-root'; return this.renderRoot(props); } }); exports["default"] = Menu; module.exports = exports['default']; /***/ }, /* 136 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _KeyCode = __webpack_require__(22); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _util = __webpack_require__(23); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /* eslint react/no-is-mounted:0 */ var MenuItem = (0, _createReactClass2["default"])({ displayName: 'MenuItem', propTypes: { rootPrefixCls: _propTypes2["default"].string, eventKey: _propTypes2["default"].string, active: _propTypes2["default"].bool, children: _propTypes2["default"].any, selectedKeys: _propTypes2["default"].array, disabled: _propTypes2["default"].bool, title: _propTypes2["default"].string, onSelect: _propTypes2["default"].func, onClick: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, parentMenu: _propTypes2["default"].object, onItemHover: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, onMouseEnter: _propTypes2["default"].func, onMouseLeave: _propTypes2["default"].func }, getDefaultProps: function getDefaultProps() { return { onSelect: _util.noop, onMouseEnter: _util.noop, onMouseLeave: _util.noop }; }, componentWillUnmount: function componentWillUnmount() { var props = this.props; if (props.onDestroy) { props.onDestroy(props.eventKey); } if (props.parentMenu.menuItemInstance === this) { this.clearMenuItemMouseLeaveTimer(); } }, onKeyDown: function onKeyDown(e) { var keyCode = e.keyCode; if (keyCode === _KeyCode2["default"].ENTER) { this.onClick(e); return true; } }, onMouseLeave: function onMouseLeave(e) { var _this = this; var props = this.props; var eventKey = props.eventKey, parentMenu = props.parentMenu; parentMenu.menuItemInstance = this; parentMenu.menuItemMouseLeaveFn = function () { if (props.active) { props.onItemHover({ key: eventKey, item: _this, hover: false, domEvent: e, trigger: 'mouseleave' }); } }; parentMenu.menuItemMouseLeaveTimer = setTimeout(parentMenu.menuItemMouseLeaveFn, 30); props.onMouseLeave({ key: eventKey, domEvent: e }); }, onMouseEnter: function onMouseEnter(e) { var props = this.props; var eventKey = props.eventKey, parentMenu = props.parentMenu; this.clearMenuItemMouseLeaveTimer(parentMenu.menuItemInstance !== this); if (parentMenu.subMenuInstance) { parentMenu.subMenuInstance.clearSubMenuTimers(); } props.onItemHover({ key: eventKey, item: this, hover: true, domEvent: e, trigger: 'mouseenter' }); props.onMouseEnter({ key: eventKey, domEvent: e }); }, onClick: function onClick(e) { var props = this.props; var selected = this.isSelected(); var eventKey = props.eventKey; var info = { key: eventKey, keyPath: [eventKey], item: this, domEvent: e }; props.onClick(info); if (props.multiple) { if (selected) { props.onDeselect(info); } else { props.onSelect(info); } } else if (!selected) { props.onSelect(info); } }, getPrefixCls: function getPrefixCls() { return this.props.rootPrefixCls + '-item'; }, getActiveClassName: function getActiveClassName() { return this.getPrefixCls() + '-active'; }, getSelectedClassName: function getSelectedClassName() { return this.getPrefixCls() + '-selected'; }, getDisabledClassName: function getDisabledClassName() { return this.getPrefixCls() + '-disabled'; }, clearMenuItemMouseLeaveTimer: function clearMenuItemMouseLeaveTimer() { var props = this.props; var callFn = void 0; var parentMenu = props.parentMenu; if (parentMenu.menuItemMouseLeaveTimer) { clearTimeout(parentMenu.menuItemMouseLeaveTimer); parentMenu.menuItemMouseLeaveTimer = null; if (callFn && parentMenu.menuItemMouseLeaveFn) { parentMenu.menuItemMouseLeaveFn(); } parentMenu.menuItemMouseLeaveFn = null; } }, isSelected: function isSelected() { return this.props.selectedKeys.indexOf(this.props.eventKey) !== -1; }, render: function render() { var props = this.props; var selected = this.isSelected(); var classes = {}; classes[this.getActiveClassName()] = !props.disabled && props.active; classes[this.getSelectedClassName()] = selected; classes[this.getDisabledClassName()] = props.disabled; classes[this.getPrefixCls()] = true; classes[props.className] = !!props.className; var attrs = (0, _extends3["default"])({}, props.attribute, { title: props.title, className: (0, _classnames2["default"])(classes), role: 'menuitem', 'aria-selected': selected, 'aria-disabled': props.disabled }); var mouseEvent = {}; if (!props.disabled) { mouseEvent = { onClick: this.onClick, onMouseLeave: this.onMouseLeave, onMouseEnter: this.onMouseEnter }; } var style = (0, _extends3["default"])({}, props.style); if (props.mode === 'inline') { style.paddingLeft = props.inlineIndent * props.level; } return _react2["default"].createElement( 'li', (0, _extends3["default"])({ style: style }, attrs, mouseEvent), props.children ); } }); MenuItem.isMenuItem = 1; exports["default"] = MenuItem; module.exports = exports['default']; /***/ }, /* 137 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var MenuItemGroup = (0, _createReactClass2["default"])({ displayName: 'MenuItemGroup', propTypes: { renderMenuItem: _propTypes2["default"].func, index: _propTypes2["default"].number, className: _propTypes2["default"].string, rootPrefixCls: _propTypes2["default"].string }, getDefaultProps: function getDefaultProps() { return { disabled: true }; }, renderInnerMenuItem: function renderInnerMenuItem(item, subIndex) { var _props = this.props, renderMenuItem = _props.renderMenuItem, index = _props.index; return renderMenuItem(item, index, subIndex); }, render: function render() { var props = this.props; var _props$className = props.className, className = _props$className === undefined ? '' : _props$className, rootPrefixCls = props.rootPrefixCls; var titleClassName = rootPrefixCls + '-item-group-title'; var listClassName = rootPrefixCls + '-item-group-list'; return _react2["default"].createElement( 'li', { className: className + ' ' + rootPrefixCls + '-item-group' }, _react2["default"].createElement( 'div', { className: titleClassName }, props.title ), _react2["default"].createElement( 'ul', { className: listClassName }, _react2["default"].Children.map(props.children, this.renderInnerMenuItem) ) ); } }); MenuItemGroup.isMenuItemGroup = true; exports["default"] = MenuItemGroup; module.exports = exports['default']; /***/ }, /* 138 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _SubPopupMenu = __webpack_require__(140); var _SubPopupMenu2 = _interopRequireDefault(_SubPopupMenu); var _KeyCode = __webpack_require__(22); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _util = __webpack_require__(23); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var guid = 0; /* eslint react/no-is-mounted:0 */ var SubMenu = (0, _createReactClass2["default"])({ displayName: 'SubMenu', propTypes: { parentMenu: _propTypes2["default"].object, title: _propTypes2["default"].node, children: _propTypes2["default"].any, selectedKeys: _propTypes2["default"].array, openKeys: _propTypes2["default"].array, onClick: _propTypes2["default"].func, onOpenChange: _propTypes2["default"].func, rootPrefixCls: _propTypes2["default"].string, eventKey: _propTypes2["default"].string, multiple: _propTypes2["default"].bool, active: _propTypes2["default"].bool, onSelect: _propTypes2["default"].func, closeSubMenuOnMouseLeave: _propTypes2["default"].bool, openSubMenuOnMouseEnter: _propTypes2["default"].bool, onDeselect: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, onItemHover: _propTypes2["default"].func, onMouseEnter: _propTypes2["default"].func, onMouseLeave: _propTypes2["default"].func, onTitleMouseEnter: _propTypes2["default"].func, onTitleMouseLeave: _propTypes2["default"].func, onTitleClick: _propTypes2["default"].func }, mixins: [__webpack_require__(139)], getDefaultProps: function getDefaultProps() { return { onMouseEnter: _util.noop, onMouseLeave: _util.noop, onTitleMouseEnter: _util.noop, onTitleMouseLeave: _util.noop, onTitleClick: _util.noop, title: '' }; }, getInitialState: function getInitialState() { this.isSubMenu = 1; return { defaultActiveFirst: false }; }, componentWillUnmount: function componentWillUnmount() { var _props = this.props, onDestroy = _props.onDestroy, eventKey = _props.eventKey, parentMenu = _props.parentMenu; if (onDestroy) { onDestroy(eventKey); } if (parentMenu.subMenuInstance === this) { this.clearSubMenuTimers(); } }, onDestroy: function onDestroy(key) { this.props.onDestroy(key); }, onKeyDown: function onKeyDown(e) { var keyCode = e.keyCode; var menu = this.menuInstance; var isOpen = this.isOpen(); if (keyCode === _KeyCode2["default"].ENTER) { this.onTitleClick(e); this.setState({ defaultActiveFirst: true }); return true; } if (keyCode === _KeyCode2["default"].RIGHT) { if (isOpen) { menu.onKeyDown(e); } else { this.triggerOpenChange(true); this.setState({ defaultActiveFirst: true }); } return true; } if (keyCode === _KeyCode2["default"].LEFT) { var handled = void 0; if (isOpen) { handled = menu.onKeyDown(e); } else { return undefined; } if (!handled) { this.triggerOpenChange(false); handled = true; } return handled; } if (isOpen && (keyCode === _KeyCode2["default"].UP || keyCode === _KeyCode2["default"].DOWN)) { return menu.onKeyDown(e); } }, onOpenChange: function onOpenChange(e) { this.props.onOpenChange(e); }, onMouseEnter: function onMouseEnter(e) { var props = this.props; this.clearSubMenuLeaveTimer(props.parentMenu.subMenuInstance !== this); props.onMouseEnter({ key: props.eventKey, domEvent: e }); }, onTitleMouseEnter: function onTitleMouseEnter(domEvent) { var props = this.props; var parentMenu = props.parentMenu, key = props.eventKey; var item = this; this.clearSubMenuTitleLeaveTimer(parentMenu.subMenuInstance !== item); if (parentMenu.menuItemInstance) { parentMenu.menuItemInstance.clearMenuItemMouseLeaveTimer(true); } var openChanges = []; if (props.openSubMenuOnMouseEnter) { openChanges.push({ key: key, item: item, trigger: 'mouseenter', open: true }); } props.onItemHover({ key: key, item: item, hover: true, trigger: 'mouseenter', openChanges: openChanges }); this.setState({ defaultActiveFirst: false }); props.onTitleMouseEnter({ key: key, domEvent: domEvent }); }, onTitleMouseLeave: function onTitleMouseLeave(e) { var _this = this; var props = this.props; var parentMenu = props.parentMenu, eventKey = props.eventKey; parentMenu.subMenuInstance = this; parentMenu.subMenuTitleLeaveFn = function () { // leave whole sub tree // still active if (props.mode === 'inline' && props.active) { props.onItemHover({ key: eventKey, item: _this, hover: false, trigger: 'mouseleave' }); } props.onTitleMouseLeave({ key: props.eventKey, domEvent: e }); }; parentMenu.subMenuTitleLeaveTimer = setTimeout(parentMenu.subMenuTitleLeaveFn, 100); }, onMouseLeave: function onMouseLeave(e) { var _this2 = this; var props = this.props; var parentMenu = props.parentMenu, eventKey = props.eventKey; parentMenu.subMenuInstance = this; parentMenu.subMenuLeaveFn = function () { // leave whole sub tree // still active if (props.mode !== 'inline') { var isOpen = _this2.isOpen(); if (isOpen && props.closeSubMenuOnMouseLeave && props.active) { props.onItemHover({ key: eventKey, item: _this2, hover: false, trigger: 'mouseleave', openChanges: [{ key: eventKey, item: _this2, trigger: 'mouseleave', open: false }] }); } else { if (props.active) { props.onItemHover({ key: eventKey, item: _this2, hover: false, trigger: 'mouseleave' }); } if (isOpen && props.closeSubMenuOnMouseLeave) { _this2.triggerOpenChange(false); } } } // trigger mouseleave props.onMouseLeave({ key: eventKey, domEvent: e }); }; // prevent popup menu and submenu gap parentMenu.subMenuLeaveTimer = setTimeout(parentMenu.subMenuLeaveFn, 100); }, onTitleClick: function onTitleClick(e) { var props = this.props; props.onTitleClick({ key: props.eventKey, domEvent: e }); if (props.openSubMenuOnMouseEnter) { return; } this.triggerOpenChange(!this.isOpen(), 'click'); this.setState({ defaultActiveFirst: false }); }, onSubMenuClick: function onSubMenuClick(info) { this.props.onClick(this.addKeyPath(info)); }, onSelect: function onSelect(info) { this.props.onSelect(info); }, onDeselect: function onDeselect(info) { this.props.onDeselect(info); }, getPrefixCls: function getPrefixCls() { return this.props.rootPrefixCls + '-submenu'; }, getActiveClassName: function getActiveClassName() { return this.getPrefixCls() + '-active'; }, getDisabledClassName: function getDisabledClassName() { return this.getPrefixCls() + '-disabled'; }, getSelectedClassName: function getSelectedClassName() { return this.getPrefixCls() + '-selected'; }, getOpenClassName: function getOpenClassName() { return this.props.rootPrefixCls + '-submenu-open'; }, saveMenuInstance: function saveMenuInstance(c) { this.menuInstance = c; }, addKeyPath: function addKeyPath(info) { return (0, _extends3["default"])({}, info, { keyPath: (info.keyPath || []).concat(this.props.eventKey) }); }, triggerOpenChange: function triggerOpenChange(open, type) { var key = this.props.eventKey; this.onOpenChange({ key: key, item: this, trigger: type, open: open }); }, clearSubMenuTimers: function clearSubMenuTimers() { var callFn = void 0; this.clearSubMenuLeaveTimer(callFn); this.clearSubMenuTitleLeaveTimer(callFn); }, clearSubMenuTitleLeaveTimer: function clearSubMenuTitleLeaveTimer() { var callFn = void 0; var parentMenu = this.props.parentMenu; if (parentMenu.subMenuTitleLeaveTimer) { clearTimeout(parentMenu.subMenuTitleLeaveTimer); parentMenu.subMenuTitleLeaveTimer = null; if (callFn && parentMenu.subMenuTitleLeaveFn) { parentMenu.subMenuTitleLeaveFn(); } parentMenu.subMenuTitleLeaveFn = null; } }, clearSubMenuLeaveTimer: function clearSubMenuLeaveTimer() { var callFn = void 0; var parentMenu = this.props.parentMenu; if (parentMenu.subMenuLeaveTimer) { clearTimeout(parentMenu.subMenuLeaveTimer); parentMenu.subMenuLeaveTimer = null; if (callFn && parentMenu.subMenuLeaveFn) { parentMenu.subMenuLeaveFn(); } parentMenu.subMenuLeaveFn = null; } }, isChildrenSelected: function isChildrenSelected() { var ret = { find: false }; (0, _util.loopMenuItemRecusively)(this.props.children, this.props.selectedKeys, ret); return ret.find; }, isOpen: function isOpen() { return this.props.openKeys.indexOf(this.props.eventKey) !== -1; }, renderChildren: function renderChildren(children) { var props = this.props; var baseProps = { mode: props.mode === 'horizontal' ? 'vertical' : props.mode, visible: this.isOpen(), level: props.level + 1, inlineIndent: props.inlineIndent, focusable: false, onClick: this.onSubMenuClick, onSelect: this.onSelect, onDeselect: this.onDeselect, onDestroy: this.onDestroy, selectedKeys: props.selectedKeys, eventKey: props.eventKey + '-menu-', openKeys: props.openKeys, openTransitionName: props.openTransitionName, openAnimation: props.openAnimation, onOpenChange: this.onOpenChange, closeSubMenuOnMouseLeave: props.closeSubMenuOnMouseLeave, defaultActiveFirst: this.state.defaultActiveFirst, multiple: props.multiple, prefixCls: props.rootPrefixCls, id: this._menuId, ref: this.saveMenuInstance }; return _react2["default"].createElement( _SubPopupMenu2["default"], baseProps, children ); }, render: function render() { var _classes; var isOpen = this.isOpen(); this.haveOpen = this.haveOpen || isOpen; var props = this.props; var prefixCls = this.getPrefixCls(); var classes = (_classes = {}, (0, _defineProperty3["default"])(_classes, props.className, !!props.className), (0, _defineProperty3["default"])(_classes, prefixCls + '-' + props.mode, 1), _classes); classes[this.getOpenClassName()] = isOpen; classes[this.getActiveClassName()] = props.active; classes[this.getDisabledClassName()] = props.disabled; classes[this.getSelectedClassName()] = this.isChildrenSelected(); if (!this._menuId) { if (props.eventKey) { this._menuId = props.eventKey + '$Menu'; } else { this._menuId = '$__$' + ++guid + '$Menu'; } } classes[prefixCls] = true; classes[prefixCls + '-' + props.mode] = 1; var titleClickEvents = {}; var mouseEvents = {}; var titleMouseEvents = {}; if (!props.disabled) { titleClickEvents = { onClick: this.onTitleClick }; mouseEvents = { onMouseLeave: this.onMouseLeave, onMouseEnter: this.onMouseEnter }; // only works in title, not outer li titleMouseEvents = { onMouseEnter: this.onTitleMouseEnter, onMouseLeave: this.onTitleMouseLeave }; } var style = {}; if (props.mode === 'inline') { style.paddingLeft = props.inlineIndent * props.level; } return _react2["default"].createElement( 'li', (0, _extends3["default"])({ className: (0, _classnames2["default"])(classes) }, mouseEvents), _react2["default"].createElement( 'div', (0, _extends3["default"])({ style: style, className: prefixCls + '-title' }, titleMouseEvents, titleClickEvents, { 'aria-expanded': isOpen, 'aria-owns': this._menuId, 'aria-haspopup': 'true' }), props.title ), this.renderChildren(props.children) ); } }); SubMenu.isSubMenu = 1; exports["default"] = SubMenu; module.exports = exports['default']; /***/ }, /* 139 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _KeyCode = __webpack_require__(22); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _addEventListener = __webpack_require__(34); var _addEventListener2 = _interopRequireDefault(_addEventListener); var _contains = __webpack_require__(59); var _contains2 = _interopRequireDefault(_contains); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = { componentDidMount: function componentDidMount() { this.componentDidUpdate(); }, componentDidUpdate: function componentDidUpdate() { if (this.props.mode !== 'inline') { if (this.props.open) { this.bindRootCloseHandlers(); } else { this.unbindRootCloseHandlers(); } } }, handleDocumentKeyUp: function handleDocumentKeyUp(e) { if (e.keyCode === _KeyCode2["default"].ESC) { this.props.onItemHover({ key: this.props.eventKey, item: this, hover: false }); } }, handleDocumentClick: function handleDocumentClick(e) { // If the click originated from within this component // don't do anything. if ((0, _contains2["default"])(_reactDom2["default"].findDOMNode(this), e.target)) { return; } var props = this.props; props.onItemHover({ hover: false, item: this, key: this.props.eventKey }); this.triggerOpenChange(false); }, bindRootCloseHandlers: function bindRootCloseHandlers() { if (!this._onDocumentClickListener) { this._onDocumentClickListener = (0, _addEventListener2["default"])(document, 'click', this.handleDocumentClick); this._onDocumentKeyupListener = (0, _addEventListener2["default"])(document, 'keyup', this.handleDocumentKeyUp); } }, unbindRootCloseHandlers: function unbindRootCloseHandlers() { if (this._onDocumentClickListener) { this._onDocumentClickListener.remove(); this._onDocumentClickListener = null; } if (this._onDocumentKeyupListener) { this._onDocumentKeyupListener.remove(); this._onDocumentKeyupListener = null; } }, componentWillUnmount: function componentWillUnmount() { this.unbindRootCloseHandlers(); } }; module.exports = exports['default']; /***/ }, /* 140 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _MenuMixin = __webpack_require__(65); var _MenuMixin2 = _interopRequireDefault(_MenuMixin); var _rcAnimate = __webpack_require__(26); var _rcAnimate2 = _interopRequireDefault(_rcAnimate); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var SubPopupMenu = (0, _createReactClass2["default"])({ displayName: 'SubPopupMenu', propTypes: { onSelect: _propTypes2["default"].func, onClick: _propTypes2["default"].func, onDeselect: _propTypes2["default"].func, onOpenChange: _propTypes2["default"].func, onDestroy: _propTypes2["default"].func, openTransitionName: _propTypes2["default"].string, openAnimation: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]), openKeys: _propTypes2["default"].arrayOf(_propTypes2["default"].string), closeSubMenuOnMouseLeave: _propTypes2["default"].bool, visible: _propTypes2["default"].bool, children: _propTypes2["default"].any }, mixins: [_MenuMixin2["default"]], onDeselect: function onDeselect(selectInfo) { this.props.onDeselect(selectInfo); }, onSelect: function onSelect(selectInfo) { this.props.onSelect(selectInfo); }, onClick: function onClick(e) { this.props.onClick(e); }, onOpenChange: function onOpenChange(e) { this.props.onOpenChange(e); }, onDestroy: function onDestroy(key) { this.props.onDestroy(key); }, onItemHover: function onItemHover(e) { var _e$openChanges = e.openChanges, openChanges = _e$openChanges === undefined ? [] : _e$openChanges; openChanges = openChanges.concat(this.getOpenChangesOnItemHover(e)); if (openChanges.length) { this.onOpenChange(openChanges); } }, getOpenTransitionName: function getOpenTransitionName() { return this.props.openTransitionName; }, renderMenuItem: function renderMenuItem(c, i, subIndex) { if (!c) { return null; } var props = this.props; var extraProps = { openKeys: props.openKeys, selectedKeys: props.selectedKeys, openSubMenuOnMouseEnter: true }; return this.renderCommonMenuItem(c, i, subIndex, extraProps); }, render: function render() { var renderFirst = this.renderFirst; this.renderFirst = 1; this.haveOpened = this.haveOpened || this.props.visible; if (!this.haveOpened) { return null; } var transitionAppear = true; if (!renderFirst && this.props.visible) { transitionAppear = false; } var props = (0, _extends3["default"])({}, this.props); props.className += ' ' + props.prefixCls + '-sub'; var animProps = {}; if (props.openTransitionName) { animProps.transitionName = props.openTransitionName; } else if ((0, _typeof3["default"])(props.openAnimation) === 'object') { animProps.animation = (0, _extends3["default"])({}, props.openAnimation); if (!transitionAppear) { delete animProps.animation.appear; } } return _react2["default"].createElement( _rcAnimate2["default"], (0, _extends3["default"])({}, animProps, { showProp: 'visible', component: '', transitionAppear: transitionAppear }), this.renderRoot(props) ); } }); exports["default"] = SubPopupMenu; module.exports = exports['default']; /***/ }, /* 141 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(204); __webpack_require__(66); /***/ }, /* 142 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Col = exports.Row = undefined; var _row = __webpack_require__(88); var _row2 = _interopRequireDefault(_row); var _col = __webpack_require__(87); var _col2 = _interopRequireDefault(_col); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports.Row = _row2['default']; exports.Col = _col2['default']; /***/ }, /* 143 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Pagination = __webpack_require__(160); var _Pagination2 = _interopRequireDefault(_Pagination); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = _Pagination2['default']; module.exports = exports['default']; /***/ }, /* 144 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(206); __webpack_require__(104); __webpack_require__(24); /***/ }, /* 145 */, /* 146 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = toArray; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function toArray(children) { var ret = []; _react2['default'].Children.forEach(children, function (c) { ret.push(c); }); return ret; } module.exports = exports['default']; /***/ }, /* 147 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var animation = void 0; function isCssAnimationSupported() { if (animation !== undefined) { return animation; } var domPrefixes = 'Webkit Moz O ms Khtml'.split(' '); var elm = document.createElement('div'); if (elm.style.animationName !== undefined) { animation = true; } if (animation !== undefined) { for (var i = 0; i < domPrefixes.length; i++) { if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) { animation = true; break; } } } animation = animation || false; return animation; } exports['default'] = isCssAnimationSupported; module.exports = exports['default']; /***/ }, /* 148 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _toConsumableArray2 = __webpack_require__(25); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _shallowequal = __webpack_require__(32); var _shallowequal2 = _interopRequireDefault(_shallowequal); var _Checkbox = __webpack_require__(71); var _Checkbox2 = _interopRequireDefault(_Checkbox); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var CheckboxGroup = function (_React$Component) { (0, _inherits3['default'])(CheckboxGroup, _React$Component); function CheckboxGroup(props) { (0, _classCallCheck3['default'])(this, CheckboxGroup); var _this = (0, _possibleConstructorReturn3['default'])(this, (CheckboxGroup.__proto__ || Object.getPrototypeOf(CheckboxGroup)).call(this, props)); _this.toggleOption = function (option) { var optionIndex = _this.state.value.indexOf(option.value); var value = [].concat((0, _toConsumableArray3['default'])(_this.state.value)); if (optionIndex === -1) { value.push(option.value); } else { value.splice(optionIndex, 1); } if (!('value' in _this.props)) { _this.setState({ value: value }); } var onChange = _this.props.onChange; if (onChange) { onChange(value); } }; _this.state = { value: props.value || props.defaultValue || [] }; return _this; } (0, _createClass3['default'])(CheckboxGroup, [{ key: 'getChildContext', value: function getChildContext() { return { checkboxGroup: { toggleOption: this.toggleOption, value: this.state.value, disabled: this.props.disabled } }; } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('value' in nextProps) { this.setState({ value: nextProps.value || [] }); } } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState) { return !(0, _shallowequal2['default'])(this.props, nextProps) || !(0, _shallowequal2['default'])(this.state, nextState); } }, { key: 'getOptions', value: function getOptions() { var options = this.props.options; // https://github.com/Microsoft/TypeScript/issues/7960 return options.map(function (option) { if (typeof option === 'string') { return { label: option, value: option }; } return option; }); } }, { key: 'render', value: function render() { var _this2 = this; var props = this.props, state = this.state; var prefixCls = props.prefixCls, className = props.className, options = props.options; var children = props.children; if (options && options.length > 0) { children = this.getOptions().map(function (option) { return _react2['default'].createElement( _Checkbox2['default'], { key: option.value, disabled: 'disabled' in option ? option.disabled : props.disabled, value: option.value, checked: state.value.indexOf(option.value) !== -1, onChange: function onChange() { return _this2.toggleOption(option); }, className: prefixCls + '-item' }, option.label ); }); } var classString = (0, _classnames2['default'])(prefixCls, className); return _react2['default'].createElement( 'div', { className: classString }, children ); } }]); return CheckboxGroup; }(_react2['default'].Component); exports['default'] = CheckboxGroup; CheckboxGroup.defaultProps = { options: [], prefixCls: 'ant-checkbox-group' }; CheckboxGroup.propTypes = { defaultValue: _propTypes2['default'].array, value: _propTypes2['default'].array, options: _propTypes2['default'].array.isRequired, onChange: _propTypes2['default'].func }; CheckboxGroup.childContextTypes = { checkboxGroup: _propTypes2['default'].any }; module.exports = exports['default']; /***/ }, /* 149 */, /* 150 */, /* 151 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _button = __webpack_require__(61); var _button2 = _interopRequireDefault(_button); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); var _dropdown = __webpack_require__(72); var _dropdown2 = _interopRequireDefault(_dropdown); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var ButtonGroup = _button2['default'].Group; var DropdownButton = function (_React$Component) { (0, _inherits3['default'])(DropdownButton, _React$Component); function DropdownButton() { (0, _classCallCheck3['default'])(this, DropdownButton); return (0, _possibleConstructorReturn3['default'])(this, (DropdownButton.__proto__ || Object.getPrototypeOf(DropdownButton)).apply(this, arguments)); } (0, _createClass3['default'])(DropdownButton, [{ key: 'render', value: function render() { var _a = this.props, type = _a.type, disabled = _a.disabled, onClick = _a.onClick, children = _a.children, prefixCls = _a.prefixCls, className = _a.className, overlay = _a.overlay, trigger = _a.trigger, align = _a.align, visible = _a.visible, onVisibleChange = _a.onVisibleChange, placement = _a.placement, getPopupContainer = _a.getPopupContainer, restProps = __rest(_a, ["type", "disabled", "onClick", "children", "prefixCls", "className", "overlay", "trigger", "align", "visible", "onVisibleChange", "placement", "getPopupContainer"]); var dropdownProps = { align: align, overlay: overlay, trigger: disabled ? [] : trigger, onVisibleChange: onVisibleChange, placement: placement, getPopupContainer: getPopupContainer }; if ('visible' in this.props) { dropdownProps.visible = visible; } return _react2['default'].createElement( ButtonGroup, (0, _extends3['default'])({}, restProps, { className: (0, _classnames2['default'])(prefixCls, className) }), _react2['default'].createElement( _button2['default'], { type: type, disabled: disabled, onClick: onClick }, children ), _react2['default'].createElement( _dropdown2['default'], dropdownProps, _react2['default'].createElement( _button2['default'], { type: type, disabled: disabled }, _react2['default'].createElement(_icon2['default'], { type: 'down' }) ) ) ); } }]); return DropdownButton; }(_react2['default'].Component); exports['default'] = DropdownButton; DropdownButton.defaultProps = { placement: 'bottomRight', type: 'default', prefixCls: 'ant-dropdown-button' }; module.exports = exports['default']; /***/ }, /* 152 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _createDOMForm = __webpack_require__(259); var _createDOMForm2 = _interopRequireDefault(_createDOMForm); var _PureRenderMixin = __webpack_require__(38); var _PureRenderMixin2 = _interopRequireDefault(_PureRenderMixin); var _omit = __webpack_require__(33); var _omit2 = _interopRequireDefault(_omit); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); var _FormItem = __webpack_require__(153); var _FormItem2 = _interopRequireDefault(_FormItem); var _constants = __webpack_require__(73); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Form = function (_React$Component) { (0, _inherits3['default'])(Form, _React$Component); function Form(props) { (0, _classCallCheck3['default'])(this, Form); var _this = (0, _possibleConstructorReturn3['default'])(this, (Form.__proto__ || Object.getPrototypeOf(Form)).call(this, props)); (0, _warning2['default'])(!props.form, 'It is unnecessary to pass `form` to `Form` after antd@1.7.0.'); return _this; } (0, _createClass3['default'])(Form, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _PureRenderMixin2['default'].shouldComponentUpdate.apply(this, args); } }, { key: 'getChildContext', value: function getChildContext() { var _props = this.props, layout = _props.layout, vertical = _props.vertical; return { vertical: layout === 'vertical' || vertical }; } }, { key: 'render', value: function render() { var _classNames; var _props2 = this.props, prefixCls = _props2.prefixCls, hideRequiredMark = _props2.hideRequiredMark, _props2$className = _props2.className, className = _props2$className === undefined ? '' : _props2$className, layout = _props2.layout, inline = _props2.inline, horizontal = _props2.horizontal, vertical = _props2.vertical; (0, _warning2['default'])(!inline && !horizontal && !vertical, '`Form[inline|horizontal|vertical]` is deprecated, please use `Form[layout]` instead.'); var formClassName = (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-horizontal', !inline && !vertical && layout === 'horizontal' || horizontal), (0, _defineProperty3['default'])(_classNames, prefixCls + '-vertical', layout === 'vertical' || vertical), (0, _defineProperty3['default'])(_classNames, prefixCls + '-inline', layout === 'inline' || inline), (0, _defineProperty3['default'])(_classNames, prefixCls + '-hide-required-mark', hideRequiredMark), _classNames), className); var formProps = (0, _omit2['default'])(this.props, ['prefixCls', 'className', 'layout', 'inline', 'horizontal', 'vertical', 'form', 'hideRequiredMark']); return _react2['default'].createElement('form', (0, _extends3['default'])({}, formProps, { className: formClassName })); } }]); return Form; }(_react2['default'].Component); exports['default'] = Form; Form.defaultProps = { prefixCls: 'ant-form', layout: 'horizontal', hideRequiredMark: false, onSubmit: function onSubmit(e) { e.preventDefault(); } }; Form.propTypes = { prefixCls: _propTypes2['default'].string, layout: _propTypes2['default'].oneOf(['horizontal', 'inline', 'vertical']), children: _propTypes2['default'].any, onSubmit: _propTypes2['default'].func, hideRequiredMark: _propTypes2['default'].bool }; Form.childContextTypes = { vertical: _propTypes2['default'].bool }; Form.Item = _FormItem2['default']; Form.create = function (options) { var formWrapper = (0, _createDOMForm2['default'])((0, _extends3['default'])({ fieldNameProp: 'id' }, options, { fieldMetaProp: _constants.FIELD_META_PROP })); /* eslint-disable react/prefer-es6-class */ return function (Component) { return formWrapper((0, _createReactClass2['default'])({ propTypes: { form: _propTypes2['default'].object.isRequired }, childContextTypes: { form: _propTypes2['default'].object.isRequired }, getChildContext: function getChildContext() { return { form: this.props.form }; }, componentWillMount: function componentWillMount() { this.__getFieldProps = this.props.form.getFieldProps; }, deprecatedGetFieldProps: function deprecatedGetFieldProps(name, option) { (0, _warning2['default'])(false, '`getFieldProps` is not recommended, please use `getFieldDecorator` instead, ' + 'see: https://u.ant.design/get-field-decorator'); return this.__getFieldProps(name, option); }, render: function render() { this.props.form.getFieldProps = this.deprecatedGetFieldProps; var withRef = {}; if (options && options.withRef) { withRef.ref = 'formWrappedComponent'; } return _react2['default'].createElement(Component, (0, _extends3['default'])({}, this.props, withRef)); } })); }; }; module.exports = exports['default']; /***/ }, /* 153 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _PureRenderMixin = __webpack_require__(38); var _PureRenderMixin2 = _interopRequireDefault(_PureRenderMixin); var _row = __webpack_require__(88); var _row2 = _interopRequireDefault(_row); var _col = __webpack_require__(87); var _col2 = _interopRequireDefault(_col); var _constants = __webpack_require__(73); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var FormItem = function (_React$Component) { (0, _inherits3['default'])(FormItem, _React$Component); function FormItem() { (0, _classCallCheck3['default'])(this, FormItem); return (0, _possibleConstructorReturn3['default'])(this, (FormItem.__proto__ || Object.getPrototypeOf(FormItem)).apply(this, arguments)); } (0, _createClass3['default'])(FormItem, [{ key: 'componentDidMount', value: function componentDidMount() { (0, _warning2['default'])(this.getControls(this.props.children, true).length <= 1, '`Form.Item` cannot generate `validateStatus` and `help` automatically, ' + 'while there are more than one `getFieldDecorator` in it.'); } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _PureRenderMixin2['default'].shouldComponentUpdate.apply(this, args); } }, { key: 'getHelpMsg', value: function getHelpMsg() { var context = this.context; var props = this.props; if (props.help === undefined && context.form) { return this.getId() ? (context.form.getFieldError(this.getId()) || []).join(', ') : ''; } return props.help; } }, { key: 'getControls', value: function getControls(children, recursively) { var controls = []; var childrenArray = _react2['default'].Children.toArray(children); for (var i = 0; i < childrenArray.length; i++) { if (!recursively && controls.length > 0) { break; } var child = childrenArray[i]; if (child.type === FormItem) { continue; } if (!child.props) { continue; } if (_constants.FIELD_META_PROP in child.props) { controls.push(child); } else if (child.props.children) { controls = controls.concat(this.getControls(child.props.children, recursively)); } } return controls; } }, { key: 'getOnlyControl', value: function getOnlyControl() { var child = this.getControls(this.props.children, false)[0]; return child !== undefined ? child : null; } }, { key: 'getChildProp', value: function getChildProp(prop) { var child = this.getOnlyControl(); return child && child.props && child.props[prop]; } }, { key: 'getId', value: function getId() { return this.getChildProp('id'); } }, { key: 'getMeta', value: function getMeta() { return this.getChildProp(_constants.FIELD_META_PROP); } }, { key: 'renderHelp', value: function renderHelp() { var prefixCls = this.props.prefixCls; var help = this.getHelpMsg(); return help ? _react2['default'].createElement( 'div', { className: prefixCls + '-explain', key: 'help' }, help ) : null; } }, { key: 'renderExtra', value: function renderExtra() { var _props = this.props, prefixCls = _props.prefixCls, extra = _props.extra; return extra ? _react2['default'].createElement( 'div', { className: prefixCls + '-extra' }, extra ) : null; } }, { key: 'getValidateStatus', value: function getValidateStatus() { var _context$form = this.context.form, isFieldValidating = _context$form.isFieldValidating, getFieldError = _context$form.getFieldError, getFieldValue = _context$form.getFieldValue; var fieldId = this.getId(); if (!fieldId) { return ''; } if (isFieldValidating(fieldId)) { return 'validating'; } if (!!getFieldError(fieldId)) { return 'error'; } var fieldValue = getFieldValue(fieldId); if (fieldValue !== undefined && fieldValue !== null && fieldValue !== '') { return 'success'; } return ''; } }, { key: 'renderValidateWrapper', value: function renderValidateWrapper(c1, c2, c3) { var classes = ''; var form = this.context.form; var props = this.props; var validateStatus = props.validateStatus === undefined && form ? this.getValidateStatus() : props.validateStatus; if (validateStatus) { classes = (0, _classnames2['default'])({ 'has-feedback': props.hasFeedback, 'has-success': validateStatus === 'success', 'has-warning': validateStatus === 'warning', 'has-error': validateStatus === 'error', 'is-validating': validateStatus === 'validating' }); } return _react2['default'].createElement( 'div', { className: this.props.prefixCls + '-item-control ' + classes }, c1, c2, c3 ); } }, { key: 'renderWrapper', value: function renderWrapper(children) { var _props2 = this.props, prefixCls = _props2.prefixCls, wrapperCol = _props2.wrapperCol; var className = (0, _classnames2['default'])(prefixCls + '-item-control-wrapper', wrapperCol && wrapperCol.className); return _react2['default'].createElement( _col2['default'], (0, _extends3['default'])({}, wrapperCol, { className: className, key: 'wrapper' }), children ); } }, { key: 'isRequired', value: function isRequired() { var required = this.props.required; if (required !== undefined) { return required; } if (this.context.form) { var meta = this.getMeta() || {}; var validate = meta.validate || []; return validate.filter(function (item) { return !!item.rules; }).some(function (item) { return item.rules.some(function (rule) { return rule.required; }); }); } return false; } }, { key: 'renderLabel', value: function renderLabel() { var _props3 = this.props, prefixCls = _props3.prefixCls, label = _props3.label, labelCol = _props3.labelCol, colon = _props3.colon, id = _props3.id; var context = this.context; var required = this.isRequired(); var labelColClassName = (0, _classnames2['default'])(prefixCls + '-item-label', labelCol && labelCol.className); var labelClassName = (0, _classnames2['default'])((0, _defineProperty3['default'])({}, prefixCls + '-item-required', required)); var labelChildren = label; // Keep label is original where there should have no colon var haveColon = colon && !context.vertical; // Remove duplicated user input colon if (haveColon && typeof label === 'string' && label.trim() !== '') { labelChildren = label.replace(/[:|:]\s*$/, ''); } return label ? _react2['default'].createElement( _col2['default'], (0, _extends3['default'])({}, labelCol, { className: labelColClassName, key: 'label' }), _react2['default'].createElement( 'label', { htmlFor: id || this.getId(), className: labelClassName, title: typeof label === 'string' ? label : '' }, labelChildren ) ) : null; } }, { key: 'renderChildren', value: function renderChildren() { var props = this.props; var children = _react2['default'].Children.map(props.children, function (child) { if (child && typeof child.type === 'function' && !child.props.size) { return _react2['default'].cloneElement(child, { size: 'large' }); } return child; }); return [this.renderLabel(), this.renderWrapper(this.renderValidateWrapper(children, this.renderHelp(), this.renderExtra()))]; } }, { key: 'renderFormItem', value: function renderFormItem(children) { var _itemClassName; var props = this.props; var prefixCls = props.prefixCls; var style = props.style; var itemClassName = (_itemClassName = {}, (0, _defineProperty3['default'])(_itemClassName, prefixCls + '-item', true), (0, _defineProperty3['default'])(_itemClassName, prefixCls + '-item-with-help', !!this.getHelpMsg()), (0, _defineProperty3['default'])(_itemClassName, prefixCls + '-item-no-colon', !props.colon), (0, _defineProperty3['default'])(_itemClassName, '' + props.className, !!props.className), _itemClassName); return _react2['default'].createElement( _row2['default'], { className: (0, _classnames2['default'])(itemClassName), style: style }, children ); } }, { key: 'render', value: function render() { var children = this.renderChildren(); return this.renderFormItem(children); } }]); return FormItem; }(_react2['default'].Component); exports['default'] = FormItem; FormItem.defaultProps = { hasFeedback: false, prefixCls: 'ant-form', colon: true }; FormItem.propTypes = { prefixCls: _propTypes2['default'].string, label: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].node]), labelCol: _propTypes2['default'].object, help: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].bool]), validateStatus: _propTypes2['default'].oneOf(['', 'success', 'warning', 'error', 'validating']), hasFeedback: _propTypes2['default'].bool, wrapperCol: _propTypes2['default'].object, className: _propTypes2['default'].string, id: _propTypes2['default'].string, children: _propTypes2['default'].node, colon: _propTypes2['default'].bool }; FormItem.contextTypes = { form: _propTypes2['default'].object, vertical: _propTypes2['default'].bool }; module.exports = exports['default']; /***/ }, /* 154 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(58); /***/ }, /* 155 */, /* 156 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Group = function Group(props) { var _classNames; var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === undefined ? 'ant-input-group' : _props$prefixCls, _props$className = props.className, className = _props$className === undefined ? '' : _props$className; var cls = (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-lg', props.size === 'large'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-sm', props.size === 'small'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-compact', props.compact), _classNames), className); return _react2['default'].createElement( 'span', { className: cls, style: props.style }, props.children ); }; exports['default'] = Group; module.exports = exports['default']; /***/ }, /* 157 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _Input = __webpack_require__(74); var _Input2 = _interopRequireDefault(_Input); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Search = function (_React$Component) { (0, _inherits3['default'])(Search, _React$Component); function Search() { (0, _classCallCheck3['default'])(this, Search); var _this = (0, _possibleConstructorReturn3['default'])(this, (Search.__proto__ || Object.getPrototypeOf(Search)).apply(this, arguments)); _this.onSearch = function () { var onSearch = _this.props.onSearch; if (onSearch) { onSearch(_this.input.refs.input.value); } _this.input.focus(); }; return _this; } (0, _createClass3['default'])(Search, [{ key: 'render', value: function render() { var _this2 = this; var _a = this.props, className = _a.className, prefixCls = _a.prefixCls, others = __rest(_a, ["className", "prefixCls"]); delete others.onSearch; var searchSuffix = _react2['default'].createElement(_icon2['default'], { className: prefixCls + '-icon', onClick: this.onSearch, type: 'search' }); return _react2['default'].createElement(_Input2['default'], (0, _extends3['default'])({ onPressEnter: this.onSearch }, others, { className: (0, _classnames2['default'])(prefixCls, className), suffix: searchSuffix, ref: function ref(node) { return _this2.input = node; } })); } }]); return Search; }(_react2['default'].Component); exports['default'] = Search; Search.defaultProps = { prefixCls: 'ant-input-search' }; module.exports = exports['default']; /***/ }, /* 158 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = calculateNodeHeight; // Thanks to https://github.com/andreypopp/react-textarea-autosize/ /** * calculateNodeHeight(uiTextNode, useCache = false) */ var HIDDEN_TEXTAREA_STYLE = '\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n'; var SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing']; var computedStyleCache = {}; var hiddenTextarea = void 0; function calculateNodeStyling(node) { var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name'); if (useCache && computedStyleCache[nodeRef]) { return computedStyleCache[nodeRef]; } var style = window.getComputedStyle(node); var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing'); var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top')); var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width')); var sizingStyle = SIZING_STYLE.map(function (name) { return name + ':' + style.getPropertyValue(name); }).join(';'); var nodeInfo = { sizingStyle: sizingStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing }; if (useCache && nodeRef) { computedStyleCache[nodeRef] = nodeInfo; } return nodeInfo; } function calculateNodeHeight(uiTextNode) { var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; if (!hiddenTextarea) { hiddenTextarea = document.createElement('textarea'); document.body.appendChild(hiddenTextarea); } // Fix wrap="off" issue // https://github.com/ant-design/ant-design/issues/6577 if (uiTextNode.getAttribute('wrap')) { hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap')); } else { hiddenTextarea.removeAttribute('wrap'); } // Copy all CSS properties that have an impact on the height of the content in // the textbox var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache), paddingSize = _calculateNodeStyling.paddingSize, borderSize = _calculateNodeStyling.borderSize, boxSizing = _calculateNodeStyling.boxSizing, sizingStyle = _calculateNodeStyling.sizingStyle; // Need to have the overflow attribute to hide the scrollbar otherwise // text-lines will not calculated properly as the shadow will technically be // narrower for content hiddenTextarea.setAttribute('style', sizingStyle + ';' + HIDDEN_TEXTAREA_STYLE); hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || ''; var minHeight = -Infinity; var maxHeight = Infinity; var height = hiddenTextarea.scrollHeight; var overflowY = void 0; if (boxSizing === 'border-box') { // border-box: add border, since height = content + padding + border height = height + borderSize; } else if (boxSizing === 'content-box') { // remove padding, since height = content height = height - paddingSize; } if (minRows !== null || maxRows !== null) { // measure height of a textarea with a single row hiddenTextarea.value = ''; var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; if (minRows !== null) { minHeight = singleRowHeight * minRows; if (boxSizing === 'border-box') { minHeight = minHeight + paddingSize + borderSize; } height = Math.max(minHeight, height); } if (maxRows !== null) { maxHeight = singleRowHeight * maxRows; if (boxSizing === 'border-box') { maxHeight = maxHeight + paddingSize + borderSize; } overflowY = height > maxHeight ? '' : 'hidden'; height = Math.min(maxHeight, height); } } return { height: height, minHeight: minHeight, maxHeight: maxHeight, overflowY: overflowY }; } module.exports = exports['default']; /***/ }, /* 159 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _select = __webpack_require__(60); var _select2 = _interopRequireDefault(_select); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var MiniSelect = function (_React$Component) { (0, _inherits3['default'])(MiniSelect, _React$Component); function MiniSelect() { (0, _classCallCheck3['default'])(this, MiniSelect); return (0, _possibleConstructorReturn3['default'])(this, (MiniSelect.__proto__ || Object.getPrototypeOf(MiniSelect)).apply(this, arguments)); } (0, _createClass3['default'])(MiniSelect, [{ key: 'render', value: function render() { return _react2['default'].createElement(_select2['default'], (0, _extends3['default'])({ size: 'small' }, this.props)); } }]); return MiniSelect; }(_react2['default'].Component); exports['default'] = MiniSelect; MiniSelect.Option = _select2['default'].Option; module.exports = exports['default']; /***/ }, /* 160 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _rcPagination = __webpack_require__(265); var _rcPagination2 = _interopRequireDefault(_rcPagination); var _zh_CN = __webpack_require__(86); var _zh_CN2 = _interopRequireDefault(_zh_CN); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _injectLocale = __webpack_require__(125); var _injectLocale2 = _interopRequireDefault(_injectLocale); var _select = __webpack_require__(60); var _select2 = _interopRequireDefault(_select); var _MiniSelect = __webpack_require__(159); var _MiniSelect2 = _interopRequireDefault(_MiniSelect); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Pagination = function (_React$Component) { (0, _inherits3['default'])(Pagination, _React$Component); function Pagination() { (0, _classCallCheck3['default'])(this, Pagination); return (0, _possibleConstructorReturn3['default'])(this, (Pagination.__proto__ || Object.getPrototypeOf(Pagination)).apply(this, arguments)); } (0, _createClass3['default'])(Pagination, [{ key: 'render', value: function render() { var _a = this.props, className = _a.className, size = _a.size, restProps = __rest(_a, ["className", "size"]); var locale = this.getLocale(); var isSmall = size === 'small'; return _react2['default'].createElement(_rcPagination2['default'], (0, _extends3['default'])({}, restProps, { className: (0, _classnames2['default'])(className, { mini: isSmall }), selectComponentClass: isSmall ? _MiniSelect2['default'] : _select2['default'], locale: locale })); } }]); return Pagination; }(_react2['default'].Component); Pagination.defaultProps = { prefixCls: 'ant-pagination', selectPrefixCls: 'ant-select' }; var injectPaginationLocale = (0, _injectLocale2['default'])('Pagination', _zh_CN2['default']); exports['default'] = injectPaginationLocale(Pagination); module.exports = exports['default']; /***/ }, /* 161 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _shallowequal = __webpack_require__(32); var _shallowequal2 = _interopRequireDefault(_shallowequal); var _radio = __webpack_require__(40); var _radio2 = _interopRequireDefault(_radio); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function getCheckedValue(children) { var value = null; var matched = false; _react2['default'].Children.forEach(children, function (radio) { if (radio && radio.props && radio.props.checked) { value = radio.props.value; matched = true; } }); return matched ? { value: value } : undefined; } var RadioGroup = function (_React$Component) { (0, _inherits3['default'])(RadioGroup, _React$Component); function RadioGroup(props) { (0, _classCallCheck3['default'])(this, RadioGroup); var _this = (0, _possibleConstructorReturn3['default'])(this, (RadioGroup.__proto__ || Object.getPrototypeOf(RadioGroup)).call(this, props)); _this.onRadioChange = function (ev) { var lastValue = _this.state.value; var value = ev.target.value; if (!('value' in _this.props)) { _this.setState({ value: value }); } var onChange = _this.props.onChange; if (onChange && value !== lastValue) { onChange(ev); } }; var value = void 0; if ('value' in props) { value = props.value; } else if ('defaultValue' in props) { value = props.defaultValue; } else { var checkedValue = getCheckedValue(props.children); value = checkedValue && checkedValue.value; } _this.state = { value: value }; return _this; } (0, _createClass3['default'])(RadioGroup, [{ key: 'getChildContext', value: function getChildContext() { return { radioGroup: { onChange: this.onRadioChange, value: this.state.value, disabled: this.props.disabled } }; } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('value' in nextProps) { this.setState({ value: nextProps.value }); } else { var checkedValue = getCheckedValue(nextProps.children); if (checkedValue) { this.setState({ value: checkedValue.value }); } } } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState) { return !(0, _shallowequal2['default'])(this.props, nextProps) || !(0, _shallowequal2['default'])(this.state, nextState); } }, { key: 'render', value: function render() { var _this2 = this; var props = this.props; var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === undefined ? 'ant-radio-group' : _props$prefixCls, _props$className = props.className, className = _props$className === undefined ? '' : _props$className; var classString = (0, _classnames2['default'])(prefixCls, (0, _defineProperty3['default'])({}, prefixCls + '-' + props.size, props.size), className); var children = props.children; // 如果存在 options, 优先使用 if (props.options && props.options.length > 0) { children = props.options.map(function (option, index) { if (typeof option === 'string') { return _react2['default'].createElement( _radio2['default'], { key: index, disabled: _this2.props.disabled, value: option, onChange: _this2.onRadioChange, checked: _this2.state.value === option }, option ); } else { return _react2['default'].createElement( _radio2['default'], { key: index, disabled: option.disabled || _this2.props.disabled, value: option.value, onChange: _this2.onRadioChange, checked: _this2.state.value === option.value }, option.label ); } }); } return _react2['default'].createElement( 'div', { className: classString, style: props.style, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave }, children ); } }]); return RadioGroup; }(_react2['default'].Component); exports['default'] = RadioGroup; RadioGroup.defaultProps = { disabled: false }; RadioGroup.childContextTypes = { radioGroup: _propTypes2['default'].any }; module.exports = exports['default']; /***/ }, /* 162 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _radio = __webpack_require__(40); var _radio2 = _interopRequireDefault(_radio); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var RadioButton = function (_React$Component) { (0, _inherits3['default'])(RadioButton, _React$Component); function RadioButton() { (0, _classCallCheck3['default'])(this, RadioButton); return (0, _possibleConstructorReturn3['default'])(this, (RadioButton.__proto__ || Object.getPrototypeOf(RadioButton)).apply(this, arguments)); } (0, _createClass3['default'])(RadioButton, [{ key: 'render', value: function render() { var radioProps = (0, _extends3['default'])({}, this.props); if (this.context.radioGroup) { radioProps.onChange = this.context.radioGroup.onChange; radioProps.checked = this.props.value === this.context.radioGroup.value; radioProps.disabled = this.props.disabled || this.context.radioGroup.disabled; } return _react2['default'].createElement(_radio2['default'], radioProps); } }]); return RadioButton; }(_react2['default'].Component); exports['default'] = RadioButton; RadioButton.defaultProps = { prefixCls: 'ant-radio-button' }; RadioButton.contextTypes = { radioGroup: _propTypes2['default'].any }; module.exports = exports['default']; /***/ }, /* 163 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(207); /***/ }, /* 164 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _rcAnimate = __webpack_require__(26); var _rcAnimate2 = _interopRequireDefault(_rcAnimate); var _isCssAnimationSupported = __webpack_require__(147); var _isCssAnimationSupported2 = _interopRequireDefault(_isCssAnimationSupported); var _omit = __webpack_require__(33); var _omit2 = _interopRequireDefault(_omit); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Spin = function (_React$Component) { (0, _inherits3['default'])(Spin, _React$Component); function Spin(props) { (0, _classCallCheck3['default'])(this, Spin); var _this = (0, _possibleConstructorReturn3['default'])(this, (Spin.__proto__ || Object.getPrototypeOf(Spin)).call(this, props)); var spinning = props.spinning; _this.state = { spinning: spinning }; return _this; } (0, _createClass3['default'])(Spin, [{ key: 'isNestedPattern', value: function isNestedPattern() { return !!(this.props && this.props.children); } }, { key: 'componentDidMount', value: function componentDidMount() { if (!(0, _isCssAnimationSupported2['default'])()) { // Show text in IE8/9 (0, _reactDom.findDOMNode)(this).className += ' ' + this.props.prefixCls + '-show-text'; } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.debounceTimeout) { clearTimeout(this.debounceTimeout); } if (this.delayTimeout) { clearTimeout(this.delayTimeout); } } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { var _this2 = this; var currentSpinning = this.props.spinning; var spinning = nextProps.spinning; var delay = this.props.delay; if (this.debounceTimeout) { clearTimeout(this.debounceTimeout); } if (currentSpinning && !spinning) { this.debounceTimeout = setTimeout(function () { return _this2.setState({ spinning: spinning }); }, 300); if (this.delayTimeout) { clearTimeout(this.delayTimeout); } } else { if (spinning && delay && !isNaN(Number(delay))) { if (this.delayTimeout) { clearTimeout(this.delayTimeout); } this.delayTimeout = setTimeout(function () { return _this2.setState({ spinning: spinning }); }, delay); } else { this.setState({ spinning: spinning }); } } } }, { key: 'render', value: function render() { var _classNames; var _a = this.props, className = _a.className, size = _a.size, prefixCls = _a.prefixCls, tip = _a.tip, wrapperClassName = _a.wrapperClassName, restProps = __rest(_a, ["className", "size", "prefixCls", "tip", "wrapperClassName"]);var spinning = this.state.spinning; var spinClassName = (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-sm', size === 'small'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-lg', size === 'large'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-spinning', spinning), (0, _defineProperty3['default'])(_classNames, prefixCls + '-show-text', !!tip), _classNames), className); // fix https://fb.me/react-unknown-prop var divProps = (0, _omit2['default'])(restProps, ['spinning', 'delay']); var spinElement = _react2['default'].createElement( 'div', (0, _extends3['default'])({}, divProps, { className: spinClassName }), _react2['default'].createElement( 'span', { className: prefixCls + '-dot' }, _react2['default'].createElement('i', null), _react2['default'].createElement('i', null), _react2['default'].createElement('i', null), _react2['default'].createElement('i', null) ), tip ? _react2['default'].createElement( 'div', { className: prefixCls + '-text' }, tip ) : null ); if (this.isNestedPattern()) { var _classNames2; var animateClassName = prefixCls + '-nested-loading'; if (wrapperClassName) { animateClassName += ' ' + wrapperClassName; } var containerClassName = (0, _classnames2['default'])((_classNames2 = {}, (0, _defineProperty3['default'])(_classNames2, prefixCls + '-container', true), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-blur', spinning), _classNames2)); return _react2['default'].createElement( _rcAnimate2['default'], (0, _extends3['default'])({}, divProps, { component: 'div', className: animateClassName, style: null, transitionName: 'fade' }), spinning && _react2['default'].createElement( 'div', { key: 'loading' }, spinElement ), _react2['default'].createElement( 'div', { className: containerClassName, key: 'container' }, this.props.children ) ); } return spinElement; } }]); return Spin; }(_react2['default'].Component); exports['default'] = Spin; Spin.defaultProps = { prefixCls: 'ant-spin', spinning: true, size: 'default', wrapperClassName: '' }; Spin.propTypes = { prefixCls: _propTypes2['default'].string, className: _propTypes2['default'].string, spinning: _propTypes2['default'].bool, size: _propTypes2['default'].oneOf(['small', 'default', 'large']), wrapperClassName: _propTypes2['default'].string }; module.exports = exports['default']; /***/ }, /* 165 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(209); /***/ }, /* 166 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Column = function (_React$Component) { (0, _inherits3['default'])(Column, _React$Component); function Column() { (0, _classCallCheck3['default'])(this, Column); return (0, _possibleConstructorReturn3['default'])(this, (Column.__proto__ || Object.getPrototypeOf(Column)).apply(this, arguments)); } return Column; }(_react2['default'].Component); exports['default'] = Column; module.exports = exports['default']; /***/ }, /* 167 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var ColumnGroup = function (_React$Component) { (0, _inherits3['default'])(ColumnGroup, _React$Component); function ColumnGroup() { (0, _classCallCheck3['default'])(this, ColumnGroup); return (0, _possibleConstructorReturn3['default'])(this, (ColumnGroup.__proto__ || Object.getPrototypeOf(ColumnGroup)).apply(this, arguments)); } return ColumnGroup; }(_react2['default'].Component); exports['default'] = ColumnGroup; ColumnGroup.__ANT_TABLE_COLUMN_GROUP = true; module.exports = exports['default']; /***/ }, /* 168 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = function (props) { return _react2['default'].createElement( 'div', { className: props.className, onClick: props.onClick }, props.children ); }; module.exports = exports['default']; /***/ }, /* 169 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _checkbox = __webpack_require__(39); var _checkbox2 = _interopRequireDefault(_checkbox); var _radio = __webpack_require__(76); var _radio2 = _interopRequireDefault(_radio); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var SelectionBox = function (_React$Component) { (0, _inherits3['default'])(SelectionBox, _React$Component); function SelectionBox(props) { (0, _classCallCheck3['default'])(this, SelectionBox); var _this = (0, _possibleConstructorReturn3['default'])(this, (SelectionBox.__proto__ || Object.getPrototypeOf(SelectionBox)).call(this, props)); _this.state = { checked: _this.getCheckState(props) }; return _this; } (0, _createClass3['default'])(SelectionBox, [{ key: 'componentDidMount', value: function componentDidMount() { this.subscribe(); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.unsubscribe) { this.unsubscribe(); } } }, { key: 'subscribe', value: function subscribe() { var _this2 = this; var store = this.props.store; this.unsubscribe = store.subscribe(function () { var checked = _this2.getCheckState(_this2.props); _this2.setState({ checked: checked }); }); } }, { key: 'getCheckState', value: function getCheckState(props) { var store = props.store, defaultSelection = props.defaultSelection, rowIndex = props.rowIndex; var checked = false; if (store.getState().selectionDirty) { checked = store.getState().selectedRowKeys.indexOf(rowIndex) >= 0; } else { checked = store.getState().selectedRowKeys.indexOf(rowIndex) >= 0 || defaultSelection.indexOf(rowIndex) >= 0; } return checked; } }, { key: 'render', value: function render() { var _props = this.props, type = _props.type, rowIndex = _props.rowIndex, disabled = _props.disabled, onChange = _props.onChange; var checked = this.state.checked; if (type === 'radio') { return _react2['default'].createElement(_radio2['default'], { disabled: disabled, onChange: onChange, value: rowIndex, checked: checked }); } return _react2['default'].createElement(_checkbox2['default'], { checked: checked, disabled: disabled, onChange: onChange }); } }]); return SelectionBox; }(_react2['default'].Component); exports['default'] = SelectionBox; module.exports = exports['default']; /***/ }, /* 170 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _checkbox = __webpack_require__(39); var _checkbox2 = _interopRequireDefault(_checkbox); var _dropdown = __webpack_require__(69); var _dropdown2 = _interopRequireDefault(_dropdown); var _menu = __webpack_require__(101); var _menu2 = _interopRequireDefault(_menu); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var SelectionCheckboxAll = function (_React$Component) { (0, _inherits3['default'])(SelectionCheckboxAll, _React$Component); function SelectionCheckboxAll(props) { (0, _classCallCheck3['default'])(this, SelectionCheckboxAll); var _this = (0, _possibleConstructorReturn3['default'])(this, (SelectionCheckboxAll.__proto__ || Object.getPrototypeOf(SelectionCheckboxAll)).call(this, props)); _this.handleSelectAllChagne = function (e) { var checked = e.target.checked; _this.props.onSelect(checked ? 'all' : 'removeAll', 0, null); }; _this.defaultSelections = [{ key: 'all', text: props.locale.selectAll, onSelect: function onSelect() {} }, { key: 'invert', text: props.locale.selectInvert, onSelect: function onSelect() {} }]; _this.state = { checked: _this.getCheckState(props), indeterminate: _this.getIndeterminateState(props) }; return _this; } (0, _createClass3['default'])(SelectionCheckboxAll, [{ key: 'componentDidMount', value: function componentDidMount() { this.subscribe(); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { this.setCheckState(nextProps); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.unsubscribe) { this.unsubscribe(); } } }, { key: 'subscribe', value: function subscribe() { var _this2 = this; var store = this.props.store; this.unsubscribe = store.subscribe(function () { _this2.setCheckState(_this2.props); }); } }, { key: 'checkSelection', value: function checkSelection(data, type, byDefaultChecked) { var _props = this.props, store = _props.store, getCheckboxPropsByItem = _props.getCheckboxPropsByItem, getRecordKey = _props.getRecordKey; // type should be 'every' | 'some' if (type === 'every' || type === 'some') { return byDefaultChecked ? data[type](function (item, i) { return getCheckboxPropsByItem(item, i).defaultChecked; }) : data[type](function (item, i) { return store.getState().selectedRowKeys.indexOf(getRecordKey(item, i)) >= 0; }); } return false; } }, { key: 'setCheckState', value: function setCheckState(props) { var checked = this.getCheckState(props); var indeterminate = this.getIndeterminateState(props); if (checked !== this.state.checked) { this.setState({ checked: checked }); } if (indeterminate !== this.state.indeterminate) { this.setState({ indeterminate: indeterminate }); } } }, { key: 'getCheckState', value: function getCheckState(props) { var store = props.store, data = props.data; var checked = void 0; if (!data.length) { checked = false; } else { checked = store.getState().selectionDirty ? this.checkSelection(data, 'every', false) : this.checkSelection(data, 'every', false) || this.checkSelection(data, 'every', true); } return checked; } }, { key: 'getIndeterminateState', value: function getIndeterminateState(props) { var store = props.store, data = props.data; var indeterminate = void 0; if (!data.length) { indeterminate = false; } else { indeterminate = store.getState().selectionDirty ? this.checkSelection(data, 'some', false) && !this.checkSelection(data, 'every', false) : this.checkSelection(data, 'some', false) && !this.checkSelection(data, 'every', false) || this.checkSelection(data, 'some', true) && !this.checkSelection(data, 'every', true); } return indeterminate; } }, { key: 'renderMenus', value: function renderMenus(selections) { var _this3 = this; return selections.map(function (selection, index) { return _react2['default'].createElement( _menu2['default'].Item, { key: selection.key || index }, _react2['default'].createElement( 'div', { onClick: function onClick() { _this3.props.onSelect(selection.key, index, selection.onSelect); } }, selection.text ) ); }); } }, { key: 'render', value: function render() { var _props2 = this.props, disabled = _props2.disabled, prefixCls = _props2.prefixCls, selections = _props2.selections, getPopupContainer = _props2.getPopupContainer; var _state = this.state, checked = _state.checked, indeterminate = _state.indeterminate; var selectionPrefixCls = prefixCls + '-selection'; var customSelections = null; if (selections) { var newSelections = Array.isArray(selections) ? this.defaultSelections.concat(selections) : this.defaultSelections; var menu = _react2['default'].createElement( _menu2['default'], { className: selectionPrefixCls + '-menu', selectedKeys: [] }, this.renderMenus(newSelections) ); customSelections = _react2['default'].createElement( _dropdown2['default'], { overlay: menu, getPopupContainer: getPopupContainer }, _react2['default'].createElement( 'div', { className: selectionPrefixCls + '-down' }, _react2['default'].createElement(_icon2['default'], { type: 'down' }) ) ); } return _react2['default'].createElement( 'div', { className: selectionPrefixCls }, _react2['default'].createElement(_checkbox2['default'], { className: (0, _classnames2['default'])((0, _defineProperty3['default'])({}, selectionPrefixCls + '-select-all-custom', customSelections)), checked: checked, indeterminate: indeterminate, disabled: disabled, onChange: this.handleSelectAllChagne }), customSelections ); } }]); return SelectionCheckboxAll; }(_react2['default'].Component); exports['default'] = SelectionCheckboxAll; module.exports = exports['default']; /***/ }, /* 171 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends4 = __webpack_require__(2); var _extends5 = _interopRequireDefault(_extends4); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(13); var _rcTable = __webpack_require__(284); var _rcTable2 = _interopRequireDefault(_rcTable); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _pagination = __webpack_require__(143); var _pagination2 = _interopRequireDefault(_pagination); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); var _spin = __webpack_require__(164); var _spin2 = _interopRequireDefault(_spin); var _warning = __webpack_require__(16); var _warning2 = _interopRequireDefault(_warning); var _filterDropdown = __webpack_require__(173); var _filterDropdown2 = _interopRequireDefault(_filterDropdown); var _createStore = __webpack_require__(172); var _createStore2 = _interopRequireDefault(_createStore); var _SelectionBox = __webpack_require__(169); var _SelectionBox2 = _interopRequireDefault(_SelectionBox); var _SelectionCheckboxAll = __webpack_require__(170); var _SelectionCheckboxAll2 = _interopRequireDefault(_SelectionCheckboxAll); var _Column = __webpack_require__(166); var _Column2 = _interopRequireDefault(_Column); var _ColumnGroup = __webpack_require__(167); var _ColumnGroup2 = _interopRequireDefault(_ColumnGroup); var _util = __webpack_require__(176); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; function noop() {} function stopPropagation(e) { e.stopPropagation(); if (e.nativeEvent.stopImmediatePropagation) { e.nativeEvent.stopImmediatePropagation(); } } var defaultLocale = { filterTitle: '筛选', filterConfirm: '确定', filterReset: '重置', emptyText: _react2['default'].createElement( 'span', null, _react2['default'].createElement(_icon2['default'], { type: 'frown-o' }), '\u6682\u65E0\u6570\u636E' ), selectAll: '全选当页', selectInvert: '反选当页' }; var defaultPagination = { onChange: noop, onShowSizeChange: noop }; /** * Avoid creating new object, so that parent component's shouldComponentUpdate * can works appropriately。 */ var emptyObject = {}; var Table = function (_React$Component) { (0, _inherits3['default'])(Table, _React$Component); function Table(props) { (0, _classCallCheck3['default'])(this, Table); var _this = (0, _possibleConstructorReturn3['default'])(this, (Table.__proto__ || Object.getPrototypeOf(Table)).call(this, props)); _this.getCheckboxPropsByItem = function (item, index) { var _this$props$rowSelect = _this.props.rowSelection, rowSelection = _this$props$rowSelect === undefined ? {} : _this$props$rowSelect; if (!rowSelection.getCheckboxProps) { return {}; } var key = _this.getRecordKey(item, index); // Cache checkboxProps if (!_this.CheckboxPropsCache[key]) { _this.CheckboxPropsCache[key] = rowSelection.getCheckboxProps(item); } return _this.CheckboxPropsCache[key]; }; _this.handleFilter = function (column, nextFilters) { var props = _this.props; var pagination = (0, _extends5['default'])({}, _this.state.pagination); var filters = (0, _extends5['default'])({}, _this.state.filters, (0, _defineProperty3['default'])({}, _this.getColumnKey(column), nextFilters)); // Remove filters not in current columns var currentColumnKeys = []; (0, _util.treeMap)(_this.columns, function (c) { if (!c.children) { currentColumnKeys.push(_this.getColumnKey(c)); } }); Object.keys(filters).forEach(function (columnKey) { if (currentColumnKeys.indexOf(columnKey) < 0) { delete filters[columnKey]; } }); if (props.pagination) { // Reset current prop pagination.current = 1; pagination.onChange(pagination.current); } var newState = { pagination: pagination, filters: {} }; var filtersToSetState = (0, _extends5['default'])({}, filters); // Remove filters which is controlled _this.getFilteredValueColumns().forEach(function (col) { var columnKey = _this.getColumnKey(col); if (columnKey) { delete filtersToSetState[columnKey]; } }); if (Object.keys(filtersToSetState).length > 0) { newState.filters = filtersToSetState; } // Controlled current prop will not respond user interaction if ((0, _typeof3['default'])(props.pagination) === 'object' && 'current' in props.pagination) { newState.pagination = (0, _extends5['default'])({}, pagination, { current: _this.state.pagination.current }); } _this.setState(newState, function () { _this.store.setState({ selectionDirty: false }); var onChange = _this.props.onChange; if (onChange) { onChange.apply(null, _this.prepareParamsArguments((0, _extends5['default'])({}, _this.state, { selectionDirty: false, filters: filters, pagination: pagination }))); } }); }; _this.handleSelect = function (record, rowIndex, e) { var checked = e.target.checked; var defaultSelection = _this.store.getState().selectionDirty ? [] : _this.getDefaultSelection(); var selectedRowKeys = _this.store.getState().selectedRowKeys.concat(defaultSelection); var key = _this.getRecordKey(record, rowIndex); if (checked) { selectedRowKeys.push(_this.getRecordKey(record, rowIndex)); } else { selectedRowKeys = selectedRowKeys.filter(function (i) { return key !== i; }); } _this.store.setState({ selectionDirty: true }); _this.setSelectedRowKeys(selectedRowKeys, { selectWay: 'onSelect', record: record, checked: checked }); }; _this.handleRadioSelect = function (record, rowIndex, e) { var checked = e.target.checked; var defaultSelection = _this.store.getState().selectionDirty ? [] : _this.getDefaultSelection(); var selectedRowKeys = _this.store.getState().selectedRowKeys.concat(defaultSelection); var key = _this.getRecordKey(record, rowIndex); selectedRowKeys = [key]; _this.store.setState({ selectionDirty: true }); _this.setSelectedRowKeys(selectedRowKeys, { selectWay: 'onSelect', record: record, checked: checked }); }; _this.handleSelectRow = function (selectionKey, index, onSelectFunc) { var data = _this.getFlatCurrentPageData(); var defaultSelection = _this.store.getState().selectionDirty ? [] : _this.getDefaultSelection(); var selectedRowKeys = _this.store.getState().selectedRowKeys.concat(defaultSelection); var changeableRowKeys = data.filter(function (item, i) { return !_this.getCheckboxPropsByItem(item, i).disabled; }).map(function (item, i) { return _this.getRecordKey(item, i); }); var changeRowKeys = []; var selectWay = ''; var checked = void 0; // handle default selection switch (selectionKey) { case 'all': changeableRowKeys.forEach(function (key) { if (selectedRowKeys.indexOf(key) < 0) { selectedRowKeys.push(key); changeRowKeys.push(key); } }); selectWay = 'onSelectAll'; checked = true; break; case 'removeAll': changeableRowKeys.forEach(function (key) { if (selectedRowKeys.indexOf(key) >= 0) { selectedRowKeys.splice(selectedRowKeys.indexOf(key), 1); changeRowKeys.push(key); } }); selectWay = 'onSelectAll'; checked = false; break; case 'invert': changeableRowKeys.forEach(function (key) { if (selectedRowKeys.indexOf(key) < 0) { selectedRowKeys.push(key); } else { selectedRowKeys.splice(selectedRowKeys.indexOf(key), 1); } changeRowKeys.push(key); selectWay = 'onSelectInvert'; }); break; default: break; } _this.store.setState({ selectionDirty: true }); // when select custom selection, callback selections[n].onSelect if (index > 1 && typeof onSelectFunc === 'function') { return onSelectFunc(changeableRowKeys); } _this.setSelectedRowKeys(selectedRowKeys, { selectWay: selectWay, checked: checked, changeRowKeys: changeRowKeys }); }; _this.handlePageChange = function (current) { for (var _len = arguments.length, otherArguments = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { otherArguments[_key - 1] = arguments[_key]; } var props = _this.props; var pagination = (0, _extends5['default'])({}, _this.state.pagination); if (current) { pagination.current = current; } else { pagination.current = pagination.current || 1; } pagination.onChange.apply(pagination, [pagination.current].concat(otherArguments)); var newState = { pagination: pagination }; // Controlled current prop will not respond user interaction if (props.pagination && (0, _typeof3['default'])(props.pagination) === 'object' && 'current' in props.pagination) { newState.pagination = (0, _extends5['default'])({}, pagination, { current: _this.state.pagination.current }); } _this.setState(newState); _this.store.setState({ selectionDirty: false }); var onChange = _this.props.onChange; if (onChange) { onChange.apply(null, _this.prepareParamsArguments((0, _extends5['default'])({}, _this.state, { selectionDirty: false, pagination: pagination }))); } }; _this.renderSelectionBox = function (type) { return function (_, record, index) { var rowIndex = _this.getRecordKey(record, index); // 从 1 开始 var props = _this.getCheckboxPropsByItem(record, index); var handleChange = function handleChange(e) { type === 'radio' ? _this.handleRadioSelect(record, rowIndex, e) : _this.handleSelect(record, rowIndex, e); }; return _react2['default'].createElement( 'span', { onClick: stopPropagation }, _react2['default'].createElement(_SelectionBox2['default'], { type: type, store: _this.store, rowIndex: rowIndex, disabled: props.disabled, onChange: handleChange, defaultSelection: _this.getDefaultSelection() }) ); }; }; _this.getRecordKey = function (record, index) { var rowKey = _this.props.rowKey; var recordKey = typeof rowKey === 'function' ? rowKey(record, index) : record[rowKey]; (0, _warning2['default'])(recordKey !== undefined, 'Each record in dataSource of table should have a unique `key` prop, or set `rowKey` to an unique primary key,' + 'see https://u.ant.design/table-row-key'); return recordKey === undefined ? index : recordKey; }; _this.getPopupContainer = function () { return (0, _reactDom.findDOMNode)(_this); }; _this.handleShowSizeChange = function (current, pageSize) { var pagination = _this.state.pagination; pagination.onShowSizeChange(current, pageSize); var nextPagination = (0, _extends5['default'])({}, pagination, { pageSize: pageSize, current: current }); _this.setState({ pagination: nextPagination }); var onChange = _this.props.onChange; if (onChange) { onChange.apply(null, _this.prepareParamsArguments((0, _extends5['default'])({}, _this.state, { pagination: nextPagination }))); } }; (0, _warning2['default'])(!('columnsPageRange' in props || 'columnsPageSize' in props), '`columnsPageRange` and `columnsPageSize` are removed, please use ' + 'fixed columns instead, see: https://u.ant.design/fixed-columns.'); _this.columns = props.columns || (0, _util.normalizeColumns)(props.children); _this.state = (0, _extends5['default'])({}, _this.getSortStateFromColumns(), { // 减少状态 filters: _this.getFiltersFromColumns(), pagination: _this.getDefaultPagination(props) }); _this.CheckboxPropsCache = {}; _this.store = (0, _createStore2['default'])({ selectedRowKeys: (props.rowSelection || {}).selectedRowKeys || [], selectionDirty: false }); return _this; } (0, _createClass3['default'])(Table, [{ key: 'getDefaultSelection', value: function getDefaultSelection() { var _this2 = this; var _props$rowSelection = this.props.rowSelection, rowSelection = _props$rowSelection === undefined ? {} : _props$rowSelection; if (!rowSelection.getCheckboxProps) { return []; } return this.getFlatData().filter(function (item, rowIndex) { return _this2.getCheckboxPropsByItem(item, rowIndex).defaultChecked; }).map(function (record, rowIndex) { return _this2.getRecordKey(record, rowIndex); }); } }, { key: 'getDefaultPagination', value: function getDefaultPagination(props) { var pagination = props.pagination || {}; return this.hasPagination(props) ? (0, _extends5['default'])({}, defaultPagination, pagination, { current: pagination.defaultCurrent || pagination.current || 1, pageSize: pagination.defaultPageSize || pagination.pageSize || 10 }) : {}; } }, { key: 'getLocale', value: function getLocale() { var locale = {}; if (this.context.antLocale && this.context.antLocale.Table) { locale = this.context.antLocale.Table; } return (0, _extends5['default'])({}, defaultLocale, locale, this.props.locale); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { this.columns = nextProps.columns || (0, _util.normalizeColumns)(nextProps.children); if ('pagination' in nextProps || 'pagination' in this.props) { this.setState(function (previousState) { var newPagination = (0, _extends5['default'])({}, defaultPagination, previousState.pagination, nextProps.pagination); newPagination.current = newPagination.current || 1; newPagination.pageSize = newPagination.pageSize || 10; return { pagination: nextProps.pagination !== false ? newPagination : emptyObject }; }); } if (nextProps.rowSelection && 'selectedRowKeys' in nextProps.rowSelection) { this.store.setState({ selectedRowKeys: nextProps.rowSelection.selectedRowKeys || [] }); var rowSelection = this.props.rowSelection; if (rowSelection && nextProps.rowSelection.getCheckboxProps !== rowSelection.getCheckboxProps) { this.CheckboxPropsCache = {}; } } if ('dataSource' in nextProps && nextProps.dataSource !== this.props.dataSource) { this.store.setState({ selectionDirty: false }); this.CheckboxPropsCache = {}; } if (this.getSortOrderColumns(this.columns).length > 0) { var sortState = this.getSortStateFromColumns(this.columns); if (sortState.sortColumn !== this.state.sortColumn || sortState.sortOrder !== this.state.sortOrder) { this.setState(sortState); } } var filteredValueColumns = this.getFilteredValueColumns(this.columns); if (filteredValueColumns.length > 0) { var filtersFromColumns = this.getFiltersFromColumns(this.columns); var newFilters = (0, _extends5['default'])({}, this.state.filters); Object.keys(filtersFromColumns).forEach(function (key) { newFilters[key] = filtersFromColumns[key]; }); if (this.isFiltersChanged(newFilters)) { this.setState({ filters: newFilters }); } } } }, { key: 'setSelectedRowKeys', value: function setSelectedRowKeys(selectedRowKeys, _ref) { var _this3 = this; var selectWay = _ref.selectWay, record = _ref.record, checked = _ref.checked, changeRowKeys = _ref.changeRowKeys; var _props$rowSelection2 = this.props.rowSelection, rowSelection = _props$rowSelection2 === undefined ? {} : _props$rowSelection2; if (rowSelection && !('selectedRowKeys' in rowSelection)) { this.store.setState({ selectedRowKeys: selectedRowKeys }); } var data = this.getFlatData(); if (!rowSelection.onChange && !rowSelection[selectWay]) { return; } var selectedRows = data.filter(function (row, i) { return selectedRowKeys.indexOf(_this3.getRecordKey(row, i)) >= 0; }); if (rowSelection.onChange) { rowSelection.onChange(selectedRowKeys, selectedRows); } if (selectWay === 'onSelect' && rowSelection.onSelect) { rowSelection.onSelect(record, checked, selectedRows); } else if (selectWay === 'onSelectAll' && rowSelection.onSelectAll) { var changeRows = data.filter(function (row, i) { return changeRowKeys.indexOf(_this3.getRecordKey(row, i)) >= 0; }); rowSelection.onSelectAll(checked, selectedRows, changeRows); } else if (selectWay === 'onSelectInvert' && rowSelection.onSelectInvert) { rowSelection.onSelectInvert(selectedRowKeys); } } }, { key: 'hasPagination', value: function hasPagination(props) { return (props || this.props).pagination !== false; } }, { key: 'isFiltersChanged', value: function isFiltersChanged(filters) { var _this4 = this; var filtersChanged = false; if (Object.keys(filters).length !== Object.keys(this.state.filters).length) { filtersChanged = true; } else { Object.keys(filters).forEach(function (columnKey) { if (filters[columnKey] !== _this4.state.filters[columnKey]) { filtersChanged = true; } }); } return filtersChanged; } }, { key: 'getSortOrderColumns', value: function getSortOrderColumns(columns) { return (0, _util.flatFilter)(columns || this.columns || [], function (column) { return 'sortOrder' in column; }); } }, { key: 'getFilteredValueColumns', value: function getFilteredValueColumns(columns) { return (0, _util.flatFilter)(columns || this.columns || [], function (column) { return typeof column.filteredValue !== 'undefined'; }); } }, { key: 'getFiltersFromColumns', value: function getFiltersFromColumns(columns) { var _this5 = this; var filters = {}; this.getFilteredValueColumns(columns).forEach(function (col) { filters[_this5.getColumnKey(col)] = col.filteredValue; }); return filters; } }, { key: 'getSortStateFromColumns', value: function getSortStateFromColumns(columns) { // return fisrt column which sortOrder is not falsy var sortedColumn = this.getSortOrderColumns(columns).filter(function (col) { return col.sortOrder; })[0]; if (sortedColumn) { return { sortColumn: sortedColumn, sortOrder: sortedColumn.sortOrder }; } return { sortColumn: null, sortOrder: null }; } }, { key: 'getSorterFn', value: function getSorterFn() { var _state = this.state, sortOrder = _state.sortOrder, sortColumn = _state.sortColumn; if (!sortOrder || !sortColumn || typeof sortColumn.sorter !== 'function') { return; } return function (a, b) { var result = sortColumn.sorter(a, b); if (result !== 0) { return sortOrder === 'descend' ? -result : result; } return 0; }; } }, { key: 'toggleSortOrder', value: function toggleSortOrder(order, column) { var _state2 = this.state, sortColumn = _state2.sortColumn, sortOrder = _state2.sortOrder; // 只同时允许一列进行排序,否则会导致排序顺序的逻辑问题 var isSortColumn = this.isSortColumn(column); if (!isSortColumn) { sortOrder = order; sortColumn = column; } else { if (sortOrder === order) { sortOrder = ''; sortColumn = null; } else { sortOrder = order; } } var newState = { sortOrder: sortOrder, sortColumn: sortColumn }; // Controlled if (this.getSortOrderColumns().length === 0) { this.setState(newState); } var onChange = this.props.onChange; if (onChange) { onChange.apply(null, this.prepareParamsArguments((0, _extends5['default'])({}, this.state, newState))); } } }, { key: 'renderRowSelection', value: function renderRowSelection() { var _this6 = this; var _props = this.props, prefixCls = _props.prefixCls, rowSelection = _props.rowSelection; var columns = this.columns.concat(); if (rowSelection) { var data = this.getFlatCurrentPageData().filter(function (item, index) { if (rowSelection.getCheckboxProps) { return !_this6.getCheckboxPropsByItem(item, index).disabled; } return true; }); var selectionColumnClass = (0, _classnames2['default'])(prefixCls + '-selection-column', (0, _defineProperty3['default'])({}, prefixCls + '-selection-column-custom', rowSelection.selections)); var selectionColumn = { key: 'selection-column', render: this.renderSelectionBox(rowSelection.type), className: selectionColumnClass }; if (rowSelection.type !== 'radio') { var checkboxAllDisabled = data.every(function (item, index) { return _this6.getCheckboxPropsByItem(item, index).disabled; }); selectionColumn.title = _react2['default'].createElement(_SelectionCheckboxAll2['default'], { store: this.store, locale: this.getLocale(), data: data, getCheckboxPropsByItem: this.getCheckboxPropsByItem, getRecordKey: this.getRecordKey, disabled: checkboxAllDisabled, prefixCls: prefixCls, onSelect: this.handleSelectRow, selections: rowSelection.selections, getPopupContainer: this.getPopupContainer }); } if (columns.some(function (column) { return column.fixed === 'left' || column.fixed === true; })) { selectionColumn.fixed = 'left'; } if (columns[0] && columns[0].key === 'selection-column') { columns[0] = selectionColumn; } else { columns.unshift(selectionColumn); } } return columns; } }, { key: 'getColumnKey', value: function getColumnKey(column, index) { return column.key || column.dataIndex || index; } }, { key: 'getMaxCurrent', value: function getMaxCurrent(total) { var _state$pagination = this.state.pagination, current = _state$pagination.current, pageSize = _state$pagination.pageSize; if ((current - 1) * pageSize >= total) { return Math.floor((total - 1) / pageSize) + 1; } return current; } }, { key: 'isSortColumn', value: function isSortColumn(column) { var sortColumn = this.state.sortColumn; if (!column || !sortColumn) { return false; } return this.getColumnKey(sortColumn) === this.getColumnKey(column); } }, { key: 'renderColumnsDropdown', value: function renderColumnsDropdown(columns) { var _this7 = this; var _props2 = this.props, prefixCls = _props2.prefixCls, dropdownPrefixCls = _props2.dropdownPrefixCls; var sortOrder = this.state.sortOrder; var locale = this.getLocale(); return (0, _util.treeMap)(columns, function (originColumn, i) { var column = (0, _extends5['default'])({}, originColumn); var key = _this7.getColumnKey(column, i); var filterDropdown = void 0; var sortButton = void 0; if (column.filters && column.filters.length > 0 || column.filterDropdown) { var colFilters = _this7.state.filters[key] || []; filterDropdown = _react2['default'].createElement(_filterDropdown2['default'], { locale: locale, column: column, selectedKeys: colFilters, confirmFilter: _this7.handleFilter, prefixCls: prefixCls + '-filter', dropdownPrefixCls: dropdownPrefixCls || 'ant-dropdown', getPopupContainer: _this7.getPopupContainer }); } if (column.sorter) { var isSortColumn = _this7.isSortColumn(column); if (isSortColumn) { column.className = column.className || ''; if (sortOrder) { column.className += ' ' + prefixCls + '-column-sort'; } } var isAscend = isSortColumn && sortOrder === 'ascend'; var isDescend = isSortColumn && sortOrder === 'descend'; sortButton = _react2['default'].createElement( 'div', { className: prefixCls + '-column-sorter' }, _react2['default'].createElement( 'span', { className: prefixCls + '-column-sorter-up ' + (isAscend ? 'on' : 'off'), title: '\u2191', onClick: function onClick() { return _this7.toggleSortOrder('ascend', column); } }, _react2['default'].createElement(_icon2['default'], { type: 'caret-up' }) ), _react2['default'].createElement( 'span', { className: prefixCls + '-column-sorter-down ' + (isDescend ? 'on' : 'off'), title: '\u2193', onClick: function onClick() { return _this7.toggleSortOrder('descend', column); } }, _react2['default'].createElement(_icon2['default'], { type: 'caret-down' }) ) ); } column.title = _react2['default'].createElement( 'span', null, column.title, sortButton, filterDropdown ); return column; }); } }, { key: 'renderPagination', value: function renderPagination() { // 强制不需要分页 if (!this.hasPagination()) { return null; } var size = 'default'; var pagination = this.state.pagination; if (pagination.size) { size = pagination.size; } else if (this.props.size === 'middle' || this.props.size === 'small') { size = 'small'; } var total = pagination.total || this.getLocalData().length; return total > 0 ? _react2['default'].createElement(_pagination2['default'], (0, _extends5['default'])({ key: 'pagination' }, pagination, { className: (0, _classnames2['default'])(pagination.className, this.props.prefixCls + '-pagination'), onChange: this.handlePageChange, total: total, size: size, current: this.getMaxCurrent(total), onShowSizeChange: this.handleShowSizeChange })) : null; } // Get pagination, filters, sorter }, { key: 'prepareParamsArguments', value: function prepareParamsArguments(state) { var pagination = (0, _extends5['default'])({}, state.pagination); // remove useless handle function in Table.onChange delete pagination.onChange; delete pagination.onShowSizeChange; var filters = state.filters; var sorter = {}; if (state.sortColumn && state.sortOrder) { sorter.column = state.sortColumn; sorter.order = state.sortOrder; sorter.field = state.sortColumn.dataIndex; sorter.columnKey = this.getColumnKey(state.sortColumn); } return [pagination, filters, sorter]; } }, { key: 'findColumn', value: function findColumn(myKey) { var _this8 = this; var column = void 0; (0, _util.treeMap)(this.columns, function (c) { if (_this8.getColumnKey(c) === myKey) { column = c; } }); return column; } }, { key: 'getCurrentPageData', value: function getCurrentPageData() { var data = this.getLocalData(); var current = void 0; var pageSize = void 0; var state = this.state; // 如果没有分页的话,默认全部展示 if (!this.hasPagination()) { pageSize = Number.MAX_VALUE; current = 1; } else { pageSize = state.pagination.pageSize; current = this.getMaxCurrent(state.pagination.total || data.length); } // 分页 // --- // 当数据量少于等于每页数量时,直接设置数据 // 否则进行读取分页数据 if (data.length > pageSize || pageSize === Number.MAX_VALUE) { data = data.filter(function (_, i) { return i >= (current - 1) * pageSize && i < current * pageSize; }); } return data; } }, { key: 'getFlatData', value: function getFlatData() { return (0, _util.flatArray)(this.getLocalData()); } }, { key: 'getFlatCurrentPageData', value: function getFlatCurrentPageData() { return (0, _util.flatArray)(this.getCurrentPageData()); } }, { key: 'recursiveSort', value: function recursiveSort(data, sorterFn) { var _this9 = this; var _props$childrenColumn = this.props.childrenColumnName, childrenColumnName = _props$childrenColumn === undefined ? 'children' : _props$childrenColumn; return data.sort(sorterFn).map(function (item) { return item[childrenColumnName] ? (0, _extends5['default'])({}, item, (0, _defineProperty3['default'])({}, childrenColumnName, _this9.recursiveSort(item[childrenColumnName], sorterFn))) : item; }); } }, { key: 'getLocalData', value: function getLocalData() { var _this10 = this; var state = this.state; var dataSource = this.props.dataSource; var data = dataSource || []; // 优化本地排序 data = data.slice(0); var sorterFn = this.getSorterFn(); if (sorterFn) { data = this.recursiveSort(data, sorterFn); } // 筛选 if (state.filters) { Object.keys(state.filters).forEach(function (columnKey) { var col = _this10.findColumn(columnKey); if (!col) { return; } var values = state.filters[columnKey] || []; if (values.length === 0) { return; } var onFilter = col.onFilter; data = onFilter ? data.filter(function (record) { return values.some(function (v) { return onFilter(v, record); }); }) : data; }); } return data; } }, { key: 'render', value: function render() { var _classNames2, _this11 = this; var _a = this.props, style = _a.style, className = _a.className, prefixCls = _a.prefixCls, showHeader = _a.showHeader, restProps = __rest(_a, ["style", "className", "prefixCls", "showHeader"]); var data = this.getCurrentPageData(); var columns = this.renderRowSelection(); var expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false; var locale = this.getLocale(); var classString = (0, _classnames2['default'])((_classNames2 = {}, (0, _defineProperty3['default'])(_classNames2, prefixCls + '-' + this.props.size, true), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-bordered', this.props.bordered), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-empty', !data.length), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-without-column-header', !showHeader), _classNames2)); columns = this.renderColumnsDropdown(columns); columns = columns.map(function (column, i) { var newColumn = (0, _extends5['default'])({}, column); newColumn.key = _this11.getColumnKey(newColumn, i); return newColumn; }); var expandIconColumnIndex = columns[0] && columns[0].key === 'selection-column' ? 1 : 0; if ('expandIconColumnIndex' in restProps) { expandIconColumnIndex = restProps.expandIconColumnIndex; } var table = _react2['default'].createElement(_rcTable2['default'], (0, _extends5['default'])({ key: 'table' }, restProps, { prefixCls: prefixCls, data: data, columns: columns, showHeader: showHeader, className: classString, expandIconColumnIndex: expandIconColumnIndex, expandIconAsCell: expandIconAsCell, emptyText: function emptyText() { return locale.emptyText; } })); // if there is no pagination or no data, // the height of spin should decrease by half of pagination var paginationPatchClass = this.hasPagination() && data && data.length !== 0 ? prefixCls + '-with-pagination' : prefixCls + '-without-pagination'; var loading = this.props.loading; if (typeof loading === 'boolean') { loading = { spinning: loading }; } return _react2['default'].createElement( 'div', { className: (0, _classnames2['default'])(prefixCls + '-wrapper', className), style: style }, _react2['default'].createElement( _spin2['default'], (0, _extends5['default'])({}, loading, { className: loading ? paginationPatchClass + ' ' + prefixCls + '-spin-holder' : '' }), table, this.renderPagination() ) ); } }]); return Table; }(_react2['default'].Component); exports['default'] = Table; Table.Column = _Column2['default']; Table.ColumnGroup = _ColumnGroup2['default']; Table.propTypes = { dataSource: _propTypes2['default'].array, columns: _propTypes2['default'].array, prefixCls: _propTypes2['default'].string, useFixedHeader: _propTypes2['default'].bool, rowSelection: _propTypes2['default'].object, className: _propTypes2['default'].string, size: _propTypes2['default'].string, loading: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].object]), bordered: _propTypes2['default'].bool, onChange: _propTypes2['default'].func, locale: _propTypes2['default'].object, dropdownPrefixCls: _propTypes2['default'].string }; Table.defaultProps = { dataSource: [], prefixCls: 'ant-table', useFixedHeader: false, rowSelection: null, className: '', size: 'large', loading: false, bordered: false, indentSize: 20, locale: {}, rowKey: 'key', showHeader: true }; Table.contextTypes = { antLocale: _propTypes2['default'].object }; module.exports = exports['default']; /***/ }, /* 172 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports["default"] = createStore; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function createStore(initialState) { var state = initialState; var listeners = []; function setState(partial) { state = (0, _extends3["default"])({}, state, partial); for (var i = 0; i < listeners.length; i++) { listeners[i](); } } function getState() { return state; } function subscribe(listener) { listeners.push(listener); return function unsubscribe() { var index = listeners.indexOf(listener); listeners.splice(index, 1); }; } return { setState: setState, getState: getState, subscribe: subscribe }; } module.exports = exports["default"]; /***/ }, /* 173 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _rcMenu = __webpack_require__(20); var _rcMenu2 = _interopRequireDefault(_rcMenu); var _domClosest = __webpack_require__(201); var _domClosest2 = _interopRequireDefault(_domClosest); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _dropdown = __webpack_require__(69); var _dropdown2 = _interopRequireDefault(_dropdown); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); var _checkbox = __webpack_require__(39); var _checkbox2 = _interopRequireDefault(_checkbox); var _radio = __webpack_require__(76); var _radio2 = _interopRequireDefault(_radio); var _FilterDropdownMenuWrapper = __webpack_require__(168); var _FilterDropdownMenuWrapper2 = _interopRequireDefault(_FilterDropdownMenuWrapper); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var FilterMenu = function (_React$Component) { (0, _inherits3['default'])(FilterMenu, _React$Component); function FilterMenu(props) { (0, _classCallCheck3['default'])(this, FilterMenu); var _this = (0, _possibleConstructorReturn3['default'])(this, (FilterMenu.__proto__ || Object.getPrototypeOf(FilterMenu)).call(this, props)); _this.setSelectedKeys = function (_ref) { var selectedKeys = _ref.selectedKeys; _this.setState({ selectedKeys: selectedKeys }); }; _this.handleClearFilters = function () { _this.setState({ selectedKeys: [] }, _this.handleConfirm); }; _this.handleConfirm = function () { _this.setVisible(false); _this.confirmFilter(); }; _this.onVisibleChange = function (visible) { _this.setVisible(visible); if (!visible) { _this.confirmFilter(); } }; _this.handleMenuItemClick = function (info) { if (info.keyPath.length <= 1) { return; } var keyPathOfSelectedItem = _this.state.keyPathOfSelectedItem; if (_this.state.selectedKeys.indexOf(info.key) >= 0) { // deselect SubMenu child delete keyPathOfSelectedItem[info.key]; } else { // select SubMenu child keyPathOfSelectedItem[info.key] = info.keyPath; } _this.setState({ keyPathOfSelectedItem: keyPathOfSelectedItem }); }; _this.renderFilterIcon = function () { var _this$props = _this.props, column = _this$props.column, locale = _this$props.locale, prefixCls = _this$props.prefixCls; var filterIcon = column.filterIcon; var dropdownSelectedClass = _this.props.selectedKeys.length > 0 ? prefixCls + '-selected' : ''; return filterIcon ? _react2['default'].cloneElement(filterIcon, { title: locale.filterTitle, className: (0, _classnames2['default'])(filterIcon.className, (0, _defineProperty3['default'])({}, prefixCls + '-icon', true)) }) : _react2['default'].createElement(_icon2['default'], { title: locale.filterTitle, type: 'filter', className: dropdownSelectedClass }); }; var visible = 'filterDropdownVisible' in props.column ? props.column.filterDropdownVisible : false; _this.state = { selectedKeys: props.selectedKeys, keyPathOfSelectedItem: {}, visible: visible }; return _this; } (0, _createClass3['default'])(FilterMenu, [{ key: 'componentDidMount', value: function componentDidMount() { var column = this.props.column; var rootNode = _reactDom2['default'].findDOMNode(this); var filterBelongToScrollBody = !!(0, _domClosest2['default'])(rootNode, '.ant-table-scroll'); if (filterBelongToScrollBody && column.fixed) { // When fixed column have filters, there will be two dropdown menus // Filter dropdown menu inside scroll body should never be shown // To fix https://github.com/ant-design/ant-design/issues/5010 this.neverShown = true; } } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { var column = nextProps.column; var newState = {}; if ('selectedKeys' in nextProps) { newState.selectedKeys = nextProps.selectedKeys; } if ('filterDropdownVisible' in column) { newState.visible = column.filterDropdownVisible; } if (Object.keys(newState).length > 0) { this.setState(newState); } } }, { key: 'setVisible', value: function setVisible(visible) { var column = this.props.column; if (!('filterDropdownVisible' in column)) { this.setState({ visible: visible }); } if (column.onFilterDropdownVisibleChange) { column.onFilterDropdownVisibleChange(visible); } } }, { key: 'confirmFilter', value: function confirmFilter() { if (this.state.selectedKeys !== this.props.selectedKeys) { this.props.confirmFilter(this.props.column, this.state.selectedKeys); } } }, { key: 'renderMenuItem', value: function renderMenuItem(item) { var column = this.props.column; var multiple = 'filterMultiple' in column ? column.filterMultiple : true; var input = multiple ? _react2['default'].createElement(_checkbox2['default'], { checked: this.state.selectedKeys.indexOf(item.value.toString()) >= 0 }) : _react2['default'].createElement(_radio2['default'], { checked: this.state.selectedKeys.indexOf(item.value.toString()) >= 0 }); return _react2['default'].createElement( _rcMenu.Item, { key: item.value }, input, _react2['default'].createElement( 'span', null, item.text ) ); } }, { key: 'hasSubMenu', value: function hasSubMenu() { var _props$column$filters = this.props.column.filters, filters = _props$column$filters === undefined ? [] : _props$column$filters; return filters.some(function (item) { return !!(item.children && item.children.length > 0); }); } }, { key: 'renderMenus', value: function renderMenus(items) { var _this2 = this; return items.map(function (item) { if (item.children && item.children.length > 0) { var keyPathOfSelectedItem = _this2.state.keyPathOfSelectedItem; var containSelected = Object.keys(keyPathOfSelectedItem).some(function (key) { return keyPathOfSelectedItem[key].indexOf(item.value) >= 0; }); var subMenuCls = containSelected ? _this2.props.dropdownPrefixCls + '-submenu-contain-selected' : ''; return _react2['default'].createElement( _rcMenu.SubMenu, { title: item.text, className: subMenuCls, key: item.value.toString() }, _this2.renderMenus(item.children) ); } return _this2.renderMenuItem(item); }); } }, { key: 'render', value: function render() { var _props = this.props, column = _props.column, locale = _props.locale, prefixCls = _props.prefixCls, dropdownPrefixCls = _props.dropdownPrefixCls, getPopupContainer = _props.getPopupContainer; // default multiple selection in filter dropdown var multiple = 'filterMultiple' in column ? column.filterMultiple : true; var dropdownMenuClass = (0, _classnames2['default'])((0, _defineProperty3['default'])({}, dropdownPrefixCls + '-menu-without-submenu', !this.hasSubMenu())); var menus = column.filterDropdown ? _react2['default'].createElement( _FilterDropdownMenuWrapper2['default'], null, column.filterDropdown ) : _react2['default'].createElement( _FilterDropdownMenuWrapper2['default'], { className: prefixCls + '-dropdown' }, _react2['default'].createElement( _rcMenu2['default'], { multiple: multiple, onClick: this.handleMenuItemClick, prefixCls: dropdownPrefixCls + '-menu', className: dropdownMenuClass, onSelect: this.setSelectedKeys, onDeselect: this.setSelectedKeys, selectedKeys: this.state.selectedKeys }, this.renderMenus(column.filters) ), _react2['default'].createElement( 'div', { className: prefixCls + '-dropdown-btns' }, _react2['default'].createElement( 'a', { className: prefixCls + '-dropdown-link confirm', onClick: this.handleConfirm }, locale.filterConfirm ), _react2['default'].createElement( 'a', { className: prefixCls + '-dropdown-link clear', onClick: this.handleClearFilters }, locale.filterReset ) ) ); return _react2['default'].createElement( _dropdown2['default'], { trigger: ['click'], overlay: menus, visible: this.neverShown ? false : this.state.visible, onVisibleChange: this.onVisibleChange, getPopupContainer: getPopupContainer }, this.renderFilterIcon() ); } }]); return FilterMenu; }(_react2['default'].Component); exports['default'] = FilterMenu; FilterMenu.defaultProps = { handleFilter: function handleFilter() {}, column: {} }; module.exports = exports['default']; /***/ }, /* 174 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Table = __webpack_require__(171); var _Table2 = _interopRequireDefault(_Table); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = _Table2['default']; module.exports = exports['default']; /***/ }, /* 175 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(210); __webpack_require__(163); __webpack_require__(124); __webpack_require__(141); __webpack_require__(165); __webpack_require__(144); /***/ }, /* 176 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _toConsumableArray2 = __webpack_require__(25); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports.flatArray = flatArray; exports.treeMap = treeMap; exports.flatFilter = flatFilter; exports.normalizeColumns = normalizeColumns; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function flatArray() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var childrenName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children'; var result = []; var loop = function loop(array) { array.forEach(function (item) { var newItem = (0, _extends3['default'])({}, item); delete newItem[childrenName]; result.push(newItem); if (item[childrenName] && item[childrenName].length > 0) { loop(item[childrenName]); } }); }; loop(data); return result; } function treeMap(tree, mapper) { var childrenName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children'; return tree.map(function (node, index) { var extra = {}; if (node[childrenName]) { extra[childrenName] = treeMap(node[childrenName], mapper, childrenName); } return (0, _extends3['default'])({}, mapper(node, index), extra); }); } function flatFilter(tree, callback) { return tree.reduce(function (acc, node) { if (callback(node)) { acc.push(node); } if (node.children) { var children = flatFilter(node.children, callback); acc.push.apply(acc, (0, _toConsumableArray3['default'])(children)); } return acc; }, []); } function normalizeColumns(elements) { var columns = []; _react2['default'].Children.forEach(elements, function (element) { if (!_react2['default'].isValidElement(element)) { return; } var column = (0, _extends3['default'])({}, element.props); if (element.key) { column.key = element.key; } if (element.type && element.type.__ANT_TABLE_COLUMN_GROUP) { column.children = normalizeColumns(column.children); } columns.push(column); }); return columns; } /***/ }, /* 177 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _util = __webpack_require__(10); var _validator = __webpack_require__(189); var _validator2 = _interopRequireDefault(_validator); var _messages2 = __webpack_require__(178); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Encapsulates a validation schema. * * @param descriptor An object declaring validation rules * for this schema. */ function Schema(descriptor) { this.rules = null; this._messages = _messages2.messages; this.define(descriptor); } Schema.prototype = { messages: function messages(_messages) { if (_messages) { this._messages = (0, _util.deepMerge)((0, _messages2.newMessages)(), _messages); } return this._messages; }, define: function define(rules) { if (!rules) { throw new Error('Cannot configure a schema with no rules'); } if ((typeof rules === 'undefined' ? 'undefined' : (0, _typeof3['default'])(rules)) !== 'object' || Array.isArray(rules)) { throw new Error('Rules must be an object'); } this.rules = {}; var z = void 0; var item = void 0; for (z in rules) { if (rules.hasOwnProperty(z)) { item = rules[z]; this.rules[z] = Array.isArray(item) ? item : [item]; } } }, validate: function validate(source_) { var _this = this; var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var oc = arguments[2]; var source = source_; var options = o; var callback = oc; if (typeof options === 'function') { callback = options; options = {}; } if (!this.rules || Object.keys(this.rules).length === 0) { if (callback) { callback(); } return; } function complete(results) { var i = void 0; var field = void 0; var errors = []; var fields = {}; function add(e) { if (Array.isArray(e)) { errors = errors.concat.apply(errors, e); } else { errors.push(e); } } for (i = 0; i < results.length; i++) { add(results[i]); } if (!errors.length) { errors = null; fields = null; } else { for (i = 0; i < errors.length; i++) { field = errors[i].field; fields[field] = fields[field] || []; fields[field].push(errors[i]); } } callback(errors, fields); } if (options.messages) { var messages = this.messages(); if (messages === _messages2.messages) { messages = (0, _messages2.newMessages)(); } (0, _util.deepMerge)(messages, options.messages); options.messages = messages; } else { options.messages = this.messages(); } var arr = void 0; var value = void 0; var series = {}; var keys = options.keys || Object.keys(this.rules); keys.forEach(function (z) { arr = _this.rules[z]; value = source[z]; arr.forEach(function (r) { var rule = r; if (typeof rule.transform === 'function') { if (source === source_) { source = (0, _extends3['default'])({}, source); } value = source[z] = rule.transform(value); } if (typeof rule === 'function') { rule = { validator: rule }; } else { rule = (0, _extends3['default'])({}, rule); } rule.validator = _this.getValidationMethod(rule); rule.field = z; rule.fullField = rule.fullField || z; rule.type = _this.getType(rule); if (!rule.validator) { return; } series[z] = series[z] || []; series[z].push({ rule: rule, value: value, source: source, field: z }); }); }); var errorFields = {}; (0, _util.asyncMap)(series, options, function (data, doIt) { var rule = data.rule; var deep = (rule.type === 'object' || rule.type === 'array') && ((0, _typeof3['default'])(rule.fields) === 'object' || (0, _typeof3['default'])(rule.defaultField) === 'object'); deep = deep && (rule.required || !rule.required && data.value); rule.field = data.field; function addFullfield(key, schema) { return (0, _extends3['default'])({}, schema, { fullField: rule.fullField + '.' + key }); } function cb() { var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var errors = e; if (!Array.isArray(errors)) { errors = [errors]; } if (errors.length) { (0, _util.warning)('async-validator:', errors); } if (errors.length && rule.message) { errors = [].concat(rule.message); } errors = errors.map((0, _util.complementError)(rule)); if ((options.first || options.fieldFirst) && errors.length) { errorFields[rule.field] = 1; return doIt(errors); } if (!deep) { doIt(errors); } else { // if rule is required but the target object // does not exist fail at the rule level and don't // go deeper if (rule.required && !data.value) { if (rule.message) { errors = [].concat(rule.message).map((0, _util.complementError)(rule)); } else if (options.error) { errors = [options.error(rule, (0, _util.format)(options.messages.required, rule.field))]; } else { errors = []; } return doIt(errors); } var fieldsSchema = {}; if (rule.defaultField) { for (var k in data.value) { if (data.value.hasOwnProperty(k)) { fieldsSchema[k] = rule.defaultField; } } } fieldsSchema = (0, _extends3['default'])({}, fieldsSchema, data.rule.fields); for (var f in fieldsSchema) { if (fieldsSchema.hasOwnProperty(f)) { var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]]; fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f)); } } var schema = new Schema(fieldsSchema); schema.messages(options.messages); if (data.rule.options) { data.rule.options.messages = options.messages; data.rule.options.error = options.error; } schema.validate(data.value, data.rule.options || options, function (errs) { doIt(errs && errs.length ? errors.concat(errs) : errs); }); } } rule.validator(rule, data.value, cb, data.source, options); }, function (results) { complete(results); }); }, getType: function getType(rule) { if (rule.type === undefined && rule.pattern instanceof RegExp) { rule.type = 'pattern'; } if (typeof rule.validator !== 'function' && rule.type && !_validator2['default'].hasOwnProperty(rule.type)) { throw new Error((0, _util.format)('Unknown rule type %s', rule.type)); } return rule.type || 'string'; }, getValidationMethod: function getValidationMethod(rule) { if (typeof rule.validator === 'function') { return rule.validator; } var keys = Object.keys(rule); var messageIndex = keys.indexOf('message'); if (messageIndex !== -1) { keys.splice(messageIndex, 1); } if (keys.length === 1 && keys[0] === 'required') { return _validator2['default'].required; } return _validator2['default'][this.getType(rule)] || false; } }; Schema.register = function register(type, validator) { if (typeof validator !== 'function') { throw new Error('Cannot register a validator by type, validator is not a function'); } _validator2['default'][type] = validator; }; Schema.messages = _messages2.messages; exports['default'] = Schema; module.exports = exports['default']; /***/ }, /* 178 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.newMessages = newMessages; function newMessages() { return { 'default': 'Validation error on field %s', required: '%s is required', 'enum': '%s must be one of %s', whitespace: '%s cannot be empty', date: { format: '%s date %s is invalid for format %s', parse: '%s date could not be parsed, %s is invalid ', invalid: '%s date %s is invalid' }, types: { string: '%s is not a %s', method: '%s is not a %s (function)', array: '%s is not an %s', object: '%s is not an %s', number: '%s is not a %s', date: '%s is not a %s', boolean: '%s is not a %s', integer: '%s is not an %s', float: '%s is not a %s', regexp: '%s is not a valid %s', email: '%s is not a valid %s', url: '%s is not a valid %s', hex: '%s is not a valid %s' }, string: { len: '%s must be exactly %s characters', min: '%s must be at least %s characters', max: '%s cannot be longer than %s characters', range: '%s must be between %s and %s characters' }, number: { len: '%s must equal %s', min: '%s cannot be less than %s', max: '%s cannot be greater than %s', range: '%s must be between %s and %s' }, array: { len: '%s must be exactly %s in length', min: '%s cannot be less than %s in length', max: '%s cannot be greater than %s in length', range: '%s must be between %s and %s in length' }, pattern: { mismatch: '%s value %s does not match pattern %s' }, clone: function clone() { var cloned = JSON.parse(JSON.stringify(this)); cloned.clone = this.clone; return cloned; } }; } var messages = exports.messages = newMessages(); /***/ }, /* 179 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } var ENUM = 'enum'; /** * Rule for validating a value exists in an enumerable list. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function enumerable(rule, value, source, errors, options) { rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : []; if (rule[ENUM].indexOf(value) === -1) { errors.push(util.format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', '))); } } exports['default'] = enumerable; module.exports = exports['default']; /***/ }, /* 180 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } /** * Rule for validating a regular expression pattern. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function pattern(rule, value, source, errors, options) { if (rule.pattern) { if (rule.pattern instanceof RegExp) { if (!rule.pattern.test(value)) { errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); } } else if (typeof rule.pattern === 'string') { var _pattern = new RegExp(rule.pattern); if (!_pattern.test(value)) { errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); } } } } exports['default'] = pattern; module.exports = exports['default']; /***/ }, /* 181 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } /** * Rule for validating minimum and maximum allowed values. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function range(rule, value, source, errors, options) { var len = typeof rule.len === 'number'; var min = typeof rule.min === 'number'; var max = typeof rule.max === 'number'; var val = value; var key = null; var num = typeof value === 'number'; var str = typeof value === 'string'; var arr = Array.isArray(value); if (num) { key = 'number'; } else if (str) { key = 'string'; } else if (arr) { key = 'array'; } // if the value is not of a supported type for range validation // the validation rule rule should use the // type property to also test for a particular type if (!key) { return false; } if (str || arr) { val = value.length; } if (len) { if (val !== rule.len) { errors.push(util.format(options.messages[key].len, rule.fullField, rule.len)); } } else if (min && !max && val < rule.min) { errors.push(util.format(options.messages[key].min, rule.fullField, rule.min)); } else if (max && !min && val > rule.max) { errors.push(util.format(options.messages[key].max, rule.fullField, rule.max)); } else if (min && max && (val < rule.min || val > rule.max)) { errors.push(util.format(options.messages[key].range, rule.fullField, rule.min, rule.max)); } } exports['default'] = range; module.exports = exports['default']; /***/ }, /* 182 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); var _required = __webpack_require__(77); var _required2 = _interopRequireDefault(_required); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /* eslint max-len:0 */ var pattern = { // http://emailregex.com/ email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'), hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i }; var types = { integer: function integer(value) { return types.number(value) && parseInt(value, 10) === value; }, float: function float(value) { return types.number(value) && !types.integer(value); }, array: function array(value) { return Array.isArray(value); }, regexp: function regexp(value) { if (value instanceof RegExp) { return true; } try { return !!new RegExp(value); } catch (e) { return false; } }, date: function date(value) { return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function'; }, number: function number(value) { if (isNaN(value)) { return false; } return typeof value === 'number'; }, object: function object(value) { return (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && !types.array(value); }, method: function method(value) { return typeof value === 'function'; }, email: function email(value) { return typeof value === 'string' && !!value.match(pattern.email); }, url: function url(value) { return typeof value === 'string' && !!value.match(pattern.url); }, hex: function hex(value) { return typeof value === 'string' && !!value.match(pattern.hex); } }; /** * Rule for validating the type of a value. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function type(rule, value, source, errors, options) { if (rule.required && value === undefined) { (0, _required2['default'])(rule, value, source, errors, options); return; } var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex']; var ruleType = rule.type; if (custom.indexOf(ruleType) > -1) { if (!types[ruleType](value)) { errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type)); } // straight typeof check } else if (ruleType && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) !== rule.type) { errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type)); } } exports['default'] = type; module.exports = exports['default']; /***/ }, /* 183 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var util = _interopRequireWildcard(_util); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } /** * Rule for validating whitespace. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param source The source object being validated. * @param errors An array of errors that this rule may add * validation errors to. * @param options The validation options. * @param options.messages The validation messages. */ function whitespace(rule, value, source, errors, options) { if (/^\s+$/.test(value) || value === '') { errors.push(util.format(options.messages.whitespace, rule.fullField)); } } exports['default'] = whitespace; module.exports = exports['default']; /***/ }, /* 184 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates an array. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function array(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value, 'array') && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options, 'array'); if (!(0, _util.isEmptyValue)(value, 'array')) { _rule2['default'].type(rule, value, source, errors, options); _rule2['default'].range(rule, value, source, errors, options); } } callback(errors); } exports['default'] = array; module.exports = exports['default']; /***/ }, /* 185 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = __webpack_require__(10); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a boolean. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function boolean(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); } } callback(errors); } exports['default'] = boolean; module.exports = exports['default']; /***/ }, /* 186 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function date(rule, value, callback, source, options) { // console.log('integer rule called %j', rule); var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); // console.log('validate on %s value', value); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (!(0, _util.isEmptyValue)(value)) { _rule2['default'].type(rule, value, source, errors, options); if (value) { _rule2['default'].range(rule, value.getTime(), source, errors, options); } } } callback(errors); } exports['default'] = date; module.exports = exports['default']; /***/ }, /* 187 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var ENUM = 'enum'; /** * Validates an enumerable list. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function enumerable(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value) { _rule2['default'][ENUM](rule, value, source, errors, options); } } callback(errors); } exports['default'] = enumerable; module.exports = exports['default']; /***/ }, /* 188 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a number is a floating point number. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function floatFn(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); _rule2['default'].range(rule, value, source, errors, options); } } callback(errors); } exports['default'] = floatFn; module.exports = exports['default']; /***/ }, /* 189 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _string = __webpack_require__(197); var _string2 = _interopRequireDefault(_string); var _method = __webpack_require__(191); var _method2 = _interopRequireDefault(_method); var _number = __webpack_require__(192); var _number2 = _interopRequireDefault(_number); var _boolean = __webpack_require__(185); var _boolean2 = _interopRequireDefault(_boolean); var _regexp = __webpack_require__(195); var _regexp2 = _interopRequireDefault(_regexp); var _integer = __webpack_require__(190); var _integer2 = _interopRequireDefault(_integer); var _float = __webpack_require__(188); var _float2 = _interopRequireDefault(_float); var _array = __webpack_require__(184); var _array2 = _interopRequireDefault(_array); var _object = __webpack_require__(193); var _object2 = _interopRequireDefault(_object); var _enum = __webpack_require__(187); var _enum2 = _interopRequireDefault(_enum); var _pattern = __webpack_require__(194); var _pattern2 = _interopRequireDefault(_pattern); var _date = __webpack_require__(186); var _date2 = _interopRequireDefault(_date); var _required = __webpack_require__(196); var _required2 = _interopRequireDefault(_required); var _type = __webpack_require__(198); var _type2 = _interopRequireDefault(_type); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = { string: _string2['default'], method: _method2['default'], number: _number2['default'], boolean: _boolean2['default'], regexp: _regexp2['default'], integer: _integer2['default'], float: _float2['default'], array: _array2['default'], object: _object2['default'], 'enum': _enum2['default'], pattern: _pattern2['default'], date: _date2['default'], url: _type2['default'], hex: _type2['default'], email: _type2['default'], required: _required2['default'] }; module.exports = exports['default']; /***/ }, /* 190 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a number is an integer. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function integer(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); _rule2['default'].range(rule, value, source, errors, options); } } callback(errors); } exports['default'] = integer; module.exports = exports['default']; /***/ }, /* 191 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a function. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function method(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); } } callback(errors); } exports['default'] = method; module.exports = exports['default']; /***/ }, /* 192 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a number. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function number(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); _rule2['default'].range(rule, value, source, errors, options); } } callback(errors); } exports['default'] = number; module.exports = exports['default']; /***/ }, /* 193 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates an object. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function object(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (value !== undefined) { _rule2['default'].type(rule, value, source, errors, options); } } callback(errors); } exports['default'] = object; module.exports = exports['default']; /***/ }, /* 194 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates a regular expression pattern. * * Performs validation when a rule only contains * a pattern property but is not declared as a string type. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function pattern(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (!(0, _util.isEmptyValue)(value, 'string')) { _rule2['default'].pattern(rule, value, source, errors, options); } } callback(errors); } exports['default'] = pattern; module.exports = exports['default']; /***/ }, /* 195 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Validates the regular expression type. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function regexp(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options); if (!(0, _util.isEmptyValue)(value)) { _rule2['default'].type(rule, value, source, errors, options); } } callback(errors); } exports['default'] = regexp; module.exports = exports['default']; /***/ }, /* 196 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof2 = __webpack_require__(17); var _typeof3 = _interopRequireDefault(_typeof2); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function required(rule, value, callback, source, options) { var errors = []; var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value); _rule2['default'].required(rule, value, source, errors, options, type); callback(errors); } exports['default'] = required; module.exports = exports['default']; /***/ }, /* 197 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * Performs validation for string types. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param options.messages The validation messages. */ function string(rule, value, callback, source, options) { var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options, 'string'); if (!(0, _util.isEmptyValue)(value, 'string')) { _rule2['default'].type(rule, value, source, errors, options); _rule2['default'].range(rule, value, source, errors, options); _rule2['default'].pattern(rule, value, source, errors, options); if (rule.whitespace === true) { _rule2['default'].whitespace(rule, value, source, errors, options); } } } callback(errors); } exports['default'] = string; module.exports = exports['default']; /***/ }, /* 198 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _rule = __webpack_require__(11); var _rule2 = _interopRequireDefault(_rule); var _util = __webpack_require__(10); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function type(rule, value, callback, source, options) { var ruleType = rule.type; var errors = []; var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); if (validate) { if ((0, _util.isEmptyValue)(value, ruleType) && !rule.required) { return callback(); } _rule2['default'].required(rule, value, source, errors, options, ruleType); if (!(0, _util.isEmptyValue)(value, ruleType)) { _rule2['default'].type(rule, value, source, errors, options); } } callback(errors); } exports['default'] = type; module.exports = exports['default']; /***/ }, /* 199 */, /* 200 */, /* 201 */ /***/ function(module, exports, __webpack_require__) { /** * Module dependencies */ var matches = __webpack_require__(202); /** * @param element {Element} * @param selector {String} * @param context {Element} * @return {Element} */ module.exports = function (element, selector, context) { context = context || document; // guard against orphans element = { parentNode: element }; while ((element = element.parentNode) && element !== context) { if (matches(element, selector)) { return element; } } }; /***/ }, /* 202 */ /***/ function(module, exports) { 'use strict'; /** * Determine if a DOM element matches a CSS selector * * @param {Element} elem * @param {String} selector * @return {Boolean} * @api public */ function matches(elem, selector) { // Vendor-specific implementations of `Element.prototype.matches()`. var proto = window.Element.prototype; var nativeMatches = proto.matches || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (!elem || elem.nodeType !== 1) { return false; } var parentElem = elem.parentNode; // use native 'matches' if (nativeMatches) { return nativeMatches.call(elem, selector); } // native support for `matches` is missing and a fallback is required var nodes = parentElem.querySelectorAll(selector); var len = nodes.length; for (var i = 0; i < len; i++) { if (nodes[i] === elem) { return true; } } return false; } /** * Expose `matches` */ module.exports = matches; /***/ }, /* 203 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 204 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 205 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 206 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 207 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 208 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 209 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 210 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 211 */ /***/ function(module, exports) { /* WEBPACK VAR INJECTION */(function(global) {/** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var funcTag = '[object Function]', genTag = '[object GeneratorFunction]', symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Symbol = root.Symbol, splice = arrayProto.splice; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), nativeCreate = getNative(Object, 'create'); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function castPath(value) { return isArray(value) ? value : stringToPath(value); } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function(string) { string = toString(string); var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Assign cache to `_.memoize`. memoize.Cache = MapCache; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } module.exports = get; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 212 */ /***/ function(module, exports, __webpack_require__) { var hashClear = __webpack_require__(229), hashDelete = __webpack_require__(230), hashGet = __webpack_require__(231), hashHas = __webpack_require__(232), hashSet = __webpack_require__(233); /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; module.exports = Hash; /***/ }, /* 213 */ /***/ function(module, exports, __webpack_require__) { var listCacheClear = __webpack_require__(237), listCacheDelete = __webpack_require__(238), listCacheGet = __webpack_require__(239), listCacheHas = __webpack_require__(240), listCacheSet = __webpack_require__(241); /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; module.exports = ListCache; /***/ }, /* 214 */ /***/ function(module, exports, __webpack_require__) { var getNative = __webpack_require__(42), root = __webpack_require__(132); /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'); module.exports = Map; /***/ }, /* 215 */ /***/ function(module, exports, __webpack_require__) { var mapCacheClear = __webpack_require__(242), mapCacheDelete = __webpack_require__(243), mapCacheGet = __webpack_require__(244), mapCacheHas = __webpack_require__(245), mapCacheSet = __webpack_require__(246); /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; module.exports = MapCache; /***/ }, /* 216 */ /***/ function(module, exports) { /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } module.exports = arrayMap; /***/ }, /* 217 */ /***/ function(module, exports, __webpack_require__) { var baseAssignValue = __webpack_require__(218), eq = __webpack_require__(80); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } module.exports = assignValue; /***/ }, /* 218 */ /***/ function(module, exports, __webpack_require__) { var defineProperty = __webpack_require__(226); /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } module.exports = baseAssignValue; /***/ }, /* 219 */ /***/ function(module, exports, __webpack_require__) { var castPath = __webpack_require__(41), toKey = __webpack_require__(43); /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } module.exports = baseGet; /***/ }, /* 220 */ /***/ function(module, exports) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.has` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHas(object, key) { return object != null && hasOwnProperty.call(object, key); } module.exports = baseHas; /***/ }, /* 221 */ /***/ function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(67), isObjectLike = __webpack_require__(68); /** `Object#toString` result references. */ var argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } module.exports = baseIsArguments; /***/ }, /* 222 */ /***/ function(module, exports, __webpack_require__) { var isFunction = __webpack_require__(251), isMasked = __webpack_require__(236), isObject = __webpack_require__(45), toSource = __webpack_require__(249); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } module.exports = baseIsNative; /***/ }, /* 223 */ /***/ function(module, exports, __webpack_require__) { var assignValue = __webpack_require__(217), castPath = __webpack_require__(41), isIndex = __webpack_require__(79), isObject = __webpack_require__(45), toKey = __webpack_require__(43); /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } module.exports = baseSet; /***/ }, /* 224 */ /***/ function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(304), arrayMap = __webpack_require__(216), isArray = __webpack_require__(30), isSymbol = __webpack_require__(46); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = baseToString; /***/ }, /* 225 */ /***/ function(module, exports, __webpack_require__) { var root = __webpack_require__(132); /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; module.exports = coreJsData; /***/ }, /* 226 */ /***/ function(module, exports, __webpack_require__) { var getNative = __webpack_require__(42); var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); module.exports = defineProperty; /***/ }, /* 227 */ /***/ function(module, exports) { /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } module.exports = getValue; /***/ }, /* 228 */ /***/ function(module, exports, __webpack_require__) { var castPath = __webpack_require__(41), isArguments = __webpack_require__(250), isArray = __webpack_require__(30), isIndex = __webpack_require__(79), isLength = __webpack_require__(252), toKey = __webpack_require__(43); /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } module.exports = hasPath; /***/ }, /* 229 */ /***/ function(module, exports, __webpack_require__) { var nativeCreate = __webpack_require__(29); /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } module.exports = hashClear; /***/ }, /* 230 */ /***/ function(module, exports) { /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } module.exports = hashDelete; /***/ }, /* 231 */ /***/ function(module, exports, __webpack_require__) { var nativeCreate = __webpack_require__(29); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } module.exports = hashGet; /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { var nativeCreate = __webpack_require__(29); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } module.exports = hashHas; /***/ }, /* 233 */ /***/ function(module, exports, __webpack_require__) { var nativeCreate = __webpack_require__(29); /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } module.exports = hashSet; /***/ }, /* 234 */ /***/ function(module, exports, __webpack_require__) { var isArray = __webpack_require__(30), isSymbol = __webpack_require__(46); /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } module.exports = isKey; /***/ }, /* 235 */ /***/ function(module, exports) { /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } module.exports = isKeyable; /***/ }, /* 236 */ /***/ function(module, exports, __webpack_require__) { var coreJsData = __webpack_require__(225); /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } module.exports = isMasked; /***/ }, /* 237 */ /***/ function(module, exports) { /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } module.exports = listCacheClear; /***/ }, /* 238 */ /***/ function(module, exports, __webpack_require__) { var assocIndexOf = __webpack_require__(27); /** Used for built-in method references. */ var arrayProto = Array.prototype; /** Built-in value references. */ var splice = arrayProto.splice; /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } module.exports = listCacheDelete; /***/ }, /* 239 */ /***/ function(module, exports, __webpack_require__) { var assocIndexOf = __webpack_require__(27); /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } module.exports = listCacheGet; /***/ }, /* 240 */ /***/ function(module, exports, __webpack_require__) { var assocIndexOf = __webpack_require__(27); /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } module.exports = listCacheHas; /***/ }, /* 241 */ /***/ function(module, exports, __webpack_require__) { var assocIndexOf = __webpack_require__(27); /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } module.exports = listCacheSet; /***/ }, /* 242 */ /***/ function(module, exports, __webpack_require__) { var Hash = __webpack_require__(212), ListCache = __webpack_require__(213), Map = __webpack_require__(214); /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } module.exports = mapCacheClear; /***/ }, /* 243 */ /***/ function(module, exports, __webpack_require__) { var getMapData = __webpack_require__(28); /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } module.exports = mapCacheDelete; /***/ }, /* 244 */ /***/ function(module, exports, __webpack_require__) { var getMapData = __webpack_require__(28); /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } module.exports = mapCacheGet; /***/ }, /* 245 */ /***/ function(module, exports, __webpack_require__) { var getMapData = __webpack_require__(28); /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } module.exports = mapCacheHas; /***/ }, /* 246 */ /***/ function(module, exports, __webpack_require__) { var getMapData = __webpack_require__(28); /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } module.exports = mapCacheSet; /***/ }, /* 247 */ /***/ function(module, exports, __webpack_require__) { var memoize = __webpack_require__(253); /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } module.exports = memoizeCapped; /***/ }, /* 248 */ /***/ function(module, exports, __webpack_require__) { var memoizeCapped = __webpack_require__(247); /** Used to match property names within property paths. */ var reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoizeCapped(function(string) { var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); module.exports = stringToPath; /***/ }, /* 249 */ /***/ function(module, exports) { /** Used for built-in method references. */ var funcProto = Function.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } module.exports = toSource; /***/ }, /* 250 */ /***/ function(module, exports, __webpack_require__) { var baseIsArguments = __webpack_require__(221), isObjectLike = __webpack_require__(68); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; module.exports = isArguments; /***/ }, /* 251 */ /***/ function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(67), isObject = __webpack_require__(45); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; /***/ }, /* 252 */ /***/ function(module, exports) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; /***/ }, /* 253 */ /***/ function(module, exports, __webpack_require__) { var MapCache = __webpack_require__(215); /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = MapCache; module.exports = memoize; /***/ }, /* 254 */ /***/ function(module, exports, __webpack_require__) { var baseToString = __webpack_require__(224); /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } module.exports = toString; /***/ }, /* 255 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _objectWithoutProperties2 = __webpack_require__(21); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _PureRenderMixin = __webpack_require__(38); var _PureRenderMixin2 = _interopRequireDefault(_PureRenderMixin); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Checkbox = function (_React$Component) { (0, _inherits3['default'])(Checkbox, _React$Component); function Checkbox(props) { (0, _classCallCheck3['default'])(this, Checkbox); var _this = (0, _possibleConstructorReturn3['default'])(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).call(this, props)); _initialiseProps.call(_this); var checked = 'checked' in props ? props.checked : props.defaultChecked; _this.state = { checked: checked }; return _this; } (0, _createClass3['default'])(Checkbox, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('checked' in nextProps) { this.setState({ checked: nextProps.checked }); } } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _PureRenderMixin2['default'].shouldComponentUpdate.apply(this, args); } }, { key: 'render', value: function render() { var _classNames; var _props = this.props, prefixCls = _props.prefixCls, className = _props.className, style = _props.style, name = _props.name, type = _props.type, disabled = _props.disabled, readOnly = _props.readOnly, tabIndex = _props.tabIndex, onClick = _props.onClick, onFocus = _props.onFocus, onBlur = _props.onBlur, others = (0, _objectWithoutProperties3['default'])(_props, ['prefixCls', 'className', 'style', 'name', 'type', 'disabled', 'readOnly', 'tabIndex', 'onClick', 'onFocus', 'onBlur']); var globalProps = Object.keys(others).reduce(function (prev, key) { if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') { prev[key] = others[key]; } return prev; }, {}); var checked = this.state.checked; var classString = (0, _classnames2['default'])(prefixCls, className, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-checked', checked), (0, _defineProperty3['default'])(_classNames, prefixCls + '-disabled', disabled), _classNames)); return _react2['default'].createElement( 'span', { className: classString, style: style }, _react2['default'].createElement('input', (0, _extends3['default'])({ name: name, type: type, readOnly: readOnly, disabled: disabled, tabIndex: tabIndex, className: prefixCls + '-input', checked: !!checked, onClick: onClick, onFocus: onFocus, onBlur: onBlur, onChange: this.handleChange }, globalProps)), _react2['default'].createElement('span', { className: prefixCls + '-inner' }) ); } }]); return Checkbox; }(_react2['default'].Component); Checkbox.propTypes = { prefixCls: _propTypes2['default'].string, className: _propTypes2['default'].string, style: _propTypes2['default'].object, name: _propTypes2['default'].string, type: _propTypes2['default'].string, defaultChecked: _propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].bool]), checked: _propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].bool]), disabled: _propTypes2['default'].bool, onFocus: _propTypes2['default'].func, onBlur: _propTypes2['default'].func, onChange: _propTypes2['default'].func, onClick: _propTypes2['default'].func, tabIndex: _propTypes2['default'].string, readOnly: _propTypes2['default'].bool }; Checkbox.defaultProps = { prefixCls: 'rc-checkbox', className: '', style: {}, type: 'checkbox', defaultChecked: false, onFocus: function onFocus() {}, onBlur: function onBlur() {}, onChange: function onChange() {} }; var _initialiseProps = function _initialiseProps() { var _this2 = this; this.handleChange = function (e) { var props = _this2.props; if (props.disabled) { return; } if (!('checked' in props)) { _this2.setState({ checked: e.target.checked }); } props.onChange({ target: (0, _extends3['default'])({}, props, { checked: e.target.checked }), stopPropagation: function stopPropagation() { e.stopPropagation(); }, preventDefault: function preventDefault() { e.preventDefault(); } }); }; }; exports['default'] = Checkbox; module.exports = exports['default']; /***/ }, /* 256 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _rcTrigger = __webpack_require__(37); var _rcTrigger2 = _interopRequireDefault(_rcTrigger); var _placements = __webpack_require__(258); var _placements2 = _interopRequireDefault(_placements); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var Dropdown = function (_Component) { _inherits(Dropdown, _Component); function Dropdown(props) { _classCallCheck(this, Dropdown); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _initialiseProps.call(_this); if ('visible' in props) { _this.state = { visible: props.visible }; } else { _this.state = { visible: props.defaultVisible }; } return _this; } Dropdown.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) { var visible = _ref.visible; if (visible !== undefined) { this.setState({ visible: visible }); } }; Dropdown.prototype.getMenuElement = function getMenuElement() { var _props = this.props, overlay = _props.overlay, prefixCls = _props.prefixCls; var extraOverlayProps = { prefixCls: prefixCls + '-menu', onClick: this.onClick }; if (typeof overlay.type === 'string') { delete extraOverlayProps.prefixCls; } return _react2["default"].cloneElement(overlay, extraOverlayProps); }; Dropdown.prototype.getPopupDomNode = function getPopupDomNode() { return this.refs.trigger.getPopupDomNode(); }; Dropdown.prototype.render = function render() { var _props2 = this.props, prefixCls = _props2.prefixCls, children = _props2.children, transitionName = _props2.transitionName, animation = _props2.animation, align = _props2.align, placement = _props2.placement, getPopupContainer = _props2.getPopupContainer, showAction = _props2.showAction, hideAction = _props2.hideAction, overlayClassName = _props2.overlayClassName, overlayStyle = _props2.overlayStyle, trigger = _props2.trigger, otherProps = _objectWithoutProperties(_props2, ['prefixCls', 'children', 'transitionName', 'animation', 'align', 'placement', 'getPopupContainer', 'showAction', 'hideAction', 'overlayClassName', 'overlayStyle', 'trigger']); return _react2["default"].createElement( _rcTrigger2["default"], _extends({}, otherProps, { prefixCls: prefixCls, ref: 'trigger', popupClassName: overlayClassName, popupStyle: overlayStyle, builtinPlacements: _placements2["default"], action: trigger, showAction: showAction, hideAction: hideAction, popupPlacement: placement, popupAlign: align, popupTransitionName: transitionName, popupAnimation: animation, popupVisible: this.state.visible, afterPopupVisibleChange: this.afterVisibleChange, popup: this.getMenuElement(), onPopupVisibleChange: this.onVisibleChange, getPopupContainer: getPopupContainer }), children ); }; return Dropdown; }(_react.Component); Dropdown.propTypes = { minOverlayWidthMatchTrigger: _propTypes2["default"].bool, onVisibleChange: _propTypes2["default"].func, prefixCls: _propTypes2["default"].string, children: _propTypes2["default"].any, transitionName: _propTypes2["default"].string, overlayClassName: _propTypes2["default"].string, animation: _propTypes2["default"].any, align: _propTypes2["default"].object, overlayStyle: _propTypes2["default"].object, placement: _propTypes2["default"].string, overlay: _propTypes2["default"].node, trigger: _propTypes2["default"].array, showAction: _propTypes2["default"].array, hideAction: _propTypes2["default"].array, getPopupContainer: _propTypes2["default"].func, visible: _propTypes2["default"].bool, defaultVisible: _propTypes2["default"].bool }; Dropdown.defaultProps = { minOverlayWidthMatchTrigger: true, prefixCls: 'rc-dropdown', trigger: ['hover'], showAction: [], hideAction: [], overlayClassName: '', overlayStyle: {}, defaultVisible: false, onVisibleChange: function onVisibleChange() {}, placement: 'bottomLeft' }; var _initialiseProps = function _initialiseProps() { var _this2 = this; this.onClick = function (e) { var props = _this2.props; var overlayProps = props.overlay.props; // do no call onVisibleChange, if you need click to hide, use onClick and control visible if (!('visible' in props)) { _this2.setState({ visible: false }); } if (overlayProps.onClick) { overlayProps.onClick(e); } }; this.onVisibleChange = function (visible) { var props = _this2.props; if (!('visible' in props)) { _this2.setState({ visible: visible }); } props.onVisibleChange(visible); }; this.afterVisibleChange = function (visible) { if (visible && _this2.props.minOverlayWidthMatchTrigger) { var overlayNode = _this2.getPopupDomNode(); var rootNode = _reactDom2["default"].findDOMNode(_this2); if (rootNode.offsetWidth > overlayNode.offsetWidth) { overlayNode.style.width = rootNode.offsetWidth + 'px'; } } }; }; exports["default"] = Dropdown; module.exports = exports['default']; /***/ }, /* 257 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Dropdown = __webpack_require__(256); var _Dropdown2 = _interopRequireDefault(_Dropdown); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = _Dropdown2["default"]; module.exports = exports['default']; /***/ }, /* 258 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var autoAdjustOverflow = { adjustX: 1, adjustY: 1 }; var targetOffset = [0, 0]; var placements = exports.placements = { topLeft: { points: ['bl', 'tl'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, topCenter: { points: ['bc', 'tc'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, topRight: { points: ['br', 'tr'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, bottomLeft: { points: ['tl', 'bl'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, bottomCenter: { points: ['tc', 'bc'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, bottomRight: { points: ['tr', 'br'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset } }; exports["default"] = placements; /***/ }, /* 259 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _domScrollIntoView = __webpack_require__(36); var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView); var _has = __webpack_require__(44); var _has2 = _interopRequireDefault(_has); var _createBaseForm = __webpack_require__(84); var _createBaseForm2 = _interopRequireDefault(_createBaseForm); var _createForm = __webpack_require__(261); var _utils = __webpack_require__(47); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function computedStyle(el, prop) { var getComputedStyle = window.getComputedStyle; var style = // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle; if (style) { return style[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); })]; } return undefined; } function getScrollableContainer(n) { var node = n; var nodeName = void 0; /* eslint no-cond-assign:0 */ while ((nodeName = node.nodeName.toLowerCase()) !== 'body') { var overflowY = computedStyle(node, 'overflowY'); if (node !== n && (overflowY === 'auto' || overflowY === 'scroll')) { return node; } node = node.parentNode; } return nodeName === 'body' ? node.ownerDocument : node; } var mixin = { getForm: function getForm() { return (0, _extends3['default'])({}, _createForm.mixin.getForm.call(this), { validateFieldsAndScroll: this.validateFieldsAndScroll }); }, validateFieldsAndScroll: function validateFieldsAndScroll(ns, opt, cb) { var _this = this; var _getParams = (0, _utils.getParams)(ns, opt, cb), names = _getParams.names, callback = _getParams.callback, options = _getParams.options; var newCb = function newCb(error, values) { if (error) { var validNames = _this.fieldsStore.getValidFieldsName(); var firstNode = void 0; var firstTop = void 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = validNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var name = _step.value; if ((0, _has2['default'])(error, name)) { var instance = _this.getFieldInstance(name); if (instance) { var node = _reactDom2['default'].findDOMNode(instance); var top = node.getBoundingClientRect().top; if (firstTop === undefined || firstTop > top) { firstTop = top; firstNode = node; } } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator['return']) { _iterator['return'](); } } finally { if (_didIteratorError) { throw _iteratorError; } } } if (firstNode) { var c = options.container || getScrollableContainer(firstNode); (0, _domScrollIntoView2['default'])(firstNode, c, (0, _extends3['default'])({ onlyScrollIfNeeded: true }, options.scroll)); } } if (typeof callback === 'function') { callback(error, values); } }; return this.validateFields(names, options, newCb); } }; function createDOMForm(option) { return (0, _createBaseForm2['default'])((0, _extends3['default'])({}, option), [mixin]); } exports['default'] = createDOMForm; module.exports = exports['default']; /***/ }, /* 260 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); exports['default'] = createFieldsStore; var _get = __webpack_require__(81); var _get2 = _interopRequireDefault(_get); var _has = __webpack_require__(44); var _has2 = _interopRequireDefault(_has); var _set = __webpack_require__(82); var _set2 = _interopRequireDefault(_set); var _utils = __webpack_require__(47); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var atom = {}; var FieldsStore = function () { function FieldsStore(fields) { (0, _classCallCheck3['default'])(this, FieldsStore); _initialiseProps.call(this); this.fields = fields; this.fieldsMeta = {}; } (0, _createClass3['default'])(FieldsStore, [{ key: 'replaceFields', value: function replaceFields(fields) { this.fields = fields; } }, { key: 'setFields', value: function setFields(fields) { var _this = this; var fieldsMeta = this.fieldsMeta; var nowFields = (0, _extends3['default'])({}, this.fields, fields); var nowValues = {}; Object.keys(fieldsMeta).forEach(function (f) { var _getNameIfNested = (0, _utils.getNameIfNested)(f), name = _getNameIfNested.name, isNested = _getNameIfNested.isNested; if (isNested && fieldsMeta[name].exclusive) { return; } nowValues[f] = _this.getValueFromFields(f, nowFields); }); Object.keys(nowValues).forEach(function (f) { var value = nowValues[f]; var fieldMeta = fieldsMeta[f]; if (fieldMeta && fieldMeta.normalize) { var nowValue = fieldMeta.normalize(value, _this.getValueFromFields(f, _this.fields), nowValues); if (nowValue !== value) { nowFields[f] = (0, _extends3['default'])({}, nowFields[f], { value: nowValue }); } } }); this.fields = nowFields; } }, { key: 'resetFields', value: function resetFields(ns) { var newFields = {}; var fields = this.fields; var names = ns || Object.keys(fields); names.forEach(function (name) { var field = fields[name]; if (field && 'value' in field) { newFields[name] = {}; } }); return newFields; } }, { key: 'getValueFromFieldsInternal', value: function getValueFromFieldsInternal(name, fields) { var field = fields[name]; if (field && 'value' in field) { return field.value; } var fieldMeta = this.fieldsMeta[name]; return fieldMeta && fieldMeta.initialValue; } }, { key: 'getValueFromFields', value: function getValueFromFields(name, fields) { var _this2 = this; var fieldsMeta = this.fieldsMeta; if (fieldsMeta[name] && fieldsMeta[name].virtual) { var ret = {}; Object.keys(fieldsMeta).forEach(function (fieldKey) { var nameIfNested = (0, _utils.getNameIfNested)(fieldKey); if (nameIfNested.name === name && nameIfNested.isNested) { (0, _set2['default'])(ret, fieldKey, _this2.getValueFromFieldsInternal(fieldKey, fields)); } }); return ret[name]; } return this.getValueFromFieldsInternal(name, fields); } }, { key: 'getValidFieldsName', value: function getValidFieldsName() { var fieldsMeta = this.fieldsMeta; return fieldsMeta ? Object.keys(fieldsMeta).filter(function (name) { return !fieldsMeta[name].hidden; }) : []; } }, { key: 'getFieldValuePropValue', value: function getFieldValuePropValue(fieldMeta) { var exclusive = fieldMeta.exclusive, leadingName = fieldMeta.leadingName, name = fieldMeta.name, getValueProps = fieldMeta.getValueProps, valuePropName = fieldMeta.valuePropName; var fieldsMeta = this.fieldsMeta; var field = exclusive ? this.getField(leadingName) : this.getField(name); var fieldValue = atom; if (field && 'value' in field) { fieldValue = field.value; } if (fieldValue === atom) { fieldValue = exclusive ? fieldsMeta[leadingName].initialValue : fieldMeta.initialValue; } if (getValueProps) { return getValueProps(fieldValue); } return (0, _defineProperty3['default'])({}, valuePropName, fieldValue); } }, { key: 'getField', value: function getField(name) { return (0, _extends3['default'])({}, this.fields[name], { name: name }); } }, { key: 'getFieldMember', value: function getFieldMember(name, member) { return this.getField(name)[member]; } }, { key: 'getFieldMeta', value: function getFieldMeta(name) { if (!this.fieldsMeta[name]) { this.fieldsMeta[name] = {}; } return this.fieldsMeta[name]; } }, { key: 'setFieldMeta', value: function setFieldMeta(name, meta) { this.fieldsMeta[name] = meta; } }, { key: 'clearField', value: function clearField(name) { delete this.fields[name]; delete this.fieldsMeta[name]; } }]); return FieldsStore; }(); var _initialiseProps = function _initialiseProps() { var _this3 = this; this.getFieldsValue = function (names) { var fields = names || (0, _utils.flatFieldNames)(_this3.getValidFieldsName()); var allValues = {}; fields.forEach(function (f) { (0, _set2['default'])(allValues, f, _this3.getFieldValue(f)); }); return allValues; }; this.getFieldValue = function (name) { var fields = _this3.fields; return _this3.getValueFromFields(name, fields); }; this.getFieldsError = function (names) { var fields = names || (0, _utils.flatFieldNames)(_this3.getValidFieldsName()); var allErrors = {}; fields.forEach(function (f) { (0, _set2['default'])(allErrors, f, _this3.getFieldError(f)); }); return allErrors; }; this.getFieldError = function (name) { return (0, _utils.getErrorStrs)(_this3.getFieldMember(name, 'errors')); }; this.setFieldsInitialValue = function (initialValues) { var fieldsMeta = _this3.fieldsMeta; var virtualPaths = (0, _utils.getVirtualPaths)(fieldsMeta); Object.keys(initialValues).forEach(function (name) { if (fieldsMeta[name] && fieldsMeta[name].virtual) { for (var i = 0, len = virtualPaths[name].length; i < len; i++) { var path = virtualPaths[name][i]; if ((0, _has2['default'])(initialValues, path)) { fieldsMeta[path] = (0, _extends3['default'])({}, fieldsMeta[path], { initialValue: (0, _get2['default'])(initialValues, path) }); } } } else if (fieldsMeta[name]) { fieldsMeta[name] = (0, _extends3['default'])({}, fieldsMeta[name], { initialValue: initialValues[name] }); } }); }; this.isFieldValidating = function (name) { return _this3.getFieldMember(name, 'validating'); }; this.isFieldsValidating = function (ns) { var names = ns || _this3.getValidFieldsName(); return names.some(function (n) { return _this3.isFieldValidating(n); }); }; this.isFieldTouched = function (name) { return _this3.getFieldMember(name, 'touched'); }; this.isFieldsTouched = function (ns) { var names = ns || _this3.getValidFieldsName(); return names.some(function (n) { return _this3.isFieldTouched(n); }); }; }; function createFieldsStore(fields) { return new FieldsStore(fields); } module.exports = exports['default']; /***/ }, /* 261 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.mixin = undefined; var _createBaseForm = __webpack_require__(84); var _createBaseForm2 = _interopRequireDefault(_createBaseForm); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var mixin = exports.mixin = { getForm: function getForm() { return { getFieldsValue: this.fieldsStore.getFieldsValue, getFieldValue: this.fieldsStore.getFieldValue, getFieldInstance: this.getFieldInstance, setFieldsValue: this.setFieldsValue, setFields: this.setFields, setFieldsInitialValue: this.fieldsStore.setFieldsInitialValue, getFieldDecorator: this.getFieldDecorator, getFieldProps: this.getFieldProps, getFieldsError: this.fieldsStore.getFieldsError, getFieldError: this.fieldsStore.getFieldError, isFieldValidating: this.fieldsStore.isFieldValidating, isFieldsValidating: this.fieldsStore.isFieldsValidating, isFieldsTouched: this.fieldsStore.isFieldsTouched, isFieldTouched: this.fieldsStore.isFieldTouched, isSubmitting: this.isSubmitting, submit: this.submit, validateFields: this.validateFields, resetFields: this.resetFields }; } }; function createForm(options) { return (0, _createBaseForm2['default'])(options, [mixin]); } exports['default'] = createForm; /***/ }, /* 262 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _KeyCode = __webpack_require__(85); var _KeyCode2 = _interopRequireDefault(_KeyCode); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Options = function (_React$Component) { (0, _inherits3['default'])(Options, _React$Component); function Options(props) { (0, _classCallCheck3['default'])(this, Options); var _this = (0, _possibleConstructorReturn3['default'])(this, (Options.__proto__ || Object.getPrototypeOf(Options)).call(this, props)); _this.buildOptionText = function (value) { return value + ' ' + _this.props.locale.items_per_page; }; _this.changeSize = function (value) { _this.props.changeSize(Number(value)); }; _this.handleChange = function (e) { _this.setState({ goInputText: e.target.value }); }; _this.go = function (e) { if (e.target.value === '') { return; } var val = Number(_this.state.goInputText); if (isNaN(val)) { val = _this.state.current; } if (e.keyCode === _KeyCode2['default'].ENTER) { _this.setState({ goInputText: '', current: _this.props.quickGo(val) }); } }; _this.state = { current: props.current, goInputText: '' }; return _this; } (0, _createClass3['default'])(Options, [{ key: 'render', value: function render() { var props = this.props; var state = this.state; var locale = props.locale; var prefixCls = props.rootPrefixCls + '-options'; var changeSize = props.changeSize; var quickGo = props.quickGo; var buildOptionText = props.buildOptionText || this.buildOptionText; var Select = props.selectComponentClass; var changeSelect = null; var goInput = null; if (!(changeSize || quickGo)) { return null; } if (changeSize && Select) { var Option = Select.Option; var pageSize = props.pageSize || props.pageSizeOptions[0]; var options = props.pageSizeOptions.map(function (opt, i) { return _react2['default'].createElement( Option, { key: i, value: opt }, buildOptionText(opt) ); }); changeSelect = _react2['default'].createElement( Select, { prefixCls: props.selectPrefixCls, showSearch: false, className: prefixCls + '-size-changer', optionLabelProp: 'children', dropdownMatchSelectWidth: false, value: pageSize.toString(), onChange: this.changeSize, getPopupContainer: function getPopupContainer(triggerNode) { return triggerNode.parentNode; } }, options ); } if (quickGo) { goInput = _react2['default'].createElement( 'div', { className: prefixCls + '-quick-jumper' }, locale.jump_to, _react2['default'].createElement('input', { type: 'text', value: state.goInputText, onChange: this.handleChange, onKeyUp: this.go }), locale.page ); } return _react2['default'].createElement( 'div', { className: '' + prefixCls }, changeSelect, goInput ); } }]); return Options; }(_react2['default'].Component); Options.propTypes = { changeSize: _propTypes2['default'].func, quickGo: _propTypes2['default'].func, selectComponentClass: _propTypes2['default'].func, current: _propTypes2['default'].number, pageSizeOptions: _propTypes2['default'].arrayOf(_propTypes2['default'].string), pageSize: _propTypes2['default'].number, buildOptionText: _propTypes2['default'].func, locale: _propTypes2['default'].object }; Options.defaultProps = { pageSizeOptions: ['10', '20', '30', '40'] }; exports['default'] = Options; module.exports = exports['default']; /***/ }, /* 263 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Pager = function Pager(props) { var prefixCls = props.rootPrefixCls + '-item'; var cls = prefixCls + ' ' + prefixCls + '-' + props.page; if (props.active) { cls = cls + ' ' + prefixCls + '-active'; } if (props.className) { cls = cls + ' ' + props.className; } return _react2['default'].createElement( 'li', { title: props.showTitle ? props.page : null, className: cls, onClick: props.onClick, onKeyPress: props.onKeyPress, tabIndex: '0' }, props.itemRender(props.page, 'page') ); }; Pager.propTypes = { page: _propTypes2['default'].number, active: _propTypes2['default'].bool, last: _propTypes2['default'].bool, locale: _propTypes2['default'].object, className: _propTypes2['default'].string, showTitle: _propTypes2['default'].bool, rootPrefixCls: _propTypes2['default'].string, onClick: _propTypes2['default'].func, onKeyPress: _propTypes2['default'].func, itemRender: _propTypes2['default'].func }; exports['default'] = Pager; module.exports = exports['default']; /***/ }, /* 264 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _Pager = __webpack_require__(263); var _Pager2 = _interopRequireDefault(_Pager); var _Options = __webpack_require__(262); var _Options2 = _interopRequireDefault(_Options); var _KeyCode = __webpack_require__(85); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _zh_CN = __webpack_require__(86); var _zh_CN2 = _interopRequireDefault(_zh_CN); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function noop() {} function isInteger(value) { return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; } function defaultItemRender(page, type) { return _react2['default'].createElement( 'a', null, type === 'page' ? page : '' ); } var Pagination = function (_React$Component) { (0, _inherits3['default'])(Pagination, _React$Component); function Pagination(props) { (0, _classCallCheck3['default'])(this, Pagination); var _this = (0, _possibleConstructorReturn3['default'])(this, (Pagination.__proto__ || Object.getPrototypeOf(Pagination)).call(this, props)); _initialiseProps.call(_this); var hasOnChange = props.onChange !== noop; var hasCurrent = 'current' in props; if (hasCurrent && !hasOnChange) { console.warn('Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.'); // eslint-disable-line } var current = props.defaultCurrent; if ('current' in props) { current = props.current; } var pageSize = props.defaultPageSize; if ('pageSize' in props) { pageSize = props.pageSize; } _this.state = { current: current, currentInputValue: current, pageSize: pageSize }; return _this; } (0, _createClass3['default'])(Pagination, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('current' in nextProps) { this.setState({ current: nextProps.current, currentInputValue: nextProps.current }); } if ('pageSize' in nextProps) { var newState = {}; var current = this.state.current; var newCurrent = this.calculatePage(nextProps.pageSize); current = current > newCurrent ? newCurrent : current; if (!('current' in nextProps)) { newState.current = current; newState.currentInputValue = current; } newState.pageSize = nextProps.pageSize; this.setState(newState); } } }, { key: 'getJumpPrevPage', value: function getJumpPrevPage() { return Math.max(1, this.state.current - (this.props.showLessItems ? 3 : 5)); } }, { key: 'getJumpNextPage', value: function getJumpNextPage() { return Math.min(this.calculatePage(), this.state.current + (this.props.showLessItems ? 3 : 5)); } }, { key: 'getJumpPrevPage', value: function getJumpPrevPage() { return Math.max(1, this.state.current - (this.props.showLessItems ? 3 : 5)); } }, { key: 'getJumpNextPage', value: function getJumpNextPage() { return Math.min(this.calculatePage(), this.state.current + (this.props.showLessItems ? 3 : 5)); } }, { key: 'render', value: function render() { var _this2 = this; var props = this.props; var locale = props.locale; var prefixCls = props.prefixCls; var allPages = this.calculatePage(); var pagerList = []; var jumpPrev = null; var jumpNext = null; var firstPager = null; var lastPager = null; var pageBufferSize = props.showLessItems ? 1 : 2; var _state = this.state, current = _state.current, pageSize = _state.pageSize; if (props.simple) { return _react2['default'].createElement( 'ul', { className: prefixCls + ' ' + prefixCls + '-simple ' + props.className }, _react2['default'].createElement( 'li', { title: props.showTitle ? locale.prev_page : null, onClick: this.prev, tabIndex: '0', onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.prev); }, className: (this.hasPrev() ? '' : prefixCls + '-disabled') + ' ' + prefixCls + '-prev', 'aria-disabled': !this.hasPrev() }, _react2['default'].createElement('a', null) ), _react2['default'].createElement( 'li', { title: props.showTitle ? this.state.current + '/' + allPages : null, className: prefixCls + '-simple-pager' }, _react2['default'].createElement('input', { type: 'text', value: this.state.currentInputValue, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onChange: this.handleKeyUp, size: '3' }), _react2['default'].createElement( 'span', { className: prefixCls + '-slash' }, '\uFF0F' ), allPages ), _react2['default'].createElement( 'li', { title: props.showTitle ? locale.next_page : null, onClick: this.next, tabIndex: '0', onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.next); }, className: (this.hasNext() ? '' : prefixCls + '-disabled') + ' ' + prefixCls + '-next', 'aria-disabled': !this.hasNext() }, _react2['default'].createElement('a', null) ) ); } if (allPages <= 5 + pageBufferSize * 2) { var _loop = function _loop(i) { var active = _this2.state.current === i; pagerList.push(_react2['default'].createElement(_Pager2['default'], { locale: locale, rootPrefixCls: prefixCls, onClick: function onClick() { _this2.handleChange(i); }, onKeyPress: function onKeyPress(e) { _this2.runIfEnter(e, _this2.handleChange, i); }, key: i, page: i, active: active, showTitle: props.showTitle, itemRender: props.itemRender })); }; for (var i = 1; i <= allPages; i++) { _loop(i); } } else { var prevItemTitle = props.showLessItems ? locale.prev_3 : locale.prev_5; var nextItemTitle = props.showLessItems ? locale.next_3 : locale.next_5; jumpPrev = _react2['default'].createElement( 'li', { title: props.showTitle ? prevItemTitle : null, key: 'prev', onClick: this.jumpPrev, tabIndex: '0', onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.jumpPrev); }, className: prefixCls + '-jump-prev' }, props.itemRender(this.getJumpPrevPage(), 'jump-prev') ); jumpNext = _react2['default'].createElement( 'li', { title: props.showTitle ? nextItemTitle : null, key: 'next', tabIndex: '0', onClick: this.jumpNext, onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.jumpNext); }, className: prefixCls + '-jump-next' }, props.itemRender(this.getJumpNextPage(), 'jump-next') ); lastPager = _react2['default'].createElement(_Pager2['default'], { locale: props.locale, last: true, rootPrefixCls: prefixCls, onClick: function onClick() { return _this2.handleChange(allPages); }, onKeyPress: function onKeyPress(e) { _this2.runIfEnter(e, _this2.handleChange, allPages); }, key: allPages, page: allPages, active: false, showTitle: props.showTitle, itemRender: props.itemRender }); firstPager = _react2['default'].createElement(_Pager2['default'], { locale: props.locale, rootPrefixCls: prefixCls, onClick: function onClick() { return _this2.handleChange(1); }, onKeyPress: function onKeyPress(e) { _this2.runIfEnter(e, _this2.handleChange, 1); }, key: 1, page: 1, active: false, showTitle: props.showTitle, itemRender: props.itemRender }); var left = Math.max(1, current - pageBufferSize); var right = Math.min(current + pageBufferSize, allPages); if (current - 1 <= pageBufferSize) { right = 1 + pageBufferSize * 2; } if (allPages - current <= pageBufferSize) { left = allPages - pageBufferSize * 2; } var _loop2 = function _loop2(i) { var active = current === i; pagerList.push(_react2['default'].createElement(_Pager2['default'], { locale: props.locale, rootPrefixCls: prefixCls, onClick: function onClick() { return _this2.handleChange(i); }, onKeyPress: function onKeyPress(e) { _this2.runIfEnter(e, _this2.handleChange, i); }, key: i, page: i, active: active, showTitle: props.showTitle, itemRender: props.itemRender })); }; for (var i = left; i <= right; i++) { _loop2(i); } if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) { pagerList[0] = _react2['default'].cloneElement(pagerList[0], { className: prefixCls + '-item-after-jump-prev' }); pagerList.unshift(jumpPrev); } if (allPages - current >= pageBufferSize * 2 && current !== allPages - 2) { pagerList[pagerList.length - 1] = _react2['default'].cloneElement(pagerList[pagerList.length - 1], { className: prefixCls + '-item-before-jump-next' }); pagerList.push(jumpNext); } if (left !== 1) { pagerList.unshift(firstPager); } if (right !== allPages) { pagerList.push(lastPager); } } var totalText = null; if (props.showTotal) { totalText = _react2['default'].createElement( 'li', { className: prefixCls + '-total-text' }, props.showTotal(props.total, [(current - 1) * pageSize + 1, current * pageSize > props.total ? props.total : current * pageSize]) ); } var prevDisabled = !this.hasPrev(); var nextDisabled = !this.hasNext(); var prevPage = this.state.current - 1 > 0 ? this.state.current - 1 : 0; var nextPage = this.state.current + 1 < allPages ? this.state.current + 1 : allPages; return _react2['default'].createElement( 'ul', { className: prefixCls + ' ' + props.className, style: props.style, unselectable: 'unselectable' }, totalText, _react2['default'].createElement( 'li', { title: props.showTitle ? locale.prev_page : null, onClick: this.prev, tabIndex: '0', onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.prev); }, className: (!prevDisabled ? '' : prefixCls + '-disabled') + ' ' + prefixCls + '-prev', 'aria-disabled': prevDisabled }, props.itemRender(prevPage, 'prev') ), pagerList, _react2['default'].createElement( 'li', { title: props.showTitle ? locale.next_page : null, onClick: this.next, tabIndex: '0', onKeyPress: function onKeyPress(e) { return _this2.runIfEnter(e, _this2.next); }, className: (!nextDisabled ? '' : prefixCls + '-disabled') + ' ' + prefixCls + '-next', 'aria-disabled': nextDisabled }, props.itemRender(nextPage, 'next') ), _react2['default'].createElement(_Options2['default'], { locale: props.locale, rootPrefixCls: prefixCls, selectComponentClass: props.selectComponentClass, selectPrefixCls: props.selectPrefixCls, changeSize: this.props.showSizeChanger ? this.changePageSize : null, current: this.state.current, pageSize: this.state.pageSize, pageSizeOptions: this.props.pageSizeOptions, quickGo: this.props.showQuickJumper ? this.handleChange : null }) ); } }]); return Pagination; }(_react2['default'].Component); Pagination.propTypes = { current: _propTypes2['default'].number, defaultCurrent: _propTypes2['default'].number, total: _propTypes2['default'].number, pageSize: _propTypes2['default'].number, defaultPageSize: _propTypes2['default'].number, onChange: _propTypes2['default'].func, showSizeChanger: _propTypes2['default'].bool, showLessItems: _propTypes2['default'].bool, onShowSizeChange: _propTypes2['default'].func, selectComponentClass: _propTypes2['default'].func, showQuickJumper: _propTypes2['default'].bool, showTitle: _propTypes2['default'].bool, pageSizeOptions: _propTypes2['default'].arrayOf(_propTypes2['default'].string), showTotal: _propTypes2['default'].func, locale: _propTypes2['default'].object, style: _propTypes2['default'].object, itemRender: _propTypes2['default'].func }; Pagination.defaultProps = { defaultCurrent: 1, total: 0, defaultPageSize: 10, onChange: noop, className: '', selectPrefixCls: 'rc-select', prefixCls: 'rc-pagination', selectComponentClass: null, showQuickJumper: false, showSizeChanger: false, showLessItems: false, showTitle: true, onShowSizeChange: noop, locale: _zh_CN2['default'], style: {}, itemRender: defaultItemRender }; var _initialiseProps = function _initialiseProps() { var _this3 = this; this.calculatePage = function (p) { var pageSize = p; if (typeof pageSize === 'undefined') { pageSize = _this3.state.pageSize; } return Math.floor((_this3.props.total - 1) / pageSize) + 1; }; this.isValid = function (page) { return isInteger(page) && page >= 1 && page !== _this3.state.current; }; this.handleKeyDown = function (e) { if (e.keyCode === _KeyCode2['default'].ARROW_UP || e.keyCode === _KeyCode2['default'].ARROW_DOWN) { e.preventDefault(); } }; this.handleKeyUp = function (e) { var inputValue = e.target.value; var value = void 0; if (inputValue === '') { value = inputValue; } else if (isNaN(Number(inputValue))) { value = _this3.state.currentInputValue; } else { value = Number(inputValue); } _this3.setState({ currentInputValue: value }); if (e.keyCode === _KeyCode2['default'].ENTER) { _this3.handleChange(value); } else if (e.keyCode === _KeyCode2['default'].ARROW_UP) { _this3.handleChange(value - 1); } else if (e.keyCode === _KeyCode2['default'].ARROW_DOWN) { _this3.handleChange(value + 1); } }; this.changePageSize = function (size) { var current = _this3.state.current; var newCurrent = _this3.calculatePage(size); current = current > newCurrent ? newCurrent : current; if (typeof size === 'number') { if (!('pageSize' in _this3.props)) { _this3.setState({ pageSize: size }); } if (!('current' in _this3.props)) { _this3.setState({ current: current, currentInputValue: current }); } } _this3.props.onShowSizeChange(current, size); }; this.handleChange = function (p) { var page = p; if (_this3.isValid(page)) { if (page > _this3.calculatePage()) { page = _this3.calculatePage(); } if (!('current' in _this3.props)) { _this3.setState({ current: page, currentInputValue: page }); } var pageSize = _this3.state.pageSize; _this3.props.onChange(page, pageSize); return page; } return _this3.state.current; }; this.prev = function () { if (_this3.hasPrev()) { _this3.handleChange(_this3.state.current - 1); } }; this.next = function () { if (_this3.hasNext()) { _this3.handleChange(_this3.state.current + 1); } }; this.jumpPrev = function () { _this3.handleChange(_this3.getJumpPrevPage()); }; this.jumpNext = function () { _this3.handleChange(_this3.getJumpNextPage()); }; this.hasPrev = function () { return _this3.state.current > 1; }; this.hasNext = function () { return _this3.state.current < _this3.calculatePage(); }; this.runIfEnter = function (event, callback) { for (var _len = arguments.length, restParams = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { restParams[_key - 2] = arguments[_key]; } if (event.key === 'Enter' || event.charCode === 13) { callback.apply(undefined, restParams); } }; }; exports['default'] = Pagination; module.exports = exports['default']; /***/ }, /* 265 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _Pagination = __webpack_require__(264); Object.defineProperty(exports, 'default', { enumerable: true, get: function get() { return _interopRequireDefault(_Pagination)['default']; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } module.exports = exports['default']; /***/ }, /* 266 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(13); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _toArray = __webpack_require__(146); var _toArray2 = _interopRequireDefault(_toArray); var _rcMenu = __webpack_require__(20); var _rcMenu2 = _interopRequireDefault(_rcMenu); var _domScrollIntoView = __webpack_require__(36); var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView); var _util = __webpack_require__(31); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var DropdownMenu = function (_React$Component) { (0, _inherits3['default'])(DropdownMenu, _React$Component); function DropdownMenu() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3['default'])(this, DropdownMenu); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = DropdownMenu.__proto__ || Object.getPrototypeOf(DropdownMenu)).call.apply(_ref, [this].concat(args))), _this), _this.scrollActiveItemToView = function () { // scroll into view var itemComponent = (0, _reactDom.findDOMNode)(_this.firstActiveItem); if (itemComponent) { (0, _domScrollIntoView2['default'])(itemComponent, (0, _reactDom.findDOMNode)(_this.refs.menu), { onlyScrollIfNeeded: true }); } }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret); } (0, _createClass3['default'])(DropdownMenu, [{ key: 'componentWillMount', value: function componentWillMount() { this.lastInputValue = this.props.inputValue; } }, { key: 'componentDidMount', value: function componentDidMount() { this.scrollActiveItemToView(); this.lastVisible = this.props.visible; } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { if (!nextProps.visible) { this.lastVisible = false; } // freeze when hide return nextProps.visible; } }, { key: 'componentDidUpdate', value: function componentDidUpdate(prevProps) { var props = this.props; if (!prevProps.visible && props.visible) { this.scrollActiveItemToView(); } this.lastVisible = props.visible; this.lastInputValue = props.inputValue; } }, { key: 'renderMenu', value: function renderMenu() { var _this2 = this; var props = this.props; var menuItems = props.menuItems, defaultActiveFirstOption = props.defaultActiveFirstOption, value = props.value, prefixCls = props.prefixCls, multiple = props.multiple, onMenuSelect = props.onMenuSelect, inputValue = props.inputValue; if (menuItems && menuItems.length) { var menuProps = {}; if (multiple) { menuProps.onDeselect = props.onMenuDeselect; menuProps.onSelect = onMenuSelect; } else { menuProps.onClick = onMenuSelect; } var selectedKeys = (0, _util.getSelectKeys)(menuItems, value); var activeKeyProps = {}; var clonedMenuItems = menuItems; if (selectedKeys.length) { if (props.visible && !this.lastVisible) { activeKeyProps.activeKey = selectedKeys[0]; } var foundFirst = false; // set firstActiveItem via cloning menus // for scroll into view var clone = function clone(item) { if (!foundFirst && selectedKeys.indexOf(item.key) !== -1) { foundFirst = true; return (0, _react.cloneElement)(item, { ref: function ref(_ref2) { _this2.firstActiveItem = _ref2; } }); } return item; }; clonedMenuItems = menuItems.map(function (item) { if (item.type.isMenuItemGroup) { var children = (0, _toArray2['default'])(item.props.children).map(clone); return (0, _react.cloneElement)(item, {}, children); } return clone(item); }); } // clear activeKey when inputValue change if (inputValue !== this.lastInputValue) { activeKeyProps.activeKey = ''; } return _react2['default'].createElement( _rcMenu2['default'], (0, _extends3['default'])({ ref: 'menu', style: this.props.dropdownMenuStyle, defaultActiveFirst: defaultActiveFirstOption }, activeKeyProps, { multiple: multiple, focusable: false }, menuProps, { selectedKeys: selectedKeys, prefixCls: prefixCls + '-menu' }), clonedMenuItems ); } return null; } }, { key: 'render', value: function render() { var renderMenu = this.renderMenu(); return renderMenu ? _react2['default'].createElement( 'div', { style: { overflow: 'auto' }, onFocus: this.props.onPopupFocus, onMouseDown: _util.preventDefaultEvent }, renderMenu ) : null; } }]); return DropdownMenu; }(_react2['default'].Component); DropdownMenu.propTypes = { defaultActiveFirstOption: _propTypes2['default'].bool, value: _propTypes2['default'].any, dropdownMenuStyle: _propTypes2['default'].object, multiple: _propTypes2['default'].bool, onPopupFocus: _propTypes2['default'].func, onMenuDeSelect: _propTypes2['default'].func, onMenuSelect: _propTypes2['default'].func, prefixCls: _propTypes2['default'].string, menuItems: _propTypes2['default'].any, inputValue: _propTypes2['default'].string, visible: _propTypes2['default'].bool }; exports['default'] = DropdownMenu; DropdownMenu.displayName = 'DropdownMenu'; module.exports = exports['default']; /***/ }, /* 267 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _util = __webpack_require__(31); var _rcMenu = __webpack_require__(20); var _warning = __webpack_require__(274); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } exports['default'] = { filterOption: function filterOption(input, child) { var defaultFilter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _util.defaultFilterFn; if (!input) { return true; } var filterFn = this.props.filterOption; if ('filterOption' in this.props) { if (this.props.filterOption === true) { filterFn = defaultFilter; } } else { filterFn = defaultFilter; } if (!filterFn) { return true; } else if (child.props.disabled) { return false; } else if (typeof filterFn === 'function') { return filterFn.call(this, input, child); } return true; }, renderFilterOptions: function renderFilterOptions(inputValue) { return this.renderFilterOptionsFromChildren(this.props.children, true, inputValue); }, renderFilterOptionsFromChildren: function renderFilterOptionsFromChildren(children, showNotFound, iv) { var _this = this; var sel = []; var props = this.props; var inputValue = iv === undefined ? this.state.inputValue : iv; var childrenKeys = []; var tags = props.tags; _react2['default'].Children.forEach(children, function (child) { if (child.type.isSelectOptGroup) { var innerItems = _this.renderFilterOptionsFromChildren(child.props.children, false); if (innerItems.length) { var label = child.props.label; var key = child.key; if (!key && typeof label === 'string') { key = label; } else if (!label && key) { label = key; } sel.push(_react2['default'].createElement( _rcMenu.ItemGroup, { key: key, title: label }, innerItems )); } return; } (0, _warning2['default'])(child.type.isSelectOption, 'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' + ('instead of `' + (child.type.name || child.type.displayName || child.type) + '`.')); var childValue = (0, _util.getValuePropValue)(child); if (_this.filterOption(inputValue, child)) { sel.push(_react2['default'].createElement(_rcMenu.Item, (0, _extends3['default'])({ style: _util.UNSELECTABLE_STYLE, attribute: _util.UNSELECTABLE_ATTRIBUTE, value: childValue, key: childValue }, child.props))); } if (tags && !child.props.disabled) { childrenKeys.push(childValue); } }); if (tags) { // tags value must be string var value = this.state.value || []; value = value.filter(function (singleValue) { return childrenKeys.indexOf(singleValue.key) === -1 && (!inputValue || String(singleValue.key).indexOf(String(inputValue)) > -1); }); sel = sel.concat(value.map(function (singleValue) { var key = singleValue.key; return _react2['default'].createElement( _rcMenu.Item, { style: _util.UNSELECTABLE_STYLE, attribute: _util.UNSELECTABLE_ATTRIBUTE, value: key, key: key }, key ); })); if (inputValue) { var notFindInputItem = sel.every(function (option) { return !_this.filterOption.call(_this, inputValue, option, function () { return (0, _util.getValuePropValue)(option) === inputValue; }); }); if (notFindInputItem) { sel.unshift(_react2['default'].createElement( _rcMenu.Item, { style: _util.UNSELECTABLE_STYLE, attribute: _util.UNSELECTABLE_ATTRIBUTE, value: inputValue, key: inputValue }, inputValue )); } } } if (!sel.length && showNotFound && props.notFoundContent) { sel = [_react2['default'].createElement( _rcMenu.Item, { style: _util.UNSELECTABLE_STYLE, attribute: _util.UNSELECTABLE_ATTRIBUTE, disabled: true, value: 'NOT_FOUND', key: 'NOT_FOUND' }, props.notFoundContent )]; } return sel; } }; module.exports = exports['default']; /***/ }, /* 268 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var OptGroup = function (_React$Component) { (0, _inherits3['default'])(OptGroup, _React$Component); function OptGroup() { (0, _classCallCheck3['default'])(this, OptGroup); return (0, _possibleConstructorReturn3['default'])(this, (OptGroup.__proto__ || Object.getPrototypeOf(OptGroup)).apply(this, arguments)); } return OptGroup; }(_react2['default'].Component); OptGroup.isSelectOptGroup = true; exports['default'] = OptGroup; module.exports = exports['default']; /***/ }, /* 269 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Option = function (_React$Component) { (0, _inherits3['default'])(Option, _React$Component); function Option() { (0, _classCallCheck3['default'])(this, Option); return (0, _possibleConstructorReturn3['default'])(this, (Option.__proto__ || Object.getPrototypeOf(Option)).apply(this, arguments)); } return Option; }(_react2['default'].Component); Option.propTypes = { value: _propTypes2['default'].string }; Option.isSelectOption = true; exports['default'] = Option; module.exports = exports['default']; /***/ }, /* 270 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectPropTypes = undefined; var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function valueType(props, propName, componentName) { var labelInValueShape = _propTypes2['default'].shape({ key: _propTypes2['default'].string.isRequired, label: _propTypes2['default'].string }); if (props.labelInValue) { var validate = _propTypes2['default'].oneOfType([_propTypes2['default'].arrayOf(labelInValueShape), labelInValueShape]); var error = validate.apply(undefined, arguments); if (error) { return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`, ' + ('when you set `labelInValue` to `true`, `' + propName + '` should in ') + 'shape of `{ key: string, label?: string }`.'); } } else if (props.multiple && props[propName] === '') { return new Error('Invalid prop `' + propName + '` of type `string` supplied to `' + componentName + '`, ' + 'expected `array` when `multiple` is `true`.'); } else { var _validate = _propTypes2['default'].oneOfType([_propTypes2['default'].arrayOf(_propTypes2['default'].string), _propTypes2['default'].string]); return _validate.apply(undefined, arguments); } } var SelectPropTypes = exports.SelectPropTypes = { defaultActiveFirstOption: _propTypes2['default'].bool, multiple: _propTypes2['default'].bool, filterOption: _propTypes2['default'].any, children: _propTypes2['default'].any, showSearch: _propTypes2['default'].bool, disabled: _propTypes2['default'].bool, allowClear: _propTypes2['default'].bool, showArrow: _propTypes2['default'].bool, tags: _propTypes2['default'].bool, prefixCls: _propTypes2['default'].string, className: _propTypes2['default'].string, transitionName: _propTypes2['default'].string, optionLabelProp: _propTypes2['default'].string, optionFilterProp: _propTypes2['default'].string, animation: _propTypes2['default'].string, choiceTransitionName: _propTypes2['default'].string, onChange: _propTypes2['default'].func, onBlur: _propTypes2['default'].func, onFocus: _propTypes2['default'].func, onSelect: _propTypes2['default'].func, onSearch: _propTypes2['default'].func, placeholder: _propTypes2['default'].any, onDeselect: _propTypes2['default'].func, labelInValue: _propTypes2['default'].bool, value: valueType, defaultValue: valueType, dropdownStyle: _propTypes2['default'].object, maxTagTextLength: _propTypes2['default'].number, tokenSeparators: _propTypes2['default'].arrayOf(_propTypes2['default'].string), getInputElement: _propTypes2['default'].func }; /***/ }, /* 271 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _createReactClass = __webpack_require__(14); var _createReactClass2 = _interopRequireDefault(_createReactClass); var _KeyCode = __webpack_require__(22); var _KeyCode2 = _interopRequireDefault(_KeyCode); var _classnames2 = __webpack_require__(8); var _classnames3 = _interopRequireDefault(_classnames2); var _rcAnimate = __webpack_require__(26); var _rcAnimate2 = _interopRequireDefault(_rcAnimate); var _componentClasses = __webpack_require__(131); var _componentClasses2 = _interopRequireDefault(_componentClasses); var _util = __webpack_require__(31); var _SelectTrigger = __webpack_require__(272); var _SelectTrigger2 = _interopRequireDefault(_SelectTrigger); var _FilterMixin = __webpack_require__(267); var _FilterMixin2 = _interopRequireDefault(_FilterMixin); var _PropTypes = __webpack_require__(270); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function noop() {} function saveRef(name, component) { this[name] = component; } function chaining() { for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) { fns[_key] = arguments[_key]; } return function () { for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } // eslint-disable-line for (var i = 0; i < fns.length; i++) { if (fns[i] && typeof fns[i] === 'function') { fns[i].apply(this, args); } } }; } var Select = (0, _createReactClass2['default'])({ propTypes: _PropTypes.SelectPropTypes, mixins: [_FilterMixin2['default']], getDefaultProps: function getDefaultProps() { return { prefixCls: 'rc-select', defaultOpen: false, labelInValue: false, defaultActiveFirstOption: true, showSearch: true, allowClear: false, placeholder: '', onChange: noop, onFocus: noop, onBlur: noop, onSelect: noop, onSearch: noop, onDeselect: noop, showArrow: true, dropdownMatchSelectWidth: true, dropdownStyle: {}, dropdownMenuStyle: {}, optionFilterProp: 'value', optionLabelProp: 'value', notFoundContent: 'Not Found' }; }, getInitialState: function getInitialState() { var props = this.props; var value = []; if ('value' in props) { value = (0, _util.toArray)(props.value); } else { value = (0, _util.toArray)(props.defaultValue); } value = this.addLabelToValue(props, value); value = this.addTitleToValue(props, value); var inputValue = ''; if (props.combobox) { inputValue = value.length ? this.getLabelFromProps(props, value[0].key) : ''; } this.saveInputRef = saveRef.bind(this, 'inputInstance'); this.saveInputMirrorRef = saveRef.bind(this, 'inputMirrorInstance'); var open = props.open; if (open === undefined) { open = props.defaultOpen; } return { value: value, inputValue: inputValue, open: open }; }, componentWillMount: function componentWillMount() { this.adjustOpenState(); }, componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if ('value' in nextProps) { var value = (0, _util.toArray)(nextProps.value); value = this.addLabelToValue(nextProps, value); value = this.addTitleToValue(nextProps, value); this.setState({ value: value }); if (nextProps.combobox) { this.setState({ inputValue: value.length ? this.getLabelFromProps(nextProps, value[0].key) : '' }); } } }, componentWillUpdate: function componentWillUpdate(nextProps, nextState) { this.props = nextProps; this.state = nextState; this.adjustOpenState(); }, componentDidUpdate: function componentDidUpdate() { if ((0, _util.isMultipleOrTags)(this.props)) { var inputNode = this.getInputDOMNode(); var mirrorNode = this.getInputMirrorDOMNode(); if (inputNode.value) { inputNode.style.width = ''; inputNode.style.width = mirrorNode.clientWidth + 'px'; } else { inputNode.style.width = ''; } } }, componentWillUnmount: function componentWillUnmount() { this.clearFocusTime(); this.clearBlurTime(); this.clearAdjustTimer(); if (this.dropdownContainer) { _reactDom2['default'].unmountComponentAtNode(this.dropdownContainer); document.body.removeChild(this.dropdownContainer); this.dropdownContainer = null; } }, onInputChange: function onInputChange(event) { var tokenSeparators = this.props.tokenSeparators; var val = event.target.value; if ((0, _util.isMultipleOrTags)(this.props) && tokenSeparators && (0, _util.includesSeparators)(val, tokenSeparators)) { var nextValue = this.tokenize(val); this.fireChange(nextValue); this.setOpenState(false, true); this.setInputValue('', false); return; } this.setInputValue(val); this.setState({ open: true }); if ((0, _util.isCombobox)(this.props)) { this.fireChange([{ key: val }]); } }, onDropdownVisibleChange: function onDropdownVisibleChange(open) { if (open && !this._focused) { this.clearBlurTime(); this.timeoutFocus(); this._focused = true; this.updateFocusClassName(); } this.setOpenState(open); }, // combobox ignore onKeyDown: function onKeyDown(event) { var props = this.props; if (props.disabled) { return; } var keyCode = event.keyCode; if (this.state.open && !this.getInputDOMNode()) { this.onInputKeyDown(event); } else if (keyCode === _KeyCode2['default'].ENTER || keyCode === _KeyCode2['default'].DOWN) { this.setOpenState(true); event.preventDefault(); } }, onInputKeyDown: function onInputKeyDown(event) { var props = this.props; if (props.disabled) { return; } var state = this.state; var keyCode = event.keyCode; if ((0, _util.isMultipleOrTags)(props) && !event.target.value && keyCode === _KeyCode2['default'].BACKSPACE) { event.preventDefault(); var value = state.value; if (value.length) { this.removeSelected(value[value.length - 1].key); } return; } if (keyCode === _KeyCode2['default'].DOWN) { if (!state.open) { this.openIfHasChildren(); event.preventDefault(); event.stopPropagation(); return; } } else if (keyCode === _KeyCode2['default'].ESC) { if (state.open) { this.setOpenState(false); event.preventDefault(); event.stopPropagation(); } return; } if (state.open) { var menu = this.refs.trigger.getInnerMenu(); if (menu && menu.onKeyDown(event)) { event.preventDefault(); event.stopPropagation(); } } }, onMenuSelect: function onMenuSelect(_ref) { var _this = this; var item = _ref.item; var value = this.state.value; var props = this.props; var selectedValue = (0, _util.getValuePropValue)(item); var selectedLabel = this.getLabelFromOption(item); var event = selectedValue; if (props.labelInValue) { event = { key: event, label: selectedLabel }; } props.onSelect(event, item); var selectedTitle = item.props.title; if ((0, _util.isMultipleOrTags)(props)) { if ((0, _util.findIndexInValueByKey)(value, selectedValue) !== -1) { return; } value = value.concat([{ key: selectedValue, label: selectedLabel, title: selectedTitle }]); } else { if ((0, _util.isCombobox)(props)) { this.skipAdjustOpen = true; this.clearAdjustTimer(); this.skipAdjustOpenTimer = setTimeout(function () { _this.skipAdjustOpen = false; }, 0); } if (value.length && value[0].key === selectedValue) { this.setOpenState(false, true); return; } value = [{ key: selectedValue, label: selectedLabel, title: selectedTitle }]; this.setOpenState(false, true); } this.fireChange(value); var inputValue = void 0; if ((0, _util.isCombobox)(props)) { inputValue = (0, _util.getPropValue)(item, props.optionLabelProp); } else { inputValue = ''; } this.setInputValue(inputValue, false); }, onMenuDeselect: function onMenuDeselect(_ref2) { var item = _ref2.item, domEvent = _ref2.domEvent; if (domEvent.type === 'click') { this.removeSelected((0, _util.getValuePropValue)(item)); } this.setInputValue('', false); }, onArrowClick: function onArrowClick(e) { e.stopPropagation(); if (!this.props.disabled) { this.setOpenState(!this.state.open, !this.state.open); } }, onPlaceholderClick: function onPlaceholderClick() { if (this.getInputDOMNode()) { this.getInputDOMNode().focus(); } }, onOuterFocus: function onOuterFocus(e) { this.clearBlurTime(); if (!(0, _util.isMultipleOrTagsOrCombobox)(this.props) && e.target === this.getInputDOMNode()) { return; } if (this._focused) { return; } this._focused = true; this.updateFocusClassName(); this.timeoutFocus(); }, onPopupFocus: function onPopupFocus() { // fix ie scrollbar, focus element again this.maybeFocus(true, true); }, onOuterBlur: function onOuterBlur() { var _this2 = this; this.blurTimer = setTimeout(function () { _this2._focused = false; _this2.updateFocusClassName(); var props = _this2.props; var value = _this2.state.value; var inputValue = _this2.state.inputValue; if ((0, _util.isSingleMode)(props) && props.showSearch && inputValue && props.defaultActiveFirstOption) { var options = _this2._options || []; if (options.length) { var firstOption = (0, _util.findFirstMenuItem)(options); if (firstOption) { value = [{ key: firstOption.key, label: _this2.getLabelFromOption(firstOption) }]; _this2.fireChange(value); } } } else if ((0, _util.isMultipleOrTags)(props) && inputValue) { // why not use setState? _this2.state.inputValue = _this2.getInputDOMNode().value = ''; } props.onBlur(_this2.getVLForOnChange(value)); }, 10); }, onClearSelection: function onClearSelection(event) { var props = this.props; var state = this.state; if (props.disabled) { return; } var inputValue = state.inputValue, value = state.value; event.stopPropagation(); if (inputValue || value.length) { if (value.length) { this.fireChange([]); } this.setOpenState(false, true); if (inputValue) { this.setInputValue(''); } } }, onChoiceAnimationLeave: function onChoiceAnimationLeave() { this.refs.trigger.refs.trigger.forcePopupAlign(); }, getLabelBySingleValue: function getLabelBySingleValue(children, value) { var _this3 = this; if (value === undefined) { return null; } var label = null; _react2['default'].Children.forEach(children, function (child) { if (child.type.isSelectOptGroup) { var maybe = _this3.getLabelBySingleValue(child.props.children, value); if (maybe !== null) { label = maybe; } } else if ((0, _util.getValuePropValue)(child) === value) { label = _this3.getLabelFromOption(child); } }); return label; }, getValueByLabel: function getValueByLabel(children, label) { var _this4 = this; if (label === undefined) { return null; } var value = null; _react2['default'].Children.forEach(children, function (child) { if (child.type.isSelectOptGroup) { var maybe = _this4.getValueByLabel(child.props.children, label); if (maybe !== null) { value = maybe; } } else if ((0, _util.toArray)(_this4.getLabelFromOption(child)).join('') === label) { value = (0, _util.getValuePropValue)(child); } }); return value; }, getLabelFromOption: function getLabelFromOption(child) { return (0, _util.getPropValue)(child, this.props.optionLabelProp); }, getLabelFromProps: function getLabelFromProps(props, value) { return this.getLabelByValue(props.children, value); }, getVLForOnChange: function getVLForOnChange(vls_) { var vls = vls_; if (vls !== undefined) { if (!this.props.labelInValue) { vls = vls.map(function (v) { return v.key; }); } else { vls = vls.map(function (vl) { return { key: vl.key, label: vl.label }; }); } return (0, _util.isMultipleOrTags)(this.props) ? vls : vls[0]; } return vls; }, getLabelByValue: function getLabelByValue(children, value) { var label = this.getLabelBySingleValue(children, value); if (label === null) { return value; } return label; }, getDropdownContainer: function getDropdownContainer() { if (!this.dropdownContainer) { this.dropdownContainer = document.createElement('div'); document.body.appendChild(this.dropdownContainer); } return this.dropdownContainer; }, getPlaceholderElement: function getPlaceholderElement() { var props = this.props, state = this.state; var hidden = false; if (state.inputValue) { hidden = true; } if (state.value.length) { hidden = true; } if ((0, _util.isCombobox)(props) && state.value.length === 1 && !state.value[0].key) { hidden = false; } var placeholder = props.placeholder; if (placeholder) { return _react2['default'].createElement( 'div', (0, _extends3['default'])({ onMouseDown: _util.preventDefaultEvent, style: (0, _extends3['default'])({ display: hidden ? 'none' : 'block' }, _util.UNSELECTABLE_STYLE) }, _util.UNSELECTABLE_ATTRIBUTE, { onClick: this.onPlaceholderClick, className: props.prefixCls + '-selection__placeholder' }), placeholder ); } return null; }, getInputElement: function getInputElement() { var props = this.props; var inputElement = props.getInputElement ? props.getInputElement() : _react2['default'].createElement('input', { id: props.id }); var inputCls = (0, _classnames3['default'])(inputElement.props.className, (0, _defineProperty3['default'])({}, props.prefixCls + '-search__field', true)); // https://github.com/ant-design/ant-design/issues/4992#issuecomment-281542159 // Add space to the end of the inputValue as the width measurement tolerance return _react2['default'].createElement( 'div', { className: props.prefixCls + '-search__field__wrap' }, _react2['default'].cloneElement(inputElement, { ref: this.saveInputRef, onChange: this.onInputChange, onKeyDown: chaining(this.onInputKeyDown, inputElement.props.onKeyDown), value: this.state.inputValue, disabled: props.disabled, className: inputCls }), _react2['default'].createElement( 'span', { ref: this.saveInputMirrorRef, className: props.prefixCls + '-search__field__mirror' }, this.state.inputValue, '\xA0' ) ); }, getInputDOMNode: function getInputDOMNode() { return this.topCtrlNode ? this.topCtrlNode.querySelector('input,textarea,div[contentEditable]') : this.inputInstance; }, getInputMirrorDOMNode: function getInputMirrorDOMNode() { return this.inputMirrorInstance; }, getPopupDOMNode: function getPopupDOMNode() { return this.refs.trigger.getPopupDOMNode(); }, getPopupMenuComponent: function getPopupMenuComponent() { return this.refs.trigger.getInnerMenu(); }, setOpenState: function setOpenState(open, needFocus) { var _this5 = this; var props = this.props, state = this.state; if (state.open === open) { this.maybeFocus(open, needFocus); return; } var nextState = { open: open }; // clear search input value when open is false in singleMode. if (!open && (0, _util.isSingleMode)(props) && props.showSearch) { this.setInputValue(''); } if (!open) { this.maybeFocus(open, needFocus); } this.setState(nextState, function () { if (open) { _this5.maybeFocus(open, needFocus); } }); }, setInputValue: function setInputValue(inputValue) { var fireSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; if (inputValue !== this.state.inputValue) { this.setState({ inputValue: inputValue }); if (fireSearch) { this.props.onSearch(inputValue); } } }, timeoutFocus: function timeoutFocus() { var _this6 = this; if (this.focusTimer) { this.clearFocusTime(); } this.focusTimer = setTimeout(function () { _this6.props.onFocus(); }, 10); }, clearFocusTime: function clearFocusTime() { if (this.focusTimer) { clearTimeout(this.focusTimer); this.focusTimer = null; } }, clearBlurTime: function clearBlurTime() { if (this.blurTimer) { clearTimeout(this.blurTimer); this.blurTimer = null; } }, clearAdjustTimer: function clearAdjustTimer() { if (this.skipAdjustOpenTimer) { clearTimeout(this.skipAdjustOpenTimer); this.skipAdjustOpenTimer = null; } }, updateFocusClassName: function updateFocusClassName() { var refs = this.refs, props = this.props; // avoid setState and its side effect if (this._focused) { (0, _componentClasses2['default'])(refs.root).add(props.prefixCls + '-focused'); } else { (0, _componentClasses2['default'])(refs.root).remove(props.prefixCls + '-focused'); } }, maybeFocus: function maybeFocus(open, needFocus) { if (needFocus || open) { var input = this.getInputDOMNode(); var _document = document, activeElement = _document.activeElement; if (input && (open || (0, _util.isMultipleOrTagsOrCombobox)(this.props))) { if (activeElement !== input) { input.focus(); this._focused = true; } } else { var selection = this.refs.selection; if (activeElement !== selection) { selection.focus(); this._focused = true; } } } }, addLabelToValue: function addLabelToValue(props, value_) { var _this7 = this; var value = value_; if (props.labelInValue) { value.forEach(function (v) { v.label = v.label || _this7.getLabelFromProps(props, v.key); }); } else { value = value.map(function (v) { return { key: v, label: _this7.getLabelFromProps(props, v) }; }); } return value; }, addTitleToValue: function addTitleToValue(props, values) { var _this8 = this; var nextValues = values; var keys = values.map(function (v) { return v.key; }); _react2['default'].Children.forEach(props.children, function (child) { if (child.type.isSelectOptGroup) { nextValues = _this8.addTitleToValue(child.props, nextValues); } else { var value = (0, _util.getValuePropValue)(child); var valueIndex = keys.indexOf(value); if (valueIndex > -1) { nextValues[valueIndex].title = child.props.title; } } }); return nextValues; }, removeSelected: function removeSelected(selectedKey) { var props = this.props; if (props.disabled || this.isChildDisabled(selectedKey)) { return; } var label = void 0; var value = this.state.value.filter(function (singleValue) { if (singleValue.key === selectedKey) { label = singleValue.label; } return singleValue.key !== selectedKey; }); var canMultiple = (0, _util.isMultipleOrTags)(props); if (canMultiple) { var event = selectedKey; if (props.labelInValue) { event = { key: selectedKey, label: label }; } props.onDeselect(event); } this.fireChange(value); }, openIfHasChildren: function openIfHasChildren() { var props = this.props; if (_react2['default'].Children.count(props.children) || (0, _util.isSingleMode)(props)) { this.setOpenState(true); } }, fireChange: function fireChange(value) { var props = this.props; if (!('value' in props)) { this.setState({ value: value }); } props.onChange(this.getVLForOnChange(value)); }, isChildDisabled: function isChildDisabled(key) { return (0, _util.toArray)(this.props.children).some(function (child) { var childValue = (0, _util.getValuePropValue)(child); return childValue === key && child.props && child.props.disabled; }); }, tokenize: function tokenize(string) { var _this9 = this; var _props = this.props, multiple = _props.multiple, tokenSeparators = _props.tokenSeparators, children = _props.children; var nextValue = this.state.value; (0, _util.splitBySeparators)(string, tokenSeparators).forEach(function (label) { var selectedValue = { key: label, label: label }; if ((0, _util.findIndexInValueByLabel)(nextValue, label) === -1) { if (multiple) { var value = _this9.getValueByLabel(children, label); if (value) { selectedValue.key = value; nextValue = nextValue.concat(selectedValue); } } else { nextValue = nextValue.concat(selectedValue); } } }); return nextValue; }, adjustOpenState: function adjustOpenState() { if (this.skipAdjustOpen) { return; } var open = this.state.open; var options = []; // If hidden menu due to no options, then it should be calculated again if (open || this.hiddenForNoOptions) { options = this.renderFilterOptions(); } this._options = options; if ((0, _util.isMultipleOrTagsOrCombobox)(this.props) || !this.props.showSearch) { if (open && !options.length) { open = false; this.hiddenForNoOptions = true; } // Keep menu open if there are options and hidden for no options before if (this.hiddenForNoOptions && options.length) { open = true; this.hiddenForNoOptions = false; } } this.state.open = open; }, renderTopControlNode: function renderTopControlNode() { var _this10 = this; var _state = this.state, value = _state.value, open = _state.open, inputValue = _state.inputValue; var props = this.props; var choiceTransitionName = props.choiceTransitionName, prefixCls = props.prefixCls, maxTagTextLength = props.maxTagTextLength, showSearch = props.showSearch; var className = prefixCls + '-selection__rendered'; // search input is inside topControlNode in single, multiple & combobox. 2016/04/13 var innerNode = null; if ((0, _util.isSingleMode)(props)) { var selectedValue = null; if (value.length) { var showSelectedValue = false; var opacity = 1; if (!showSearch) { showSelectedValue = true; } else { if (open) { showSelectedValue = !inputValue; if (showSelectedValue) { opacity = 0.4; } } else { showSelectedValue = true; } } var singleValue = value[0]; selectedValue = _react2['default'].createElement( 'div', { key: 'value', className: prefixCls + '-selection-selected-value', title: singleValue.title || singleValue.label, style: { display: showSelectedValue ? 'block' : 'none', opacity: opacity } }, value[0].label ); } if (!showSearch) { innerNode = [selectedValue]; } else { innerNode = [selectedValue, _react2['default'].createElement( 'div', { className: prefixCls + '-search ' + prefixCls + '-search--inline', key: 'input', style: { display: open ? 'block' : 'none' } }, this.getInputElement() )]; } } else { var selectedValueNodes = []; if ((0, _util.isMultipleOrTags)(props)) { selectedValueNodes = value.map(function (singleValue) { var content = singleValue.label; var title = singleValue.title || content; if (maxTagTextLength && typeof content === 'string' && content.length > maxTagTextLength) { content = content.slice(0, maxTagTextLength) + '...'; } var disabled = _this10.isChildDisabled(singleValue.key); var choiceClassName = disabled ? prefixCls + '-selection__choice ' + prefixCls + '-selection__choice__disabled' : prefixCls + '-selection__choice'; return _react2['default'].createElement( 'li', (0, _extends3['default'])({ style: _util.UNSELECTABLE_STYLE }, _util.UNSELECTABLE_ATTRIBUTE, { onMouseDown: _util.preventDefaultEvent, className: choiceClassName, key: singleValue.key, title: title }), _react2['default'].createElement( 'div', { className: prefixCls + '-selection__choice__content' }, content ), disabled ? null : _react2['default'].createElement('span', { className: prefixCls + '-selection__choice__remove', onClick: _this10.removeSelected.bind(_this10, singleValue.key) }) ); }); } selectedValueNodes.push(_react2['default'].createElement( 'li', { className: prefixCls + '-search ' + prefixCls + '-search--inline', key: '__input' }, this.getInputElement() )); if ((0, _util.isMultipleOrTags)(props) && choiceTransitionName) { innerNode = _react2['default'].createElement( _rcAnimate2['default'], { onLeave: this.onChoiceAnimationLeave, component: 'ul', transitionName: choiceTransitionName }, selectedValueNodes ); } else { innerNode = _react2['default'].createElement( 'ul', null, selectedValueNodes ); } } return _react2['default'].createElement( 'div', { className: className, ref: function ref(node) { return _this10.topCtrlNode = node; } }, this.getPlaceholderElement(), innerNode ); }, render: function render() { var _rootCls; var props = this.props; var multiple = (0, _util.isMultipleOrTags)(props); var state = this.state; var className = props.className, disabled = props.disabled, allowClear = props.allowClear, prefixCls = props.prefixCls; var ctrlNode = this.renderTopControlNode(); var extraSelectionProps = {}; var open = this.state.open; var options = this._options; if (!(0, _util.isMultipleOrTagsOrCombobox)(props)) { extraSelectionProps = { onKeyDown: this.onKeyDown, tabIndex: 0 }; } var rootCls = (_rootCls = {}, (0, _defineProperty3['default'])(_rootCls, className, !!className), (0, _defineProperty3['default'])(_rootCls, prefixCls, 1), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-open', open), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-focused', open || !!this._focused), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-combobox', (0, _util.isCombobox)(props)), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-disabled', disabled), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-enabled', !disabled), (0, _defineProperty3['default'])(_rootCls, prefixCls + '-allow-clear', !!props.allowClear), _rootCls); var clearStyle = (0, _extends3['default'])({}, _util.UNSELECTABLE_STYLE, { display: 'none' }); if (state.inputValue || state.value.length) { clearStyle.display = 'block'; } var clear = _react2['default'].createElement('span', (0, _extends3['default'])({ key: 'clear', onMouseDown: _util.preventDefaultEvent, style: clearStyle }, _util.UNSELECTABLE_ATTRIBUTE, { className: prefixCls + '-selection__clear', onClick: this.onClearSelection })); return _react2['default'].createElement( _SelectTrigger2['default'], { onPopupFocus: this.onPopupFocus, dropdownAlign: props.dropdownAlign, dropdownClassName: props.dropdownClassName, dropdownMatchSelectWidth: props.dropdownMatchSelectWidth, defaultActiveFirstOption: props.defaultActiveFirstOption, dropdownMenuStyle: props.dropdownMenuStyle, transitionName: props.transitionName, animation: props.animation, prefixCls: props.prefixCls, dropdownStyle: props.dropdownStyle, combobox: props.combobox, showSearch: props.showSearch, options: options, multiple: multiple, disabled: disabled, visible: open, inputValue: state.inputValue, value: state.value, onDropdownVisibleChange: this.onDropdownVisibleChange, getPopupContainer: props.getPopupContainer, onMenuSelect: this.onMenuSelect, onMenuDeselect: this.onMenuDeselect, ref: 'trigger' }, _react2['default'].createElement( 'div', { style: props.style, ref: 'root', onBlur: this.onOuterBlur, onFocus: this.onOuterFocus, className: (0, _classnames3['default'])(rootCls) }, _react2['default'].createElement( 'div', (0, _extends3['default'])({ ref: 'selection', key: 'selection', className: prefixCls + '-selection\n ' + prefixCls + '-selection--' + (multiple ? 'multiple' : 'single'), role: 'combobox', 'aria-autocomplete': 'list', 'aria-haspopup': 'true', 'aria-expanded': open }, extraSelectionProps), ctrlNode, allowClear ? clear : null, multiple || !props.showArrow ? null : _react2['default'].createElement( 'span', (0, _extends3['default'])({ key: 'arrow', className: prefixCls + '-arrow', style: _util.UNSELECTABLE_STYLE }, _util.UNSELECTABLE_ATTRIBUTE, { onClick: this.onArrowClick }), _react2['default'].createElement('b', null) ) ) ) ); } }); Select.displayName = 'Select'; exports['default'] = Select; module.exports = exports['default']; /***/ }, /* 272 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = __webpack_require__(9); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _objectWithoutProperties2 = __webpack_require__(21); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _rcTrigger = __webpack_require__(37); var _rcTrigger2 = _interopRequireDefault(_rcTrigger); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = __webpack_require__(8); var _classnames2 = _interopRequireDefault(_classnames); var _DropdownMenu = __webpack_require__(266); var _DropdownMenu2 = _interopRequireDefault(_DropdownMenu); var _reactDom = __webpack_require__(13); var _reactDom2 = _interopRequireDefault(_reactDom); var _util = __webpack_require__(31); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _rcTrigger2['default'].displayName = 'Trigger'; var BUILT_IN_PLACEMENTS = { bottomLeft: { points: ['tl', 'bl'], offset: [0, 4], overflow: { adjustX: 0, adjustY: 1 } }, topLeft: { points: ['bl', 'tl'], offset: [0, -4], overflow: { adjustX: 0, adjustY: 1 } } }; var SelectTrigger = function (_React$Component) { (0, _inherits3['default'])(SelectTrigger, _React$Component); function SelectTrigger() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3['default'])(this, SelectTrigger); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = SelectTrigger.__proto__ || Object.getPrototypeOf(SelectTrigger)).call.apply(_ref, [this].concat(args))), _this), _this.getInnerMenu = function () { return _this.popupMenu && _this.popupMenu.refs.menu; }, _this.getPopupDOMNode = function () { return _this.refs.trigger.getPopupDomNode(); }, _this.getDropdownElement = function (newProps) { var props = _this.props; return _react2['default'].createElement(_DropdownMenu2['default'], (0, _extends3['default'])({ ref: _this.saveMenu }, newProps, { prefixCls: _this.getDropdownPrefixCls(), onMenuSelect: props.onMenuSelect, onMenuDeselect: props.onMenuDeselect, value: props.value, defaultActiveFirstOption: props.defaultActiveFirstOption, dropdownMenuStyle: props.dropdownMenuStyle })); }, _this.getDropdownTransitionName = function () { var props = _this.props; var transitionName = props.transitionName; if (!transitionName && props.animation) { transitionName = _this.getDropdownPrefixCls() + '-' + props.animation; } return transitionName; }, _this.getDropdownPrefixCls = function () { return _this.props.prefixCls + '-dropdown'; }, _this.saveMenu = function (menu) { _this.popupMenu = menu; }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret); } (0, _createClass3['default'])(SelectTrigger, [{ key: 'componentDidUpdate', value: function componentDidUpdate() { var _props = this.props, visible = _props.visible, dropdownMatchSelectWidth = _props.dropdownMatchSelectWidth; if (visible) { var dropdownDOMNode = this.getPopupDOMNode(); if (dropdownDOMNode) { var widthProp = dropdownMatchSelectWidth ? 'width' : 'minWidth'; dropdownDOMNode.style[widthProp] = _reactDom2['default'].findDOMNode(this).offsetWidth + 'px'; } } } }, { key: 'render', value: function render() { var _popupClassName; var _props2 = this.props, onPopupFocus = _props2.onPopupFocus, props = (0, _objectWithoutProperties3['default'])(_props2, ['onPopupFocus']); var multiple = props.multiple, visible = props.visible, inputValue = props.inputValue, dropdownAlign = props.dropdownAlign, disabled = props.disabled, showSearch = props.showSearch, dropdownClassName = props.dropdownClassName; var dropdownPrefixCls = this.getDropdownPrefixCls(); var popupClassName = (_popupClassName = {}, (0, _defineProperty3['default'])(_popupClassName, dropdownClassName, !!dropdownClassName), (0, _defineProperty3['default'])(_popupClassName, dropdownPrefixCls + '--' + (multiple ? 'multiple' : 'single'), 1), _popupClassName); var popupElement = this.getDropdownElement({ menuItems: props.options, onPopupFocus: onPopupFocus, multiple: multiple, inputValue: inputValue, visible: visible }); var hideAction = void 0; if (disabled) { hideAction = []; } else if ((0, _util.isSingleMode)(props) && !showSearch) { hideAction = ['click']; } else { hideAction = ['blur']; } return _react2['default'].createElement( _rcTrigger2['default'], (0, _extends3['default'])({}, props, { showAction: disabled ? [] : ['click'], hideAction: hideAction, ref: 'trigger', popupPlacement: 'bottomLeft', builtinPlacements: BUILT_IN_PLACEMENTS, prefixCls: dropdownPrefixCls, popupTransitionName: this.getDropdownTransitionName(), onPopupVisibleChange: props.onDropdownVisibleChange, popup: popupElement, popupAlign: dropdownAlign, popupVisible: visible, getPopupContainer: props.getPopupContainer, popupClassName: (0, _classnames2['default'])(popupClassName), popupStyle: props.dropdownStyle }), props.children ); } }]); return SelectTrigger; }(_react2['default'].Component); SelectTrigger.propTypes = { onPopupFocus: _propTypes2['default'].func, dropdownMatchSelectWidth: _propTypes2['default'].bool, dropdownAlign: _propTypes2['default'].object, visible: _propTypes2['default'].bool, disabled: _propTypes2['default'].bool, showSearch: _propTypes2['default'].bool, dropdownClassName: _propTypes2['default'].string, multiple: _propTypes2['default'].bool, inputValue: _propTypes2['default'].string, filterOption: _propTypes2['default'].any, options: _propTypes2['default'].any, prefixCls: _propTypes2['default'].string, popupClassName: _propTypes2['default'].string, children: _propTypes2['default'].any }; exports['default'] = SelectTrigger; SelectTrigger.displayName = 'SelectTrigger'; module.exports = exports['default']; /***/ }, /* 273 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.OptGroup = exports.Option = undefined; var _Select = __webpack_require__(271); var _Select2 = _interopRequireDefault(_Select); var _Option = __webpack_require__(269); var _Option2 = _interopRequireDefault(_Option); var _OptGroup = __webpack_require__(268); var _OptGroup2 = _interopRequireDefault(_OptGroup); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _Select2['default'].Option = _Option2['default']; _Select2['default'].OptGroup = _OptGroup2['default']; exports.Option = _Option2['default']; exports.OptGroup = _OptGroup2['default']; exports['default'] = _Select2['default']; /***/ }, /* 274 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ 'use strict'; /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = function() {}; if (true) { warning = function(condition, format, args) { var len = arguments.length; args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) { args[key - 2] = arguments[key]; } if (format === undefined) { throw new Error( '`warning(condition, format, ...args)` requires a warning ' + 'message argument' ); } if (format.length < 10 || (/^[s\W]*$/).test(format)) { throw new Error( 'The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format ); } if (!condition) { var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function() { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch(x) {} } }; } module.exports = warning; /***/ }, /* 275 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Column = function (_Component) { (0, _inherits3['default'])(Column, _Component); function Column() { (0, _classCallCheck3['default'])(this, Column); return (0, _possibleConstructorReturn3['default'])(this, (Column.__proto__ || Object.getPrototypeOf(Column)).apply(this, arguments)); } return Column; }(_react.Component); Column.propTypes = { className: _propTypes2['default'].string, colSpan: _propTypes2['default'].number, title: _propTypes2['default'].node, dataIndex: _propTypes2['default'].string, width: _propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].string]), fixed: _propTypes2['default'].oneOf([true, 'left', 'right']), render: _propTypes2['default'].func, onCellClick: _propTypes2['default'].func }; exports['default'] = Column; module.exports = exports['default']; /***/ }, /* 276 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var ColumnGroup = function (_Component) { (0, _inherits3['default'])(ColumnGroup, _Component); function ColumnGroup() { (0, _classCallCheck3['default'])(this, ColumnGroup); return (0, _possibleConstructorReturn3['default'])(this, (ColumnGroup.__proto__ || Object.getPrototypeOf(ColumnGroup)).apply(this, arguments)); } return ColumnGroup; }(_react.Component); ColumnGroup.propTypes = { title: _propTypes2['default'].node }; ColumnGroup.isTableColumnGroup = true; exports['default'] = ColumnGroup; module.exports = exports['default']; /***/ }, /* 277 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _toConsumableArray2 = __webpack_require__(25); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var ColumnManager = function () { function ColumnManager(columns, elements) { (0, _classCallCheck3['default'])(this, ColumnManager); this._cached = {}; this.columns = columns || this.normalize(elements); } (0, _createClass3['default'])(ColumnManager, [{ key: 'isAnyColumnsFixed', value: function isAnyColumnsFixed() { var _this = this; return this._cache('isAnyColumnsFixed', function () { return _this.columns.some(function (column) { return !!column.fixed; }); }); } }, { key: 'isAnyColumnsLeftFixed', value: function isAnyColumnsLeftFixed() { var _this2 = this; return this._cache('isAnyColumnsLeftFixed', function () { return _this2.columns.some(function (column) { return column.fixed === 'left' || column.fixed === true; }); }); } }, { key: 'isAnyColumnsRightFixed', value: function isAnyColumnsRightFixed() { var _this3 = this; return this._cache('isAnyColumnsRightFixed', function () { return _this3.columns.some(function (column) { return column.fixed === 'right'; }); }); } }, { key: 'leftColumns', value: function leftColumns() { var _this4 = this; return this._cache('leftColumns', function () { return _this4.groupedColumns().filter(function (column) { return column.fixed === 'left' || column.fixed === true; }); }); } }, { key: 'rightColumns', value: function rightColumns() { var _this5 = this; return this._cache('rightColumns', function () { return _this5.groupedColumns().filter(function (column) { return column.fixed === 'right'; }); }); } }, { key: 'leafColumns', value: function leafColumns() { var _this6 = this; return this._cache('leafColumns', function () { return _this6._leafColumns(_this6.columns); }); } }, { key: 'leftLeafColumns', value: function leftLeafColumns() { var _this7 = this; return this._cache('leftLeafColumns', function () { return _this7._leafColumns(_this7.leftColumns()); }); } }, { key: 'rightLeafColumns', value: function rightLeafColumns() { var _this8 = this; return this._cache('rightLeafColumns', function () { return _this8._leafColumns(_this8.rightColumns()); }); } // add appropriate rowspan and colspan to column }, { key: 'groupedColumns', value: function groupedColumns() { var _this9 = this; return this._cache('groupedColumns', function () { var _groupColumns = function _groupColumns(columns) { var currentRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var parentColumn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; // track how many rows we got rows[currentRow] = rows[currentRow] || []; var grouped = []; var setRowSpan = function setRowSpan(column) { var rowSpan = rows.length - currentRow; if (column && !column.children && // parent columns are supposed to be one row rowSpan > 1 && (!column.rowSpan || column.rowSpan < rowSpan)) { column.rowSpan = rowSpan; } }; columns.forEach(function (column, index) { var newColumn = (0, _extends3['default'])({}, column); rows[currentRow].push(newColumn); parentColumn.colSpan = parentColumn.colSpan || 0; if (newColumn.children && newColumn.children.length > 0) { newColumn.children = _groupColumns(newColumn.children, currentRow + 1, newColumn, rows); parentColumn.colSpan = parentColumn.colSpan + newColumn.colSpan; } else { parentColumn.colSpan++; } // update rowspan to all same row columns for (var i = 0; i < rows[currentRow].length - 1; ++i) { setRowSpan(rows[currentRow][i]); } // last column, update rowspan immediately if (index + 1 === columns.length) { setRowSpan(newColumn); } grouped.push(newColumn); }); return grouped; }; return _groupColumns(_this9.columns); }); } }, { key: 'normalize', value: function normalize(elements) { var _this10 = this; var columns = []; _react2['default'].Children.forEach(elements, function (element) { if (!_react2['default'].isValidElement(element)) { return; } var column = (0, _extends3['default'])({}, element.props); if (element.key) { column.key = element.key; } if (element.type.isTableColumnGroup) { column.children = _this10.normalize(column.children); } columns.push(column); }); return columns; } }, { key: 'reset', value: function reset(columns, elements) { this.columns = columns || this.normalize(elements); this._cached = {}; } }, { key: '_cache', value: function _cache(name, fn) { if (name in this._cached) { return this._cached[name]; } this._cached[name] = fn(); return this._cached[name]; } }, { key: '_leafColumns', value: function _leafColumns(columns) { var _this11 = this; var leafColumns = []; columns.forEach(function (column) { if (!column.children) { leafColumns.push(column); } else { leafColumns.push.apply(leafColumns, (0, _toConsumableArray3['default'])(_this11._leafColumns(column.children))); } }); return leafColumns; } }]); return ColumnManager; }(); exports['default'] = ColumnManager; module.exports = exports['default']; /***/ }, /* 278 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _shallowequal = __webpack_require__(48); var _shallowequal2 = _interopRequireDefault(_shallowequal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var ExpandIcon = function (_React$Component) { (0, _inherits3['default'])(ExpandIcon, _React$Component); function ExpandIcon() { (0, _classCallCheck3['default'])(this, ExpandIcon); return (0, _possibleConstructorReturn3['default'])(this, (ExpandIcon.__proto__ || Object.getPrototypeOf(ExpandIcon)).apply(this, arguments)); } (0, _createClass3['default'])(ExpandIcon, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { return !(0, _shallowequal2['default'])(nextProps, this.props); } }, { key: 'render', value: function render() { var _props = this.props, expandable = _props.expandable, prefixCls = _props.prefixCls, onExpand = _props.onExpand, needIndentSpaced = _props.needIndentSpaced, expanded = _props.expanded, record = _props.record; if (expandable) { var expandClassName = expanded ? 'expanded' : 'collapsed'; return _react2['default'].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-' + expandClassName, onClick: function onClick(e) { return onExpand(!expanded, record, e); } }); } else if (needIndentSpaced) { return _react2['default'].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-spaced' }); } return null; } }]); return ExpandIcon; }(_react2['default'].Component); ExpandIcon.propTypes = { record: _propTypes2['default'].object, prefixCls: _propTypes2['default'].string, expandable: _propTypes2['default'].any, expanded: _propTypes2['default'].bool, needIndentSpaced: _propTypes2['default'].bool, onExpand: _propTypes2['default'].func }; exports['default'] = ExpandIcon; module.exports = exports['default']; /***/ }, /* 279 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _toConsumableArray2 = __webpack_require__(25); var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _TableRow = __webpack_require__(282); var _TableRow2 = _interopRequireDefault(_TableRow); var _TableHeader = __webpack_require__(281); var _TableHeader2 = _interopRequireDefault(_TableHeader); var _utils = __webpack_require__(285); var _shallowequal = __webpack_require__(48); var _shallowequal2 = _interopRequireDefault(_shallowequal); var _addEventListener = __webpack_require__(34); var _addEventListener2 = _interopRequireDefault(_addEventListener); var _ColumnManager = __webpack_require__(277); var _ColumnManager2 = _interopRequireDefault(_ColumnManager); var _createStore = __webpack_require__(283); var _createStore2 = _interopRequireDefault(_createStore); var _componentClasses = __webpack_require__(131); var _componentClasses2 = _interopRequireDefault(_componentClasses); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var Table = function (_React$Component) { (0, _inherits3['default'])(Table, _React$Component); function Table(props) { (0, _classCallCheck3['default'])(this, Table); var _this = (0, _possibleConstructorReturn3['default'])(this, (Table.__proto__ || Object.getPrototypeOf(Table)).call(this, props)); _this.onExpanded = function (expanded, record, e, index) { if (e) { e.preventDefault(); e.stopPropagation(); } var info = _this.findExpandedRow(record); if (typeof info !== 'undefined' && !expanded) { _this.onRowDestroy(record, index); } else if (!info && expanded) { var expandedRows = _this.getExpandedRows().concat(); expandedRows.push(_this.getRowKey(record, index)); _this.onExpandedRowsChange(expandedRows); } _this.props.onExpand(expanded, record); }; _this.onRowDestroy = function (record, rowIndex) { var expandedRows = _this.getExpandedRows().concat(); var rowKey = _this.getRowKey(record, rowIndex); var index = -1; expandedRows.forEach(function (r, i) { if (r === rowKey) { index = i; } }); if (index !== -1) { expandedRows.splice(index, 1); } _this.onExpandedRowsChange(expandedRows); }; _this.handleWindowResize = function () { _this.syncFixedTableRowHeight(); _this.setScrollPositionClassName(); }; _this.syncFixedTableRowHeight = function () { var tableRect = _this.tableNode.getBoundingClientRect(); // If tableNode's height less than 0, suppose it is hidden and don't recalculate rowHeight. // see: https://github.com/ant-design/ant-design/issues/4836 if (tableRect.height !== undefined && tableRect.height <= 0) { return; } var prefixCls = _this.props.prefixCls; var headRows = _this.refs.headTable ? _this.refs.headTable.querySelectorAll('thead') : _this.refs.bodyTable.querySelectorAll('thead'); var bodyRows = _this.refs.bodyTable.querySelectorAll('.' + prefixCls + '-row') || []; var fixedColumnsHeadRowsHeight = [].map.call(headRows, function (row) { return row.getBoundingClientRect().height || 'auto'; }); var fixedColumnsBodyRowsHeight = [].map.call(bodyRows, function (row) { return row.getBoundingClientRect().height || 'auto'; }); if ((0, _shallowequal2['default'])(_this.state.fixedColumnsHeadRowsHeight, fixedColumnsHeadRowsHeight) && (0, _shallowequal2['default'])(_this.state.fixedColumnsBodyRowsHeight, fixedColumnsBodyRowsHeight)) { return; } _this.setState({ fixedColumnsHeadRowsHeight: fixedColumnsHeadRowsHeight, fixedColumnsBodyRowsHeight: fixedColumnsBodyRowsHeight }); }; _this.handleBodyScrollLeft = function (e) { var target = e.target; var _this$props$scroll = _this.props.scroll, scroll = _this$props$scroll === undefined ? {} : _this$props$scroll; var _this$refs = _this.refs, headTable = _this$refs.headTable, bodyTable = _this$refs.bodyTable; if (target.scrollLeft !== _this.lastScrollLeft && scroll.x) { if (target === bodyTable && headTable) { headTable.scrollLeft = target.scrollLeft; } else if (target === headTable && bodyTable) { bodyTable.scrollLeft = target.scrollLeft; } _this.setScrollPositionClassName(target); } // Remember last scrollLeft for scroll direction detecting. _this.lastScrollLeft = target.scrollLeft; }; _this.handleBodyScrollTop = function (e) { var target = e.target; var _this$props$scroll2 = _this.props.scroll, scroll = _this$props$scroll2 === undefined ? {} : _this$props$scroll2; var _this$refs2 = _this.refs, headTable = _this$refs2.headTable, bodyTable = _this$refs2.bodyTable, fixedColumnsBodyLeft = _this$refs2.fixedColumnsBodyLeft, fixedColumnsBodyRight = _this$refs2.fixedColumnsBodyRight; if (target.scrollTop !== _this.lastScrollTop && scroll.y && target !== headTable) { var scrollTop = target.scrollTop; if (fixedColumnsBodyLeft && target !== fixedColumnsBodyLeft) { fixedColumnsBodyLeft.scrollTop = scrollTop; } if (fixedColumnsBodyRight && target !== fixedColumnsBodyRight) { fixedColumnsBodyRight.scrollTop = scrollTop; } if (bodyTable && target !== bodyTable) { bodyTable.scrollTop = scrollTop; } } // Remember last scrollTop for scroll direction detecting. _this.lastScrollTop = target.scrollTop; }; _this.handleBodyScroll = function (e) { _this.handleBodyScrollLeft(e); _this.handleBodyScrollTop(e); }; _this.handleRowHover = function (isHover, key) { _this.store.setState({ currentHoverKey: isHover ? key : null }); }; var expandedRowKeys = []; var rows = [].concat((0, _toConsumableArray3['default'])(props.data)); _this.columnManager = new _ColumnManager2['default'](props.columns, props.children); _this.store = (0, _createStore2['default'])({ currentHoverKey: null, expandedRowsHeight: {} }); _this.setScrollPosition('left'); if (props.defaultExpandAllRows) { for (var i = 0; i < rows.length; i++) { var row = rows[i]; expandedRowKeys.push(_this.getRowKey(row, i)); rows = rows.concat(row[props.childrenColumnName] || []); } } else { expandedRowKeys = props.expandedRowKeys || props.defaultExpandedRowKeys; } _this.state = { expandedRowKeys: expandedRowKeys, currentHoverKey: null, fixedColumnsHeadRowsHeight: [], fixedColumnsBodyRowsHeight: [] }; return _this; } (0, _createClass3['default'])(Table, [{ key: 'componentDidMount', value: function componentDidMount() { if (this.columnManager.isAnyColumnsFixed()) { this.handleWindowResize(); this.debouncedWindowResize = (0, _utils.debounce)(this.handleWindowResize, 150); this.resizeEvent = (0, _addEventListener2['default'])(window, 'resize', this.debouncedWindowResize); } } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('expandedRowKeys' in nextProps) { this.setState({ expandedRowKeys: nextProps.expandedRowKeys }); } if (nextProps.columns && nextProps.columns !== this.props.columns) { this.columnManager.reset(nextProps.columns); } else if (nextProps.children !== this.props.children) { this.columnManager.reset(null, nextProps.children); } } }, { key: 'componentDidUpdate', value: function componentDidUpdate(prevProps) { if (this.columnManager.isAnyColumnsFixed()) { this.handleWindowResize(); } // when table changes to empty, reset scrollLeft if (prevProps.data.length > 0 && this.props.data.length === 0 && this.hasScrollX()) { this.resetScrollX(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.resizeEvent) { this.resizeEvent.remove(); } if (this.debouncedWindowResize) { this.debouncedWindowResize.cancel(); } } }, { key: 'onExpandedRowsChange', value: function onExpandedRowsChange(expandedRowKeys) { if (!this.props.expandedRowKeys) { this.setState({ expandedRowKeys: expandedRowKeys }); } this.props.onExpandedRowsChange(expandedRowKeys); } }, { key: 'getRowKey', value: function getRowKey(record, index) { var rowKey = this.props.rowKey; var key = typeof rowKey === 'function' ? rowKey(record, index) : record[rowKey]; (0, _utils.warningOnce)(key !== undefined, 'Each record in table should have a unique `key` prop,' + 'or set `rowKey` to an unique primary key.'); return key === undefined ? index : key; } }, { key: 'getExpandedRows', value: function getExpandedRows() { return this.props.expandedRowKeys || this.state.expandedRowKeys; } }, { key: 'getHeader', value: function getHeader(columns, fixed) { var _props = this.props, showHeader = _props.showHeader, expandIconAsCell = _props.expandIconAsCell, prefixCls = _props.prefixCls; var rows = this.getHeaderRows(columns); if (expandIconAsCell && fixed !== 'right') { rows[0].unshift({ key: 'rc-table-expandIconAsCell', className: prefixCls + '-expand-icon-th', title: '', rowSpan: rows.length }); } var trStyle = fixed ? this.getHeaderRowStyle(columns, rows) : null; return showHeader ? _react2['default'].createElement(_TableHeader2['default'], { prefixCls: prefixCls, rows: rows, rowStyle: trStyle }) : null; } }, { key: 'getHeaderRows', value: function getHeaderRows(columns) { var _this2 = this; var currentRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var rows = arguments[2]; rows = rows || []; rows[currentRow] = rows[currentRow] || []; columns.forEach(function (column) { if (column.rowSpan && rows.length < column.rowSpan) { while (rows.length < column.rowSpan) { rows.push([]); } } var cell = { key: column.key, className: column.className || '', children: column.title }; if (column.children) { _this2.getHeaderRows(column.children, currentRow + 1, rows); } if ('colSpan' in column) { cell.colSpan = column.colSpan; } if ('rowSpan' in column) { cell.rowSpan = column.rowSpan; } if (cell.colSpan !== 0) { rows[currentRow].push(cell); } }); return rows.filter(function (row) { return row.length > 0; }); } }, { key: 'getExpandedRow', value: function getExpandedRow(key, content, visible, className, fixed) { var _props2 = this.props, prefixCls = _props2.prefixCls, expandIconAsCell = _props2.expandIconAsCell; var colCount = void 0; if (fixed === 'left') { colCount = this.columnManager.leftLeafColumns().length; } else if (fixed === 'right') { colCount = this.columnManager.rightLeafColumns().length; } else { colCount = this.columnManager.leafColumns().length; } var columns = [{ key: 'extra-row', render: function render() { return { props: { colSpan: colCount }, children: fixed !== 'right' ? content : '&nbsp;' }; } }]; if (expandIconAsCell && fixed !== 'right') { columns.unshift({ key: 'expand-icon-placeholder', render: function render() { return null; } }); } return _react2['default'].createElement(_TableRow2['default'], { columns: columns, visible: visible, className: className, key: key + '-extra-row', rowKey: key + '-extra-row', prefixCls: prefixCls + '-expanded-row', indent: 1, expandable: false, store: this.store, expandedRow: true, fixed: !!fixed }); } }, { key: 'getRowsByData', value: function getRowsByData(data, visible, indent, columns, fixed) { var props = this.props; var childrenColumnName = props.childrenColumnName, expandedRowRender = props.expandedRowRender, expandRowByClick = props.expandRowByClick, rowClassName = props.rowClassName, rowRef = props.rowRef, expandedRowClassName = props.expandedRowClassName, onRowClick = props.onRowClick, onRowDoubleClick = props.onRowDoubleClick, onRowMouseEnter = props.onRowMouseEnter, onRowMouseLeave = props.onRowMouseLeave; var fixedColumnsBodyRowsHeight = this.state.fixedColumnsBodyRowsHeight; var rst = []; var needIndentSpaced = props.data.some(function (record) { return record[childrenColumnName]; }); var expandIconAsCell = fixed !== 'right' ? props.expandIconAsCell : false; var expandIconColumnIndex = fixed !== 'right' ? props.expandIconColumnIndex : -1; for (var i = 0; i < data.length; i++) { var record = data[i]; var key = this.getRowKey(record, i); var childrenColumn = record[childrenColumnName]; var isRowExpanded = this.isRowExpanded(record, i); var expandedRowContent = void 0; if (expandedRowRender && isRowExpanded) { expandedRowContent = expandedRowRender(record, i, indent); } var className = rowClassName(record, i, indent); var onHoverProps = {}; if (this.columnManager.isAnyColumnsFixed()) { onHoverProps.onHover = this.handleRowHover; } var height = fixed && fixedColumnsBodyRowsHeight[i] ? fixedColumnsBodyRowsHeight[i] : null; var leafColumns = void 0; if (fixed === 'left') { leafColumns = this.columnManager.leftLeafColumns(); } else if (fixed === 'right') { leafColumns = this.columnManager.rightLeafColumns(); } else { leafColumns = this.columnManager.leafColumns(); } rst.push(_react2['default'].createElement(_TableRow2['default'], (0, _extends3['default'])({ indent: indent, indentSize: props.indentSize, needIndentSpaced: needIndentSpaced, className: className, record: record, expandIconAsCell: expandIconAsCell, onDestroy: this.onRowDestroy, index: i, visible: visible, expandRowByClick: expandRowByClick, onExpand: this.onExpanded, expandable: childrenColumn || expandedRowRender, expanded: isRowExpanded, prefixCls: props.prefixCls + '-row', childrenColumnName: childrenColumnName, columns: leafColumns, expandIconColumnIndex: expandIconColumnIndex, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick, onRowMouseEnter: onRowMouseEnter, onRowMouseLeave: onRowMouseLeave, height: height }, onHoverProps, { key: key, hoverKey: key, ref: rowRef(record, i, indent), store: this.store }))); var subVisible = visible && isRowExpanded; if (expandedRowContent && isRowExpanded) { rst.push(this.getExpandedRow(key, expandedRowContent, subVisible, expandedRowClassName(record, i, indent), fixed)); } if (childrenColumn) { rst = rst.concat(this.getRowsByData(childrenColumn, subVisible, indent + 1, columns, fixed)); } } return rst; } }, { key: 'getRows', value: function getRows(columns, fixed) { return this.getRowsByData(this.props.data, true, 0, columns, fixed); } }, { key: 'getColGroup', value: function getColGroup(columns, fixed) { var cols = []; if (this.props.expandIconAsCell && fixed !== 'right') { cols.push(_react2['default'].createElement('col', { className: this.props.prefixCls + '-expand-icon-col', key: 'rc-table-expand-icon-col' })); } var leafColumns = void 0; if (fixed === 'left') { leafColumns = this.columnManager.leftLeafColumns(); } else if (fixed === 'right') { leafColumns = this.columnManager.rightLeafColumns(); } else { leafColumns = this.columnManager.leafColumns(); } cols = cols.concat(leafColumns.map(function (c) { return _react2['default'].createElement('col', { key: c.key, style: { width: c.width, minWidth: c.width } }); })); return _react2['default'].createElement( 'colgroup', null, cols ); } }, { key: 'getLeftFixedTable', value: function getLeftFixedTable() { return this.getTable({ columns: this.columnManager.leftColumns(), fixed: 'left' }); } }, { key: 'getRightFixedTable', value: function getRightFixedTable() { return this.getTable({ columns: this.columnManager.rightColumns(), fixed: 'right' }); } }, { key: 'getTable', value: function getTable() { var _this3 = this; var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var columns = options.columns, fixed = options.fixed; var _props3 = this.props, prefixCls = _props3.prefixCls, _props3$scroll = _props3.scroll, scroll = _props3$scroll === undefined ? {} : _props3$scroll, getBodyWrapper = _props3.getBodyWrapper, showHeader = _props3.showHeader; var useFixedHeader = this.props.useFixedHeader; var bodyStyle = (0, _extends3['default'])({}, this.props.bodyStyle); var headStyle = {}; var tableClassName = ''; if (scroll.x || fixed) { tableClassName = prefixCls + '-fixed'; bodyStyle.overflowX = bodyStyle.overflowX || 'auto'; } var innerBodyStyle = {}; if (scroll.y) { // maxHeight will make fixed-Table scrolling not working // so we only set maxHeight to body-Table here if (fixed) { innerBodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y; innerBodyStyle.overflowY = bodyStyle.overflowY || 'scroll'; } else { bodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y; } bodyStyle.overflowY = bodyStyle.overflowY || 'scroll'; useFixedHeader = true; // Add negative margin bottom for scroll bar overflow bug var scrollbarWidth = (0, _utils.measureScrollbar)(); if (scrollbarWidth > 0) { (fixed ? bodyStyle : headStyle).marginBottom = '-' + scrollbarWidth + 'px'; (fixed ? bodyStyle : headStyle).paddingBottom = '0px'; } } var renderTable = function renderTable() { var hasHead = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; var hasBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var tableStyle = {}; if (!fixed && scroll.x) { // not set width, then use content fixed width if (scroll.x === true) { tableStyle.tableLayout = 'fixed'; } else { tableStyle.width = scroll.x; } } var tableBody = hasBody ? getBodyWrapper(_react2['default'].createElement( 'tbody', { className: prefixCls + '-tbody' }, _this3.getRows(columns, fixed) )) : null; return _react2['default'].createElement( 'table', { className: tableClassName, style: tableStyle, key: 'table' }, _this3.getColGroup(columns, fixed), hasHead ? _this3.getHeader(columns, fixed) : null, tableBody ); }; var headTable = void 0; if (useFixedHeader && showHeader) { headTable = _react2['default'].createElement( 'div', { key: 'headTable', className: prefixCls + '-header', ref: fixed ? null : 'headTable', style: headStyle, onScroll: this.handleBodyScrollLeft }, renderTable(true, false) ); } var bodyTable = _react2['default'].createElement( 'div', { key: 'bodyTable', className: prefixCls + '-body', style: bodyStyle, ref: 'bodyTable', onScroll: this.handleBodyScroll }, renderTable(!useFixedHeader) ); if (fixed && columns.length) { var refName = void 0; if (columns[0].fixed === 'left' || columns[0].fixed === true) { refName = 'fixedColumnsBodyLeft'; } else if (columns[0].fixed === 'right') { refName = 'fixedColumnsBodyRight'; } delete bodyStyle.overflowX; delete bodyStyle.overflowY; bodyTable = _react2['default'].createElement( 'div', { key: 'bodyTable', className: prefixCls + '-body-outer', style: (0, _extends3['default'])({}, bodyStyle) }, _react2['default'].createElement( 'div', { className: prefixCls + '-body-inner', style: innerBodyStyle, ref: refName, onScroll: this.handleBodyScroll }, renderTable(!useFixedHeader) ) ); } return [headTable, bodyTable]; } }, { key: 'getTitle', value: function getTitle() { var _props4 = this.props, title = _props4.title, prefixCls = _props4.prefixCls; return title ? _react2['default'].createElement( 'div', { className: prefixCls + '-title', key: 'title' }, title(this.props.data) ) : null; } }, { key: 'getFooter', value: function getFooter() { var _props5 = this.props, footer = _props5.footer, prefixCls = _props5.prefixCls; return footer ? _react2['default'].createElement( 'div', { className: prefixCls + '-footer', key: 'footer' }, footer(this.props.data) ) : null; } }, { key: 'getEmptyText', value: function getEmptyText() { var _props6 = this.props, emptyText = _props6.emptyText, prefixCls = _props6.prefixCls, data = _props6.data; return !data.length ? _react2['default'].createElement( 'div', { className: prefixCls + '-placeholder', key: 'emptyText' }, typeof emptyText === 'function' ? emptyText() : emptyText ) : null; } }, { key: 'getHeaderRowStyle', value: function getHeaderRowStyle(columns, rows) { var fixedColumnsHeadRowsHeight = this.state.fixedColumnsHeadRowsHeight; var headerHeight = fixedColumnsHeadRowsHeight[0]; if (headerHeight && columns) { if (headerHeight === 'auto') { return { height: 'auto' }; } return { height: headerHeight / rows.length }; } return null; } }, { key: 'setScrollPosition', value: function setScrollPosition(position) { this.scrollPosition = position; if (this.tableNode) { var prefixCls = this.props.prefixCls; if (position === 'both') { (0, _componentClasses2['default'])(this.tableNode).remove(new RegExp('^' + prefixCls + '-scroll-position-.+$')).add(prefixCls + '-scroll-position-left').add(prefixCls + '-scroll-position-right'); } else { (0, _componentClasses2['default'])(this.tableNode).remove(new RegExp('^' + prefixCls + '-scroll-position-.+$')).add(prefixCls + '-scroll-position-' + position); } } } }, { key: 'setScrollPositionClassName', value: function setScrollPositionClassName(target) { var node = target || this.refs.bodyTable; var scrollToLeft = node.scrollLeft === 0; var scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width; if (scrollToLeft && scrollToRight) { this.setScrollPosition('both'); } else if (scrollToLeft) { this.setScrollPosition('left'); } else if (scrollToRight) { this.setScrollPosition('right'); } else if (this.scrollPosition !== 'middle') { this.setScrollPosition('middle'); } } }, { key: 'resetScrollX', value: function resetScrollX() { if (this.refs.headTable) { this.refs.headTable.scrollLeft = 0; } if (this.refs.bodyTable) { this.refs.bodyTable.scrollLeft = 0; } } }, { key: 'findExpandedRow', value: function findExpandedRow(record, index) { var _this4 = this; var rows = this.getExpandedRows().filter(function (i) { return i === _this4.getRowKey(record, index); }); return rows[0]; } }, { key: 'isRowExpanded', value: function isRowExpanded(record, index) { return typeof this.findExpandedRow(record, index) !== 'undefined'; } }, { key: 'hasScrollX', value: function hasScrollX() { var _props$scroll = this.props.scroll, scroll = _props$scroll === undefined ? {} : _props$scroll; return 'x' in scroll; } }, { key: 'render', value: function render() { var _this5 = this; var props = this.props; var prefixCls = props.prefixCls; var className = props.prefixCls; if (props.className) { className += ' ' + props.className; } if (props.useFixedHeader || props.scroll && props.scroll.y) { className += ' ' + prefixCls + '-fixed-header'; } if (this.scrollPosition === 'both') { className += ' ' + prefixCls + '-scroll-position-left ' + prefixCls + '-scroll-position-right'; } else { className += ' ' + prefixCls + '-scroll-position-' + this.scrollPosition; } var isTableScroll = this.columnManager.isAnyColumnsFixed() || props.scroll.x || props.scroll.y; var content = [this.getTable({ columns: this.columnManager.groupedColumns() }), this.getEmptyText(), this.getFooter()]; var scrollTable = isTableScroll ? _react2['default'].createElement( 'div', { className: prefixCls + '-scroll' }, content ) : content; return _react2['default'].createElement( 'div', { ref: function ref(node) { return _this5.tableNode = node; }, className: className, style: props.style }, this.getTitle(), _react2['default'].createElement( 'div', { className: prefixCls + '-content' }, scrollTable, this.columnManager.isAnyColumnsLeftFixed() && _react2['default'].createElement( 'div', { className: prefixCls + '-fixed-left' }, this.getLeftFixedTable() ), this.columnManager.isAnyColumnsRightFixed() && _react2['default'].createElement( 'div', { className: prefixCls + '-fixed-right' }, this.getRightFixedTable() ) ) ); } }]); return Table; }(_react2['default'].Component); Table.propTypes = { data: _propTypes2['default'].array, expandIconAsCell: _propTypes2['default'].bool, defaultExpandAllRows: _propTypes2['default'].bool, expandedRowKeys: _propTypes2['default'].array, defaultExpandedRowKeys: _propTypes2['default'].array, useFixedHeader: _propTypes2['default'].bool, columns: _propTypes2['default'].array, prefixCls: _propTypes2['default'].string, bodyStyle: _propTypes2['default'].object, style: _propTypes2['default'].object, rowKey: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].func]), rowClassName: _propTypes2['default'].func, expandedRowClassName: _propTypes2['default'].func, childrenColumnName: _propTypes2['default'].string, onExpand: _propTypes2['default'].func, onExpandedRowsChange: _propTypes2['default'].func, indentSize: _propTypes2['default'].number, onRowClick: _propTypes2['default'].func, onRowDoubleClick: _propTypes2['default'].func, expandIconColumnIndex: _propTypes2['default'].number, showHeader: _propTypes2['default'].bool, title: _propTypes2['default'].func, footer: _propTypes2['default'].func, emptyText: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].func]), scroll: _propTypes2['default'].object, rowRef: _propTypes2['default'].func, getBodyWrapper: _propTypes2['default'].func, children: _propTypes2['default'].node }; Table.defaultProps = { data: [], useFixedHeader: false, expandIconAsCell: false, defaultExpandAllRows: false, defaultExpandedRowKeys: [], rowKey: 'key', rowClassName: function rowClassName() { return ''; }, expandedRowClassName: function expandedRowClassName() { return ''; }, onExpand: function onExpand() {}, onExpandedRowsChange: function onExpandedRowsChange() {}, onRowClick: function onRowClick() {}, onRowDoubleClick: function onRowDoubleClick() {}, onRowMouseEnter: function onRowMouseEnter() {}, onRowMouseLeave: function onRowMouseLeave() {}, prefixCls: 'rc-table', bodyStyle: {}, style: {}, childrenColumnName: 'children', indentSize: 15, expandIconColumnIndex: 0, showHeader: true, scroll: {}, rowRef: function rowRef() { return null; }, getBodyWrapper: function getBodyWrapper(body) { return body; }, emptyText: function emptyText() { return 'No Data'; } }; exports['default'] = Table; module.exports = exports['default']; /***/ }, /* 280 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _lodash = __webpack_require__(211); var _lodash2 = _interopRequireDefault(_lodash); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var TableCell = function (_React$Component) { (0, _inherits3['default'])(TableCell, _React$Component); function TableCell() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3['default'])(this, TableCell); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = TableCell.__proto__ || Object.getPrototypeOf(TableCell)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) { var _this$props = _this.props, record = _this$props.record, onCellClick = _this$props.column.onCellClick; if (onCellClick) { onCellClick(record, e); } }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret); } (0, _createClass3['default'])(TableCell, [{ key: 'isInvalidRenderCellText', value: function isInvalidRenderCellText(text) { return text && !_react2['default'].isValidElement(text) && Object.prototype.toString.call(text) === '[object Object]'; } }, { key: 'render', value: function render() { var _props = this.props, record = _props.record, indentSize = _props.indentSize, prefixCls = _props.prefixCls, indent = _props.indent, index = _props.index, expandIcon = _props.expandIcon, column = _props.column; var dataIndex = column.dataIndex, render = column.render, _column$className = column.className, className = _column$className === undefined ? '' : _column$className; // We should return undefined if no dataIndex is specified, but in order to // be compatible with object-path's behavior, we return the record object instead. var text = void 0; if (typeof dataIndex === 'number') { text = (0, _lodash2['default'])(record, dataIndex); } else if (!dataIndex || dataIndex.length === 0) { text = record; } else { text = (0, _lodash2['default'])(record, dataIndex); } var tdProps = void 0; var colSpan = void 0; var rowSpan = void 0; if (render) { text = render(text, record, index); if (this.isInvalidRenderCellText(text)) { tdProps = text.props || {}; colSpan = tdProps.colSpan; rowSpan = tdProps.rowSpan; text = text.children; } } // Fix https://github.com/ant-design/ant-design/issues/1202 if (this.isInvalidRenderCellText(text)) { text = null; } var indentText = expandIcon ? _react2['default'].createElement('span', { style: { paddingLeft: indentSize * indent + 'px' }, className: prefixCls + '-indent indent-level-' + indent }) : null; if (rowSpan === 0 || colSpan === 0) { return null; } return _react2['default'].createElement( 'td', (0, _extends3['default'])({ className: className }, tdProps, { onClick: this.handleClick }), indentText, expandIcon, text ); } }]); return TableCell; }(_react2['default'].Component); TableCell.propTypes = { record: _propTypes2['default'].object, prefixCls: _propTypes2['default'].string, index: _propTypes2['default'].number, indent: _propTypes2['default'].number, indentSize: _propTypes2['default'].number, column: _propTypes2['default'].object, expandIcon: _propTypes2['default'].node }; exports['default'] = TableCell; module.exports = exports['default']; /***/ }, /* 281 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _shallowequal = __webpack_require__(48); var _shallowequal2 = _interopRequireDefault(_shallowequal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var TableHeader = function (_React$Component) { (0, _inherits3['default'])(TableHeader, _React$Component); function TableHeader() { (0, _classCallCheck3['default'])(this, TableHeader); return (0, _possibleConstructorReturn3['default'])(this, (TableHeader.__proto__ || Object.getPrototypeOf(TableHeader)).apply(this, arguments)); } (0, _createClass3['default'])(TableHeader, [{ key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps) { return !(0, _shallowequal2['default'])(nextProps, this.props); } }, { key: 'render', value: function render() { var _props = this.props, prefixCls = _props.prefixCls, rowStyle = _props.rowStyle, rows = _props.rows; return _react2['default'].createElement( 'thead', { className: prefixCls + '-thead' }, rows.map(function (row, index) { return _react2['default'].createElement( 'tr', { key: index, style: rowStyle }, row.map(function (cellProps, i) { return _react2['default'].createElement('th', (0, _extends3['default'])({}, cellProps, { key: i })); }) ); }) ); } }]); return TableHeader; }(_react2['default'].Component); TableHeader.propTypes = { prefixCls: _propTypes2['default'].string, rowStyle: _propTypes2['default'].object, rows: _propTypes2['default'].array }; exports['default'] = TableHeader; module.exports = exports['default']; /***/ }, /* 282 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(4); var _propTypes2 = _interopRequireDefault(_propTypes); var _TableCell = __webpack_require__(280); var _TableCell2 = _interopRequireDefault(_TableCell); var _ExpandIcon = __webpack_require__(278); var _ExpandIcon2 = _interopRequireDefault(_ExpandIcon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var TableRow = function (_React$Component) { (0, _inherits3['default'])(TableRow, _React$Component); function TableRow() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3['default'])(this, TableRow); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = TableRow.__proto__ || Object.getPrototypeOf(TableRow)).call.apply(_ref, [this].concat(args))), _this), _this.state = { hovered: false, height: null }, _this.onRowClick = function (event) { var _this$props = _this.props, record = _this$props.record, index = _this$props.index, onRowClick = _this$props.onRowClick, expandable = _this$props.expandable, expandRowByClick = _this$props.expandRowByClick, expanded = _this$props.expanded, onExpand = _this$props.onExpand; if (expandable && expandRowByClick) { onExpand(!expanded, record, event, index); } onRowClick(record, index, event); }, _this.onRowDoubleClick = function (event) { var _this$props2 = _this.props, record = _this$props2.record, index = _this$props2.index, onRowDoubleClick = _this$props2.onRowDoubleClick; onRowDoubleClick(record, index, event); }, _this.onMouseEnter = function (event) { var _this$props3 = _this.props, record = _this$props3.record, index = _this$props3.index, onRowMouseEnter = _this$props3.onRowMouseEnter, onHover = _this$props3.onHover, hoverKey = _this$props3.hoverKey; onHover(true, hoverKey); onRowMouseEnter(record, index, event); }, _this.onMouseLeave = function (event) { var _this$props4 = _this.props, record = _this$props4.record, index = _this$props4.index, onRowMouseLeave = _this$props4.onRowMouseLeave, onHover = _this$props4.onHover, hoverKey = _this$props4.hoverKey; onHover(false, hoverKey); onRowMouseLeave(record, index, event); }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret); } (0, _createClass3['default'])(TableRow, [{ key: 'componentDidMount', value: function componentDidMount() { var _this2 = this; var store = this.props.store; this.pushHeight(); this.pullHeight(); this.unsubscribe = store.subscribe(function () { _this2.setHover(); _this2.pullHeight(); }); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { var _props = this.props, record = _props.record, onDestroy = _props.onDestroy, index = _props.index; onDestroy(record, index); if (this.unsubscribe) { this.unsubscribe(); } } }, { key: 'setHover', value: function setHover() { var _props2 = this.props, store = _props2.store, hoverKey = _props2.hoverKey; var _store$getState = store.getState(), currentHoverKey = _store$getState.currentHoverKey; if (currentHoverKey === hoverKey) { this.setState({ hovered: true }); } else if (this.state.hovered === true) { this.setState({ hovered: false }); } } }, { key: 'pullHeight', value: function pullHeight() { var _props3 = this.props, store = _props3.store, expandedRow = _props3.expandedRow, fixed = _props3.fixed, rowKey = _props3.rowKey; var _store$getState2 = store.getState(), expandedRowsHeight = _store$getState2.expandedRowsHeight; if (expandedRow && fixed && expandedRowsHeight[rowKey]) { this.setState({ height: expandedRowsHeight[rowKey] }); } } }, { key: 'pushHeight', value: function pushHeight() { var _props4 = this.props, store = _props4.store, expandedRow = _props4.expandedRow, fixed = _props4.fixed, rowKey = _props4.rowKey; if (expandedRow && !fixed) { var _store$getState3 = store.getState(), expandedRowsHeight = _store$getState3.expandedRowsHeight; var height = this.trRef.getBoundingClientRect().height; expandedRowsHeight[rowKey] = height; store.setState({ expandedRowsHeight: expandedRowsHeight }); } } }, { key: 'render', value: function render() { var _this3 = this; var _props5 = this.props, prefixCls = _props5.prefixCls, columns = _props5.columns, record = _props5.record, visible = _props5.visible, index = _props5.index, expandIconColumnIndex = _props5.expandIconColumnIndex, expandIconAsCell = _props5.expandIconAsCell, expanded = _props5.expanded, expandRowByClick = _props5.expandRowByClick, expandable = _props5.expandable, onExpand = _props5.onExpand, needIndentSpaced = _props5.needIndentSpaced, indent = _props5.indent, indentSize = _props5.indentSize; var className = this.props.className; if (this.state.hovered) { className += ' ' + prefixCls + '-hover'; } var cells = []; var expandIcon = _react2['default'].createElement(_ExpandIcon2['default'], { expandable: expandable, prefixCls: prefixCls, onExpand: onExpand, needIndentSpaced: needIndentSpaced, expanded: expanded, record: record }); for (var i = 0; i < columns.length; i++) { if (expandIconAsCell && i === 0) { cells.push(_react2['default'].createElement( 'td', { className: prefixCls + '-expand-icon-cell', key: 'rc-table-expand-icon-cell' }, expandIcon )); } var isColumnHaveExpandIcon = expandIconAsCell || expandRowByClick ? false : i === expandIconColumnIndex; cells.push(_react2['default'].createElement(_TableCell2['default'], { prefixCls: prefixCls, record: record, indentSize: indentSize, indent: indent, index: index, column: columns[i], key: columns[i].key, expandIcon: isColumnHaveExpandIcon ? expandIcon : null })); } var height = this.props.height || this.state.height; var style = { height: height }; if (!visible) { style.display = 'none'; } return _react2['default'].createElement( 'tr', { ref: function ref(node) { return _this3.trRef = node; }, onClick: this.onRowClick, onDoubleClick: this.onRowDoubleClick, onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave, className: prefixCls + ' ' + className + ' ' + prefixCls + '-level-' + indent, style: style }, cells ); } }]); return TableRow; }(_react2['default'].Component); TableRow.propTypes = { onDestroy: _propTypes2['default'].func, onRowClick: _propTypes2['default'].func, onRowDoubleClick: _propTypes2['default'].func, onRowMouseEnter: _propTypes2['default'].func, onRowMouseLeave: _propTypes2['default'].func, record: _propTypes2['default'].object, prefixCls: _propTypes2['default'].string, expandIconColumnIndex: _propTypes2['default'].number, onHover: _propTypes2['default'].func, columns: _propTypes2['default'].array, height: _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number]), visible: _propTypes2['default'].bool, index: _propTypes2['default'].number, hoverKey: _propTypes2['default'].any, expanded: _propTypes2['default'].bool, expandable: _propTypes2['default'].any, onExpand: _propTypes2['default'].func, needIndentSpaced: _propTypes2['default'].bool, className: _propTypes2['default'].string, indent: _propTypes2['default'].number, indentSize: _propTypes2['default'].number, expandIconAsCell: _propTypes2['default'].bool, expandRowByClick: _propTypes2['default'].bool, store: _propTypes2['default'].object.isRequired, expandedRow: _propTypes2['default'].bool, fixed: _propTypes2['default'].bool, rowKey: _propTypes2['default'].string }; TableRow.defaultProps = { onRowClick: function onRowClick() {}, onRowDoubleClick: function onRowDoubleClick() {}, onRowMouseEnter: function onRowMouseEnter() {}, onRowMouseLeave: function onRowMouseLeave() {}, onDestroy: function onDestroy() {}, expandIconColumnIndex: 0, expandRowByClick: false, onHover: function onHover() {} }; exports['default'] = TableRow; module.exports = exports['default']; /***/ }, /* 283 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); exports["default"] = createStore; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function createStore(initialState) { var state = initialState; var listeners = []; function setState(partial) { state = (0, _extends3["default"])({}, state, partial); for (var i = 0; i < listeners.length; i++) { listeners[i](); } } function getState() { return state; } function subscribe(listener) { listeners.push(listener); return function unsubscribe() { var index = listeners.indexOf(listener); listeners.splice(index, 1); }; } return { setState: setState, getState: getState, subscribe: subscribe }; } module.exports = exports['default']; /***/ }, /* 284 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ColumnGroup = exports.Column = undefined; var _Table = __webpack_require__(279); var _Table2 = _interopRequireDefault(_Table); var _Column = __webpack_require__(275); var _Column2 = _interopRequireDefault(_Column); var _ColumnGroup = __webpack_require__(276); var _ColumnGroup2 = _interopRequireDefault(_ColumnGroup); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _Table2['default'].Column = _Column2['default']; _Table2['default'].ColumnGroup = _ColumnGroup2['default']; exports['default'] = _Table2['default']; exports.Column = _Column2['default']; exports.ColumnGroup = _ColumnGroup2['default']; /***/ }, /* 285 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.measureScrollbar = measureScrollbar; exports.debounce = debounce; exports.warningOnce = warningOnce; var _warning = __webpack_require__(51); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var scrollbarWidth = void 0; // Measure scrollbar width for padding body during modal show/hide var scrollbarMeasure = { position: 'absolute', top: '-9999px', width: '50px', height: '50px', overflow: 'scroll' }; function measureScrollbar() { if (typeof document === 'undefined' || typeof window === 'undefined') { return 0; } if (scrollbarWidth) { return scrollbarWidth; } var scrollDiv = document.createElement('div'); for (var scrollProp in scrollbarMeasure) { if (scrollbarMeasure.hasOwnProperty(scrollProp)) { scrollDiv.style[scrollProp] = scrollbarMeasure[scrollProp]; } } document.body.appendChild(scrollDiv); var width = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); scrollbarWidth = width; return scrollbarWidth; } function debounce(func, wait, immediate) { var timeout = void 0; function debounceFunc() { var context = this; var args = arguments; // https://fb.me/react-event-pooling if (args[0] && args[0].persist) { args[0].persist(); } var later = function later() { timeout = null; if (!immediate) { func.apply(context, args); } }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) { func.apply(context, args); } } debounceFunc.cancel = function cancel() { if (timeout) { clearTimeout(timeout); timeout = null; } }; return debounceFunc; } var warned = {}; function warningOnce(condition, format, args) { if (!warned[format]) { (0, _warning2['default'])(condition, format, args); warned[format] = !condition; } } /***/ }, /* 286 */, /* 287 */, /* 288 */, /* 289 */, /* 290 */, /* 291 */, /* 292 */, /* 293 */, /* 294 */, /* 295 */, /* 296 */, /* 297 */, /* 298 */, /* 299 */, /* 300 */, /* 301 */, /* 302 */, /* 303 */, /* 304 */, /* 305 */, /* 306 */, /* 307 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** * Created by lvliqi on 2017/5/2. */ var request = __webpack_require__(106); /// exports.default = { loginCheck: function loginCheck(data) { return request('/admin/login/check', data, 'POST'); }, login: function login(data) { return request('/admin/login/login', data, 'POST'); }, logout: function logout(data) { return request('/admin/login/logout', data, 'POST'); }, menuList: function menuList(data) { return request('/admin/sys/menu/list', data, 'POST'); }, userList: function userList(data) { return request('/admin/sys/user/list', data, 'POST'); }, userAdd: function userAdd(data) { return request('/admin/sys/user/add', data, 'POST'); }, getUserRight: function getUserRight(data) { return request('/admin/sys/user/get_user_right', data, 'POST'); }, editUserRight: function editUserRight(data) { return request('/admin/sys/user/edit_user_right', data, 'POST'); }, removeUser: function removeUser(data) { return request('/admin/sys/user/remove_user', data, 'POST'); }, resetPasswd: function resetPasswd(data) { return request('/admin/sys/user/reset_passwd', data, 'POST'); }, rightList: function rightList(data) { return request('/admin/sys/right/group_list', data, 'POST'); }, addGroup: function addGroup(data) { return request('/admin/sys/right/add_group', data, 'POST'); }, editGroup: function editGroup(data) { return request('/admin/sys/right/edit_group', data, 'POST'); }, groupDetailInfo: function groupDetailInfo(data) { return request('/admin/sys/right/group_detail_info', data, 'POST'); }, allRightList: function allRightList(data) { return request('/admin/sys/right/all_right_list', data, 'POST'); }, addGroupDetail: function addGroupDetail(data) { return request('/admin/sys/right/add_group_detail', data, 'POST'); }, groupAllList: function groupAllList(data) { return request('/admin/sys/right/group_all_list', data, 'POST'); }, removeGroup: function removeGroup(data) { return request('/admin/sys/right/remove_group', data, 'POST'); }, commonUserList: function commonUserList(data) { return request('/admin/sys/commonUser/lists', data, 'POST'); }, commonUserDel: function commonUserDel(data) { return request('/admin/sys/commonUser/del', data, 'POST'); }, commonUserBan: function commonUserBan(data) { return request('/admin/sys/commonUser/ban', data, 'POST'); }, commonUserUnBan: function commonUserUnBan(data) { return request('/admin/sys/commonUser/unban', data, 'POST'); }, fileAdd: function fileAdd(data) { return request('/admin/sys/file/add', data, 'POST'); }, fileAll: function fileAll(data) { return request('/admin/sys/file/all', data, 'POST'); }, fileDel: function fileDel(data) { return request('/admin/sys/file/del', data, 'POST'); }, fileRead: function fileRead(data) { return request('/admin/sys/file/read', data, 'POST'); }, fileWrite: function fileWrite(data) { return request('/admin/sys/file/write', data, 'POST'); }, fileDir: function fileDir(data) { return request('/admin/sys/file/dir', data, 'POST'); } }; module.exports = exports['default']; /***/ }, /* 308 */, /* 309 */, /* 310 */, /* 311 */, /* 312 */, /* 313 */, /* 314 */, /* 315 */, /* 316 */, /* 317 */, /* 318 */, /* 319 */, /* 320 */, /* 321 */, /* 322 */, /* 323 */, /* 324 */, /* 325 */, /* 326 */, /* 327 */, /* 328 */, /* 329 */, /* 330 */, /* 331 */, /* 332 */, /* 333 */, /* 334 */, /* 335 */, /* 336 */, /* 337 */, /* 338 */, /* 339 */, /* 340 */, /* 341 */, /* 342 */, /* 343 */, /* 344 */, /* 345 */, /* 346 */, /* 347 */, /* 348 */, /* 349 */, /* 350 */, /* 351 */, /* 352 */, /* 353 */, /* 354 */, /* 355 */, /* 356 */, /* 357 */, /* 358 */, /* 359 */, /* 360 */, /* 361 */, /* 362 */, /* 363 */, /* 364 */, /* 365 */, /* 366 */, /* 367 */, /* 368 */, /* 369 */, /* 370 */, /* 371 */, /* 372 */, /* 373 */, /* 374 */, /* 375 */, /* 376 */, /* 377 */, /* 378 */, /* 379 */, /* 380 */, /* 381 */, /* 382 */, /* 383 */, /* 384 */, /* 385 */, /* 386 */, /* 387 */, /* 388 */, /* 389 */, /* 390 */, /* 391 */, /* 392 */, /* 393 */, /* 394 */, /* 395 */, /* 396 */, /* 397 */, /* 398 */, /* 399 */, /* 400 */, /* 401 */, /* 402 */, /* 403 */, /* 404 */, /* 405 */, /* 406 */, /* 407 */, /* 408 */, /* 409 */, /* 410 */, /* 411 */, /* 412 */, /* 413 */, /* 414 */, /* 415 */, /* 416 */, /* 417 */, /* 418 */, /* 419 */, /* 420 */, /* 421 */, /* 422 */, /* 423 */, /* 424 */, /* 425 */, /* 426 */, /* 427 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = __webpack_require__(2); var _extends3 = _interopRequireDefault(_extends2); var _classCallCheck2 = __webpack_require__(3); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(7); var _createClass3 = _interopRequireDefault(_createClass2); var _possibleConstructorReturn2 = __webpack_require__(6); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _inherits2 = __webpack_require__(5); var _inherits3 = _interopRequireDefault(_inherits2); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _tooltip = __webpack_require__(94); var _tooltip2 = _interopRequireDefault(_tooltip); var _icon = __webpack_require__(18); var _icon2 = _interopRequireDefault(_icon); var _button = __webpack_require__(61); var _button2 = _interopRequireDefault(_button); var _injectLocale = __webpack_require__(125); var _injectLocale2 = _interopRequireDefault(_injectLocale); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var __rest = undefined && undefined.__rest || function (s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; }return t; }; var Popconfirm = function (_React$Component) { (0, _inherits3['default'])(Popconfirm, _React$Component); function Popconfirm(props) { (0, _classCallCheck3['default'])(this, Popconfirm); var _this = (0, _possibleConstructorReturn3['default'])(this, (Popconfirm.__proto__ || Object.getPrototypeOf(Popconfirm)).call(this, props)); _this.onConfirm = function (e) { _this.setVisible(false); var onConfirm = _this.props.onConfirm; if (onConfirm) { onConfirm.call(_this, e); } }; _this.onCancel = function (e) { _this.setVisible(false); var onCancel = _this.props.onCancel; if (onCancel) { onCancel.call(_this, e); } }; _this.onVisibleChange = function (visible) { _this.setVisible(visible); }; _this.state = { visible: props.visible }; return _this; } (0, _createClass3['default'])(Popconfirm, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if ('visible' in nextProps) { this.setState({ visible: nextProps.visible }); } } }, { key: 'getPopupDomNode', value: function getPopupDomNode() { return this.refs.tooltip.getPopupDomNode(); } }, { key: 'setVisible', value: function setVisible(visible) { var props = this.props; if (!('visible' in props)) { this.setState({ visible: visible }); } var onVisibleChange = props.onVisibleChange; if (onVisibleChange) { onVisibleChange(visible); } } }, { key: 'render', value: function render() { var _a = this.props, prefixCls = _a.prefixCls, title = _a.title, placement = _a.placement, okText = _a.okText, cancelText = _a.cancelText, restProps = __rest(_a, ["prefixCls", "title", "placement", "okText", "cancelText"]); var popconfirmLocale = this.getLocale(); var overlay = _react2['default'].createElement( 'div', null, _react2['default'].createElement( 'div', { className: prefixCls + '-inner-content' }, _react2['default'].createElement( 'div', { className: prefixCls + '-message' }, _react2['default'].createElement(_icon2['default'], { type: 'exclamation-circle' }), _react2['default'].createElement( 'div', { className: prefixCls + '-message-title' }, title ) ), _react2['default'].createElement( 'div', { className: prefixCls + '-buttons' }, _react2['default'].createElement( _button2['default'], { onClick: this.onCancel, size: 'small' }, cancelText || popconfirmLocale.cancelText ), _react2['default'].createElement( _button2['default'], { onClick: this.onConfirm, type: 'primary', size: 'small' }, okText || popconfirmLocale.okText ) ) ) ); return _react2['default'].createElement(_tooltip2['default'], (0, _extends3['default'])({}, restProps, { prefixCls: prefixCls, placement: placement, onVisibleChange: this.onVisibleChange, visible: this.state.visible, overlay: overlay, ref: 'tooltip' })); } }]); return Popconfirm; }(_react2['default'].Component); Popconfirm.defaultProps = { prefixCls: 'ant-popover', transitionName: 'zoom-big', placement: 'top', trigger: 'click' }; var injectPopconfirmLocale = (0, _injectLocale2['default'])('Popconfirm', { cancelText: '取消', okText: '确定' }); exports['default'] = injectPopconfirmLocale(Popconfirm); module.exports = exports['default']; /***/ }, /* 428 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(429); __webpack_require__(66); /***/ }, /* 429 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; __webpack_require__(12); __webpack_require__(488); /***/ }, /* 430 */, /* 431 */, /* 432 */, /* 433 */, /* 434 */, /* 435 */, /* 436 */, /* 437 */, /* 438 */, /* 439 */, /* 440 */, /* 441 */, /* 442 */, /* 443 */, /* 444 */, /* 445 */, /* 446 */, /* 447 */, /* 448 */, /* 449 */, /* 450 */, /* 451 */, /* 452 */, /* 453 */, /* 454 */, /* 455 */, /* 456 */, /* 457 */, /* 458 */, /* 459 */, /* 460 */, /* 461 */, /* 462 */, /* 463 */, /* 464 */, /* 465 */, /* 466 */, /* 467 */, /* 468 */, /* 469 */, /* 470 */, /* 471 */, /* 472 */, /* 473 */, /* 474 */, /* 475 */, /* 476 */, /* 477 */, /* 478 */, /* 479 */, /* 480 */, /* 481 */, /* 482 */, /* 483 */, /* 484 */, /* 485 */, /* 486 */, /* 487 */, /* 488 */ /***/ function(module, exports) { // removed by extract-text-webpack-plugin /***/ }, /* 489 */, /* 490 */, /* 491 */, /* 492 */, /* 493 */, /* 494 */, /* 495 */, /* 496 */, /* 497 */, /* 498 */, /* 499 */, /* 500 */, /* 501 */, /* 502 */, /* 503 */, /* 504 */, /* 505 */, /* 506 */, /* 507 */, /* 508 */, /* 509 */, /* 510 */, /* 511 */, /* 512 */, /* 513 */, /* 514 */, /* 515 */, /* 516 */, /* 517 */, /* 518 */, /* 519 */, /* 520 */, /* 521 */, /* 522 */, /* 523 */, /* 524 */, /* 525 */, /* 526 */, /* 527 */, /* 528 */, /* 529 */, /* 530 */, /* 531 */, /* 532 */, /* 533 */, /* 534 */, /* 535 */, /* 536 */, /* 537 */, /* 538 */, /* 539 */, /* 540 */, /* 541 */, /* 542 */, /* 543 */, /* 544 */, /* 545 */, /* 546 */, /* 547 */, /* 548 */, /* 549 */, /* 550 */, /* 551 */, /* 552 */, /* 553 */, /* 554 */, /* 555 */, /* 556 */, /* 557 */, /* 558 */, /* 559 */, /* 560 */, /* 561 */, /* 562 */, /* 563 */, /* 564 */, /* 565 */, /* 566 */, /* 567 */, /* 568 */, /* 569 */, /* 570 */, /* 571 */, /* 572 */, /* 573 */, /* 574 */, /* 575 */, /* 576 */, /* 577 */, /* 578 */, /* 579 */, /* 580 */, /* 581 */, /* 582 */, /* 583 */, /* 584 */, /* 585 */, /* 586 */, /* 587 */, /* 588 */, /* 589 */, /* 590 */, /* 591 */, /* 592 */, /* 593 */, /* 594 */, /* 595 */, /* 596 */, /* 597 */, /* 598 */, /* 599 */, /* 600 */, /* 601 */, /* 602 */, /* 603 */, /* 604 */, /* 605 */, /* 606 */, /* 607 */, /* 608 */, /* 609 */, /* 610 */, /* 611 */, /* 612 */, /* 613 */, /* 614 */, /* 615 */, /* 616 */, /* 617 */, /* 618 */, /* 619 */, /* 620 */, /* 621 */, /* 622 */, /* 623 */, /* 624 */, /* 625 */, /* 626 */, /* 627 */, /* 628 */, /* 629 */, /* 630 */, /* 631 */, /* 632 */, /* 633 */, /* 634 */, /* 635 */, /* 636 */, /* 637 */, /* 638 */, /* 639 */, /* 640 */, /* 641 */, /* 642 */, /* 643 */, /* 644 */, /* 645 */, /* 646 */, /* 647 */, /* 648 */, /* 649 */, /* 650 */, /* 651 */, /* 652 */, /* 653 */, /* 654 */, /* 655 */, /* 656 */, /* 657 */, /* 658 */, /* 659 */, /* 660 */, /* 661 */, /* 662 */, /* 663 */, /* 664 */, /* 665 */, /* 666 */, /* 667 */, /* 668 */, /* 669 */, /* 670 */, /* 671 */, /* 672 */, /* 673 */, /* 674 */, /* 675 */, /* 676 */, /* 677 */, /* 678 */, /* 679 */, /* 680 */, /* 681 */, /* 682 */, /* 683 */, /* 684 */, /* 685 */, /* 686 */, /* 687 */, /* 688 */, /* 689 */, /* 690 */, /* 691 */, /* 692 */, /* 693 */, /* 694 */, /* 695 */, /* 696 */, /* 697 */, /* 698 */, /* 699 */, /* 700 */, /* 701 */, /* 702 */, /* 703 */, /* 704 */, /* 705 */, /* 706 */, /* 707 */, /* 708 */, /* 709 */, /* 710 */, /* 711 */, /* 712 */, /* 713 */, /* 714 */, /* 715 */, /* 716 */, /* 717 */, /* 718 */, /* 719 */, /* 720 */, /* 721 */, /* 722 */, /* 723 */, /* 724 */, /* 725 */, /* 726 */, /* 727 */, /* 728 */, /* 729 */, /* 730 */, /* 731 */, /* 732 */, /* 733 */, /* 734 */, /* 735 */, /* 736 */, /* 737 */, /* 738 */, /* 739 */, /* 740 */, /* 741 */, /* 742 */, /* 743 */, /* 744 */, /* 745 */, /* 746 */, /* 747 */, /* 748 */, /* 749 */, /* 750 */, /* 751 */, /* 752 */, /* 753 */, /* 754 */, /* 755 */, /* 756 */, /* 757 */, /* 758 */, /* 759 */, /* 760 */, /* 761 */, /* 762 */, /* 763 */, /* 764 */, /* 765 */, /* 766 */, /* 767 */, /* 768 */, /* 769 */, /* 770 */, /* 771 */, /* 772 */, /* 773 */, /* 774 */, /* 775 */, /* 776 */, /* 777 */, /* 778 */, /* 779 */, /* 780 */, /* 781 */, /* 782 */, /* 783 */, /* 784 */, /* 785 */, /* 786 */, /* 787 */, /* 788 */, /* 789 */, /* 790 */, /* 791 */, /* 792 */, /* 793 */, /* 794 */, /* 795 */, /* 796 */, /* 797 */, /* 798 */, /* 799 */, /* 800 */, /* 801 */, /* 802 */, /* 803 */, /* 804 */, /* 805 */, /* 806 */, /* 807 */, /* 808 */, /* 809 */, /* 810 */, /* 811 */, /* 812 */, /* 813 */, /* 814 */, /* 815 */, /* 816 */, /* 817 */, /* 818 */, /* 819 */, /* 820 */, /* 821 */, /* 822 */, /* 823 */, /* 824 */, /* 825 */, /* 826 */, /* 827 */, /* 828 */, /* 829 */, /* 830 */, /* 831 */, /* 832 */, /* 833 */, /* 834 */, /* 835 */, /* 836 */, /* 837 */, /* 838 */, /* 839 */, /* 840 */, /* 841 */, /* 842 */, /* 843 */, /* 844 */, /* 845 */, /* 846 */, /* 847 */, /* 848 */, /* 849 */, /* 850 */, /* 851 */, /* 852 */, /* 853 */, /* 854 */, /* 855 */, /* 856 */, /* 857 */, /* 858 */, /* 859 */, /* 860 */, /* 861 */, /* 862 */, /* 863 */, /* 864 */, /* 865 */, /* 866 */, /* 867 */, /* 868 */, /* 869 */, /* 870 */, /* 871 */, /* 872 */, /* 873 */, /* 874 */, /* 875 */, /* 876 */, /* 877 */, /* 878 */, /* 879 */, /* 880 */, /* 881 */, /* 882 */, /* 883 */, /* 884 */, /* 885 */, /* 886 */, /* 887 */, /* 888 */, /* 889 */, /* 890 */, /* 891 */, /* 892 */, /* 893 */, /* 894 */, /* 895 */, /* 896 */, /* 897 */, /* 898 */, /* 899 */, /* 900 */, /* 901 */, /* 902 */, /* 903 */, /* 904 */, /* 905 */, /* 906 */, /* 907 */, /* 908 */, /* 909 */, /* 910 */, /* 911 */, /* 912 */, /* 913 */, /* 914 */, /* 915 */, /* 916 */, /* 917 */, /* 918 */, /* 919 */, /* 920 */, /* 921 */, /* 922 */, /* 923 */, /* 924 */, /* 925 */, /* 926 */, /* 927 */, /* 928 */, /* 929 */, /* 930 */, /* 931 */, /* 932 */, /* 933 */, /* 934 */, /* 935 */, /* 936 */, /* 937 */, /* 938 */, /* 939 */, /* 940 */, /* 941 */, /* 942 */, /* 943 */, /* 944 */, /* 945 */, /* 946 */, /* 947 */, /* 948 */, /* 949 */, /* 950 */, /* 951 */, /* 952 */, /* 953 */, /* 954 */, /* 955 */, /* 956 */, /* 957 */, /* 958 */, /* 959 */, /* 960 */, /* 961 */, /* 962 */, /* 963 */, /* 964 */, /* 965 */, /* 966 */, /* 967 */, /* 968 */, /* 969 */, /* 970 */, /* 971 */, /* 972 */, /* 973 */, /* 974 */, /* 975 */, /* 976 */, /* 977 */, /* 978 */, /* 979 */, /* 980 */, /* 981 */, /* 982 */, /* 983 */, /* 984 */, /* 985 */, /* 986 */, /* 987 */, /* 988 */, /* 989 */, /* 990 */, /* 991 */, /* 992 */, /* 993 */, /* 994 */, /* 995 */, /* 996 */, /* 997 */, /* 998 */, /* 999 */, /* 1000 */, /* 1001 */, /* 1002 */, /* 1003 */, /* 1004 */, /* 1005 */, /* 1006 */, /* 1007 */, /* 1008 */, /* 1009 */, /* 1010 */, /* 1011 */, /* 1012 */, /* 1013 */, /* 1014 */, /* 1015 */, /* 1016 */, /* 1017 */, /* 1018 */, /* 1019 */, /* 1020 */, /* 1021 */, /* 1022 */, /* 1023 */, /* 1024 */, /* 1025 */, /* 1026 */, /* 1027 */, /* 1028 */, /* 1029 */, /* 1030 */, /* 1031 */, /* 1032 */, /* 1033 */, /* 1034 */, /* 1035 */, /* 1036 */, /* 1037 */, /* 1038 */, /* 1039 */, /* 1040 */, /* 1041 */, /* 1042 */, /* 1043 */, /* 1044 */, /* 1045 */, /* 1046 */, /* 1047 */, /* 1048 */, /* 1049 */, /* 1050 */, /* 1051 */, /* 1052 */, /* 1053 */, /* 1054 */, /* 1055 */, /* 1056 */, /* 1057 */, /* 1058 */, /* 1059 */, /* 1060 */, /* 1061 */, /* 1062 */, /* 1063 */, /* 1064 */, /* 1065 */, /* 1066 */, /* 1067 */, /* 1068 */, /* 1069 */, /* 1070 */, /* 1071 */, /* 1072 */, /* 1073 */, /* 1074 */, /* 1075 */, /* 1076 */, /* 1077 */, /* 1078 */, /* 1079 */, /* 1080 */, /* 1081 */, /* 1082 */, /* 1083 */, /* 1084 */, /* 1085 */, /* 1086 */, /* 1087 */, /* 1088 */, /* 1089 */, /* 1090 */, /* 1091 */, /* 1092 */, /* 1093 */, /* 1094 */, /* 1095 */, /* 1096 */, /* 1097 */, /* 1098 */, /* 1099 */, /* 1100 */, /* 1101 */, /* 1102 */, /* 1103 */, /* 1104 */, /* 1105 */, /* 1106 */, /* 1107 */, /* 1108 */, /* 1109 */, /* 1110 */, /* 1111 */, /* 1112 */, /* 1113 */, /* 1114 */, /* 1115 */, /* 1116 */, /* 1117 */, /* 1118 */, /* 1119 */, /* 1120 */, /* 1121 */, /* 1122 */, /* 1123 */, /* 1124 */, /* 1125 */, /* 1126 */, /* 1127 */, /* 1128 */, /* 1129 */, /* 1130 */, /* 1131 */, /* 1132 */, /* 1133 */, /* 1134 */, /* 1135 */, /* 1136 */, /* 1137 */, /* 1138 */, /* 1139 */, /* 1140 */, /* 1141 */, /* 1142 */, /* 1143 */, /* 1144 */, /* 1145 */, /* 1146 */, /* 1147 */, /* 1148 */, /* 1149 */, /* 1150 */, /* 1151 */, /* 1152 */, /* 1153 */, /* 1154 */, /* 1155 */, /* 1156 */, /* 1157 */, /* 1158 */, /* 1159 */, /* 1160 */, /* 1161 */, /* 1162 */, /* 1163 */, /* 1164 */, /* 1165 */, /* 1166 */, /* 1167 */, /* 1168 */, /* 1169 */, /* 1170 */, /* 1171 */, /* 1172 */, /* 1173 */, /* 1174 */, /* 1175 */, /* 1176 */, /* 1177 */, /* 1178 */, /* 1179 */, /* 1180 */, /* 1181 */, /* 1182 */, /* 1183 */, /* 1184 */, /* 1185 */, /* 1186 */, /* 1187 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(175); var _table = __webpack_require__(174); var _table2 = _interopRequireDefault(_table); var _css2 = __webpack_require__(130); var _row = __webpack_require__(129); var _row2 = _interopRequireDefault(_row); var _css3 = __webpack_require__(66); var _button = __webpack_require__(61); var _button2 = _interopRequireDefault(_button); var _css4 = __webpack_require__(428); var _popconfirm = __webpack_require__(427); var _popconfirm2 = _interopRequireDefault(_popconfirm); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _dva = __webpack_require__(90); var _SysFileAddModal = __webpack_require__(1190); var _SysFileAddModal2 = _interopRequireDefault(_SysFileAddModal); var _SysFileEditModal = __webpack_require__(1192); var _SysFileEditModal2 = _interopRequireDefault(_SysFileEditModal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = (0, _dva.connect)(function (_ref) { var sysFileAdd = _ref.sysFileAdd, sysFile = _ref.sysFile, sysFileEdit = _ref.sysFileEdit; return { sysFileAdd: sysFileAdd, sysFile: sysFile, sysFileEdit: sysFileEdit }; })(function (_ref2) { var dispatch = _ref2.dispatch, sysFileAdd = _ref2.sysFileAdd, sysFile = _ref2.sysFile, sysFileEdit = _ref2.sysFileEdit; var list = sysFile.list; var SysFileAddModalProps = _extends({}, sysFileAdd, { onCancel: function onCancel() { dispatch({ type: 'sysFileAdd/payload', payload: { visible: false } }); }, onOk: function onOk(data) { dispatch({ type: 'sysFileAdd/set', data: data }); } }); var columns = [{ title: 'ID', dataIndex: 'id', key: 'id' }, { title: '文件路径', dataIndex: 'path', key: 'path' }, { title: '操作', key: 'action', width: 300, render: function render(text, record) { return _react2.default.createElement( 'div', null, _react2.default.createElement( 'a', { href: 'javascript:;', onClick: function onClick() { dispatch({ type: 'sysFile/readFile', path: record.path }); } }, '\u8BFB/\u5199\u6587\u4EF6' ), _react2.default.createElement('span', { className: 'ant-divider' }), _react2.default.createElement( _popconfirm2.default, { title: '\u786E\u8BA4\u5220\u9664\u5417?', onConfirm: function onConfirm() { dispatch({ type: 'sysFile/del', id: record.id }); } }, _react2.default.createElement( 'a', { href: 'javascript:;' }, '\u5220\u9664' ) ) ); } }]; var SysFileEditModalProps = _extends({}, sysFileEdit, { onCancel: function onCancel() { dispatch({ type: 'sysFileEdit/payload', payload: { visible: false } }); }, onOk: function onOk(data) { dispatch({ type: 'sysFileEdit/set', data: data }); } }); return _react2.default.createElement( 'div', null, _react2.default.createElement( _row2.default, null, _react2.default.createElement( _button2.default, { onClick: function onClick() { dispatch({ type: 'sysFileAdd/payload', payload: { visible: true } }); } }, '\u6DFB\u52A0\u6587\u4EF6' ) ), _react2.default.createElement(_table2.default, { dataSource: list, columns: columns, style: { marginTop: 16 }, pagination: false, rowKey: function rowKey(record) { return record.id; } }), sysFileAdd.visible ? _react2.default.createElement(_SysFileAddModal2.default, SysFileAddModalProps) : '', sysFileEdit.visible ? _react2.default.createElement(_SysFileEditModal2.default, SysFileEditModalProps) : '' ); }); module.exports = exports['default']; /***/ }, /* 1188 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _sys = __webpack_require__(307); var _sys2 = _interopRequireDefault(_sys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { namespace: 'sysFile', state: { list: [] }, reducers: { payload: function payload(state, _ref) { var _payload = _ref.payload; return _extends({}, state, _payload); } }, effects: { init: regeneratorRuntime.mark(function init(_, _ref2) { var put = _ref2.put; var _ref3, list; return regeneratorRuntime.wrap(function init$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return _sys2.default.fileAll(); case 2: _ref3 = _context.sent; list = _ref3.data; _context.next = 6; return put({ type: 'payload', payload: { list: list } }); case 6: case 'end': return _context.stop(); } } }, init, this); }), del: regeneratorRuntime.mark(function del(_ref4, _ref5) { var id = _ref4.id; var put = _ref5.put; return regeneratorRuntime.wrap(function del$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return _sys2.default.fileDel({ id: id }); case 2: _context2.next = 4; return put({ type: 'init' }); case 4: successAlert('删除成功'); case 5: case 'end': return _context2.stop(); } } }, del, this); }), readFile: regeneratorRuntime.mark(function readFile(_ref6, _ref7) { var path = _ref6.path; var put = _ref7.put; var _ref8, content; return regeneratorRuntime.wrap(function readFile$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return _sys2.default.fileRead({ path: path }); case 2: _ref8 = _context3.sent; content = _ref8.data; _context3.next = 6; return put({ type: 'sysFileEdit/payload', payload: { item: { content: content, path: path }, visible: true } }); case 6: case 'end': return _context3.stop(); } } }, readFile, this); }) }, subscriptions: { setup: function setup(_ref9) { var history = _ref9.history, dispatch = _ref9.dispatch; history.listen(function (location) { if (location.pathname == '/admin/sys/file') { dispatch({ type: 'init' }); } }); } } }; module.exports = exports['default']; /***/ }, /* 1189 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Created by lvliqi on 2017/5/26. */ var _sys = __webpack_require__(307); var _sys2 = _interopRequireDefault(_sys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { namespace: 'sysFileAdd', state: { visible: false, title: '添加地址', confirmLoading: false, item: {}, loading: false }, reducers: { payload: function payload(state, _ref) { var _payload = _ref.payload; return _extends({}, state, _payload); } }, effects: { set: regeneratorRuntime.mark(function set(_ref2, _ref3) { var data = _ref2.data; var put = _ref3.put, select = _ref3.select; var path; return regeneratorRuntime.wrap(function set$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: path = data.path; if (!(path == "")) { _context.next = 4; break; } warningAlert('请选择文件'); return _context.abrupt('return'); case 4: _context.next = 6; return _sys2.default.fileAdd({ path: path }); case 6: _context.next = 8; return put({ type: 'payload', payload: { visible: false } }); case 8: successAlert('添加成功'); _context.next = 11; return put({ type: 'sysFile/init' }); case 11: case 'end': return _context.stop(); } } }, set, this); }) } }; module.exports = exports['default']; /***/ }, /* 1190 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(128); var _modal = __webpack_require__(127); var _modal2 = _interopRequireDefault(_modal); var _css2 = __webpack_require__(24); var _input = __webpack_require__(70); var _input2 = _interopRequireDefault(_input); var _css3 = __webpack_require__(63); var _form = __webpack_require__(62); var _form2 = _interopRequireDefault(_form); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Created by lvliqi on 2017/5/3. */ var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _FileChoose = __webpack_require__(1193); var _FileChoose2 = _interopRequireDefault(_FileChoose); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FormItem = _form2.default.Item; var formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } }; exports.default = _form2.default.create()(function (_ref) { var visible = _ref.visible, title = _ref.title, onCancel = _ref.onCancel, onOk = _ref.onOk, confirmLoading = _ref.confirmLoading, item = _ref.item, _ref$form = _ref.form, getFieldDecorator = _ref$form.getFieldDecorator, validateFields = _ref$form.validateFields, getFieldsValue = _ref$form.getFieldsValue, setFieldsValue = _ref$form.setFieldsValue; function handleOk() { validateFields(function (errors) { if (errors) { return; } var data = _extends({}, getFieldsValue()); onOk(data); }); } var modelProps = { visible: visible, title: title, onCancel: onCancel, width: 800, onOk: handleOk, confirmLoading: confirmLoading, maskClosable: false }; return _react2.default.createElement( _modal2.default, modelProps, _react2.default.createElement( _form2.default, null, _react2.default.createElement( FormItem, _extends({ label: '\u6587\u4EF6\u8DEF\u5F84' }, formItemLayout), getFieldDecorator('path', { initialValue: item.path || '' })(_react2.default.createElement(_input2.default, null)) ), _react2.default.createElement(_FileChoose2.default, { onChange: function onChange(cf) { setFieldsValue({ path: cf }); } }) ) ); }); module.exports = exports['default']; /***/ }, /* 1191 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Created by lvliqi on 2017/5/26. */ var _sys = __webpack_require__(307); var _sys2 = _interopRequireDefault(_sys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { namespace: 'sysFileEdit', state: { visible: false, title: '操作文件', confirmLoading: false, item: {}, loading: false }, reducers: { payload: function payload(state, _ref) { var _payload = _ref.payload; return _extends({}, state, _payload); } }, effects: { set: regeneratorRuntime.mark(function set(_ref2, _ref3) { var data = _ref2.data; var put = _ref3.put, select = _ref3.select; var content, _ref4, item, path; return regeneratorRuntime.wrap(function set$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: content = data.content; _context.next = 3; return select(function (state) { return state.sysFileEdit; }); case 3: _ref4 = _context.sent; item = _ref4.item; path = item.path; _context.next = 8; return _sys2.default.fileWrite({ content: content, path: path }); case 8: _context.next = 10; return put({ type: 'payload', payload: { visible: false } }); case 10: successAlert('保存成功'); case 11: case 'end': return _context.stop(); } } }, set, this); }) } }; module.exports = exports['default']; /***/ }, /* 1192 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(128); var _modal = __webpack_require__(127); var _modal2 = _interopRequireDefault(_modal); var _css2 = __webpack_require__(24); var _input = __webpack_require__(70); var _input2 = _interopRequireDefault(_input); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var TextArea = _input2.default.TextArea; var DeployConfigModal = function (_React$Component) { _inherits(DeployConfigModal, _React$Component); function DeployConfigModal(props) { _classCallCheck(this, DeployConfigModal); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = props.item; return _this; } DeployConfigModal.prototype.render = function render() { var _this2 = this; var item = this.state; var _props = this.props, visible = _props.visible, title = _props.title, onCancel = _props.onCancel, confirmLoading = _props.confirmLoading, _onOk = _props.onOk; var modelProps = { visible: visible, title: title, onCancel: onCancel, width: "90%", confirmLoading: false, onOk: function onOk() { var content = _this2.state.content; _onOk({ content: content }); } }; var content = item.content; return _react2.default.createElement( _modal2.default, modelProps, _react2.default.createElement(TextArea, { rows: 4, autosize: true, value: content, onChange: function onChange(e) { var content = e.target.value; _this2.setState({ content: content }); } }) ); }; return DeployConfigModal; }(_react2.default.Component); exports.default = DeployConfigModal; module.exports = exports['default']; /***/ }, /* 1193 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _css = __webpack_require__(163); var _radio = __webpack_require__(76); var _radio2 = _interopRequireDefault(_radio); var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); var _sys = __webpack_require__(307); var _sys2 = _interopRequireDefault(_sys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } var FileChoose = function (_React$Component) { _inherits(FileChoose, _React$Component); function FileChoose(props) { _classCallCheck(this, FileChoose); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { list: [], current: '/', checkFile: '' }; return _this; } FileChoose.prototype.render = function render() { var _this2 = this; var _state = this.state, list = _state.list, current = _state.current, checkFile = _state.checkFile; var onChange = this.props.onChange; return _react2.default.createElement( 'div', null, _react2.default.createElement( 'div', null, '\u5F53\u524D\u8DEF\u5F84\uFF1A', current ), list.map(function (d, i) { return _react2.default.createElement( 'div', { key: i }, d.t == 'dir' ? _react2.default.createElement( 'a', { href: 'javascript:;', onClick: function onClick() { if (d.n == '..') { d.p = current.split('/'); d.p.pop(); d.p = d.p.join('/'); d.p = d.p == '' ? '/' : d.p; } _sys2.default.fileDir({ dir: d.p }).then(function (n) { var list = n.data; list = [{ t: 'dir', p: '', n: '..' }].concat(_toConsumableArray(list)); _this2.setState({ list: list, current: d.p }); }).catch(function (err) { errorAlert('文件读取失败'); }); } }, d.n ) : _react2.default.createElement( _radio2.default, { checked: checkFile == d.p, onClick: function onClick() { _this2.setState({ checkFile: d.p }); onChange && onChange(d.p); } }, d.n ) ); }) ); }; FileChoose.prototype.componentDidMount = function componentDidMount() { var _this3 = this; _sys2.default.fileDir({ dir: '/' }).then(function (d) { var list = d.data; _this3.setState({ list: list, current: '/' }); }); }; return FileChoose; }(_react2.default.Component); exports.default = FileChoose; module.exports = exports['default']; /***/ } ]); //# sourceMappingURL=SysFile.admin.chunk.js.map
ajax/libs/yui/3.7.2/event-focus/event-focus.js
MenZil/cdnjs
YUI.add('event-focus', function (Y, NAME) { /** * Adds bubbling and delegation support to DOM events focus and blur. * * @module event * @submodule event-focus */ var Event = Y.Event, YLang = Y.Lang, isString = YLang.isString, arrayIndex = Y.Array.indexOf, useActivate = YLang.isFunction( Y.DOM.create('<p onbeforeactivate=";"/>').onbeforeactivate); function define(type, proxy, directEvent) { var nodeDataKey = '_' + type + 'Notifiers'; Y.Event.define(type, { _attach: function (el, notifier, delegate) { if (Y.DOM.isWindow(el)) { return Event._attach([type, function (e) { notifier.fire(e); }, el]); } else { return Event._attach( [proxy, this._proxy, el, this, notifier, delegate], { capture: true }); } }, _proxy: function (e, notifier, delegate) { var target = e.target, currentTarget = e.currentTarget, notifiers = target.getData(nodeDataKey), yuid = Y.stamp(currentTarget._node), defer = (useActivate || target !== currentTarget), directSub; notifier.currentTarget = (delegate) ? target : currentTarget; notifier.container = (delegate) ? currentTarget : null; // Maintain a list to handle subscriptions from nested // containers div#a>div#b>input #a.on(focus..) #b.on(focus..), // use one focus or blur subscription that fires notifiers from // #b then #a to emulate bubble sequence. if (!notifiers) { notifiers = {}; target.setData(nodeDataKey, notifiers); // only subscribe to the element's focus if the target is // not the current target ( if (defer) { directSub = Event._attach( [directEvent, this._notify, target._node]).sub; directSub.once = true; } } else { // In old IE, defer is always true. In capture-phase browsers, // The delegate subscriptions will be encountered first, which // will establish the notifiers data and direct subscription // on the node. If there is also a direct subscription to the // node's focus/blur, it should not call _notify because the // direct subscription from the delegate sub(s) exists, which // will call _notify. So this avoids _notify being called // twice, unnecessarily. defer = true; } if (!notifiers[yuid]) { notifiers[yuid] = []; } notifiers[yuid].push(notifier); if (!defer) { this._notify(e); } }, _notify: function (e, container) { var currentTarget = e.currentTarget, notifierData = currentTarget.getData(nodeDataKey), axisNodes = currentTarget.ancestors(), doc = currentTarget.get('ownerDocument'), delegates = [], // Used to escape loops when there are no more // notifiers to consider count = notifierData ? Y.Object.keys(notifierData).length : 0, target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret; // clear the notifications list (mainly for delegation) currentTarget.clearData(nodeDataKey); // Order the delegate subs by their placement in the parent axis axisNodes.push(currentTarget); // document.get('ownerDocument') returns null // which we'll use to prevent having duplicate Nodes in the list if (doc) { axisNodes.unshift(doc); } // ancestors() returns the Nodes from top to bottom axisNodes._nodes.reverse(); if (count) { // Store the count for step 2 tmp = count; axisNodes.some(function (node) { var yuid = Y.stamp(node), notifiers = notifierData[yuid], i, len; if (notifiers) { count--; for (i = 0, len = notifiers.length; i < len; ++i) { if (notifiers[i].handle.sub.filter) { delegates.push(notifiers[i]); } } } return !count; }); count = tmp; } // Walk up the parent axis, notifying direct subscriptions and // testing delegate filters. while (count && (target = axisNodes.shift())) { yuid = Y.stamp(target); notifiers = notifierData[yuid]; if (notifiers) { for (i = 0, len = notifiers.length; i < len; ++i) { notifier = notifiers[i]; sub = notifier.handle.sub; match = true; e.currentTarget = target; if (sub.filter) { match = sub.filter.apply(target, [target, e].concat(sub.args || [])); // No longer necessary to test against this // delegate subscription for the nodes along // the parent axis. delegates.splice( arrayIndex(delegates, notifier), 1); } if (match) { // undefined for direct subs e.container = notifier.container; ret = notifier.fire(e); } if (ret === false || e.stopped === 2) { break; } } delete notifiers[yuid]; count--; } if (e.stopped !== 2) { // delegates come after subs targeting this specific node // because they would not normally report until they'd // bubbled to the container node. for (i = 0, len = delegates.length; i < len; ++i) { notifier = delegates[i]; sub = notifier.handle.sub; if (sub.filter.apply(target, [target, e].concat(sub.args || []))) { e.container = notifier.container; e.currentTarget = target; ret = notifier.fire(e); } if (ret === false || e.stopped === 2) { break; } } } if (e.stopped) { break; } } }, on: function (node, sub, notifier) { sub.handle = this._attach(node._node, notifier); }, detach: function (node, sub) { sub.handle.detach(); }, delegate: function (node, sub, notifier, filter) { if (isString(filter)) { sub.filter = function (target) { return Y.Selector.test(target._node, filter, node === target ? null : node._node); }; } sub.handle = this._attach(node._node, notifier, true); }, detachDelegate: function (node, sub) { sub.handle.detach(); } }, true); } // For IE, we need to defer to focusin rather than focus because // `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate, // el.onfocusin, doSomething, then el.onfocus. All others support capture // phase focus, which executes before doSomething. To guarantee consistent // behavior for this use case, IE's direct subscriptions are made against // focusin so subscribers will be notified before js following el.focus() is // executed. if (useActivate) { // name capture phase direct subscription define("focus", "beforeactivate", "focusin"); define("blur", "beforedeactivate", "focusout"); } else { define("focus", "focus", "focus"); define("blur", "blur", "blur"); } }, '@VERSION@', {"requires": ["event-synthetic"]});
src/svg-icons/device/battery-50.js
pomerantsev/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBattery50 = (props) => ( <SvgIcon {...props}> <path fillOpacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V13h10V5.33z"/><path d="M7 13v7.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13H7z"/> </SvgIcon> ); DeviceBattery50 = pure(DeviceBattery50); DeviceBattery50.displayName = 'DeviceBattery50'; DeviceBattery50.muiName = 'SvgIcon'; export default DeviceBattery50;
ajax/libs/forerunnerdb/1.3.788/fdb-all.js
nolsherry/cdnjs
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ var Core = _dereq_('./core'), CollectionGroup = _dereq_('../lib/CollectionGroup'), View = _dereq_('../lib/View'), Highchart = _dereq_('../lib/Highchart'), Persist = _dereq_('../lib/Persist'), Document = _dereq_('../lib/Document'), Overview = _dereq_('../lib/Overview'), Grid = _dereq_('../lib/Grid'), NodeApiClient = _dereq_('../lib/NodeApiClient'), BinaryLog = _dereq_('../lib/BinaryLog'); if (typeof window !== 'undefined') { window.ForerunnerDB = Core; } module.exports = Core; },{"../lib/BinaryLog":4,"../lib/CollectionGroup":8,"../lib/Document":12,"../lib/Grid":14,"../lib/Highchart":15,"../lib/NodeApiClient":31,"../lib/Overview":34,"../lib/Persist":36,"../lib/View":43,"./core":2}],2:[function(_dereq_,module,exports){ var Core = _dereq_('../lib/Core'), ShimIE8 = _dereq_('../lib/Shim.IE8'); if (typeof window !== 'undefined') { window.ForerunnerDB = Core; } module.exports = Core; },{"../lib/Core":10,"../lib/Shim.IE8":42}],3:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'), sharedPathSolver; /** * Creates an always-sorted multi-key bucket that allows ForerunnerDB to * know the index that a document will occupy in an array with minimal * processing, speeding up things like sorted views. * @param {object} orderBy An order object. * @constructor */ var ActiveBucket = function (orderBy) { this._primaryKey = '_id'; this._keyArr = []; this._data = []; this._objLookup = {}; this._count = 0; this._keyArr = sharedPathSolver.parse(orderBy, true); }; Shared.addModule('ActiveBucket', ActiveBucket); Shared.mixin(ActiveBucket.prototype, 'Mixin.Sorting'); sharedPathSolver = new Path(); /** * Gets / sets the primary key used by the active bucket. * @returns {String} The current primary key. */ Shared.synthesize(ActiveBucket.prototype, 'primaryKey'); /** * Quicksorts a single document into the passed array and * returns the index that the document should occupy. * @param {object} obj The document to calculate index for. * @param {array} arr The array the document index will be * calculated for. * @param {string} item The string key representation of the * document whose index is being calculated. * @param {function} fn The comparison function that is used * to determine if a document is sorted below or above the * document we are calculating the index for. * @returns {number} The index the document should occupy. */ ActiveBucket.prototype.qs = function (obj, arr, item, fn) { // If the array is empty then return index zero if (!arr.length) { return 0; } var lastMidwayIndex = -1, midwayIndex, lookupItem, result, start = 0, end = arr.length - 1; // Loop the data until our range overlaps while (end >= start) { // Calculate the midway point (divide and conquer) midwayIndex = Math.floor((start + end) / 2); if (lastMidwayIndex === midwayIndex) { // No more items to scan break; } // Get the item to compare against lookupItem = arr[midwayIndex]; if (lookupItem !== undefined) { // Compare items result = fn(this, obj, item, lookupItem); if (result > 0) { start = midwayIndex + 1; } if (result < 0) { end = midwayIndex - 1; } } lastMidwayIndex = midwayIndex; } if (result > 0) { return midwayIndex + 1; } else { return midwayIndex; } }; /** * Calculates the sort position of an item against another item. * @param {object} sorter An object or instance that contains * sortAsc and sortDesc methods. * @param {object} obj The document to compare. * @param {string} a The first key to compare. * @param {string} b The second key to compare. * @returns {number} Either 1 for sort a after b or -1 to sort * a before b. * @private */ ActiveBucket.prototype._sortFunc = function (sorter, obj, a, b) { var aVals = a.split('.:.'), bVals = b.split('.:.'), arr = sorter._keyArr, count = arr.length, index, sortType, castType; for (index = 0; index < count; index++) { sortType = arr[index]; castType = typeof sharedPathSolver.get(obj, sortType.path); if (castType === 'number') { aVals[index] = Number(aVals[index]); bVals[index] = Number(bVals[index]); } // Check for non-equal items if (aVals[index] !== bVals[index]) { // Return the sorted items if (sortType.value === 1) { return sorter.sortAsc(aVals[index], bVals[index]); } if (sortType.value === -1) { return sorter.sortDesc(aVals[index], bVals[index]); } } } }; /** * Inserts a document into the active bucket. * @param {object} obj The document to insert. * @returns {number} The index the document now occupies. */ ActiveBucket.prototype.insert = function (obj) { var key, keyIndex; key = this.documentKey(obj); keyIndex = this._data.indexOf(key); if (keyIndex === -1) { // Insert key keyIndex = this.qs(obj, this._data, key, this._sortFunc); this._data.splice(keyIndex, 0, key); } else { this._data.splice(keyIndex, 0, key); } this._objLookup[obj[this._primaryKey]] = key; this._count++; return keyIndex; }; /** * Removes a document from the active bucket. * @param {object} obj The document to remove. * @returns {boolean} True if the document was removed * successfully or false if it wasn't found in the active * bucket. */ ActiveBucket.prototype.remove = function (obj) { var key, keyIndex; key = this._objLookup[obj[this._primaryKey]]; if (key) { keyIndex = this._data.indexOf(key); if (keyIndex > -1) { this._data.splice(keyIndex, 1); delete this._objLookup[obj[this._primaryKey]]; this._count--; return true; } else { return false; } } return false; }; /** * Get the index that the passed document currently occupies * or the index it will occupy if added to the active bucket. * @param {object} obj The document to get the index for. * @returns {number} The index. */ ActiveBucket.prototype.index = function (obj) { var key, keyIndex; key = this.documentKey(obj); keyIndex = this._data.indexOf(key); if (keyIndex === -1) { // Get key index keyIndex = this.qs(obj, this._data, key, this._sortFunc); } return keyIndex; }; /** * The key that represents the passed document. * @param {object} obj The document to get the key for. * @returns {string} The document key. */ ActiveBucket.prototype.documentKey = function (obj) { var key = '', arr = this._keyArr, count = arr.length, index, sortType; for (index = 0; index < count; index++) { sortType = arr[index]; if (key) { key += '.:.'; } key += sharedPathSolver.get(obj, sortType.path); } // Add the unique identifier on the end of the key key += '.:.' + obj[this._primaryKey]; return key; }; /** * Get the number of documents currently indexed in the active * bucket instance. * @returns {number} The number of documents. */ ActiveBucket.prototype.count = function () { return this._count; }; Shared.finishModule('ActiveBucket'); module.exports = ActiveBucket; },{"./Path":35,"./Shared":41}],4:[function(_dereq_,module,exports){ "use strict"; var Shared, ReactorIO, Collection, CollectionInit, Db, DbInit, BinaryLog; Shared = _dereq_('./Shared'); BinaryLog = function () { this.init.apply(this, arguments); }; BinaryLog.prototype.init = function (parent) { var self = this; self._logCounter = 0; self._parent = parent; self.size(1000); }; Shared.addModule('BinaryLog', BinaryLog); Shared.mixin(BinaryLog.prototype, 'Mixin.Common'); Shared.mixin(BinaryLog.prototype, 'Mixin.ChainReactor'); Shared.mixin(BinaryLog.prototype, 'Mixin.Events'); Collection = Shared.modules.Collection; Db = Shared.modules.Db; ReactorIO = Shared.modules.ReactorIO; CollectionInit = Collection.prototype.init; DbInit = Db.prototype.init; Shared.synthesize(BinaryLog.prototype, 'name'); Shared.synthesize(BinaryLog.prototype, 'size'); BinaryLog.prototype.attachIO = function () { var self = this; if (!self._io) { self._log = new Collection(self._parent.name() + '-BinaryLog', {capped: true, size: self.size()}); // Override the log collection's id generator so it is linear self._log.objectId = function (id) { if (!id) { id = ++self._logCounter; } return id; }; self._io = new ReactorIO(self._parent, self, function (chainPacket) { self._log.insert({ type: chainPacket.type, data: chainPacket.data }); // Returning false informs the chain reactor to continue propagation // of the chain packet down the graph tree return false; }); } }; BinaryLog.prototype.detachIO = function () { var self = this; if (self._io) { self._log.drop(); self._io.drop(); delete self._log; delete self._io; } }; Collection.prototype.init = function () { CollectionInit.apply(this, arguments); this._binaryLog = new BinaryLog(this); }; Shared.finishModule('BinaryLog'); module.exports = BinaryLog; },{"./Shared":41}],5:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'), sharedPathSolver = new Path(); var BinaryTree = function (data, compareFunc, hashFunc) { this.init.apply(this, arguments); }; BinaryTree.prototype.init = function (data, index, primaryKey, compareFunc, hashFunc) { this._store = []; this._keys = []; if (primaryKey !== undefined) { this.primaryKey(primaryKey); } if (index !== undefined) { this.index(index); } if (compareFunc !== undefined) { this.compareFunc(compareFunc); } if (hashFunc !== undefined) { this.hashFunc(hashFunc); } if (data !== undefined) { this.data(data); } }; Shared.addModule('BinaryTree', BinaryTree); Shared.mixin(BinaryTree.prototype, 'Mixin.ChainReactor'); Shared.mixin(BinaryTree.prototype, 'Mixin.Sorting'); Shared.mixin(BinaryTree.prototype, 'Mixin.Common'); Shared.synthesize(BinaryTree.prototype, 'compareFunc'); Shared.synthesize(BinaryTree.prototype, 'hashFunc'); Shared.synthesize(BinaryTree.prototype, 'indexDir'); Shared.synthesize(BinaryTree.prototype, 'primaryKey'); Shared.synthesize(BinaryTree.prototype, 'keys'); Shared.synthesize(BinaryTree.prototype, 'index', function (index) { if (index !== undefined) { if (this.debug()) { console.log('Setting index', index, sharedPathSolver.parse(index, true)); } // Convert the index object to an array of key val objects this.keys(sharedPathSolver.parse(index, true)); } return this.$super.call(this, index); }); /** * Remove all data from the binary tree. */ BinaryTree.prototype.clear = function () { delete this._data; delete this._left; delete this._right; this._store = []; }; /** * Sets this node's data object. All further inserted documents that * match this node's key and value will be pushed via the push() * method into the this._store array. When deciding if a new data * should be created left, right or middle (pushed) of this node the * new data is checked against the data set via this method. * @param val * @returns {*} */ BinaryTree.prototype.data = function (val) { if (val !== undefined) { this._data = val; if (this._hashFunc) { this._hash = this._hashFunc(val); } return this; } return this._data; }; /** * Pushes an item to the binary tree node's store array. * @param {*} val The item to add to the store. * @returns {*} */ BinaryTree.prototype.push = function (val) { if (val !== undefined) { this._store.push(val); return this; } return false; }; /** * Pulls an item from the binary tree node's store array. * @param {*} val The item to remove from the store. * @returns {*} */ BinaryTree.prototype.pull = function (val) { if (val !== undefined) { var index = this._store.indexOf(val); if (index > -1) { this._store.splice(index, 1); return this; } } return false; }; /** * Default compare method. Can be overridden. * @param a * @param b * @returns {number} * @private */ BinaryTree.prototype._compareFunc = function (a, b) { // Loop the index array var i, indexData, result = 0; for (i = 0; i < this._keys.length; i++) { indexData = this._keys[i]; if (indexData.value === 1) { result = this.sortAsc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path)); } else if (indexData.value === -1) { result = this.sortDesc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path)); } if (this.debug()) { console.log('Compared %s with %s order %d in path %s and result was %d', sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path), indexData.value, indexData.path, result); } if (result !== 0) { if (this.debug()) { console.log('Retuning result %d', result); } return result; } } if (this.debug()) { console.log('Retuning result %d', result); } return result; }; /** * Default hash function. Can be overridden. * @param obj * @private */ BinaryTree.prototype._hashFunc = function (obj) { /*var i, indexData, hash = ''; for (i = 0; i < this._keys.length; i++) { indexData = this._keys[i]; if (hash) { hash += '_'; } hash += obj[indexData.path]; } return hash;*/ return obj[this._keys[0].path]; }; /** * Removes (deletes reference to) either left or right child if the passed * node matches one of them. * @param {BinaryTree} node The node to remove. */ BinaryTree.prototype.removeChildNode = function (node) { if (this._left === node) { // Remove left delete this._left; } else if (this._right === node) { // Remove right delete this._right; } }; /** * Returns the branch this node matches (left or right). * @param node * @returns {String} */ BinaryTree.prototype.nodeBranch = function (node) { if (this._left === node) { return 'left'; } else if (this._right === node) { return 'right'; } }; /** * Inserts a document into the binary tree. * @param data * @returns {*} */ BinaryTree.prototype.insert = function (data) { var result, inserted, failed, i; if (data instanceof Array) { // Insert array of data inserted = []; failed = []; for (i = 0; i < data.length; i++) { if (this.insert(data[i])) { inserted.push(data[i]); } else { failed.push(data[i]); } } return { inserted: inserted, failed: failed }; } if (this.debug()) { console.log('Inserting', data); } if (!this._data) { if (this.debug()) { console.log('Node has no data, setting data', data); } // Insert into this node (overwrite) as there is no data this.data(data); //this.push(data); return true; } result = this._compareFunc(this._data, data); if (result === 0) { if (this.debug()) { console.log('Data is equal (currrent, new)', this._data, data); } //this.push(data); // Less than this node if (this._left) { // Propagate down the left branch this._left.insert(data); } else { // Assign to left branch this._left = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc); this._left._parent = this; } return true; } if (result === -1) { if (this.debug()) { console.log('Data is greater (currrent, new)', this._data, data); } // Greater than this node if (this._right) { // Propagate down the right branch this._right.insert(data); } else { // Assign to right branch this._right = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc); this._right._parent = this; } return true; } if (result === 1) { if (this.debug()) { console.log('Data is less (currrent, new)', this._data, data); } // Less than this node if (this._left) { // Propagate down the left branch this._left.insert(data); } else { // Assign to left branch this._left = new BinaryTree(data, this._index, this._binaryTree, this._compareFunc, this._hashFunc); this._left._parent = this; } return true; } return false; }; BinaryTree.prototype.remove = function (data) { var pk = this.primaryKey(), result, removed, i; if (data instanceof Array) { // Insert array of data removed = []; for (i = 0; i < data.length; i++) { if (this.remove(data[i])) { removed.push(data[i]); } } return removed; } if (this.debug()) { console.log('Removing', data); } if (this._data[pk] === data[pk]) { // Remove this node return this._remove(this); } // Compare the data to work out which branch to send the remove command down result = this._compareFunc(this._data, data); if (result === -1 && this._right) { return this._right.remove(data); } if (result === 1 && this._left) { return this._left.remove(data); } return false; }; BinaryTree.prototype._remove = function (node) { var leftNode, rightNode; if (this._left) { // Backup branch data leftNode = this._left; rightNode = this._right; // Copy data from left node this._left = leftNode._left; this._right = leftNode._right; this._data = leftNode._data; this._store = leftNode._store; if (rightNode) { // Attach the rightNode data to the right-most node // of the leftNode leftNode.rightMost()._right = rightNode; } } else if (this._right) { // Backup branch data rightNode = this._right; // Copy data from right node this._left = rightNode._left; this._right = rightNode._right; this._data = rightNode._data; this._store = rightNode._store; } else { this.clear(); } return true; }; BinaryTree.prototype.leftMost = function () { if (!this._left) { return this; } else { return this._left.leftMost(); } }; BinaryTree.prototype.rightMost = function () { if (!this._right) { return this; } else { return this._right.rightMost(); } }; /** * Searches the binary tree for all matching documents based on the data * passed (query). * @param {Object} data The data / document to use for lookups. * @param {Object} options An options object. * @param {Operation} op An optional operation instance. Pass undefined * if not being used. * @param {Array=} resultArr The results passed between recursive calls. * Do not pass anything into this argument when calling externally. * @returns {*|Array} */ BinaryTree.prototype.lookup = function (data, options, op, resultArr) { var result = this._compareFunc(this._data, data); resultArr = resultArr || []; if (result === 0) { if (this._left) { this._left.lookup(data, options, op, resultArr); } resultArr.push(this._data); if (this._right) { this._right.lookup(data, options, op, resultArr); } } if (result === -1) { if (this._right) { this._right.lookup(data, options, op, resultArr); } } if (result === 1) { if (this._left) { this._left.lookup(data, options, op, resultArr); } } return resultArr; }; /** * Returns the entire binary tree ordered. * @param {String} type * @param resultArr * @returns {*|Array} */ BinaryTree.prototype.inOrder = function (type, resultArr) { resultArr = resultArr || []; if (this._left) { this._left.inOrder(type, resultArr); } switch (type) { case 'hash': resultArr.push(this._hash); break; case 'data': resultArr.push(this._data); break; default: resultArr.push({ key: this._data, arr: this._store }); break; } if (this._right) { this._right.inOrder(type, resultArr); } return resultArr; }; /** * Searches the binary tree for all matching documents based on the regular * expression passed. * @param path * @param val * @param regex * @param {Array=} resultArr The results passed between recursive calls. * Do not pass anything into this argument when calling externally. * @returns {*|Array} */ BinaryTree.prototype.startsWith = function (path, val, regex, resultArr) { var reTest, thisDataPathVal = sharedPathSolver.get(this._data, path), thisDataPathValSubStr = thisDataPathVal.substr(0, val.length), result; //regex = regex || new RegExp('^' + val); resultArr = resultArr || []; if (resultArr._visitedCount === undefined) { resultArr._visitedCount = 0; } resultArr._visitedCount++; resultArr._visitedNodes = resultArr._visitedNodes || []; resultArr._visitedNodes.push(thisDataPathVal); result = this.sortAsc(thisDataPathValSubStr, val); reTest = thisDataPathValSubStr === val; if (result === 0) { if (this._left) { this._left.startsWith(path, val, regex, resultArr); } if (reTest) { resultArr.push(this._data); } if (this._right) { this._right.startsWith(path, val, regex, resultArr); } } if (result === -1) { if (reTest) { resultArr.push(this._data); } if (this._right) { this._right.startsWith(path, val, regex, resultArr); } } if (result === 1) { if (this._left) { this._left.startsWith(path, val, regex, resultArr); } if (reTest) { resultArr.push(this._data); } } return resultArr; }; /*BinaryTree.prototype.find = function (type, search, resultArr) { resultArr = resultArr || []; if (this._left) { this._left.find(type, search, resultArr); } // Check if this node's data is greater or less than the from value var fromResult = this.sortAsc(this._data[key], from), toResult = this.sortAsc(this._data[key], to); if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) { // This data node is greater than or equal to the from value, // and less than or equal to the to value so include it switch (type) { case 'hash': resultArr.push(this._hash); break; case 'data': resultArr.push(this._data); break; default: resultArr.push({ key: this._data, arr: this._store }); break; } } if (this._right) { this._right.find(type, search, resultArr); } return resultArr; };*/ /** * * @param {String} type * @param {String} key The data key / path to range search against. * @param {Number} from Range search from this value (inclusive) * @param {Number} to Range search to this value (inclusive) * @param {Array=} resultArr Leave undefined when calling (internal use), * passes the result array between recursive calls to be returned when * the recursion chain completes. * @param {Path=} pathResolver Leave undefined when calling (internal use), * caches the path resolver instance for performance. * @returns {Array} Array of matching document objects */ BinaryTree.prototype.findRange = function (type, key, from, to, resultArr, pathResolver) { resultArr = resultArr || []; pathResolver = pathResolver || new Path(key); if (this._left) { this._left.findRange(type, key, from, to, resultArr, pathResolver); } // Check if this node's data is greater or less than the from value var pathVal = pathResolver.value(this._data), fromResult = this.sortAsc(pathVal, from), toResult = this.sortAsc(pathVal, to); if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) { // This data node is greater than or equal to the from value, // and less than or equal to the to value so include it switch (type) { case 'hash': resultArr.push(this._hash); break; case 'data': resultArr.push(this._data); break; default: resultArr.push({ key: this._data, arr: this._store }); break; } } if (this._right) { this._right.findRange(type, key, from, to, resultArr, pathResolver); } return resultArr; }; /*BinaryTree.prototype.findRegExp = function (type, key, pattern, resultArr) { resultArr = resultArr || []; if (this._left) { this._left.findRegExp(type, key, pattern, resultArr); } // Check if this node's data is greater or less than the from value var fromResult = this.sortAsc(this._data[key], from), toResult = this.sortAsc(this._data[key], to); if ((fromResult === 0 || fromResult === 1) && (toResult === 0 || toResult === -1)) { // This data node is greater than or equal to the from value, // and less than or equal to the to value so include it switch (type) { case 'hash': resultArr.push(this._hash); break; case 'data': resultArr.push(this._data); break; default: resultArr.push({ key: this._data, arr: this._store }); break; } } if (this._right) { this._right.findRegExp(type, key, pattern, resultArr); } return resultArr; };*/ /** * Determines if the passed query and options object will be served * by this index successfully or not and gives a score so that the * DB search system can determine how useful this index is in comparison * to other indexes on the same collection. * @param query * @param queryOptions * @param matchOptions * @returns {{matchedKeys: Array, totalKeyCount: Number, score: number}} */ BinaryTree.prototype.match = function (query, queryOptions, matchOptions) { // Check if the passed query has data in the keys our index // operates on and if so, is the query sort matching our order var indexKeyArr, queryArr, matchedKeys = [], matchedKeyCount = 0, i; indexKeyArr = sharedPathSolver.parseArr(this._index, { verbose: true }); queryArr = sharedPathSolver.parseArr(query, matchOptions && matchOptions.pathOptions ? matchOptions.pathOptions : { ignore:/\$/, verbose: true }); // Loop the query array and check the order of keys against the // index key array to see if this index can be used for (i = 0; i < indexKeyArr.length; i++) { if (queryArr[i] === indexKeyArr[i]) { matchedKeyCount++; matchedKeys.push(queryArr[i]); } } return { matchedKeys: matchedKeys, totalKeyCount: queryArr.length, score: matchedKeyCount }; //return sharedPathSolver.countObjectPaths(this._keys, query); }; Shared.finishModule('BinaryTree'); module.exports = BinaryTree; },{"./Path":35,"./Shared":41}],6:[function(_dereq_,module,exports){ "use strict"; var crcTable, checksum; crcTable = (function () { var crcTable = [], c, n, k; for (n = 0; n < 256; n++) { c = n; for (k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); // jshint ignore:line } crcTable[n] = c; } return crcTable; }()); /** * Returns a checksum of a string. * @param {String} str The string to checksum. * @return {Number} The checksum generated. */ checksum = function(str) { var crc = 0 ^ (-1), // jshint ignore:line i; for (i = 0; i < str.length; i++) { crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF]; // jshint ignore:line } return (crc ^ (-1)) >>> 0; // jshint ignore:line }; module.exports = checksum; },{}],7:[function(_dereq_,module,exports){ "use strict"; var Shared, Db, Metrics, KeyValueStore, Path, IndexHashMap, IndexBinaryTree, Index2d, Overload, ReactorIO, Condition, sharedPathSolver; Shared = _dereq_('./Shared'); /** * Creates a new collection. Collections store multiple documents and * handle CRUD against those documents. * @constructor */ var Collection = function (name, options) { this.init.apply(this, arguments); }; Collection.prototype.init = function (name, options) { this.sharedPathSolver = sharedPathSolver; this._primaryKey = '_id'; this._primaryIndex = new KeyValueStore('primary'); this._primaryCrc = new KeyValueStore('primaryCrc'); this._crcLookup = new KeyValueStore('crcLookup'); this._name = name; this._data = []; this._metrics = new Metrics(); this._options = options || { changeTimestamp: false }; if (this._options.db) { this.db(this._options.db); } // Create an object to store internal protected data this._metaData = {}; this._deferQueue = { insert: [], update: [], remove: [], upsert: [], async: [] }; this._deferThreshold = { insert: 100, update: 100, remove: 100, upsert: 100 }; this._deferTime = { insert: 1, update: 1, remove: 1, upsert: 1 }; this._deferredCalls = true; // Set the subset to itself since it is the root collection this.subsetOf(this); }; Shared.addModule('Collection', Collection); Shared.mixin(Collection.prototype, 'Mixin.Common'); Shared.mixin(Collection.prototype, 'Mixin.Events'); Shared.mixin(Collection.prototype, 'Mixin.ChainReactor'); Shared.mixin(Collection.prototype, 'Mixin.CRUD'); Shared.mixin(Collection.prototype, 'Mixin.Constants'); Shared.mixin(Collection.prototype, 'Mixin.Triggers'); Shared.mixin(Collection.prototype, 'Mixin.Sorting'); Shared.mixin(Collection.prototype, 'Mixin.Matching'); Shared.mixin(Collection.prototype, 'Mixin.Updating'); Shared.mixin(Collection.prototype, 'Mixin.Tags'); Metrics = _dereq_('./Metrics'); KeyValueStore = _dereq_('./KeyValueStore'); Path = _dereq_('./Path'); IndexHashMap = _dereq_('./IndexHashMap'); IndexBinaryTree = _dereq_('./IndexBinaryTree'); Index2d = _dereq_('./Index2d'); Db = Shared.modules.Db; Overload = _dereq_('./Overload'); ReactorIO = _dereq_('./ReactorIO'); Condition = _dereq_('./Condition'); sharedPathSolver = new Path(); /** * Gets / sets the deferred calls flag. If set to true (default) * then operations on large data sets can be broken up and done * over multiple CPU cycles (creating an async state). For purely * synchronous behaviour set this to false. * @param {Boolean=} val The value to set. * @returns {Boolean} */ Shared.synthesize(Collection.prototype, 'deferredCalls'); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'state'); /** * Gets / sets the name of the collection. * @param {String=} val The name of the collection to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'name'); /** * Gets / sets the metadata stored in the collection. * @param {Object=} val The data to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'metaData'); /** * Gets / sets boolean to determine if the collection should be * capped or not. * @param {Boolean=} val The value to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'capped'); /** * Gets / sets capped collection size. This is the maximum number * of records that the capped collection will store. * @param {Number=} val The value to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'cappedSize'); /** * Adds a job id to the async queue to signal to other parts * of the application that some async work is currently being * done. * @param {String} key The id of the async job. * @private */ Collection.prototype._asyncPending = function (key) { this._deferQueue.async.push(key); }; /** * Removes a job id from the async queue to signal to other * parts of the application that some async work has been * completed. If no further async jobs exist on the queue then * the "ready" event is emitted from this collection instance. * @param {String} key The id of the async job. * @private */ Collection.prototype._asyncComplete = function (key) { // Remove async flag for this type var index = this._deferQueue.async.indexOf(key); while (index > -1) { this._deferQueue.async.splice(index, 1); index = this._deferQueue.async.indexOf(key); } if (this._deferQueue.async.length === 0) { this.deferEmit('ready'); } }; /** * Get the data array that represents the collection's data. * This data is returned by reference and should not be altered outside * of the provided CRUD functionality of the collection as doing so * may cause unstable index behaviour within the collection. * @returns {Array} */ Collection.prototype.data = function () { return this._data; }; /** * Drops a collection and all it's stored data from the database. * @param {Function=} callback A callback method to call once the * operation has completed. * @returns {boolean} True on success, false on failure. */ Collection.prototype.drop = function (callback) { var key; if (!this.isDropped()) { if (this._db && this._db._collection && this._name) { if (this.debug()) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; this.emit('drop', this); delete this._db._collection[this._name]; // Remove any reactor IO chain links if (this._collate) { for (key in this._collate) { if (this._collate.hasOwnProperty(key)) { this.collateRemove(key); } } } delete this._primaryKey; delete this._primaryIndex; delete this._primaryCrc; delete this._crcLookup; delete this._data; delete this._metrics; delete this._listeners; if (callback) { callback.call(this, false, true); } return true; } } else { if (callback) { callback.call(this, false, true); } return true; } if (callback) { callback.call(this, false, true); } return false; }; /** * Gets / sets the primary key for this collection. * @param {String=} keyName The name of the primary key. * @returns {*} */ Collection.prototype.primaryKey = function (keyName) { if (keyName !== undefined) { if (this._primaryKey !== keyName) { var oldKey = this._primaryKey; this._primaryKey = keyName; // Set the primary key index primary key this._primaryIndex.primaryKey(keyName); // Rebuild the primary key index this.rebuildPrimaryKeyIndex(); // Propagate change down the chain this.chainSend('primaryKey', { keyName: keyName, oldData: oldKey }); } return this; } return this._primaryKey; }; /** * Handles insert events and routes changes to binds and views as required. * @param {Array} inserted An array of inserted documents. * @param {Array} failed An array of documents that failed to insert. * @private */ Collection.prototype._onInsert = function (inserted, failed) { this.emit('insert', inserted, failed); }; /** * Handles update events and routes changes to binds and views as required. * @param {Array} items An array of updated documents. * @private */ Collection.prototype._onUpdate = function (items) { this.emit('update', items); }; /** * Handles remove events and routes changes to binds and views as required. * @param {Array} items An array of removed documents. * @private */ Collection.prototype._onRemove = function (items) { this.emit('remove', items); }; /** * Handles any change to the collection by updating the * lastChange timestamp on the collection's metaData. This * only happens if the changeTimestamp option is enabled * on the collection (it is disabled by default). * @private */ Collection.prototype._onChange = function () { if (this._options.changeTimestamp) { // Record the last change timestamp this._metaData.lastChange = this.serialiser.convert(new Date()); } }; /** * Gets / sets the db instance this class instance belongs to. * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(Collection.prototype, 'db', function (db) { if (db) { if (this.primaryKey() === '_id') { // Set primary key to the db's key by default this.primaryKey(db.primaryKey()); // Apply the same debug settings this.debug(db.debug()); } } return this.$super.apply(this, arguments); }); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Collection.prototype, 'mongoEmulation'); Collection.prototype.setData = new Overload('Collection.prototype.setData', { /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. */ '*': function (data) { return this.$main.call(this, data, {}); }, /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param {Object} options Optional options object. */ '*, object': function (data, options) { return this.$main.call(this, data, options); }, /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param {Function} callback Optional callback function. */ '*, function': function (data, callback) { return this.$main.call(this, data, {}, callback); }, /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param {*} options Optional options object. * @param {Function} callback Optional callback function. */ '*, *, function': function (data, options, callback) { return this.$main.call(this, data, options, callback); }, /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param {*} options Optional options object. * @param {*} callback Optional callback function. */ '*, *, *': function (data, options, callback) { return this.$main.call(this, data, options, callback); }, /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set via the remove() method, and the remove event will * fire as well. * @name setData * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param {Object} options Optional options object. * @param {Function} callback Optional callback function. */ '$main': function (data, options, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (data) { var deferredSetting = this.deferredCalls(), oldData = [].concat(this._data); // Switch off deferred calls since setData should be // a synchronous call this.deferredCalls(false); options = this.options(options); if (options.$decouple) { data = this.decouple(data); } if (!(data instanceof Array)) { data = [data]; } // Remove all items from the collection this.remove({}); // Insert the new data this.insert(data); // Switch deferred calls back to previous settings this.deferredCalls(deferredSetting); this._onChange(); this.emit('setData', this._data, oldData); } if (callback) { callback.call(this); } return this; } }); /** * Drops and rebuilds the primary key index for all documents * in the collection. * @param {Object=} options An optional options object. * @private */ Collection.prototype.rebuildPrimaryKeyIndex = function (options) { options = options || { $ensureKeys: undefined, $violationCheck: undefined }; var ensureKeys = options && options.$ensureKeys !== undefined ? options.$ensureKeys : true, violationCheck = options && options.$violationCheck !== undefined ? options.$violationCheck : true, arr, arrCount, arrItem, pIndex = this._primaryIndex, crcIndex = this._primaryCrc, crcLookup = this._crcLookup, pKey = this._primaryKey, jString; // Drop the existing primary index pIndex.truncate(); crcIndex.truncate(); crcLookup.truncate(); // Loop the data and check for a primary key in each object arr = this._data; arrCount = arr.length; while (arrCount--) { arrItem = arr[arrCount]; if (ensureKeys) { // Make sure the item has a primary key this.ensurePrimaryKey(arrItem); } if (violationCheck) { // Check for primary key violation if (!pIndex.uniqueSet(arrItem[pKey], arrItem)) { // Primary key violation throw(this.logIdentifier() + ' Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: ' + arrItem[this._primaryKey]); } } else { pIndex.set(arrItem[pKey], arrItem); } // Generate a hash string jString = this.hash(arrItem); crcIndex.set(arrItem[pKey], jString); crcLookup.set(jString, arrItem); } }; /** * Checks for a primary key on the document and assigns one if none * currently exists. * @param {Object} obj The object to check a primary key against. * @private */ Collection.prototype.ensurePrimaryKey = function (obj) { if (obj[this._primaryKey] === undefined) { // Assign a primary key automatically obj[this._primaryKey] = this.objectId(); } }; /** * Clears all data from the collection. * @returns {Collection} */ Collection.prototype.truncate = function () { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } // TODO: This should use remove so that chain reactor events are properly // TODO: handled, but ensure that chunking is switched off this.emit('truncate', this._data); // Clear all the data from the collection this._data.length = 0; // Re-create the primary index data this._primaryIndex = new KeyValueStore('primary'); this._primaryCrc = new KeyValueStore('primaryCrc'); this._crcLookup = new KeyValueStore('crcLookup'); this._onChange(); this.emit('immediateChange', {type: 'truncate'}); this.deferEmit('change', {type: 'truncate'}); return this; }; /** * Inserts a new document or updates an existing document in a * collection depending on if a matching primary key exists in * the collection already or not. * * If the document contains a primary key field (based on the * collections's primary key) then the database will search for * an existing document with a matching id. If a matching * document is found, the document will be updated. Any keys that * match keys on the existing document will be overwritten with * new data. Any keys that do not currently exist on the document * will be added to the document. * * If the document does not contain an id or the id passed does * not match an existing document, an insert is performed instead. * If no id is present a new primary key id is provided for the * document and the document is inserted. * * @param {Object} obj The document object to upsert or an array * containing documents to upsert. * @param {Function=} callback Optional callback method. * @returns {Object} An object containing two keys, "op" contains * either "insert" or "update" depending on the type of operation * that was performed and "result" contains the return data from * the operation used. */ Collection.prototype.upsert = function (obj, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (obj) { var queue = this._deferQueue.upsert, deferThreshold = this._deferThreshold.upsert, returnData = {}, query, i; // Determine if the object passed is an array or not if (obj instanceof Array) { if (this._deferredCalls && obj.length > deferThreshold) { // Break up upsert into blocks this._deferQueue.upsert = queue.concat(obj); this._asyncPending('upsert'); // Fire off the insert queue handler this.processQueue('upsert', callback); return {}; } else { // Loop the array and upsert each item returnData = []; for (i = 0; i < obj.length; i++) { returnData.push(this.upsert(obj[i])); } if (callback) { callback.call(this); } return returnData; } } // Determine if the operation is an insert or an update if (obj[this._primaryKey]) { // Check if an object with this primary key already exists query = {}; query[this._primaryKey] = obj[this._primaryKey]; if (this._primaryIndex.lookup(query)[0]) { // The document already exists with this id, this operation is an update returnData.op = 'update'; } else { // No document with this id exists, this operation is an insert returnData.op = 'insert'; } } else { // The document passed does not contain an id, this operation is an insert returnData.op = 'insert'; } switch (returnData.op) { case 'insert': returnData.result = this.insert(obj, callback); break; case 'update': returnData.result = this.update(query, obj, {}, callback); break; default: break; } return returnData; } else { if (callback) { callback.call(this); } } return {}; }; /** * Executes a method against each document that matches query and returns an * array of documents that may have been modified by the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the results. * @param {Object=} options Optional options object. * @returns {Array} */ Collection.prototype.filter = function (query, func, options) { return (this.find(query, options)).filter(func); }; /** * Executes a method against each document that matches query and then executes * an update based on the return data of the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the update. * @param {Object=} options Optional options object passed to the initial find call. * @returns {Array} */ Collection.prototype.filterUpdate = function (query, func, options) { var items = this.find(query, options), results = [], singleItem, singleQuery, singleUpdate, pk = this.primaryKey(), i; for (i = 0; i < items.length; i++) { singleItem = items[i]; singleUpdate = func(singleItem); if (singleUpdate) { singleQuery = {}; singleQuery[pk] = singleItem[pk]; results.push(this.update(singleQuery, singleUpdate)); } } return results; }; /** * Modifies an existing document or documents in a collection. * This will update all matches for 'query' with the data held * in 'update'. It will not overwrite the matched documents * with the update document. * * @param {Object} query The query that must be matched for a * document to be operated on. * @param {Object} update The object containing updated * key/values. Any keys that match keys on the existing document * will be overwritten with this data. Any keys that do not * currently exist on the document will be added to the document. * @param {Object=} options An options object. * @param {Function=} callback The callback method to call when * the update is complete. * @returns {Array} The items that were updated. */ Collection.prototype.update = function (query, update, options, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); this.convertToFdb(update); } else { // Decouple the update data update = this.decouple(update); } // Handle transform update = this.transformIn(update); return this._handleUpdate(query, update, options, callback); }; /** * Handles the update operation that was initiated by a call to update(). * @param {Object} query The query that must be matched for a * document to be operated on. * @param {Object} update The object containing updated * key/values. Any keys that match keys on the existing document * will be overwritten with this data. Any keys that do not * currently exist on the document will be added to the document. * @param {Object=} options An options object. * @param {Function=} callback The callback method to call when * the update is complete. * @returns {Array} The items that were updated. * @private */ Collection.prototype._handleUpdate = function (query, update, options, callback) { var self = this, op = this._metrics.create('update'), dataSet, updated, updateCall = function (referencedDoc) { var oldDoc = self.decouple(referencedDoc), newDoc, triggerOperation, result; if (self.willTrigger(self.TYPE_UPDATE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_UPDATE, self.PHASE_AFTER)) { newDoc = self.decouple(referencedDoc); triggerOperation = { type: 'update', query: self.decouple(query), update: self.decouple(update), options: self.decouple(options), op: op }; // Update newDoc with the update criteria so we know what the data will look // like AFTER the update is processed result = self.updateObject(newDoc, triggerOperation.update, triggerOperation.query, triggerOperation.options, ''); if (self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_BEFORE, referencedDoc, newDoc) !== false) { // No triggers complained so let's execute the replacement of the existing // object with the new one result = self.updateObject(referencedDoc, newDoc, triggerOperation.query, triggerOperation.options, ''); // NOTE: If for some reason we would only like to fire this event if changes are actually going // to occur on the object from the proposed update then we can add "result &&" to the if self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_AFTER, oldDoc, newDoc); } else { // Trigger cancelled operation so tell result that it was not updated result = false; } } else { // No triggers complained so let's execute the replacement of the existing // object with the new one result = self.updateObject(referencedDoc, update, query, options, ''); } // Inform indexes of the change self._updateIndexes(oldDoc, referencedDoc); return result; }; op.start(); op.time('Retrieve documents to update'); dataSet = this.find(query, {$decouple: false}); op.time('Retrieve documents to update'); if (dataSet.length) { op.time('Update documents'); updated = dataSet.filter(updateCall); op.time('Update documents'); if (updated.length) { if (this.debug()) { console.log(this.logIdentifier() + ' Updated some data'); } op.time('Resolve chains'); if (this.chainWillSend()) { this.chainSend('update', { query: query, update: update, dataSet: this.decouple(updated) }, options); } op.time('Resolve chains'); this._onUpdate(updated); this._onChange(); if (callback) { callback.call(this); } this.emit('immediateChange', {type: 'update', data: updated}); this.deferEmit('change', {type: 'update', data: updated}); } } op.stop(); // TODO: Should we decouple the updated array before return by default? return updated || []; }; /** * Replaces an existing object with data from the new object without * breaking data references. It does this by removing existing keys * from the base object and then adding the passed object's keys to * the existing base object, thereby maintaining any references to * the existing base object but effectively replacing the object with * the new one. * @param {Object} currentObj The base object to alter. * @param {Object} newObj The new object to overwrite the existing one * with. * @returns {*} Chain. * @private */ Collection.prototype._replaceObj = function (currentObj, newObj) { var i; // Check if the new document has a different primary key value from the existing one // Remove item from indexes this._removeFromIndexes(currentObj); // Remove existing keys from current object for (i in currentObj) { if (currentObj.hasOwnProperty(i)) { delete currentObj[i]; } } // Add new keys to current object for (i in newObj) { if (newObj.hasOwnProperty(i)) { currentObj[i] = newObj[i]; } } // Update the item in the primary index if (!this._insertIntoIndexes(currentObj)) { throw(this.logIdentifier() + ' Primary key violation in update! Key violated: ' + currentObj[this._primaryKey]); } // Update the object in the collection data //this._data.splice(this._data.indexOf(currentObj), 1, newObj); return this; }; /** * Helper method to update a document via it's id. * @param {String} id The id of the document. * @param {Object} update The object containing the key/values to * update to. * @returns {Object} The document that was updated or undefined * if no document was updated. */ Collection.prototype.updateById = function (id, update) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.update(searchObj, update)[0]; }; /** * Internal method for document updating. * @param {Object} doc The document to update. * @param {Object} update The object with key/value pairs to update * the document with. * @param {Object} query The query object that we need to match to * perform an update. * @param {Object} options An options object. * @param {String} path The current recursive path. * @param {String} opType The type of update operation to perform, * if none is specified default is to set new data against matching * fields. * @returns {Boolean} True if the document was updated with new / * changed data or false if it was not updated because the data was * the same. * @private */ Collection.prototype.updateObject = function (doc, update, query, options, path, opType) { // TODO: This method is long, try to break it into smaller pieces update = this.decouple(update); // Clear leading dots from path path = path || ''; if (path.substr(0, 1) === '.') { path = path.substr(1, path.length -1); } //var oldDoc = this.decouple(doc), var updated = false, recurseUpdated = false, operation, tmpArray, tmpIndex, tmpCount, tempIndex, tempKey, replaceObj, pk, pathInstance, sourceIsArray, updateIsArray, i; // Loop each key in the update object for (i in update) { if (update.hasOwnProperty(i)) { // Reset operation flag operation = false; // Check if the property starts with a dollar (function) if (i.substr(0, 1) === '$') { // Check for commands switch (i) { case '$key': case '$index': case '$data': case '$min': case '$max': // Ignore some operators operation = true; break; case '$each': operation = true; // Loop over the array of updates and run each one tmpCount = update.$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { recurseUpdated = this.updateObject(doc, update.$each[tmpIndex], query, options, path); if (recurseUpdated) { updated = true; } } updated = updated || recurseUpdated; break; case '$replace': operation = true; replaceObj = update.$replace; pk = this.primaryKey(); // Loop the existing item properties and compare with // the replacement (never remove primary key) for (tempKey in doc) { if (doc.hasOwnProperty(tempKey) && tempKey !== pk) { if (replaceObj[tempKey] === undefined) { // The new document doesn't have this field, remove it from the doc this._updateUnset(doc, tempKey); updated = true; } } } // Loop the new item props and update the doc for (tempKey in replaceObj) { if (replaceObj.hasOwnProperty(tempKey) && tempKey !== pk) { this._updateOverwrite(doc, tempKey, replaceObj[tempKey]); updated = true; } } break; default: operation = true; // Now run the operation recurseUpdated = this.updateObject(doc, update[i], query, options, path, i); updated = updated || recurseUpdated; break; } } // Check if the key has a .$ at the end, denoting an array lookup if (this._isPositionalKey(i)) { operation = true; // Modify i to be the name of the field i = i.substr(0, i.length - 2); pathInstance = new Path(path + '.' + i); // Check if the key is an array and has items if (doc[i] && doc[i] instanceof Array && doc[i].length) { tmpArray = []; // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], pathInstance.value(query)[0], options, '', {})) { tmpArray.push(tmpIndex); } } // Loop the items that matched and update them for (tmpIndex = 0; tmpIndex < tmpArray.length; tmpIndex++) { recurseUpdated = this.updateObject(doc[i][tmpArray[tmpIndex]], update[i + '.$'], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } } if (!operation) { if (!opType && typeof(update[i]) === 'object') { if (doc[i] !== null && typeof(doc[i]) === 'object') { // Check if we are dealing with arrays sourceIsArray = doc[i] instanceof Array; updateIsArray = update[i] instanceof Array; if (sourceIsArray || updateIsArray) { // Check if the update is an object and the doc is an array if (!updateIsArray && sourceIsArray) { // Update is an object, source is an array so match the array items // with our query object to find the one to update inside this array // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { recurseUpdated = this.updateObject(doc[i][tmpIndex], update[i], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } else { // Either both source and update are arrays or the update is // an array and the source is not, so set source to update if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } } } else { // The doc key is an object so traverse the // update further recurseUpdated = this.updateObject(doc[i], update[i], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } else { if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } } } else { switch (opType) { case '$inc': var doUpdate = true; // Check for a $min / $max operator if (update[i] > 0) { if (update.$max) { // Check current value if (doc[i] >= update.$max) { // Don't update doUpdate = false; } } } else if (update[i] < 0) { if (update.$min) { // Check current value if (doc[i] <= update.$min) { // Don't update doUpdate = false; } } } if (doUpdate) { this._updateIncrement(doc, i, update[i]); updated = true; } break; case '$cast': // Casts a property to the type specified if it is not already // that type. If the cast is an array or an object and the property // is not already that type a new array or object is created and // set to the property, overwriting the previous value switch (update[i]) { case 'array': if (!(doc[i] instanceof Array)) { // Cast to an array this._updateProperty(doc, i, update.$data || []); updated = true; } break; case 'object': if (!(doc[i] instanceof Object) || (doc[i] instanceof Array)) { // Cast to an object this._updateProperty(doc, i, update.$data || {}); updated = true; } break; case 'number': if (typeof doc[i] !== 'number') { // Cast to a number this._updateProperty(doc, i, Number(doc[i])); updated = true; } break; case 'string': if (typeof doc[i] !== 'string') { // Cast to a string this._updateProperty(doc, i, String(doc[i])); updated = true; } break; default: throw(this.logIdentifier() + ' Cannot update cast to unknown type: ' + update[i]); } break; case '$push': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { // Check for a $position modifier with an $each if (update[i].$position !== undefined && update[i].$each instanceof Array) { // Grab the position to insert at tempIndex = update[i].$position; // Loop the each array and push each item tmpCount = update[i].$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { this._updateSplicePush(doc[i], tempIndex + tmpIndex, update[i].$each[tmpIndex]); } } else if (update[i].$each instanceof Array) { // Do a loop over the each to push multiple items tmpCount = update[i].$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { this._updatePush(doc[i], update[i].$each[tmpIndex]); } } else { // Do a standard push this._updatePush(doc[i], update[i]); } updated = true; } else { throw(this.logIdentifier() + ' Cannot push to a key that is not an array! (' + i + ')'); } break; case '$pull': if (doc[i] instanceof Array) { tmpArray = []; // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], update[i], options, '', {})) { tmpArray.push(tmpIndex); } } tmpCount = tmpArray.length; // Now loop the pull array and remove items to be pulled while (tmpCount--) { this._updatePull(doc[i], tmpArray[tmpCount]); updated = true; } } break; case '$pullAll': if (doc[i] instanceof Array) { if (update[i] instanceof Array) { tmpArray = doc[i]; tmpCount = tmpArray.length; if (tmpCount > 0) { // Now loop the pull array and remove items to be pulled while (tmpCount--) { for (tempIndex = 0; tempIndex < update[i].length; tempIndex++) { if (tmpArray[tmpCount] === update[i][tempIndex]) { this._updatePull(doc[i], tmpCount); tmpCount--; updated = true; } } if (tmpCount < 0) { break; } } } } else { throw(this.logIdentifier() + ' Cannot pullAll without being given an array of values to pull! (' + i + ')'); } } break; case '$addToSet': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { // Loop the target array and check for existence of item var targetArr = doc[i], targetArrIndex, targetArrCount = targetArr.length, objHash, addObj = true, optionObj = (options && options.$addToSet), hashMode, pathSolver; // Check if we have an options object for our operation if (update[i].$key) { hashMode = false; pathSolver = new Path(update[i].$key); objHash = pathSolver.value(update[i])[0]; // Remove the key from the object before we add it delete update[i].$key; } else if (optionObj && optionObj.key) { hashMode = false; pathSolver = new Path(optionObj.key); objHash = pathSolver.value(update[i])[0]; } else { objHash = this.jStringify(update[i]); hashMode = true; } for (targetArrIndex = 0; targetArrIndex < targetArrCount; targetArrIndex++) { if (hashMode) { // Check if objects match via a string hash (JSON) if (this.jStringify(targetArr[targetArrIndex]) === objHash) { // The object already exists, don't add it addObj = false; break; } } else { // Check if objects match based on the path if (objHash === pathSolver.value(targetArr[targetArrIndex])[0]) { // The object already exists, don't add it addObj = false; break; } } } if (addObj) { this._updatePush(doc[i], update[i]); updated = true; } } else { throw(this.logIdentifier() + ' Cannot addToSet on a key that is not an array! (' + i + ')'); } break; case '$splicePush': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { tempIndex = update.$index; if (tempIndex !== undefined) { delete update.$index; // Check for out of bounds index if (tempIndex > doc[i].length) { tempIndex = doc[i].length; } this._updateSplicePush(doc[i], tempIndex, update[i]); updated = true; } else { throw(this.logIdentifier() + ' Cannot splicePush without a $index integer value!'); } } else { throw(this.logIdentifier() + ' Cannot splicePush with a key that is not an array! (' + i + ')'); } break; case '$move': if (doc[i] instanceof Array) { // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], update[i], options, '', {})) { var moveToIndex = update.$index; if (moveToIndex !== undefined) { delete update.$index; this._updateSpliceMove(doc[i], tmpIndex, moveToIndex); updated = true; } else { throw(this.logIdentifier() + ' Cannot move without a $index integer value!'); } break; } } } else { throw(this.logIdentifier() + ' Cannot move on a key that is not an array! (' + i + ')'); } break; case '$mul': this._updateMultiply(doc, i, update[i]); updated = true; break; case '$rename': this._updateRename(doc, i, update[i]); updated = true; break; case '$overwrite': this._updateOverwrite(doc, i, update[i]); updated = true; break; case '$unset': this._updateUnset(doc, i); updated = true; break; case '$clear': this._updateClear(doc, i); updated = true; break; case '$pop': if (doc[i] instanceof Array) { if (this._updatePop(doc[i], update[i])) { updated = true; } } else { throw(this.logIdentifier() + ' Cannot pop from a key that is not an array! (' + i + ')'); } break; case '$toggle': // Toggle the boolean property between true and false this._updateProperty(doc, i, !doc[i]); updated = true; break; default: if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } break; } } } } } return updated; }; /** * Determines if the passed key has an array positional mark * (a dollar at the end of its name). * @param {String} key The key to check. * @returns {Boolean} True if it is a positional or false if not. * @private */ Collection.prototype._isPositionalKey = function (key) { return key.substr(key.length - 2, 2) === '.$'; }; /** * Removes any documents from the collection that match the search * query key/values. * @param {Object} query The query object. * @param {Object=} options An options object. * @param {Function=} callback A callback method. * @returns {Array} An array of the documents that were removed. */ Collection.prototype.remove = function (query, options, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } var self = this, dataSet, index, arrIndex, returnArr, removeMethod, triggerOperation, doc, newDoc; if (typeof(options) === 'function') { callback = options; options = {}; } // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); } if (query instanceof Array) { returnArr = []; for (arrIndex = 0; arrIndex < query.length; arrIndex++) { returnArr.push(this.remove(query[arrIndex], {noEmit: true})); } if (!options || (options && !options.noEmit)) { this._onRemove(returnArr); } if (callback) { callback.call(this, false, returnArr); } return returnArr; } else { returnArr = []; dataSet = this.find(query, {$decouple: false}); if (dataSet.length) { removeMethod = function (dataItem) { // Remove the item from the collection's indexes self._removeFromIndexes(dataItem); // Remove data from internal stores index = self._data.indexOf(dataItem); self._dataRemoveAtIndex(index); returnArr.push(dataItem); }; // Remove the data from the collection for (var i = 0; i < dataSet.length; i++) { doc = dataSet[i]; if (self.willTrigger(self.TYPE_REMOVE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_REMOVE, self.PHASE_AFTER)) { triggerOperation = { type: 'remove' }; newDoc = self.decouple(doc); if (self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_BEFORE, newDoc, newDoc) !== false) { // The trigger didn't ask to cancel so execute the removal method removeMethod(doc); self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_AFTER, newDoc, newDoc); } } else { // No triggers to execute removeMethod(doc); } } if (returnArr.length) { //op.time('Resolve chains'); self.chainSend('remove', { query: query, dataSet: returnArr }, options); //op.time('Resolve chains'); if (!options || (options && !options.noEmit)) { this._onRemove(returnArr); } this._onChange(); this.emit('immediateChange', {type: 'remove', data: returnArr}); this.deferEmit('change', {type: 'remove', data: returnArr}); } } if (callback) { callback.call(this, false, returnArr); } return returnArr; } }; /** * Helper method that removes a document that matches the given id. * @param {String} id The id of the document to remove. * @returns {Object} The document that was removed or undefined if * nothing was removed. */ Collection.prototype.removeById = function (id) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.remove(searchObj)[0]; }; /** * Processes a deferred action queue. * @param {String} type The queue name to process. * @param {Function} callback A method to call when the queue has processed. * @param {Object=} resultObj A temp object to hold results in. */ Collection.prototype.processQueue = function (type, callback, resultObj) { var self = this, queue = this._deferQueue[type], deferThreshold = this._deferThreshold[type], deferTime = this._deferTime[type], dataArr, result; resultObj = resultObj || { deferred: true }; if (queue.length) { // Process items up to the threshold if (queue.length > deferThreshold) { // Grab items up to the threshold value dataArr = queue.splice(0, deferThreshold); } else { // Grab all the remaining items dataArr = queue.splice(0, queue.length); } result = self[type](dataArr); switch (type) { case 'insert': resultObj.inserted = resultObj.inserted || []; resultObj.failed = resultObj.failed || []; resultObj.inserted = resultObj.inserted.concat(result.inserted); resultObj.failed = resultObj.failed.concat(result.failed); break; } // Queue another process setTimeout(function () { self.processQueue.call(self, type, callback, resultObj); }, deferTime); } else { if (callback) { callback.call(this, resultObj); } this._asyncComplete(type); } // Check if all queues are complete if (!this.isProcessingQueue()) { this.deferEmit('queuesComplete'); } }; /** * Checks if any CRUD operations have been deferred and are still waiting to * be processed. * @returns {Boolean} True if there are still deferred CRUD operations to process * or false if all queues are clear. */ Collection.prototype.isProcessingQueue = function () { var i; for (i in this._deferQueue) { if (this._deferQueue.hasOwnProperty(i)) { if (this._deferQueue[i].length) { return true; } } } return false; }; /** * Inserts a document or array of documents into the collection. * @param {Object|Array} data Either a document object or array of document * @param {Number=} index Optional index to insert the record at. * @param {Collection~insertCallback=} callback Optional callback called * once the insert is complete. */ Collection.prototype.insert = function (data, index, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (typeof(index) === 'function') { callback = index; index = this._data.length; } else if (index === undefined) { index = this._data.length; } data = this.transformIn(data); return this._insertHandle(data, index, callback); }; /** * The insert operation's callback. * @callback Collection~insertCallback * @param {Object} result The result object will contain two arrays (inserted * and failed) which represent the documents that did get inserted and those * that didn't for some reason (usually index violation). Failed items also * contain a reason. Inspect the failed array for further information. * * A third field called "deferred" is a boolean value to indicate if the * insert operation was deferred across more than one CPU cycle (to avoid * blocking the main thread). */ /** * Inserts a document or array of documents into the collection. * @param {Object|Array} data Either a document object or array of document * @param {Number=} index Optional index to insert the record at. * @param {Collection~insertCallback=} callback Optional callback called * once the insert is complete. */ Collection.prototype._insertHandle = function (data, index, callback) { var //self = this, queue = this._deferQueue.insert, deferThreshold = this._deferThreshold.insert, //deferTime = this._deferTime.insert, inserted = [], failed = [], insertResult, resultObj, i; if (data instanceof Array) { // Check if there are more insert items than the insert defer // threshold, if so, break up inserts so we don't tie up the // ui or thread if (this._deferredCalls && data.length > deferThreshold) { // Break up insert into blocks this._deferQueue.insert = queue.concat(data); this._asyncPending('insert'); // Fire off the insert queue handler this.processQueue('insert', callback); return; } else { // Loop the array and add items for (i = 0; i < data.length; i++) { insertResult = this._insert(data[i], index + i); if (insertResult === true) { inserted.push(data[i]); } else { failed.push({ doc: data[i], reason: insertResult }); } } } } else { // Store the data item insertResult = this._insert(data, index); if (insertResult === true) { inserted.push(data); } else { failed.push({ doc: data, reason: insertResult }); } } resultObj = { deferred: false, inserted: inserted, failed: failed }; this._onInsert(inserted, failed); if (callback) { callback.call(this, resultObj); } this._onChange(); this.emit('immediateChange', {type: 'insert', data: inserted}); this.deferEmit('change', {type: 'insert', data: inserted}); return resultObj; }; /** * Internal method to insert a document into the collection. Will * check for index violations before allowing the document to be inserted. * @param {Object} doc The document to insert after passing index violation * tests. * @param {Number=} index Optional index to insert the document at. * @returns {Boolean|Object} True on success, false if no document passed, * or an object containing details about an index violation if one occurred. * @private */ Collection.prototype._insert = function (doc, index) { if (doc) { var self = this, indexViolation, triggerOperation, insertMethod, newDoc, capped = this.capped(), cappedSize = this.cappedSize(); this.ensurePrimaryKey(doc); // Check indexes are not going to be broken by the document indexViolation = this.insertIndexViolation(doc); insertMethod = function (doc) { // Add the item to the collection's indexes self._insertIntoIndexes(doc); // Check index overflow if (index > self._data.length) { index = self._data.length; } // Insert the document self._dataInsertAtIndex(index, doc); // Check capped collection status and remove first record // if we are over the threshold if (capped && self._data.length > cappedSize) { // Remove the first item in the data array self.removeById(self._data[0][self._primaryKey]); } //op.time('Resolve chains'); if (self.chainWillSend()) { self.chainSend('insert', { dataSet: self.decouple([doc]) }, { index: index }); } //op.time('Resolve chains'); }; if (!indexViolation) { if (self.willTrigger(self.TYPE_INSERT, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) { triggerOperation = { type: 'insert' }; if (self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_BEFORE, {}, doc) !== false) { insertMethod(doc); if (self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) { // Clone the doc so that the programmer cannot update the internal document // on the "after" phase trigger newDoc = self.decouple(doc); self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_AFTER, {}, newDoc); } } else { // The trigger just wants to cancel the operation return 'Trigger cancelled operation'; } } else { // No triggers to execute insertMethod(doc); } return true; } else { return 'Index violation in index: ' + indexViolation; } } return 'No document passed to insert'; }; /** * Inserts a document into the internal collection data array at * Inserts a document into the internal collection data array at * the specified index. * @param {number} index The index to insert at. * @param {object} doc The document to insert. * @private */ Collection.prototype._dataInsertAtIndex = function (index, doc) { this._data.splice(index, 0, doc); }; /** * Removes a document from the internal collection data array at * the specified index. * @param {number} index The index to remove from. * @private */ Collection.prototype._dataRemoveAtIndex = function (index) { this._data.splice(index, 1); }; /** * Replaces all data in the collection's internal data array with * the passed array of data. * @param {array} data The array of data to replace existing data with. * @private */ Collection.prototype._dataReplace = function (data) { // Clear the array - using a while loop with pop is by far the // fastest way to clear an array currently while (this._data.length) { this._data.pop(); } // Append new items to the array this._data = this._data.concat(data); }; /** * Inserts a document into the collection indexes. * @param {Object} doc The document to insert. * @private */ Collection.prototype._insertIntoIndexes = function (doc) { var arr = this._indexByName, arrIndex, violated, hash = this.hash(doc), pk = this._primaryKey; // Insert to primary key index violated = this._primaryIndex.uniqueSet(doc[pk], doc); this._primaryCrc.uniqueSet(doc[pk], hash); this._crcLookup.uniqueSet(hash, doc); // Insert into other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].insert(doc); } } return violated; }; /** * Removes a document from the collection indexes. * @param {Object} doc The document to remove. * @private */ Collection.prototype._removeFromIndexes = function (doc) { var arr = this._indexByName, arrIndex, hash = this.hash(doc), pk = this._primaryKey; // Remove from primary key index this._primaryIndex.unSet(doc[pk]); this._primaryCrc.unSet(doc[pk]); this._crcLookup.unSet(hash); // Remove from other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].remove(doc); } } }; /** * Updates collection index data for the passed document. * @param {Object} oldDoc The old document as it was before the update. * @param {Object} newDoc The document as it now is after the update. * @private */ Collection.prototype._updateIndexes = function (oldDoc, newDoc) { this._removeFromIndexes(oldDoc); this._insertIntoIndexes(newDoc); }; /** * Rebuild collection indexes. * @private */ Collection.prototype._rebuildIndexes = function () { var arr = this._indexByName, arrIndex; // Remove from other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].rebuild(); } } }; /** * Uses the passed query to generate a new collection with results * matching the query parameters. * * @param {Object} query The query object to generate the subset with. * @param {Object=} options An options object. * @returns {*} */ Collection.prototype.subset = function (query, options) { var result = this.find(query, options), coll; coll = new Collection(); coll.db(this._db); coll.subsetOf(this) .primaryKey(this._primaryKey) .setData(result); return coll; }; /** * Gets / sets the collection that this collection is a subset of. * @param {Collection=} collection The collection to set as the parent of this subset. * @returns {Collection} */ Shared.synthesize(Collection.prototype, 'subsetOf'); /** * Checks if the collection is a subset of the passed collection. * @param {Collection} collection The collection to test against. * @returns {Boolean} True if the passed collection is the parent of * the current collection. */ Collection.prototype.isSubsetOf = function (collection) { return this._subsetOf === collection; }; /** * Find the distinct values for a specified field across a single collection and * returns the results in an array. * @param {String} key The field path to return distinct values for e.g. "person.name". * @param {Object=} query The query to use to filter the documents used to return values from. * @param {Object=} options The query options to use when running the query. * @returns {Array} */ Collection.prototype.distinct = function (key, query, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } var data = this.find(query, options), pathSolver = new Path(key), valueUsed = {}, distinctValues = [], value, i; // Loop the data and build array of distinct values for (i = 0; i < data.length; i++) { value = pathSolver.value(data[i])[0]; if (value && !valueUsed[value]) { valueUsed[value] = true; distinctValues.push(value); } } return distinctValues; }; /** * Helper method to find a document by it's id. * @param {String} id The id of the document. * @param {Object=} options The options object, allowed keys are sort and limit. * @returns {Array} The items that were updated. */ Collection.prototype.findById = function (id, options) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.find(searchObj, options)[0]; }; /** * Finds all documents that contain the passed string or search object * regardless of where the string might occur within the document. This * will match strings from the start, middle or end of the document's * string (partial match). * @param {String} search The string to search for. Case sensitive. * @param {Object=} options A standard find() options object. * @returns {Array} An array of documents that matched the search string. */ Collection.prototype.peek = function (search, options) { // Loop all items var arr = this._data, arrCount = arr.length, arrIndex, arrItem, tempColl = new Collection(), typeOfSearch = typeof search; if (typeOfSearch === 'string') { for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { // Get json representation of object arrItem = this.jStringify(arr[arrIndex]); // Check if string exists in object json if (arrItem.indexOf(search) > -1) { // Add this item to the temp collection tempColl.insert(arr[arrIndex]); } } return tempColl.find({}, options); } else { return this.find(search, options); } }; /** * Provides a query plan / operations log for a query. * @param {Object} query The query to execute. * @param {Object=} options Optional options object. * @returns {Object} The query plan. */ Collection.prototype.explain = function (query, options) { var result = this.find(query, options); return result.__fdbOp._data; }; /** * Generates an options object with default values or adds default * values to a passed object if those values are not currently set * to anything. * @param {object=} obj Optional options object to modify. * @returns {object} The options object. */ Collection.prototype.options = function (obj) { obj = obj || {}; obj.$decouple = obj.$decouple !== undefined ? obj.$decouple : true; obj.$explain = obj.$explain !== undefined ? obj.$explain : false; return obj; }; /** * Queries the collection based on the query object passed. * @param {Object} query The query key/values that a document must match in * order for it to be returned in the result array. * @param {Object=} options An optional options object. * @param {Function=} callback !! DO NOT USE, THIS IS NON-OPERATIONAL !! * Optional callback. If specified the find process * will not return a value and will assume that you wish to operate under an * async mode. This will break up large find requests into smaller chunks and * process them in a non-blocking fashion allowing large datasets to be queried * without causing the browser UI to pause. Results from this type of operation * will be passed back to the callback once completed. * * @returns {Array} The results array from the find operation, containing all * documents that matched the query. */ Collection.prototype.find = function (query, options, callback) { // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); } if (callback) { // Check the size of the collection's data array // Split operation into smaller tasks and callback when complete callback.call(this, 'Callbacks for the find() operation are not yet implemented!', []); return []; } return this._find.call(this, query, options, callback); }; Collection.prototype._find = function (query, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } // TODO: This method is quite long, break into smaller pieces query = query || {}; var op = this._metrics.create('find'), pk = this.primaryKey(), self = this, analysis, scanLength, requiresTableScan = true, resultArr, joinIndex, joinSource = {}, joinQuery, joinPath, joinSourceKey, joinSourceType, joinSourceIdentifier, joinSourceData, resultRemove = [], i, j, k, fieldListOn = [], fieldListOff = [], elemMatchPathSolver, elemMatchSubArr, elemMatchSpliceArr, matcherTmpOptions = {}, result, cursor = {}, pathSolver, waterfallCollection, matcher; if (!(options instanceof Array)) { options = this.options(options); } matcher = function (doc) { return self._match(doc, query, options, 'and', matcherTmpOptions); }; op.start(); if (query) { // Check if the query is an array (multi-operation waterfall query) if (query instanceof Array) { waterfallCollection = this; // Loop the query operations for (i = 0; i < query.length; i++) { // Execute each operation and pass the result into the next // query operation waterfallCollection = waterfallCollection.subset(query[i], options && options[i] ? options[i] : {}); } return waterfallCollection.find(); } // Pre-process any data-changing query operators first if (query.$findSub) { // Check we have all the parts we need if (!query.$findSub.$path) { throw('$findSub missing $path property!'); } return this.findSub( query.$findSub.$query, query.$findSub.$path, query.$findSub.$subQuery, query.$findSub.$subOptions ); } if (query.$findSubOne) { // Check we have all the parts we need if (!query.$findSubOne.$path) { throw('$findSubOne missing $path property!'); } return this.findSubOne( query.$findSubOne.$query, query.$findSubOne.$path, query.$findSubOne.$subQuery, query.$findSubOne.$subOptions ); } // Get query analysis to execute best optimised code path op.time('analyseQuery'); analysis = this._analyseQuery(self.decouple(query), options, op); op.time('analyseQuery'); op.data('analysis', analysis); // Check if the query tries to limit by data that would only exist after // the join operation has been completed if (analysis.hasJoin && analysis.queriesJoin) { // The query has a join and tries to limit by it's joined data // Get references to the join sources op.time('joinReferences'); for (joinIndex = 0; joinIndex < analysis.joinsOn.length; joinIndex++) { joinSourceData = analysis.joinsOn[joinIndex]; joinSourceKey = joinSourceData.key; joinSourceType = joinSourceData.type; joinSourceIdentifier = joinSourceData.id; joinPath = new Path(analysis.joinQueries[joinSourceKey]); joinQuery = joinPath.value(query)[0]; joinSource[joinSourceIdentifier] = this._db[joinSourceType](joinSourceKey).subset(joinQuery); // Remove join clause from main query delete query[analysis.joinQueries[joinSourceKey]]; } op.time('joinReferences'); } // Check if an index lookup can be used to return this result if (analysis.indexMatch.length && (!options || (options && !options.$skipIndex))) { op.data('index.potential', analysis.indexMatch); op.data('index.used', analysis.indexMatch[0].index); // Get the data from the index op.time('indexLookup'); resultArr = analysis.indexMatch[0].lookup || []; op.time('indexLookup'); // Check if the index coverage is all keys, if not we still need to table scan it if (analysis.indexMatch[0].keyData.totalKeyCount === analysis.indexMatch[0].keyData.score) { // Don't require a table scan to find relevant documents requiresTableScan = false; } } else { op.flag('usedIndex', false); } if (requiresTableScan) { if (resultArr && resultArr.length) { scanLength = resultArr.length; op.time('tableScan: ' + scanLength); // Filter the source data and return the result resultArr = resultArr.filter(matcher); } else { // Filter the source data and return the result scanLength = this._data.length; op.time('tableScan: ' + scanLength); resultArr = this._data.filter(matcher); } op.time('tableScan: ' + scanLength); } // Order the array if we were passed a sort clause if (options.$orderBy) { op.time('sort'); resultArr = this.sort(options.$orderBy, resultArr); op.time('sort'); } if (options.$page !== undefined && options.$limit !== undefined) { // Record paging data cursor.page = options.$page; cursor.pages = Math.ceil(resultArr.length / options.$limit); cursor.records = resultArr.length; // Check if we actually need to apply the paging logic if (options.$page && options.$limit > 0) { op.data('cursor', cursor); // Skip to the page specified based on limit resultArr.splice(0, options.$page * options.$limit); } } if (options.$skip) { cursor.skip = options.$skip; // Skip past the number of records specified resultArr.splice(0, options.$skip); op.data('skip', options.$skip); } if (options.$limit && resultArr && resultArr.length > options.$limit) { cursor.limit = options.$limit; resultArr.length = options.$limit; op.data('limit', options.$limit); } if (options.$decouple) { // Now decouple the data from the original objects op.time('decouple'); resultArr = this.decouple(resultArr); op.time('decouple'); op.data('flag.decouple', true); } // Now process any joins on the final data if (options.$join) { resultRemove = resultRemove.concat(this.applyJoin(resultArr, options.$join, joinSource)); op.data('flag.join', true); } // Process removal queue if (resultRemove.length) { op.time('removalQueue'); this.spliceArrayByIndexList(resultArr, resultRemove); op.time('removalQueue'); } if (options.$transform) { op.time('transform'); for (i = 0; i < resultArr.length; i++) { resultArr.splice(i, 1, options.$transform(resultArr[i])); } op.time('transform'); op.data('flag.transform', true); } // Process transforms if (this._transformEnabled && this._transformOut) { op.time('transformOut'); resultArr = this.transformOut(resultArr); op.time('transformOut'); } op.data('results', resultArr.length); } else { resultArr = []; } // Check for an $as operator in the options object and if it exists // iterate over the fields and generate a rename function that will // operate over the entire returned data array and rename each object's // fields to their new names // TODO: Enable $as in collection find to allow renaming fields /*if (options.$as) { renameFieldPath = new Path(); renameFieldMethod = function (obj, oldFieldPath, newFieldName) { renameFieldPath.path(oldFieldPath); renameFieldPath.rename(newFieldName); }; for (i in options.$as) { if (options.$as.hasOwnProperty(i)) { } } }*/ if (!options.$aggregate) { // Generate a list of fields to limit data by // Each property starts off being enabled by default (= 1) then // if any property is explicitly specified as 1 then all switch to // zero except _id. // // Any that are explicitly set to zero are switched off. op.time('scanFields'); for (i in options) { if (options.hasOwnProperty(i) && i.indexOf('$') !== 0) { if (options[i] === 1) { fieldListOn.push(i); } else if (options[i] === 0) { fieldListOff.push(i); } } } op.time('scanFields'); // Limit returned fields by the options data if (fieldListOn.length || fieldListOff.length) { op.data('flag.limitFields', true); op.data('limitFields.on', fieldListOn); op.data('limitFields.off', fieldListOff); op.time('limitFields'); // We have explicit fields switched on or off for (i = 0; i < resultArr.length; i++) { result = resultArr[i]; for (j in result) { if (result.hasOwnProperty(j)) { if (fieldListOn.length) { // We have explicit fields switched on so remove all fields // that are not explicitly switched on // Check if the field name is not the primary key if (j !== pk) { if (fieldListOn.indexOf(j) === -1) { // This field is not in the on list, remove it delete result[j]; } } } if (fieldListOff.length) { // We have explicit fields switched off so remove fields // that are explicitly switched off if (fieldListOff.indexOf(j) > -1) { // This field is in the off list, remove it delete result[j]; } } } } } op.time('limitFields'); } // Now run any projections on the data required if (options.$elemMatch) { op.data('flag.elemMatch', true); op.time('projection-elemMatch'); for (i in options.$elemMatch) { if (options.$elemMatch.hasOwnProperty(i)) { elemMatchPathSolver = new Path(i); // Loop the results array for (j = 0; j < resultArr.length; j++) { elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0]; // Check we have a sub-array to loop if (elemMatchSubArr && elemMatchSubArr.length) { // Loop the sub-array and check for projection query matches for (k = 0; k < elemMatchSubArr.length; k++) { // Check if the current item in the sub-array matches the projection query if (self._match(elemMatchSubArr[k], options.$elemMatch[i], options, '', {})) { // The item matches the projection query so set the sub-array // to an array that ONLY contains the matching item and then // exit the loop since we only want to match the first item elemMatchPathSolver.set(resultArr[j], i, [elemMatchSubArr[k]]); break; } } } } } } op.time('projection-elemMatch'); } if (options.$elemsMatch) { op.data('flag.elemsMatch', true); op.time('projection-elemsMatch'); for (i in options.$elemsMatch) { if (options.$elemsMatch.hasOwnProperty(i)) { elemMatchPathSolver = new Path(i); // Loop the results array for (j = 0; j < resultArr.length; j++) { elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0]; // Check we have a sub-array to loop if (elemMatchSubArr && elemMatchSubArr.length) { elemMatchSpliceArr = []; // Loop the sub-array and check for projection query matches for (k = 0; k < elemMatchSubArr.length; k++) { // Check if the current item in the sub-array matches the projection query if (self._match(elemMatchSubArr[k], options.$elemsMatch[i], options, '', {})) { // The item matches the projection query so add it to the final array elemMatchSpliceArr.push(elemMatchSubArr[k]); } } // Now set the final sub-array to the matched items elemMatchPathSolver.set(resultArr[j], i, elemMatchSpliceArr); } } } } op.time('projection-elemsMatch'); } } // Process aggregation if (options.$aggregate) { op.data('flag.aggregate', true); op.time('aggregate'); pathSolver = new Path(options.$aggregate); resultArr = pathSolver.value(resultArr); op.time('aggregate'); } // Now process any $groupBy clause if (options.$groupBy) { op.data('flag.group', true); op.time('group'); resultArr = this.group(options.$groupBy, resultArr); op.time('group'); } op.stop(); resultArr.__fdbOp = op; resultArr.$cursor = cursor; return resultArr; }; /** * Returns one document that satisfies the specified query criteria. If multiple * documents satisfy the query, this method returns the first document to match * the query. * @returns {*} */ Collection.prototype.findOne = function () { return (this.find.apply(this, arguments))[0]; }; /** * Gets the index in the collection data array of the first item matched by * the passed query object. * @param {Object} query The query to run to find the item to return the index of. * @param {Object=} options An options object. * @returns {Number} */ Collection.prototype.indexOf = function (query, options) { var item = this.find(query, {$decouple: false})[0], sortedData; if (item) { if (!options || options && !options.$orderBy) { // Basic lookup from order of insert return this._data.indexOf(item); } else { // Trying to locate index based on query with sort order options.$decouple = false; sortedData = this.find(query, options); return sortedData.indexOf(item); } } return -1; }; /** * Returns the index of the document identified by the passed item's primary key. * @param {*} itemLookup The document whose primary key should be used to lookup * or the id to lookup. * @param {Object=} options An options object. * @returns {Number} The index the item with the matching primary key is occupying. */ Collection.prototype.indexOfDocById = function (itemLookup, options) { var item, sortedData; if (typeof itemLookup !== 'object') { item = this._primaryIndex.get(itemLookup); } else { item = this._primaryIndex.get(itemLookup[this._primaryKey]); } if (item) { if (!options || options && !options.$orderBy) { // Basic lookup return this._data.indexOf(item); } else { // Sorted lookup options.$decouple = false; sortedData = this.find({}, options); return sortedData.indexOf(item); } } return -1; }; /** * Removes a document from the collection by it's index in the collection's * data array. * @param {Number} index The index of the document to remove. * @returns {Object} The document that has been removed or false if none was * removed. */ Collection.prototype.removeByIndex = function (index) { var doc, docId; doc = this._data[index]; if (doc !== undefined) { doc = this.decouple(doc); docId = doc[this.primaryKey()]; return this.removeById(docId); } return false; }; /** * Gets / sets the collection transform options. * @param {Object} obj A collection transform options object. * @returns {*} */ Collection.prototype.transform = function (obj) { if (obj !== undefined) { if (typeof obj === "object") { if (obj.enabled !== undefined) { this._transformEnabled = obj.enabled; } if (obj.dataIn !== undefined) { this._transformIn = obj.dataIn; } if (obj.dataOut !== undefined) { this._transformOut = obj.dataOut; } } else { this._transformEnabled = obj !== false; } return this; } return { enabled: this._transformEnabled, dataIn: this._transformIn, dataOut: this._transformOut }; }; /** * Transforms data using the set transformIn method. * @param {Object} data The data to transform. * @returns {*} */ Collection.prototype.transformIn = function (data) { if (this._transformEnabled && this._transformIn) { if (data instanceof Array) { var finalArr = [], transformResult, i; for (i = 0; i < data.length; i++) { transformResult = this._transformIn(data[i]); // Support transforms returning multiple items if (transformResult instanceof Array) { finalArr = finalArr.concat(transformResult); } else { finalArr.push(transformResult); } } return finalArr; } else { return this._transformIn(data); } } return data; }; /** * Transforms data using the set transformOut method. * @param {Object} data The data to transform. * @returns {*} */ Collection.prototype.transformOut = function (data) { if (this._transformEnabled && this._transformOut) { if (data instanceof Array) { var finalArr = [], transformResult, i; for (i = 0; i < data.length; i++) { transformResult = this._transformOut(data[i]); // Support transforms returning multiple items if (transformResult instanceof Array) { finalArr = finalArr.concat(transformResult); } else { finalArr.push(transformResult); } } return finalArr; } else { return this._transformOut(data); } } return data; }; /** * Sorts an array of documents by the given sort path. * @param {*} sortObj The keys and orders the array objects should be sorted by. * @param {Array} arr The array of documents to sort. * @returns {Array} */ Collection.prototype.sort = function (sortObj, arr) { // Convert the index object to an array of key val objects var self = this, keys = sharedPathSolver.parse(sortObj, true); if (keys.length) { // Execute sort arr.sort(function (a, b) { // Loop the index array var i, indexData, result = 0; for (i = 0; i < keys.length; i++) { indexData = keys[i]; if (indexData.value === 1) { result = self.sortAsc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path)); } else if (indexData.value === -1) { result = self.sortDesc(sharedPathSolver.get(a, indexData.path), sharedPathSolver.get(b, indexData.path)); } if (result !== 0) { return result; } } return result; }); } return arr; }; /** * Groups an array of documents into multiple array fields, named by the value * of the given group path. * @param {*} groupObj The key path the array objects should be grouped by. * @param {Array} arr The array of documents to group. * @returns {Object} */ Collection.prototype.group = function (groupObj, arr) { // Convert the index object to an array of key val objects var keys = sharedPathSolver.parse(groupObj, true), groupPathSolver = new Path(), groupValue, groupResult = {}, keyIndex, i; if (keys.length) { for (keyIndex = 0; keyIndex < keys.length; keyIndex++) { groupPathSolver.path(keys[keyIndex].path); // Execute group for (i = 0; i < arr.length; i++) { groupValue = groupPathSolver.get(arr[i]); groupResult[groupValue] = groupResult[groupValue] || []; groupResult[groupValue].push(arr[i]); } } } return groupResult; }; // Commented as we have a new method that was originally implemented for binary trees. // This old method actually has problems with nested sort objects /*Collection.prototype.sortold = function (sortObj, arr) { // Make sure we have an array object arr = arr || []; var sortArr = [], sortKey, sortSingleObj; for (sortKey in sortObj) { if (sortObj.hasOwnProperty(sortKey)) { sortSingleObj = {}; sortSingleObj[sortKey] = sortObj[sortKey]; sortSingleObj.___fdbKey = String(sortKey); sortArr.push(sortSingleObj); } } if (sortArr.length < 2) { // There is only one sort criteria, do a simple sort and return it return this._sort(sortObj, arr); } else { return this._bucketSort(sortArr, arr); } };*/ /** * REMOVED AS SUPERCEDED BY BETTER SORT SYSTEMS * Takes array of sort paths and sorts them into buckets before returning final * array fully sorted by multi-keys. * @param keyArr * @param arr * @returns {*} * @private */ /*Collection.prototype._bucketSort = function (keyArr, arr) { var keyObj = keyArr.shift(), arrCopy, bucketData, bucketOrder, bucketKey, buckets, i, finalArr = []; if (keyArr.length > 0) { // Sort array by bucket key arr = this._sort(keyObj, arr); // Split items into buckets bucketData = this.bucket(keyObj.___fdbKey, arr); bucketOrder = bucketData.order; buckets = bucketData.buckets; // Loop buckets and sort contents for (i = 0; i < bucketOrder.length; i++) { bucketKey = bucketOrder[i]; arrCopy = [].concat(keyArr); finalArr = finalArr.concat(this._bucketSort(arrCopy, buckets[bucketKey])); } return finalArr; } else { return this._sort(keyObj, arr); } };*/ /** * Takes an array of objects and returns a new object with the array items * split into buckets by the passed key. * @param {String} key The key to split the array into buckets by. * @param {Array} arr An array of objects. * @returns {Object} */ /*Collection.prototype.bucket = function (key, arr) { var i, oldField, field, fieldArr = [], buckets = {}; for (i = 0; i < arr.length; i++) { field = String(arr[i][key]); if (oldField !== field) { fieldArr.push(field); oldField = field; } buckets[field] = buckets[field] || []; buckets[field].push(arr[i]); } return { buckets: buckets, order: fieldArr }; };*/ /** * Sorts array by individual sort path. * @param {String} key The path to sort by. * @param {Array} arr The array of objects to sort. * @returns {Array|*} * @private */ Collection.prototype._sort = function (key, arr) { var self = this, sorterMethod, pathSolver = new Path(), dataPath = pathSolver.parse(key, true)[0]; pathSolver.path(dataPath.path); if (dataPath.value === 1) { // Sort ascending sorterMethod = function (a, b) { var valA = pathSolver.value(a)[0], valB = pathSolver.value(b)[0]; return self.sortAsc(valA, valB); }; } else if (dataPath.value === -1) { // Sort descending sorterMethod = function (a, b) { var valA = pathSolver.value(a)[0], valB = pathSolver.value(b)[0]; return self.sortDesc(valA, valB); }; } else { throw(this.logIdentifier() + ' $orderBy clause has invalid direction: ' + dataPath.value + ', accepted values are 1 or -1 for ascending or descending!'); } return arr.sort(sorterMethod); }; /** * Internal method that takes a search query and options and * returns an object containing details about the query which * can be used to optimise the search. * * @param {Object} query The search query to analyse. * @param {Object} options The query options object. * @param {Operation} op The instance of the Operation class that * this operation is using to track things like performance and steps * taken etc. * @returns {Object} * @private */ Collection.prototype._analyseQuery = function (query, options, op) { var analysis = { queriesOn: [{id: '$collection.' + this._name, type: 'colletion', key: this._name}], indexMatch: [], hasJoin: false, queriesJoin: false, joinQueries: {}, query: query, options: options }, joinSourceIndex, joinSourceKey, joinSourceType, joinSourceIdentifier, joinMatch, joinSources = [], joinSourceReferences = [], queryPath, index, indexMatchData, indexRef, indexRefName, indexLookup, pathSolver, queryKeyCount, pkQueryType, lookupResult, i; // Check if the query is a primary key lookup op.time('checkIndexes'); pathSolver = new Path(); queryKeyCount = pathSolver.parseArr(query, { ignore:/\$/, verbose: true }).length; if (queryKeyCount) { if (query[this._primaryKey] !== undefined) { // Check suitability of querying key value index pkQueryType = typeof query[this._primaryKey]; if (pkQueryType === 'string' || pkQueryType === 'number' || query[this._primaryKey] instanceof Array) { // Return item via primary key possible op.time('checkIndexMatch: Primary Key'); lookupResult = this._primaryIndex.lookup(query, options, op); analysis.indexMatch.push({ lookup: lookupResult, keyData: { matchedKeys: [this._primaryKey], totalKeyCount: queryKeyCount, score: 1 }, index: this._primaryIndex }); op.time('checkIndexMatch: Primary Key'); } } // Check if an index can speed up the query for (i in this._indexById) { if (this._indexById.hasOwnProperty(i)) { indexRef = this._indexById[i]; indexRefName = indexRef.name(); op.time('checkIndexMatch: ' + indexRefName); indexMatchData = indexRef.match(query, options); if (indexMatchData.score > 0) { // This index can be used, store it indexLookup = indexRef.lookup(query, options, op); analysis.indexMatch.push({ lookup: indexLookup, keyData: indexMatchData, index: indexRef }); } op.time('checkIndexMatch: ' + indexRefName); if (indexMatchData.score === queryKeyCount) { // Found an optimal index, do not check for any more break; } } } op.time('checkIndexes'); // Sort array descending on index key count (effectively a measure of relevance to the query) if (analysis.indexMatch.length > 1) { op.time('findOptimalIndex'); analysis.indexMatch.sort(function (a, b) { if (a.keyData.score > b.keyData.score) { // This index has a higher score than the other return -1; } if (a.keyData.score < b.keyData.score) { // This index has a lower score than the other return 1; } // The indexes have the same score but can still be compared by the number of records // they return from the query. The fewer records they return the better so order by // record count if (a.keyData.score === b.keyData.score) { return a.lookup.length - b.lookup.length; } }); op.time('findOptimalIndex'); } } // Check for join data if (options.$join) { analysis.hasJoin = true; // Loop all join operations for (joinSourceIndex = 0; joinSourceIndex < options.$join.length; joinSourceIndex++) { // Loop the join sources and keep a reference to them for (joinSourceKey in options.$join[joinSourceIndex]) { if (options.$join[joinSourceIndex].hasOwnProperty(joinSourceKey)) { joinMatch = options.$join[joinSourceIndex][joinSourceKey]; joinSourceType = joinMatch.$sourceType || 'collection'; joinSourceIdentifier = '$' + joinSourceType + '.' + joinSourceKey; joinSources.push({ id: joinSourceIdentifier, type: joinSourceType, key: joinSourceKey }); // Check if the join uses an $as operator if (options.$join[joinSourceIndex][joinSourceKey].$as !== undefined) { joinSourceReferences.push(options.$join[joinSourceIndex][joinSourceKey].$as); } else { joinSourceReferences.push(joinSourceKey); } } } } // Loop the join source references and determine if the query references // any of the sources that are used in the join. If there no queries against // joined sources the find method can use a code path optimised for this. // Queries against joined sources requires the joined sources to be filtered // first and then joined so requires a little more work. for (index = 0; index < joinSourceReferences.length; index++) { // Check if the query references any source data that the join will create queryPath = this._queryReferencesSource(query, joinSourceReferences[index], ''); if (queryPath) { analysis.joinQueries[joinSources[index].key] = queryPath; analysis.queriesJoin = true; } } analysis.joinsOn = joinSources; analysis.queriesOn = analysis.queriesOn.concat(joinSources); } return analysis; }; /** * Checks if the passed query references a source object (such * as a collection) by name. * @param {Object} query The query object to scan. * @param {String} sourceName The source name to scan for in the query. * @param {String=} path The path to scan from. * @returns {*} * @private */ Collection.prototype._queryReferencesSource = function (query, sourceName, path) { var i; for (i in query) { if (query.hasOwnProperty(i)) { // Check if this key is a reference match if (i === sourceName) { if (path) { path += '.'; } return path + i; } else { if (typeof(query[i]) === 'object') { // Recurse if (path) { path += '.'; } path += i; return this._queryReferencesSource(query[i], sourceName, path); } } } } return false; }; /** * Returns the number of documents currently in the collection. * @returns {Number} */ Collection.prototype.count = function (query, options) { if (!query) { return this._data.length; } else { // Run query and return count return this.find(query, options).length; } }; /** * Finds sub-documents from the collection's documents. * @param {Object} match The query object to use when matching * parent documents from which the sub-documents are queried. * @param {String} path The path string used to identify the * key in which sub-documents are stored in parent documents. * @param {Object=} subDocQuery The query to use when matching * which sub-documents to return. * @param {Object=} subDocOptions The options object to use * when querying for sub-documents. * @returns {*} */ Collection.prototype.findSub = function (match, path, subDocQuery, subDocOptions) { return this._findSub(this.find(match), path, subDocQuery, subDocOptions); }; Collection.prototype._findSub = function (docArr, path, subDocQuery, subDocOptions) { var pathHandler = new Path(path), docCount = docArr.length, docIndex, subDocArr, subDocCollection = new Collection('__FDB_temp_' + this.objectId()).db(this._db), subDocResults, resultObj = { parents: docCount, subDocTotal: 0, subDocs: [], pathFound: false, err: '' }; subDocOptions = subDocOptions || {}; for (docIndex = 0; docIndex < docCount; docIndex++) { subDocArr = pathHandler.value(docArr[docIndex])[0]; if (subDocArr) { subDocCollection.setData(subDocArr); subDocResults = subDocCollection.find(subDocQuery, subDocOptions); if (subDocOptions.returnFirst && subDocResults.length) { return subDocResults[0]; } if (subDocOptions.$split) { resultObj.subDocs.push(subDocResults); } else { resultObj.subDocs = resultObj.subDocs.concat(subDocResults); } resultObj.subDocTotal += subDocResults.length; resultObj.pathFound = true; } } // Drop the sub-document collection subDocCollection.drop(); if (!resultObj.pathFound) { resultObj.err = 'No objects found in the parent documents with a matching path of: ' + path; } // Check if the call should not return stats, if so return only subDocs array if (subDocOptions.$stats) { return resultObj; } else { return resultObj.subDocs; } }; /** * Finds the first sub-document from the collection's documents * that matches the subDocQuery parameter. * @param {Object} match The query object to use when matching * parent documents from which the sub-documents are queried. * @param {String} path The path string used to identify the * key in which sub-documents are stored in parent documents. * @param {Object=} subDocQuery The query to use when matching * which sub-documents to return. * @param {Object=} subDocOptions The options object to use * when querying for sub-documents. * @returns {Object} */ Collection.prototype.findSubOne = function (match, path, subDocQuery, subDocOptions) { return this.findSub(match, path, subDocQuery, subDocOptions)[0]; }; /** * Checks that the passed document will not violate any index rules if * inserted into the collection. * @param {Object} doc The document to check indexes against. * @returns {Boolean} Either false (no violation occurred) or true if * a violation was detected. */ Collection.prototype.insertIndexViolation = function (doc) { var indexViolated, arr = this._indexByName, arrIndex, arrItem; // Check the item's primary key is not already in use if (this._primaryIndex.get(doc[this._primaryKey])) { indexViolated = this._primaryIndex; } else { // Check violations of other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arrItem = arr[arrIndex]; if (arrItem.unique()) { if (arrItem.violation(doc)) { indexViolated = arrItem; break; } } } } } return indexViolated ? indexViolated.name() : false; }; /** * Creates an index on the specified keys. * @param {Object} keys The object containing keys to index. * @param {Object} options An options object. * @returns {*} */ Collection.prototype.ensureIndex = function (keys, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } this._indexByName = this._indexByName || {}; this._indexById = this._indexById || {}; var index, time = { start: new Date().getTime() }; if (options) { if (options.type) { // Check if the specified type is available if (Shared.index[options.type]) { // We found the type, generate it index = new Shared.index[options.type](keys, options, this); } else { throw(this.logIdentifier() + ' Cannot create index of type "' + options.type + '", type not found in the index type register (Shared.index)'); } } else { // Create default index type index = new IndexHashMap(keys, options, this); } } else { // Default index = new IndexHashMap(keys, options, this); } // Check the index does not already exist if (this._indexByName[index.name()]) { // Index already exists return { err: 'Index with that name already exists' }; } /*if (this._indexById[index.id()]) { // Index already exists return { err: 'Index with those keys already exists' }; }*/ // Create the index index.rebuild(); // Add the index this._indexByName[index.name()] = index; this._indexById[index.id()] = index; time.end = new Date().getTime(); time.total = time.end - time.start; this._lastOp = { type: 'ensureIndex', stats: { time: time } }; return { index: index, id: index.id(), name: index.name(), state: index.state() }; }; /** * Gets an index by it's name. * @param {String} name The name of the index to retreive. * @returns {*} */ Collection.prototype.index = function (name) { if (this._indexByName) { return this._indexByName[name]; } }; /** * Gets the last reporting operation's details such as run time. * @returns {Object} */ Collection.prototype.lastOp = function () { return this._metrics.list(); }; /** * Generates a difference object that contains insert, update and remove arrays * representing the operations to execute to make this collection have the same * data as the one passed. * @param {Collection} collection The collection to diff against. * @returns {{}} */ Collection.prototype.diff = function (collection) { var diff = { insert: [], update: [], remove: [] }; var pk = this.primaryKey(), arr, arrIndex, arrItem, arrCount; // Check if the primary key index of each collection can be utilised if (pk !== collection.primaryKey()) { throw(this.logIdentifier() + ' Diffing requires that both collections have the same primary key!'); } // Use the collection primary key index to do the diff (super-fast) arr = collection._data; // Check if we have an array or another collection while (arr && !(arr instanceof Array)) { // We don't have an array, assign collection and get data collection = arr; arr = collection._data; } arrCount = arr.length; // Loop the collection's data array and check for matching items for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = arr[arrIndex]; // Check for a matching item in this collection if (this._primaryIndex.get(arrItem[pk])) { // Matching item exists, check if the data is the same if (this._primaryCrc.get(arrItem[pk]) !== collection._primaryCrc.get(arrItem[pk])) { // The documents exist in both collections but data differs, update required diff.update.push(arrItem); } } else { // The document is missing from this collection, insert required diff.insert.push(arrItem); } } // Now loop this collection's data and check for matching items arr = this._data; arrCount = arr.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = arr[arrIndex]; if (!collection._primaryIndex.get(arrItem[pk])) { // The document does not exist in the other collection, remove required diff.remove.push(arrItem); } } return diff; }; Collection.prototype.collateAdd = new Overload('Collection.prototype.collateAdd', { /** * Adds a data source to collate data from and specifies the * key name to collate data to. * @func collateAdd * @memberof Collection * @param {Collection} collection The collection to collate data from. * @param {String=} keyName Optional name of the key to collate data to. * If none is provided the record CRUD is operated on the root collection * data. */ 'object, string': function (collection, keyName) { var self = this; self.collateAdd(collection, function (packet) { var obj1, obj2; switch (packet.type) { case 'insert': if (keyName) { obj1 = { $push: {} }; obj1.$push[keyName] = self.decouple(packet.data.dataSet); self.update({}, obj1); } else { self.insert(packet.data.dataSet); } break; case 'update': if (keyName) { obj1 = {}; obj2 = {}; obj1[keyName] = packet.data.query; obj2[keyName + '.$'] = packet.data.update; self.update(obj1, obj2); } else { self.update(packet.data.query, packet.data.update); } break; case 'remove': if (keyName) { obj1 = { $pull: {} }; obj1.$pull[keyName] = {}; obj1.$pull[keyName][self.primaryKey()] = packet.data.dataSet[0][collection.primaryKey()]; self.update({}, obj1); } else { self.remove(packet.data.dataSet); } break; default: } }); }, /** * Adds a data source to collate data from and specifies a process * method that will handle the collation functionality (for custom * collation). * @func collateAdd * @memberof Collection * @param {Collection} collection The collection to collate data from. * @param {Function} process The process method. */ 'object, function': function (collection, process) { if (typeof collection === 'string') { // The collection passed is a name, not a reference so get // the reference from the name collection = this._db.collection(collection, { autoCreate: false, throwError: false }); } if (collection) { this._collate = this._collate || {}; this._collate[collection.name()] = new ReactorIO(collection, this, process); return this; } else { throw('Cannot collate from a non-existent collection!'); } } }); Collection.prototype.collateRemove = function (collection) { if (typeof collection === 'object') { // We need to have the name of the collection to remove it collection = collection.name(); } if (collection) { // Drop the reactor IO chain node this._collate[collection].drop(); // Remove the collection data from the collate object delete this._collate[collection]; return this; } else { throw('No collection name passed to collateRemove() or collection not found!'); } }; /** * Creates a condition handler that will react to changes in data on the * collection. * @example Create a condition handler that reacts when data changes. * var coll = db.collection('test'), * condition = coll.when({_id: 'test1', val: 1}) * .then(function () { * console.log('Condition met!'); * }) * .else(function () { * console.log('Condition un-met'); * }); * * coll.insert({_id: 'test1', val: 1}); * * @see Condition * @param {Object} query The query that will trigger the condition's then() * callback. * @returns {Condition} */ Collection.prototype.when = function (query) { var queryId = JSON.stringify(query); this._when = this._when || {}; this._when[queryId] = this._when[queryId] || new Condition(this, query); return this._when[queryId]; }; Db.prototype.collection = new Overload('Db.prototype.collection', { /** * Get a collection with no name (generates a random name). If the * collection does not already exist then one is created for that * name automatically. * @func collection * @memberof Db * @returns {Collection} */ '': function () { return this.$main.call(this, { name: this.objectId() }); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {Object} data An options object or a collection instance. * @returns {Collection} */ 'object': function (data) { // Handle being passed an instance if (data instanceof Collection) { if (data.state() !== 'droppped') { return data; } else { return this.$main.call(this, { name: data.name() }); } } return this.$main.call(this, data); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @returns {Collection} */ 'string': function (collectionName) { return this.$main.call(this, { name: collectionName }); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {String} primaryKey Optional primary key to specify the * primary key field on the collection objects. Defaults to "_id". * @returns {Collection} */ 'string, string': function (collectionName, primaryKey) { return this.$main.call(this, { name: collectionName, primaryKey: primaryKey }); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {Object} options An options object. * @returns {Collection} */ 'string, object': function (collectionName, options) { options.name = collectionName; return this.$main.call(this, options); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {String} primaryKey Optional primary key to specify the * primary key field on the collection objects. Defaults to "_id". * @param {Object} options An options object. * @returns {Collection} */ 'string, string, object': function (collectionName, primaryKey, options) { options.name = collectionName; options.primaryKey = primaryKey; return this.$main.call(this, options); }, /** * The main handler method. This gets called by all the other * variants and handles the actual logic of the overloaded method. * @func collection * @memberof Db * @param {Object} options An options object. * @returns {*} */ '$main': function (options) { var self = this, name = options.name; if (name) { if (this._collection[name]) { return this._collection[name]; } else { if (options && options.autoCreate === false) { if (options && options.throwError !== false) { throw(this.logIdentifier() + ' Cannot get collection ' + name + ' because it does not exist and auto-create has been disabled!'); } return undefined; } if (this.debug()) { console.log(this.logIdentifier() + ' Creating collection ' + name); } } this._collection[name] = this._collection[name] || new Collection(name, options).db(this); this._collection[name].mongoEmulation(this.mongoEmulation()); if (options.primaryKey !== undefined) { this._collection[name].primaryKey(options.primaryKey); } if (options.capped !== undefined) { // Check we have a size if (options.size !== undefined) { this._collection[name].capped(options.capped); this._collection[name].cappedSize(options.size); } else { throw(this.logIdentifier() + ' Cannot create a capped collection without specifying a size!'); } } // Listen for events on this collection so we can fire global events // on the database in response to it self._collection[name].on('change', function () { self.emit('change', self._collection[name], 'collection', name); }); self.emit('create', self._collection[name], 'collection', name); return this._collection[name]; } else { if (!options || (options && options.throwError !== false)) { throw(this.logIdentifier() + ' Cannot get collection with undefined name!'); } } } }); /** * Determine if a collection with the passed name already exists. * @memberof Db * @param {String} viewName The name of the collection to check for. * @returns {boolean} */ Db.prototype.collectionExists = function (viewName) { return Boolean(this._collection[viewName]); }; /** * Returns an array of collections the DB currently has. * @memberof Db * @param {String|RegExp=} search The optional search string or * regular expression to use to match collection names against. * @returns {Array} An array of objects containing details of each * collection the database is currently managing. */ Db.prototype.collections = function (search) { var arr = [], collections = this._collection, collection, i; if (search) { if (!(search instanceof RegExp)) { // Turn the search into a regular expression search = new RegExp(search); } } for (i in collections) { if (collections.hasOwnProperty(i)) { collection = collections[i]; if (search) { if (search.exec(i)) { arr.push({ name: i, count: collection.count(), linked: collection.isLinked !== undefined ? collection.isLinked() : false }); } } else { arr.push({ name: i, count: collection.count(), linked: collection.isLinked !== undefined ? collection.isLinked() : false }); } } } arr.sort(function (a, b) { return a.name.localeCompare(b.name); }); return arr; }; Shared.finishModule('Collection'); module.exports = Collection; },{"./Condition":9,"./Index2d":16,"./IndexBinaryTree":17,"./IndexHashMap":18,"./KeyValueStore":19,"./Metrics":20,"./Overload":33,"./Path":35,"./ReactorIO":39,"./Shared":41}],8:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, DbInit, Collection; Shared = _dereq_('./Shared'); /** * Creates a new collection group. Collection groups allow single operations to be * propagated to multiple collections at once. CRUD operations against a collection * group are in fed to the group's collections. Useful when separating out slightly * different data into multiple collections but querying as one collection. * @constructor */ var CollectionGroup = function () { this.init.apply(this, arguments); }; CollectionGroup.prototype.init = function (name) { var self = this; self._name = name; self._data = new Collection('__FDB__cg_data_' + self._name); self._collections = []; self._view = []; }; Shared.addModule('CollectionGroup', CollectionGroup); Shared.mixin(CollectionGroup.prototype, 'Mixin.Common'); Shared.mixin(CollectionGroup.prototype, 'Mixin.ChainReactor'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Constants'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Triggers'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Tags'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Events'); Collection = _dereq_('./Collection'); Db = Shared.modules.Db; DbInit = Shared.modules.Db.prototype.init; CollectionGroup.prototype.on = function () { this._data.on.apply(this._data, arguments); }; CollectionGroup.prototype.off = function () { this._data.off.apply(this._data, arguments); }; CollectionGroup.prototype.emit = function () { this._data.emit.apply(this._data, arguments); }; /** * Gets / sets the primary key for this collection group. * @param {String=} keyName The name of the primary key. * @returns {*} */ CollectionGroup.prototype.primaryKey = function (keyName) { if (keyName !== undefined) { this._primaryKey = keyName; return this; } return this._primaryKey; }; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'state'); /** * Gets / sets the db instance the collection group belongs to. * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'db'); /** * Gets / sets the instance name. * @param {String=} name The new name to set. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'name'); CollectionGroup.prototype.addCollection = function (collection) { if (collection) { if (this._collections.indexOf(collection) === -1) { //var self = this; // Check for compatible primary keys if (this._collections.length) { if (this._primaryKey !== collection.primaryKey()) { throw(this.logIdentifier() + ' All collections in a collection group must have the same primary key!'); } } else { // Set the primary key to the first collection added this.primaryKey(collection.primaryKey()); } // Add the collection this._collections.push(collection); collection._groups = collection._groups || []; collection._groups.push(this); collection.chain(this); // Hook the collection's drop event to destroy group data collection.on('drop', function () { // Remove collection from any group associations if (collection._groups && collection._groups.length) { var groupArr = [], i; // Copy the group array because if we call removeCollection on a group // it will alter the groups array of this collection mid-loop! for (i = 0; i < collection._groups.length; i++) { groupArr.push(collection._groups[i]); } // Loop any groups we are part of and remove ourselves from them for (i = 0; i < groupArr.length; i++) { collection._groups[i].removeCollection(collection); } } delete collection._groups; }); // Add collection's data this._data.insert(collection.find()); } } return this; }; CollectionGroup.prototype.removeCollection = function (collection) { if (collection) { var collectionIndex = this._collections.indexOf(collection), groupIndex; if (collectionIndex !== -1) { collection.unChain(this); this._collections.splice(collectionIndex, 1); collection._groups = collection._groups || []; groupIndex = collection._groups.indexOf(this); if (groupIndex !== -1) { collection._groups.splice(groupIndex, 1); } collection.off('drop'); } if (this._collections.length === 0) { // Wipe the primary key delete this._primaryKey; } } return this; }; CollectionGroup.prototype._chainHandler = function (chainPacket) { //sender = chainPacket.sender; switch (chainPacket.type) { case 'setData': // Decouple the data to ensure we are working with our own copy chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet); // Remove old data this._data.remove(chainPacket.data.oldData); // Add new data this._data.insert(chainPacket.data.dataSet); break; case 'insert': // Decouple the data to ensure we are working with our own copy chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet); // Add new data this._data.insert(chainPacket.data.dataSet); break; case 'update': // Update data this._data.update(chainPacket.data.query, chainPacket.data.update, chainPacket.options); break; case 'remove': this._data.remove(chainPacket.data.query, chainPacket.options); break; default: break; } }; CollectionGroup.prototype.insert = function () { this._collectionsRun('insert', arguments); }; CollectionGroup.prototype.update = function () { this._collectionsRun('update', arguments); }; CollectionGroup.prototype.updateById = function () { this._collectionsRun('updateById', arguments); }; CollectionGroup.prototype.remove = function () { this._collectionsRun('remove', arguments); }; CollectionGroup.prototype._collectionsRun = function (type, args) { for (var i = 0; i < this._collections.length; i++) { this._collections[i][type].apply(this._collections[i], args); } }; CollectionGroup.prototype.find = function (query, options) { return this._data.find(query, options); }; /** * Helper method that removes a document that matches the given id. * @param {String} id The id of the document to remove. */ CollectionGroup.prototype.removeById = function (id) { // Loop the collections in this group and apply the remove for (var i = 0; i < this._collections.length; i++) { this._collections[i].removeById(id); } }; /** * Uses the passed query to generate a new collection with results * matching the query parameters. * * @param query * @param options * @returns {*} */ CollectionGroup.prototype.subset = function (query, options) { var result = this.find(query, options); return new Collection() .subsetOf(this) .primaryKey(this._primaryKey) .setData(result); }; /** * Drops a collection group from the database. * @returns {boolean} True on success, false on failure. */ CollectionGroup.prototype.drop = function (callback) { if (!this.isDropped()) { var i, collArr, viewArr; if (this._debug) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; if (this._collections && this._collections.length) { collArr = [].concat(this._collections); for (i = 0; i < collArr.length; i++) { this.removeCollection(collArr[i]); } } if (this._view && this._view.length) { viewArr = [].concat(this._view); for (i = 0; i < viewArr.length; i++) { this._removeView(viewArr[i]); } } this.emit('drop', this); delete this._listeners; if (callback) { callback(false, true); } } return true; }; // Extend DB to include collection groups Db.prototype.init = function () { this._collectionGroup = {}; DbInit.apply(this, arguments); }; /** * Creates a new collectionGroup instance or returns an existing * instance if one already exists with the passed name. * @func collectionGroup * @memberOf Db * @param {String} name The name of the instance. * @returns {*} */ Db.prototype.collectionGroup = function (name) { var self = this; if (name) { // Handle being passed an instance if (name instanceof CollectionGroup) { return name; } if (this._collectionGroup && this._collectionGroup[name]) { return this._collectionGroup[name]; } this._collectionGroup[name] = new CollectionGroup(name).db(this); self.emit('create', self._collectionGroup[name], 'collectionGroup', name); return this._collectionGroup[name]; } else { // Return an object of collection data return this._collectionGroup; } }; /** * Returns an array of collection groups the DB currently has. * @returns {Array} An array of objects containing details of each collection group * the database is currently managing. */ Db.prototype.collectionGroups = function () { var arr = [], i; for (i in this._collectionGroup) { if (this._collectionGroup.hasOwnProperty(i)) { arr.push({ name: i }); } } return arr; }; module.exports = CollectionGroup; },{"./Collection":7,"./Shared":41}],9:[function(_dereq_,module,exports){ "use strict"; /** * The condition class monitors a data source and updates it's internal * state depending on clauses that it has been given. When all clauses * are satisfied the then() callback is fired. If conditions were met * but data changed that made them un-met, the else() callback is fired. */ var Shared, Condition; Shared = _dereq_('./Shared'); /** * Create a constructor method that calls the instance's init method. * This allows the constructor to be overridden by other modules because * they can override the init method with their own. */ Condition = function () { this.init.apply(this, arguments); }; Condition.prototype.init = function (dataSource, clause) { this._dataSource = dataSource; this._query = [clause]; this._started = false; this._state = [false]; this._satisfied = false; // Set this to true by default for faster performance this.earlyExit(true); }; // Tell ForerunnerDB about our new module Shared.addModule('Condition', Condition); // Mixin some commonly used methods Shared.mixin(Condition.prototype, 'Mixin.Common'); Shared.mixin(Condition.prototype, 'Mixin.ChainReactor'); Shared.synthesize(Condition.prototype, 'then'); Shared.synthesize(Condition.prototype, 'else'); Shared.synthesize(Condition.prototype, 'earlyExit'); /** * Adds a new clause to the condition. * @param {Object} clause The query clause to add to the condition. * @returns {Condition} */ Condition.prototype.and = function (clause) { this._query.push(clause); this._state.push(false); return this; }; /** * Starts the condition so that changes to data will call callback * methods according to clauses being met. * @returns {Condition} */ Condition.prototype.start = function () { if (!this._started) { var self = this; // Resolve the current state this._updateStates(); self._onChange = function () { self._updateStates(); }; // Create a chain reactor link to the data source so we start receiving CRUD ops from it this._dataSource.on('change', self._onChange); this._started = true; } return this; }; /** * Updates the internal status of all the clauses against the underlying * data source. * @private */ Condition.prototype._updateStates = function () { var satisfied = true, i; for (i = 0; i < this._query.length; i++) { this._state[i] = this._dataSource.count(this._query[i]) > 0; if (!this._state[i]) { satisfied = false; // Early exit since we have found a state that is not true if (this._earlyExit) { break; } } } if (this._satisfied !== satisfied) { // Our state has changed, fire the relevant operation if (satisfied) { // Fire the "then" operation if (this._then) { this._then(); } } else { // Fire the "else" operation if (this._else) { this._else(); } } this._satisfied = satisfied; } }; /** * Stops the condition so that callbacks will no longer fire. * @returns {Condition} */ Condition.prototype.stop = function () { if (this._started) { this._dataSource.off('change', this._onChange); delete this._onChange; this._started = false; } return this; }; // Tell ForerunnerDB that our module has finished loading Shared.finishModule('Condition'); module.exports = Condition; },{"./Shared":41}],10:[function(_dereq_,module,exports){ /* License Copyright (c) 2015 Irrelon Software Limited http://www.irrelon.com http://www.forerunnerdb.com Please visit the license page to see latest license information: http://www.forerunnerdb.com/licensing.html */ "use strict"; var Shared, Db, Metrics, Overload, _instances = []; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * Creates a new ForerunnerDB instance. Core instances handle the lifecycle of * multiple database instances. * @constructor */ var Core = function (val) { this.init.apply(this, arguments); }; Core.prototype.init = function (name) { this._db = {}; this._debug = {}; this._name = name || 'ForerunnerDB'; _instances.push(this); }; /** * Returns the number of instantiated ForerunnerDB objects. * @returns {Number} The number of instantiated instances. */ Core.prototype.instantiatedCount = function () { return _instances.length; }; /** * Get all instances as an array or a single ForerunnerDB instance * by it's array index. * @param {Number=} index Optional index of instance to get. * @returns {Array|Object} Array of instances or a single instance. */ Core.prototype.instances = function (index) { if (index !== undefined) { return _instances[index]; } return _instances; }; /** * Get all instances as an array of instance names or a single ForerunnerDB * instance by it's name. * @param {String=} name Optional name of instance to get. * @returns {Array|Object} Array of instance names or a single instance. */ Core.prototype.namedInstances = function (name) { var i, instArr; if (name !== undefined) { for (i = 0; i < _instances.length; i++) { if (_instances[i].name === name) { return _instances[i]; } } return undefined; } instArr = []; for (i = 0; i < _instances.length; i++) { instArr.push(_instances[i].name); } return instArr; }; Core.prototype.moduleLoaded = new Overload({ /** * Checks if a module has been loaded into the database. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @returns {Boolean} True if the module is loaded, false if not. */ 'string': function (moduleName) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } return true; } return false; }, /** * Checks if a module is loaded and if so calls the passed * callback method. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @param {Function} callback The callback method to call if module is loaded. */ 'string, function': function (moduleName, callback) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } if (callback) { callback(); } } }, /** * Checks if an array of named modules are loaded and if so * calls the passed callback method. * @func moduleLoaded * @memberof Core * @param {Array} moduleName The array of module names to check for. * @param {Function} callback The callback method to call if modules are loaded. */ 'array, function': function (moduleNameArr, callback) { var moduleName, i; for (i = 0; i < moduleNameArr.length; i++) { moduleName = moduleNameArr[i]; if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } } } if (callback) { callback(); } }, /** * Checks if a module is loaded and if so calls the passed * success method, otherwise calls the failure method. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @param {Function} success The callback method to call if module is loaded. * @param {Function} failure The callback method to call if module not loaded. */ 'string, function, function': function (moduleName, success, failure) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { failure(); return false; } } success(); } } }); /** * Checks version against the string passed and if it matches (or partially matches) * then the callback is called. * @param {String} val The version to check against. * @param {Function} callback The callback to call if match is true. * @returns {Boolean} */ Core.prototype.version = function (val, callback) { if (val !== undefined) { if (Shared.version.indexOf(val) === 0) { if (callback) { callback(); } return true; } return false; } return Shared.version; }; // Expose moduleLoaded() method to non-instantiated object ForerunnerDB Core.moduleLoaded = Core.prototype.moduleLoaded; // Expose version() method to non-instantiated object ForerunnerDB Core.version = Core.prototype.version; // Expose instances() method to non-instantiated object ForerunnerDB Core.instances = Core.prototype.instances; // Expose instantiatedCount() method to non-instantiated object ForerunnerDB Core.instantiatedCount = Core.prototype.instantiatedCount; // Provide public access to the Shared object Core.shared = Shared; Core.prototype.shared = Shared; Shared.addModule('Core', Core); Shared.mixin(Core.prototype, 'Mixin.Common'); Shared.mixin(Core.prototype, 'Mixin.Constants'); Db = _dereq_('./Db.js'); Metrics = _dereq_('./Metrics.js'); /** * Gets / sets the name of the instance. This is primarily used for * name-spacing persistent storage. * @param {String=} val The name of the instance to set. * @returns {*} */ Shared.synthesize(Core.prototype, 'name'); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Core.prototype, 'mongoEmulation'); // Set a flag to determine environment Core.prototype._isServer = false; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a browser. */ Core.prototype.isClient = function () { return !this._isServer; }; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a server. */ Core.prototype.isServer = function () { return this._isServer; }; /** * Added to provide an error message for users who have not seen * the new instantiation breaking change warning and try to get * a collection directly from the core instance. */ Core.prototype.collection = function () { throw("ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"); }; module.exports = Core; },{"./Db.js":11,"./Metrics.js":20,"./Overload":33,"./Shared":41}],11:[function(_dereq_,module,exports){ "use strict"; var Shared, Core, Collection, Metrics, Checksum, Overload; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * Creates a new ForerunnerDB database instance. * @constructor */ var Db = function (name, core) { this.init.apply(this, arguments); }; Db.prototype.init = function (name, core) { this.core(core); this._primaryKey = '_id'; this._name = name; this._collection = {}; this._debug = {}; }; Shared.addModule('Db', Db); Db.prototype.moduleLoaded = new Overload({ /** * Checks if a module has been loaded into the database. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @returns {Boolean} True if the module is loaded, false if not. */ 'string': function (moduleName) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } return true; } return false; }, /** * Checks if a module is loaded and if so calls the passed * callback method. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @param {Function} callback The callback method to call if module is loaded. */ 'string, function': function (moduleName, callback) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } if (callback) { callback(); } } }, /** * Checks if a module is loaded and if so calls the passed * success method, otherwise calls the failure method. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @param {Function} success The callback method to call if module is loaded. * @param {Function} failure The callback method to call if module not loaded. */ 'string, function, function': function (moduleName, success, failure) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { failure(); return false; } } success(); } } }); /** * Checks version against the string passed and if it matches (or partially matches) * then the callback is called. * @param {String} val The version to check against. * @param {Function} callback The callback to call if match is true. * @returns {Boolean} */ Db.prototype.version = function (val, callback) { if (val !== undefined) { if (Shared.version.indexOf(val) === 0) { if (callback) { callback(); } return true; } return false; } return Shared.version; }; // Expose moduleLoaded method to non-instantiated object ForerunnerDB Db.moduleLoaded = Db.prototype.moduleLoaded; // Expose version method to non-instantiated object ForerunnerDB Db.version = Db.prototype.version; // Provide public access to the Shared object Db.shared = Shared; Db.prototype.shared = Shared; Shared.addModule('Db', Db); Shared.mixin(Db.prototype, 'Mixin.Common'); Shared.mixin(Db.prototype, 'Mixin.ChainReactor'); Shared.mixin(Db.prototype, 'Mixin.Constants'); Shared.mixin(Db.prototype, 'Mixin.Tags'); Core = Shared.modules.Core; Collection = _dereq_('./Collection.js'); Metrics = _dereq_('./Metrics.js'); Checksum = _dereq_('./Checksum.js'); Db.prototype._isServer = false; /** * Gets / sets the core object this database belongs to. */ Shared.synthesize(Db.prototype, 'core'); /** * Gets / sets the default primary key for new collections. * @param {String=} val The name of the primary key to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'primaryKey'); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'state'); /** * Gets / sets the name of the database. * @param {String=} val The name of the database to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'name'); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Db.prototype, 'mongoEmulation'); /** * Returns true if ForerunnerDB is running on a client browser. * @returns {boolean} */ Db.prototype.isClient = function () { return !this._isServer; }; /** * Returns true if ForerunnerDB is running on a server. * @returns {boolean} */ Db.prototype.isServer = function () { return this._isServer; }; /** * Returns a checksum of a string. * @param {String} string The string to checksum. * @return {String} The checksum generated. */ Db.prototype.Checksum = Checksum; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a browser. */ Db.prototype.isClient = function () { return !this._isServer; }; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a server. */ Db.prototype.isServer = function () { return this._isServer; }; /** * Converts a normal javascript array of objects into a DB collection. * @param {Array} arr An array of objects. * @returns {Collection} A new collection instance with the data set to the * array passed. */ Db.prototype.arrayToCollection = function (arr) { return new Collection().setData(arr); }; /** * Registers an event listener against an event name. * @param {String} event The name of the event to listen for. * @param {Function} listener The listener method to call when * the event is fired. * @returns {*} */ Db.prototype.on = function(event, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || []; this._listeners[event].push(listener); return this; }; /** * De-registers an event listener from an event name. * @param {String} event The name of the event to stop listening for. * @param {Function} listener The listener method passed to on() when * registering the event listener. * @returns {*} */ Db.prototype.off = function(event, listener) { if (event in this._listeners) { var arr = this._listeners[event], index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } return this; }; /** * Emits an event by name with the given data. * @param {String} event The name of the event to emit. * @param {*=} data The data to emit with the event. * @returns {*} */ Db.prototype.emit = function(event, data) { this._listeners = this._listeners || {}; if (event in this._listeners) { var arr = this._listeners[event], arrCount = arr.length, arrIndex; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arr[arrIndex].apply(this, Array.prototype.slice.call(arguments, 1)); } } return this; }; Db.prototype.peek = function (search) { var i, coll, arr = [], typeOfSearch = typeof search; // Loop collections for (i in this._collection) { if (this._collection.hasOwnProperty(i)) { coll = this._collection[i]; if (typeOfSearch === 'string') { arr = arr.concat(coll.peek(search)); } else { arr = arr.concat(coll.find(search)); } } } return arr; }; /** * Find all documents across all collections in the database that match the passed * string or search object. * @param search String or search object. * @returns {Array} */ Db.prototype.peek = function (search) { var i, coll, arr = [], typeOfSearch = typeof search; // Loop collections for (i in this._collection) { if (this._collection.hasOwnProperty(i)) { coll = this._collection[i]; if (typeOfSearch === 'string') { arr = arr.concat(coll.peek(search)); } else { arr = arr.concat(coll.find(search)); } } } return arr; }; /** * Find all documents across all collections in the database that match the passed * string or search object and return them in an object where each key is the name * of the collection that the document was matched in. * @param search String or search object. * @returns {object} */ Db.prototype.peekCat = function (search) { var i, coll, cat = {}, arr, typeOfSearch = typeof search; // Loop collections for (i in this._collection) { if (this._collection.hasOwnProperty(i)) { coll = this._collection[i]; if (typeOfSearch === 'string') { arr = coll.peek(search); if (arr && arr.length) { cat[coll.name()] = arr; } } else { arr = coll.find(search); if (arr && arr.length) { cat[coll.name()] = arr; } } } } return cat; }; Db.prototype.drop = new Overload({ /** * Drops the database. * @func drop * @memberof Db */ '': function () { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._listeners; delete this._core._db[this._name]; } return true; }, /** * Drops the database with optional callback method. * @func drop * @memberof Db * @param {Function} callback Optional callback method. */ 'function': function (callback) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex, finishCount = 0, afterDrop = function () { finishCount++; if (finishCount === arrCount) { if (callback) { callback(); } } }; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(afterDrop); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._listeners; delete this._core._db[this._name]; } return true; }, /** * Drops the database with optional persistent storage drop. Persistent * storage is dropped by default if no preference is provided. * @func drop * @memberof Db * @param {Boolean} removePersist Drop persistent storage for this database. */ 'boolean': function (removePersist) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(removePersist); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._listeners; delete this._core._db[this._name]; } return true; }, /** * Drops the database and optionally controls dropping persistent storage * and callback method. * @func drop * @memberof Db * @param {Boolean} removePersist Drop persistent storage for this database. * @param {Function} callback Optional callback method. */ 'boolean, function': function (removePersist, callback) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex, finishCount = 0, afterDrop = function () { finishCount++; if (finishCount === arrCount) { if (callback) { callback(); } } }; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(removePersist, afterDrop); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._listeners; delete this._core._db[this._name]; } return true; } }); /** * Gets a database instance by name. * @memberof Core * @param {String=} name Optional name of the database. If none is provided * a random name is assigned. * @returns {Db} */ Core.prototype.db = function (name) { // Handle being passed an instance if (name instanceof Db) { return name; } if (!name) { name = this.objectId(); } this._db[name] = this._db[name] || new Db(name, this); this._db[name].mongoEmulation(this.mongoEmulation()); return this._db[name]; }; /** * Returns an array of databases that ForerunnerDB currently has. * @memberof Core * @param {String|RegExp=} search The optional search string or regular expression to use * to match collection names against. * @returns {Array} An array of objects containing details of each database * that ForerunnerDB is currently managing and it's child entities. */ Core.prototype.databases = function (search) { var arr = [], tmpObj, addDb, i; if (search) { if (!(search instanceof RegExp)) { // Turn the search into a regular expression search = new RegExp(search); } } for (i in this._db) { if (this._db.hasOwnProperty(i)) { addDb = true; if (search) { if (!search.exec(i)) { addDb = false; } } if (addDb) { tmpObj = { name: i, children: [] }; if (this.shared.moduleExists('Collection')) { tmpObj.children.push({ module: 'collection', moduleName: 'Collections', count: this._db[i].collections().length }); } if (this.shared.moduleExists('CollectionGroup')) { tmpObj.children.push({ module: 'collectionGroup', moduleName: 'Collection Groups', count: this._db[i].collectionGroups().length }); } if (this.shared.moduleExists('Document')) { tmpObj.children.push({ module: 'document', moduleName: 'Documents', count: this._db[i].documents().length }); } if (this.shared.moduleExists('Grid')) { tmpObj.children.push({ module: 'grid', moduleName: 'Grids', count: this._db[i].grids().length }); } if (this.shared.moduleExists('Overview')) { tmpObj.children.push({ module: 'overview', moduleName: 'Overviews', count: this._db[i].overviews().length }); } if (this.shared.moduleExists('View')) { tmpObj.children.push({ module: 'view', moduleName: 'Views', count: this._db[i].views().length }); } arr.push(tmpObj); } } } arr.sort(function (a, b) { return a.name.localeCompare(b.name); }); return arr; }; Shared.finishModule('Db'); module.exports = Db; },{"./Checksum.js":6,"./Collection.js":7,"./Metrics.js":20,"./Overload":33,"./Shared":41}],12:[function(_dereq_,module,exports){ "use strict"; // TODO: Remove the _update* methods because we are already mixing them // TODO: in now via Mixin.Updating and update autobind to extend the _update* // TODO: methods like we already do with collection var Shared, Collection, Db; Shared = _dereq_('./Shared'); /** * Creates a new Document instance. Documents allow you to create individual * objects that can have standard ForerunnerDB CRUD operations run against * them, as well as data-binding if the AutoBind module is included in your * project. * @name Document * @class Document * @constructor */ var FdbDocument = function () { this.init.apply(this, arguments); }; FdbDocument.prototype.init = function (name) { this._name = name; this._data = {}; }; Shared.addModule('Document', FdbDocument); Shared.mixin(FdbDocument.prototype, 'Mixin.Common'); Shared.mixin(FdbDocument.prototype, 'Mixin.Events'); Shared.mixin(FdbDocument.prototype, 'Mixin.ChainReactor'); Shared.mixin(FdbDocument.prototype, 'Mixin.Constants'); Shared.mixin(FdbDocument.prototype, 'Mixin.Triggers'); Shared.mixin(FdbDocument.prototype, 'Mixin.Matching'); Shared.mixin(FdbDocument.prototype, 'Mixin.Updating'); Shared.mixin(FdbDocument.prototype, 'Mixin.Tags'); Collection = _dereq_('./Collection'); Db = Shared.modules.Db; /** * Gets / sets the current state. * @func state * @memberof Document * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'state'); /** * Gets / sets the db instance this class instance belongs to. * @func db * @memberof Document * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'db'); /** * Gets / sets the document name. * @func name * @memberof Document * @param {String=} val The name to assign * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'name'); /** * Sets the data for the document. * @func setData * @memberof Document * @param data * @param options * @returns {Document} */ FdbDocument.prototype.setData = function (data, options) { var i, $unset; if (data) { options = options || { $decouple: true }; if (options && options.$decouple === true) { data = this.decouple(data); } if (this._linked) { $unset = {}; // Remove keys that don't exist in the new data from the current object for (i in this._data) { if (i.substr(0, 6) !== 'jQuery' && this._data.hasOwnProperty(i)) { // Check if existing data has key if (data[i] === undefined) { // Add property name to those to unset $unset[i] = 1; } } } data.$unset = $unset; // Now update the object with new data this.updateObject(this._data, data, {}); } else { // Straight data assignment this._data = data; } this.deferEmit('change', {type: 'setData', data: this.decouple(this._data)}); } return this; }; /** * Gets the document's data returned as a single object. * @func find * @memberof Document * @param {Object} query The query object - currently unused, just * provide a blank object e.g. {} * @param {Object=} options An options object. * @returns {Object} The document's data object. */ FdbDocument.prototype.find = function (query, options) { var result; if (options && options.$decouple === false) { result = this._data; } else { result = this.decouple(this._data); } return result; }; /** * Modifies the document. This will update the document with the data held in 'update'. * @func update * @memberof Document * @param {Object} query The query that must be matched for a document to be * operated on. * @param {Object} update The object containing updated key/values. Any keys that * match keys on the existing document will be overwritten with this data. Any * keys that do not currently exist on the document will be added to the document. * @param {Object=} options An options object. * @returns {Array} The items that were updated. */ FdbDocument.prototype.update = function (query, update, options) { var result = this.updateObject(this._data, update, query, options); if (result) { this.deferEmit('change', {type: 'update', data: this.decouple(this._data)}); } }; /** * Internal method for document updating. * @func updateObject * @memberof Document * @param {Object} doc The document to update. * @param {Object} update The object with key/value pairs to update the document with. * @param {Object} query The query object that we need to match to perform an update. * @param {Object} options An options object. * @param {String} path The current recursive path. * @param {String} opType The type of update operation to perform, if none is specified * default is to set new data against matching fields. * @returns {Boolean} True if the document was updated with new / changed data or * false if it was not updated because the data was the same. * @private */ FdbDocument.prototype.updateObject = Collection.prototype.updateObject; /** * Determines if the passed key has an array positional mark (a dollar at the end * of its name). * @func _isPositionalKey * @memberof Document * @param {String} key The key to check. * @returns {Boolean} True if it is a positional or false if not. * @private */ FdbDocument.prototype._isPositionalKey = function (key) { return key.substr(key.length - 2, 2) === '.$'; }; /** * Updates a property on an object depending on if the collection is * currently running data-binding or not. * @func _updateProperty * @memberof Document * @param {Object} doc The object whose property is to be updated. * @param {String} prop The property to update. * @param {*} val The new value of the property. * @private */ FdbDocument.prototype._updateProperty = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, val); if (this.debug()) { console.log(this.logIdentifier() + ' Setting data-bound document property "' + prop + '"'); } } else { doc[prop] = val; if (this.debug()) { console.log(this.logIdentifier() + ' Setting non-data-bound document property "' + prop + '" to val "' + val + '"'); } } }; /** * Increments a value for a property on a document by the passed number. * @func _updateIncrement * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to increment by. * @private */ FdbDocument.prototype._updateIncrement = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, doc[prop] + val); } else { doc[prop] += val; } }; /** * Changes the index of an item in the passed array. * @func _updateSpliceMove * @memberof Document * @param {Array} arr The array to modify. * @param {Number} indexFrom The index to move the item from. * @param {Number} indexTo The index to move the item to. * @private */ FdbDocument.prototype._updateSpliceMove = function (arr, indexFrom, indexTo) { if (this._linked) { window.jQuery.observable(arr).move(indexFrom, indexTo); if (this.debug()) { console.log(this.logIdentifier() + ' Moving data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } } else { arr.splice(indexTo, 0, arr.splice(indexFrom, 1)[0]); if (this.debug()) { console.log(this.logIdentifier() + ' Moving non-data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } } }; /** * Inserts an item into the passed array at the specified index. * @func _updateSplicePush * @memberof Document * @param {Array} arr The array to insert into. * @param {Number} index The index to insert at. * @param {Object} doc The document to insert. * @private */ FdbDocument.prototype._updateSplicePush = function (arr, index, doc) { if (arr.length > index) { if (this._linked) { window.jQuery.observable(arr).insert(index, doc); } else { arr.splice(index, 0, doc); } } else { if (this._linked) { window.jQuery.observable(arr).insert(doc); } else { arr.push(doc); } } }; /** * Inserts an item at the end of an array. * @func _updatePush * @memberof Document * @param {Array} arr The array to insert the item into. * @param {Object} doc The document to insert. * @private */ FdbDocument.prototype._updatePush = function (arr, doc) { if (this._linked) { window.jQuery.observable(arr).insert(doc); } else { arr.push(doc); } }; /** * Removes an item from the passed array. * @func _updatePull * @memberof Document * @param {Array} arr The array to modify. * @param {Number} index The index of the item in the array to remove. * @private */ FdbDocument.prototype._updatePull = function (arr, index) { if (this._linked) { window.jQuery.observable(arr).remove(index); } else { arr.splice(index, 1); } }; /** * Multiplies a value for a property on a document by the passed number. * @func _updateMultiply * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to multiply by. * @private */ FdbDocument.prototype._updateMultiply = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, doc[prop] * val); } else { doc[prop] *= val; } }; /** * Renames a property on a document to the passed property. * @func _updateRename * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to rename. * @param {Number} val The new property name. * @private */ FdbDocument.prototype._updateRename = function (doc, prop, val) { var existingVal = doc[prop]; if (this._linked) { window.jQuery.observable(doc).setProperty(val, existingVal); window.jQuery.observable(doc).removeProperty(prop); } else { doc[val] = existingVal; delete doc[prop]; } }; /** * Deletes a property on a document. * @func _updateUnset * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to delete. * @private */ FdbDocument.prototype._updateUnset = function (doc, prop) { if (this._linked) { window.jQuery.observable(doc).removeProperty(prop); } else { delete doc[prop]; } }; /** * Drops the document. * @func drop * @memberof Document * @returns {boolean} True if successful, false if not. */ FdbDocument.prototype.drop = function (callback) { if (!this.isDropped()) { if (this._db && this._name) { if (this._db && this._db._document && this._db._document[this._name]) { this._state = 'dropped'; delete this._db._document[this._name]; delete this._data; this.emit('drop', this); if (callback) { callback(false, true); } delete this._listeners; return true; } } } else { return true; } return false; }; /** * Creates a new document instance or returns an existing * instance if one already exists with the passed name. * @func document * @memberOf Db * @param {String} name The name of the instance. * @returns {*} */ Db.prototype.document = function (name) { var self = this; if (name) { // Handle being passed an instance if (name instanceof FdbDocument) { if (name.state() !== 'droppped') { return name; } else { name = name.name(); } } if (this._document && this._document[name]) { return this._document[name]; } this._document = this._document || {}; this._document[name] = new FdbDocument(name).db(this); self.emit('create', self._document[name], 'document', name); return this._document[name]; } else { // Return an object of document data return this._document; } }; /** * Returns an array of documents the DB currently has. * @func documents * @memberof Db * @returns {Array} An array of objects containing details of each document * the database is currently managing. */ Db.prototype.documents = function () { var arr = [], item, i; for (i in this._document) { if (this._document.hasOwnProperty(i)) { item = this._document[i]; arr.push({ name: i, linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Document'); module.exports = FdbDocument; },{"./Collection":7,"./Shared":41}],13:[function(_dereq_,module,exports){ // geohash.js // Geohash library for Javascript // (c) 2008 David Troy // Distributed under the MIT License // Original at: https://github.com/davetroy/geohash-js // Modified by Irrelon Software Limited (http://www.irrelon.com) // to clean up and modularise the code using Node.js-style exports // and add a few helper methods. // @by Rob Evans - rob@irrelon.com "use strict"; /* Define some shared constants that will be used by all instances of the module. */ var bits, base32, neighbors, borders, PI180 = Math.PI / 180, PI180R = 180 / Math.PI, earthRadius = 6371; // mean radius of the earth bits = [16, 8, 4, 2, 1]; base32 = "0123456789bcdefghjkmnpqrstuvwxyz"; neighbors = { right: {even: "bc01fg45238967deuvhjyznpkmstqrwx"}, left: {even: "238967debc01fg45kmstqrwxuvhjyznp"}, top: {even: "p0r21436x8zb9dcf5h7kjnmqesgutwvy"}, bottom: {even: "14365h7k9dcfesgujnmqp0r2twvyx8zb"} }; borders = { right: {even: "bcfguvyz"}, left: {even: "0145hjnp"}, top: {even: "prxz"}, bottom: {even: "028b"} }; neighbors.bottom.odd = neighbors.left.even; neighbors.top.odd = neighbors.right.even; neighbors.left.odd = neighbors.bottom.even; neighbors.right.odd = neighbors.top.even; borders.bottom.odd = borders.left.even; borders.top.odd = borders.right.even; borders.left.odd = borders.bottom.even; borders.right.odd = borders.top.even; var GeoHash = function () {}; /** * Converts degrees to radians. * @param {Number} degrees * @return {Number} radians */ GeoHash.prototype.radians = function radians (degrees) { return degrees * PI180; }; /** * Converts radians to degrees. * @param {Number} radians * @return {Number} degrees */ GeoHash.prototype.degrees = function (radians) { return radians * PI180R; }; GeoHash.prototype.refineInterval = function (interval, cd, mask) { if (cd & mask) { //jshint ignore: line interval[0] = (interval[0] + interval[1]) / 2; } else { interval[1] = (interval[0] + interval[1]) / 2; } }; /** * Calculates all surrounding neighbours of a hash and returns them. * @param {String} centerHash The hash at the center of the grid. * @param options * @returns {*} */ GeoHash.prototype.calculateNeighbours = function (centerHash, options) { var response; if (!options || options.type === 'object') { response = { center: centerHash, left: this.calculateAdjacent(centerHash, 'left'), right: this.calculateAdjacent(centerHash, 'right'), top: this.calculateAdjacent(centerHash, 'top'), bottom: this.calculateAdjacent(centerHash, 'bottom') }; response.topLeft = this.calculateAdjacent(response.left, 'top'); response.topRight = this.calculateAdjacent(response.right, 'top'); response.bottomLeft = this.calculateAdjacent(response.left, 'bottom'); response.bottomRight = this.calculateAdjacent(response.right, 'bottom'); } else { response = []; response[4] = centerHash; response[3] = this.calculateAdjacent(centerHash, 'left'); response[5] = this.calculateAdjacent(centerHash, 'right'); response[1] = this.calculateAdjacent(centerHash, 'top'); response[7] = this.calculateAdjacent(centerHash, 'bottom'); response[0] = this.calculateAdjacent(response[3], 'top'); response[2] = this.calculateAdjacent(response[5], 'top'); response[6] = this.calculateAdjacent(response[3], 'bottom'); response[8] = this.calculateAdjacent(response[5], 'bottom'); } return response; }; /** * Calculates a new lat/lng by travelling from the center point in the * bearing specified for the distance specified. * @param {Array} centerPoint An array with latitude at index 0 and * longitude at index 1. * @param {Number} distanceKm The distance to travel in kilometers. * @param {Number} bearing The bearing to travel in degrees (zero is * north). * @returns {{lat: Number, lng: Number}} */ GeoHash.prototype.calculateLatLngByDistanceBearing = function (centerPoint, distanceKm, bearing) { var curLon = centerPoint[1], curLat = centerPoint[0], destLat = Math.asin(Math.sin(this.radians(curLat)) * Math.cos(distanceKm / earthRadius) + Math.cos(this.radians(curLat)) * Math.sin(distanceKm / earthRadius) * Math.cos(this.radians(bearing))), tmpLon = this.radians(curLon) + Math.atan2(Math.sin(this.radians(bearing)) * Math.sin(distanceKm / earthRadius) * Math.cos(this.radians(curLat)), Math.cos(distanceKm / earthRadius) - Math.sin(this.radians(curLat)) * Math.sin(destLat)), destLon = (tmpLon + 3 * Math.PI) % (2 * Math.PI) - Math.PI; // normalise to -180..+180º return { lat: this.degrees(destLat), lng: this.degrees(destLon) }; }; /** * Calculates the extents of a bounding box around the center point which * encompasses the radius in kilometers passed. * @param {Array} centerPoint An array with latitude at index 0 and * longitude at index 1. * @param radiusKm Radius in kilometers. * @returns {{lat: Array, lng: Array}} */ GeoHash.prototype.calculateExtentByRadius = function (centerPoint, radiusKm) { var maxWest, maxEast, maxNorth, maxSouth, lat = [], lng = []; maxNorth = this.calculateLatLngByDistanceBearing(centerPoint, radiusKm, 0); maxEast = this.calculateLatLngByDistanceBearing(centerPoint, radiusKm, 90); maxSouth = this.calculateLatLngByDistanceBearing(centerPoint, radiusKm, 180); maxWest = this.calculateLatLngByDistanceBearing(centerPoint, radiusKm, 270); lat[0] = maxNorth.lat; lat[1] = maxSouth.lat; lng[0] = maxWest.lng; lng[1] = maxEast.lng; return { lat: lat, lng: lng }; }; /** * Calculates all the geohashes that make up the bounding box that surrounds * the circle created from the center point and radius passed. * @param {Array} centerPoint An array with latitude at index 0 and * longitude at index 1. * @param {Number} radiusKm The radius in kilometers to encompass. * @param {Number} precision The number of characters to limit the returned * geohash strings to. * @returns {Array} The array of geohashes that encompass the bounding box. */ GeoHash.prototype.calculateHashArrayByRadius = function (centerPoint, radiusKm, precision) { var extent = this.calculateExtentByRadius(centerPoint, radiusKm), northWest = [extent.lat[0], extent.lng[0]], northEast = [extent.lat[0], extent.lng[1]], southWest = [extent.lat[1], extent.lng[0]], northWestHash = this.encode(northWest[0], northWest[1], precision), northEastHash = this.encode(northEast[0], northEast[1], precision), southWestHash = this.encode(southWest[0], southWest[1], precision), hash, widthCount = 0, heightCount = 0, widthIndex, heightIndex, hashArray = []; hash = northWestHash; hashArray.push(hash); // Walk from north west to north east until we find the north east geohash while (hash !== northEastHash) { hash = this.calculateAdjacent(hash, 'right'); widthCount++; hashArray.push(hash); } hash = northWestHash; // Walk from north west to south west until we find the south west geohash while (hash !== southWestHash) { hash = this.calculateAdjacent(hash, 'bottom'); heightCount++; } // We now know the width and height in hash boxes of the area, fill in the // rest of the hashes into the hashArray array for (widthIndex = 0; widthIndex <= widthCount; widthIndex++) { hash = hashArray[widthIndex]; for (heightIndex = 0; heightIndex < heightCount; heightIndex++) { hash = this.calculateAdjacent(hash, 'bottom'); hashArray.push(hash); } } return hashArray; }; /** * Calculates an adjacent hash to the hash passed, in the direction * specified. * @param {String} srcHash The hash to calculate adjacent to. * @param {String} dir Either "top", "left", "bottom" or "right". * @returns {String} The resulting geohash. */ GeoHash.prototype.calculateAdjacent = function (srcHash, dir) { srcHash = srcHash.toLowerCase(); var lastChr = srcHash.charAt(srcHash.length - 1), type = (srcHash.length % 2) ? 'odd' : 'even', base = srcHash.substring(0, srcHash.length - 1); if (borders[dir][type].indexOf(lastChr) !== -1) { base = this.calculateAdjacent(base, dir); } return base + base32[neighbors[dir][type].indexOf(lastChr)]; }; /** * Decodes a string geohash back to a longitude/latitude array. * The array contains three latitudes and three longitudes. The * first of each is the lower extent of the geohash bounding box, * the second is the upper extent and the third is the center * of the geohash bounding box. * @param {String} geohash The hash to decode. * @returns {Object} */ GeoHash.prototype.decode = function (geohash) { var isEven = 1, lat = [], lon = [], i, c, cd, j, mask, latErr, lonErr; lat[0] = -90.0; lat[1] = 90.0; lon[0] = -180.0; lon[1] = 180.0; latErr = 90.0; lonErr = 180.0; for (i = 0; i < geohash.length; i++) { c = geohash[i]; cd = base32.indexOf(c); for (j = 0; j < 5; j++) { mask = bits[j]; if (isEven) { lonErr /= 2; this.refineInterval(lon, cd, mask); } else { latErr /= 2; this.refineInterval(lat, cd, mask); } isEven = !isEven; } } lat[2] = (lat[0] + lat[1]) / 2; lon[2] = (lon[0] + lon[1]) / 2; return { lat: lat, lng: lon }; }; /** * Encodes a longitude/latitude to geohash string. * @param latitude * @param longitude * @param {Number=} precision Length of the geohash string. Defaults to 12. * @returns {String} */ GeoHash.prototype.encode = function (latitude, longitude, precision) { var isEven = 1, mid, lat = [], lon = [], bit = 0, ch = 0, geoHash = ""; if (!precision) { precision = 12; } lat[0] = -90.0; lat[1] = 90.0; lon[0] = -180.0; lon[1] = 180.0; while (geoHash.length < precision) { if (isEven) { mid = (lon[0] + lon[1]) / 2; if (longitude > mid) { ch |= bits[bit]; //jshint ignore: line lon[0] = mid; } else { lon[1] = mid; } } else { mid = (lat[0] + lat[1]) / 2; if (latitude > mid) { ch |= bits[bit]; //jshint ignore: line lat[0] = mid; } else { lat[1] = mid; } } isEven = !isEven; if (bit < 4) { bit++; } else { geoHash += base32[ch]; bit = 0; ch = 0; } } return geoHash; }; if (typeof module !== 'undefined') { module.exports = GeoHash; } },{}],14:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, CollectionGroup, View, CollectionInit, DbInit, ReactorIO; //Shared = ForerunnerDB.shared; Shared = _dereq_('./Shared'); /** * Creates a new grid instance. * @name Grid * @class Grid * @param {String} selector jQuery selector. * @param {String} template The template selector. * @param {Object=} options The options object to apply to the grid. * @constructor */ var Grid = function (selector, template, options) { this.init.apply(this, arguments); }; Grid.prototype.init = function (selector, template, options) { var self = this; this._selector = selector; this._template = template; this._options = options || {}; this._debug = {}; this._id = this.objectId(); this._collectionDroppedWrap = function () { self._collectionDropped.apply(self, arguments); }; }; Shared.addModule('Grid', Grid); Shared.mixin(Grid.prototype, 'Mixin.Common'); Shared.mixin(Grid.prototype, 'Mixin.ChainReactor'); Shared.mixin(Grid.prototype, 'Mixin.Constants'); Shared.mixin(Grid.prototype, 'Mixin.Triggers'); Shared.mixin(Grid.prototype, 'Mixin.Events'); Shared.mixin(Grid.prototype, 'Mixin.Tags'); Collection = _dereq_('./Collection'); CollectionGroup = _dereq_('./CollectionGroup'); View = _dereq_('./View'); ReactorIO = _dereq_('./ReactorIO'); CollectionInit = Collection.prototype.init; Db = Shared.modules.Db; DbInit = Db.prototype.init; /** * Gets / sets the current state. * @func state * @memberof Grid * @param {String=} val The name of the state to set. * @returns {Grid} */ Shared.synthesize(Grid.prototype, 'state'); /** * Gets / sets the current name. * @func name * @memberof Grid * @param {String=} val The name to set. * @returns {Grid} */ Shared.synthesize(Grid.prototype, 'name'); /** * Executes an insert against the grid's underlying data-source. * @func insert * @memberof Grid */ Grid.prototype.insert = function () { this._from.insert.apply(this._from, arguments); }; /** * Executes an update against the grid's underlying data-source. * @func update * @memberof Grid */ Grid.prototype.update = function () { this._from.update.apply(this._from, arguments); }; /** * Executes an updateById against the grid's underlying data-source. * @func updateById * @memberof Grid */ Grid.prototype.updateById = function () { this._from.updateById.apply(this._from, arguments); }; /** * Executes a remove against the grid's underlying data-source. * @func remove * @memberof Grid */ Grid.prototype.remove = function () { this._from.remove.apply(this._from, arguments); }; /** * Sets the collection from which the grid will assemble its data. * @func from * @memberof Grid * @param {Collection} collection The collection to use to assemble grid data. * @returns {Grid} */ Grid.prototype.from = function (collection) { //var self = this; if (collection !== undefined) { // Check if we have an existing from if (this._from) { // Remove the listener to the drop event this._from.off('drop', this._collectionDroppedWrap); this._from._removeGrid(this); } if (typeof(collection) === 'string') { collection = this._db.collection(collection); } this._from = collection; this._from.on('drop', this._collectionDroppedWrap); this.refresh(); } return this; }; /** * Gets / sets the db instance this class instance belongs to. * @func db * @memberof Grid * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(Grid.prototype, 'db', function (db) { if (db) { // Apply the same debug settings this.debug(db.debug()); } return this.$super.apply(this, arguments); }); Grid.prototype._collectionDropped = function (collection) { if (collection) { // Collection was dropped, remove from grid delete this._from; } }; /** * Drops a grid and all it's stored data from the database. * @func drop * @memberof Grid * @returns {boolean} True on success, false on failure. */ Grid.prototype.drop = function (callback) { if (!this.isDropped()) { if (this._from) { // Remove data-binding this._from.unlink(this._selector, this.template()); // Kill listeners and references this._from.off('drop', this._collectionDroppedWrap); this._from._removeGrid(this); if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Dropping grid ' + this._selector); } this._state = 'dropped'; if (this._db && this._selector) { delete this._db._grid[this._selector]; } this.emit('drop', this); if (callback) { callback(false, true); } delete this._selector; delete this._template; delete this._from; delete this._db; delete this._listeners; return true; } } else { return true; } return false; }; /** * Gets / sets the grid's HTML template to use when rendering. * @func template * @memberof Grid * @param {Selector} template The template's jQuery selector. * @returns {*} */ Grid.prototype.template = function (template) { if (template !== undefined) { this._template = template; return this; } return this._template; }; Grid.prototype._sortGridClick = function (e) { var elem = window.jQuery(e.currentTarget), sortColText = elem.attr('data-grid-sort') || '', sortColDir = parseInt((elem.attr('data-grid-dir') || "-1"), 10) === -1 ? 1 : -1, sortCols = sortColText.split(','), sortObj = {}, i; // Remove all grid sort tags from the grid window.jQuery(this._selector).find('[data-grid-dir]').removeAttr('data-grid-dir'); // Flip the sort direction elem.attr('data-grid-dir', sortColDir); for (i = 0; i < sortCols.length; i++) { sortObj[sortCols] = sortColDir; } Shared.mixin(sortObj, this._options.$orderBy); this._from.orderBy(sortObj); this.emit('sort', sortObj); }; /** * Refreshes the grid data such as ordering etc. * @func refresh * @memberof Grid */ Grid.prototype.refresh = function () { if (this._from) { if (this._from.link) { var self = this, elem = window.jQuery(this._selector), sortClickListener = function () { self._sortGridClick.apply(self, arguments); }; // Clear the container elem.html(''); if (self._from.orderBy) { // Remove listeners elem.off('click', '[data-grid-sort]', sortClickListener); } if (self._from.query) { // Remove listeners elem.off('click', '[data-grid-filter]', sortClickListener); } // Set wrap name if none is provided self._options.$wrap = self._options.$wrap || 'gridRow'; // Auto-bind the data to the grid template self._from.link(self._selector, self.template(), self._options); // Check if the data source (collection or view) has an // orderBy method (usually only views) and if so activate // the sorting system if (self._from.orderBy) { // Listen for sort requests elem.on('click', '[data-grid-sort]', sortClickListener); } if (self._from.query) { // Listen for filter requests var queryObj = {}; elem.find('[data-grid-filter]').each(function (index, filterElem) { filterElem = window.jQuery(filterElem); var filterField = filterElem.attr('data-grid-filter'), filterVarType = filterElem.attr('data-grid-vartype'), filterSort = {}, title = filterElem.html(), dropDownButton, dropDownMenu, template, onFilterSourceChange, filterQuery, filterView = self._db.view('tmpGridFilter_' + self._id + '_' + filterField); filterSort[filterField] = 1; filterQuery = { $distinct: filterSort }; filterView .query(filterQuery) .orderBy(filterSort) .from(self._from._from); onFilterSourceChange = function () { filterView.refresh(); }; // Listen for changes on the filter source and update // the filters if changes occur self._from._from.on('change', onFilterSourceChange); // This bit of commented code can filter other filter // views so that only items that match other filter // selections show in the other filters, but this can // be confusing to the user. The best possible way to // use this would be to "grey out" the selections that // cannot be used because they would return zero results // when used in conjuctions with other filter selections. /*self._from.on('change', function () { if (self._from && self._from instanceof View) { var query = self._from.query(); query.$distinct = filterSort; delete query[filterField]; filterView .query(query); console.log(self._from._from.find(query)); } });*/ // Listen for the grid being dropped and remove listener // for changes on filter source self.on('drop', function () { if (self._from && self._from._from) { self._from._from.off('change', onFilterSourceChange); } }); template = [ '<div class="dropdown" id="' + self._id + '_' + filterField + '">', '<button class="btn btn-default dropdown-toggle" type="button" id="' + self._id + '_' + filterField + '_dropdownButton" data-toggle="dropdown" aria-expanded="true">', title + ' <span class="caret"></span>', '</button>', '</div>' ]; dropDownButton = window.jQuery(template.join('')); dropDownMenu = window.jQuery('<ul class="dropdown-menu" role="menu" id="' + self._id + '_' + filterField + '_dropdownMenu"></ul>'); dropDownButton.append(dropDownMenu); filterElem.html(dropDownButton); // Data-link the underlying data to the grid filter drop-down filterView.link(dropDownMenu, { template: [ '<li role="presentation" class="input-group" style="width: 240px; padding-left: 10px; padding-right: 10px; padding-top: 5px;">', '<input type="search" class="form-control gridFilterSearch" placeholder="Search...">', '<span class="input-group-btn">', '<button class="btn btn-default gridFilterClearSearch" type="button"><span class="glyphicon glyphicon-remove-circle glyphicons glyphicons-remove"></span></button>', '</span>', '</li>', '<li role="presentation" class="divider"></li>', '<li role="presentation" data-val="$all">', '<a role="menuitem" tabindex="-1">', '<input type="checkbox" checked>&nbsp;All', '</a>', '</li>', '<li role="presentation" class="divider"></li>', '{^{for options}}', '<li role="presentation" data-link="data-val{:' + filterField + '}">', '<a role="menuitem" tabindex="-1">', '<input type="checkbox">&nbsp;{^{:' + filterField + '}}', '</a>', '</li>', '{{/for}}' ].join('') }, { $wrap: 'options' }); elem.on('keyup', '#' + self._id + '_' + filterField + '_dropdownMenu .gridFilterSearch', function (e) { var elem = window.jQuery(this), query = filterView.query(), search = elem.val(); if (search) { query[filterField] = new RegExp(search, 'gi'); } else { delete query[filterField]; } filterView.query(query); }); elem.on('click', '#' + self._id + '_' + filterField + '_dropdownMenu .gridFilterClearSearch', function (e) { // Clear search text box window.jQuery(this).parents('li').find('.gridFilterSearch').val(''); // Clear view query var query = filterView.query(); delete query[filterField]; filterView.query(query); }); elem.on('click', '#' + self._id + '_' + filterField + '_dropdownMenu li', function (e) { e.stopPropagation(); var fieldValue, elem = $(this), checkbox = elem.find('input[type="checkbox"]'), checked, addMode = true, fieldInArr, liElem, i; // If the checkbox is not the one clicked on if (!window.jQuery(e.target).is('input')) { // Set checkbox to opposite of current value checkbox.prop('checked', !checkbox.prop('checked')); checked = checkbox.is(':checked'); } else { checkbox.prop('checked', checkbox.prop('checked')); checked = checkbox.is(':checked'); } liElem = window.jQuery(this); fieldValue = liElem.attr('data-val'); // Check if the selection is the "all" option if (fieldValue === '$all') { // Remove the field from the query delete queryObj[filterField]; // Clear all other checkboxes liElem.parent().find('li[data-val!="$all"]').find('input[type="checkbox"]').prop('checked', false); } else { // Clear the "all" checkbox liElem.parent().find('[data-val="$all"]').find('input[type="checkbox"]').prop('checked', false); // Check if the type needs casting switch (filterVarType) { case 'integer': fieldValue = parseInt(fieldValue, 10); break; case 'float': fieldValue = parseFloat(fieldValue); break; default: } // Check if the item exists already queryObj[filterField] = queryObj[filterField] || { $in: [] }; fieldInArr = queryObj[filterField].$in; for (i = 0; i < fieldInArr.length; i++) { if (fieldInArr[i] === fieldValue) { // Item already exists if (checked === false) { // Remove the item fieldInArr.splice(i, 1); } addMode = false; break; } } if (addMode && checked) { fieldInArr.push(fieldValue); } if (!fieldInArr.length) { // Remove the field from the query delete queryObj[filterField]; } } // Set the view query self._from.queryData(queryObj); if (self._from.pageFirst) { self._from.pageFirst(); } }); }); } self.emit('refresh'); } else { throw('Grid requires the AutoBind module in order to operate!'); } } return this; }; /** * Returns the number of documents currently in the grid. * @func count * @memberof Grid * @returns {Number} */ Grid.prototype.count = function () { return this._from.count(); }; /** * Creates a grid and assigns the collection as its data source. * @func grid * @memberof Collection * @param {String} selector jQuery selector of grid output target. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Collection.prototype.grid = View.prototype.grid = function (selector, template, options) { if (this._db && this._db._grid ) { if (selector !== undefined) { if (template !== undefined) { if (!this._db._grid[selector]) { var grid = new Grid(selector, template, options) .db(this._db) .from(this); this._grid = this._grid || []; this._grid.push(grid); this._db._grid[selector] = grid; return grid; } else { throw(this.logIdentifier() + ' Cannot create a grid because a grid with this name already exists: ' + selector); } } return this._db._grid[selector]; } return this._db._grid; } }; /** * Removes a grid safely from the DOM. Must be called when grid is * no longer required / is being removed from DOM otherwise references * will stick around and cause memory leaks. * @func unGrid * @memberof Collection * @param {String} selector jQuery selector of grid output target. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Collection.prototype.unGrid = View.prototype.unGrid = function (selector, template, options) { var i, grid; if (this._db && this._db._grid ) { if (selector && template) { if (this._db._grid[selector]) { grid = this._db._grid[selector]; delete this._db._grid[selector]; return grid.drop(); } else { throw(this.logIdentifier() + ' Cannot remove grid because a grid with this name does not exist: ' + name); } } else { // No parameters passed, remove all grids from this module for (i in this._db._grid) { if (this._db._grid.hasOwnProperty(i)) { grid = this._db._grid[i]; delete this._db._grid[i]; grid.drop(); if (this.debug()) { console.log(this.logIdentifier() + ' Removed grid binding "' + i + '"'); } } } this._db._grid = {}; } } }; /** * Adds a grid to the internal grid lookup. * @func _addGrid * @memberof Collection * @param {Grid} grid The grid to add. * @returns {Collection} * @private */ Collection.prototype._addGrid = CollectionGroup.prototype._addGrid = View.prototype._addGrid = function (grid) { if (grid !== undefined) { this._grid = this._grid || []; this._grid.push(grid); } return this; }; /** * Removes a grid from the internal grid lookup. * @func _removeGrid * @memberof Collection * @param {Grid} grid The grid to remove. * @returns {Collection} * @private */ Collection.prototype._removeGrid = CollectionGroup.prototype._removeGrid = View.prototype._removeGrid = function (grid) { if (grid !== undefined && this._grid) { var index = this._grid.indexOf(grid); if (index > -1) { this._grid.splice(index, 1); } } return this; }; // Extend DB with grids init Db.prototype.init = function () { this._grid = {}; DbInit.apply(this, arguments); }; /** * Determine if a grid with the passed name already exists. * @func gridExists * @memberof Db * @param {String} selector The jQuery selector to bind the grid to. * @returns {boolean} */ Db.prototype.gridExists = function (selector) { return Boolean(this._grid[selector]); }; /** * Creates a grid based on the passed arguments. * @func grid * @memberof Db * @param {String} selector The jQuery selector of the grid to retrieve. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Db.prototype.grid = function (selector, template, options) { if (!this._grid[selector]) { if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating grid ' + selector); } } this._grid[selector] = this._grid[selector] || new Grid(selector, template, options).db(this); return this._grid[selector]; }; /** * Removes a grid based on the passed arguments. * @func unGrid * @memberof Db * @param {String} selector The jQuery selector of the grid to retrieve. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Db.prototype.unGrid = function (selector, template, options) { if (!this._grid[selector]) { if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating grid ' + selector); } } this._grid[selector] = this._grid[selector] || new Grid(selector, template, options).db(this); return this._grid[selector]; }; /** * Returns an array of grids the DB currently has. * @func grids * @memberof Db * @returns {Array} An array of objects containing details of each grid * the database is currently managing. */ Db.prototype.grids = function () { var arr = [], item, i; for (i in this._grid) { if (this._grid.hasOwnProperty(i)) { item = this._grid[i]; arr.push({ name: i, count: item.count(), linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Grid'); module.exports = Grid; },{"./Collection":7,"./CollectionGroup":8,"./ReactorIO":39,"./Shared":41,"./View":43}],15:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Collection, CollectionInit, Overload; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * The constructor. * * @constructor */ var Highchart = function (collection, options) { this.init.apply(this, arguments); }; Highchart.prototype.init = function (collection, options) { this._options = options; this._selector = window.jQuery(this._options.selector); if (!this._selector[0]) { throw(this.classIdentifier() + ' "' + collection.name() + '": Chart target element does not exist via selector: ' + this._options.selector); } this._listeners = {}; this._collection = collection; // Setup the chart this._options.series = []; // Disable attribution on highcharts options.chartOptions = options.chartOptions || {}; options.chartOptions.credits = false; // Set the data for the chart var data, seriesObj, chartData; switch (this._options.type) { case 'pie': // Create chart from data this._selector.highcharts(this._options.chartOptions); this._chart = this._selector.highcharts(); // Generate graph data from collection data data = this._collection.find(); seriesObj = { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<b>{point.name}</b>: {y} ({point.percentage:.0f}%)', style: { color: (window.Highcharts.theme && window.Highcharts.theme.contrastTextColor) || 'black' } } }; chartData = this.pieDataFromCollectionData(data, this._options.keyField, this._options.valField); window.jQuery.extend(seriesObj, this._options.seriesOptions); window.jQuery.extend(seriesObj, { name: this._options.seriesName, data: chartData }); this._chart.addSeries(seriesObj, true, true); break; case 'line': case 'area': case 'column': case 'bar': // Generate graph data from collection data chartData = this.seriesDataFromCollectionData( this._options.seriesField, this._options.keyField, this._options.valField, this._options.orderBy, this._options ); this._options.chartOptions.xAxis = chartData.xAxis; this._options.chartOptions.series = chartData.series; this._selector.highcharts(this._options.chartOptions); this._chart = this._selector.highcharts(); break; default: throw(this.classIdentifier() + ' "' + collection.name() + '": Chart type specified is not currently supported by ForerunnerDB: ' + this._options.type); } // Hook the collection events to auto-update the chart this._hookEvents(); }; Shared.addModule('Highchart', Highchart); Collection = Shared.modules.Collection; CollectionInit = Collection.prototype.init; Shared.mixin(Highchart.prototype, 'Mixin.Common'); Shared.mixin(Highchart.prototype, 'Mixin.Events'); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Highchart.prototype, 'state'); /** * Generate pie-chart series data from the given collection data array. * @param data * @param keyField * @param valField * @returns {Array} */ Highchart.prototype.pieDataFromCollectionData = function (data, keyField, valField) { var graphData = [], i; for (i = 0; i < data.length; i++) { graphData.push([data[i][keyField], data[i][valField]]); } return graphData; }; /** * Generate line-chart series data from the given collection data array. * @param seriesField * @param keyField * @param valField * @param orderBy */ Highchart.prototype.seriesDataFromCollectionData = function (seriesField, keyField, valField, orderBy, options) { var data = this._collection.distinct(seriesField), seriesData = [], xAxis = options && options.chartOptions && options.chartOptions.xAxis ? options.chartOptions.xAxis : { categories: [] }, seriesName, query, dataSearch, seriesValues, sData, i, k; // What we WANT to output: /*series: [{ name: 'Responses', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }]*/ // Loop keys for (i = 0; i < data.length; i++) { seriesName = data[i]; query = {}; query[seriesField] = seriesName; seriesValues = []; dataSearch = this._collection.find(query, { orderBy: orderBy }); // Loop the keySearch data and grab the value for each item for (k = 0; k < dataSearch.length; k++) { if (xAxis.categories) { xAxis.categories.push(dataSearch[k][keyField]); seriesValues.push(dataSearch[k][valField]); } else { seriesValues.push([dataSearch[k][keyField], dataSearch[k][valField]]); } } sData = { name: seriesName, data: seriesValues }; if (options.seriesOptions) { for (k in options.seriesOptions) { if (options.seriesOptions.hasOwnProperty(k)) { sData[k] = options.seriesOptions[k]; } } } seriesData.push(sData); } return { xAxis: xAxis, series: seriesData }; }; /** * Hook the events the chart needs to know about from the internal collection. * @private */ Highchart.prototype._hookEvents = function () { var self = this; self._collection.on('change', function () { self._changeListener.apply(self, arguments); }); // If the collection is dropped, clean up after ourselves self._collection.on('drop', function () { self.drop.apply(self); }); }; /** * Handles changes to the collection data that the chart is reading from and then * updates the data in the chart display. * @private */ Highchart.prototype._changeListener = function () { var self = this; // Update the series data on the chart if (typeof self._collection !== 'undefined' && self._chart) { var data = self._collection.find(), i; switch (self._options.type) { case 'pie': self._chart.series[0].setData( self.pieDataFromCollectionData( data, self._options.keyField, self._options.valField ), true, true ); break; case 'bar': case 'line': case 'area': case 'column': var seriesData = self.seriesDataFromCollectionData( self._options.seriesField, self._options.keyField, self._options.valField, self._options.orderBy, self._options ); if (seriesData.xAxis.categories) { self._chart.xAxis[0].setCategories( seriesData.xAxis.categories ); } for (i = 0; i < seriesData.series.length; i++) { if (self._chart.series[i]) { // Series exists, set it's data self._chart.series[i].setData( seriesData.series[i].data, true, true ); } else { // Series data does not yet exist, add a new series self._chart.addSeries( seriesData.series[i], true, true ); } } break; default: break; } } }; /** * Destroys the chart and all internal references. * @returns {Boolean} */ Highchart.prototype.drop = function (callback) { if (!this.isDropped()) { this._state = 'dropped'; if (this._chart) { this._chart.destroy(); } if (this._collection) { this._collection.off('change', this._changeListener); this._collection.off('drop', this.drop); if (this._collection._highcharts) { delete this._collection._highcharts[this._options.selector]; } } delete this._chart; delete this._options; delete this._collection; this.emit('drop', this); if (callback) { callback(false, true); } delete this._listeners; return true; } else { return true; } }; // Extend collection with highchart init Collection.prototype.init = function () { this._highcharts = {}; CollectionInit.apply(this, arguments); }; /** * Creates a pie chart from the collection. * @type {Overload} */ Collection.prototype.pieChart = new Overload({ /** * Chart via options object. * @func pieChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'pie'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'pie'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func pieChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {String} seriesName The name of the series to display on the chart. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, keyField, valField, seriesName, options) { options = options || {}; options.selector = selector; options.keyField = keyField; options.valField = valField; options.seriesName = seriesName; // Call the main chart method this.pieChart(options); } }); /** * Creates a line chart from the collection. * @type {Overload} */ Collection.prototype.lineChart = new Overload({ /** * Chart via selector. * @func lineChart * @memberof Highchart * @param {String} selector The chart selector. * @returns {*} */ 'string': function (selector) { return this._highcharts[selector]; }, /** * Chart via options object. * @func lineChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'line'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'line'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func lineChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.lineChart(options); } }); /** * Creates an area chart from the collection. * @type {Overload} */ Collection.prototype.areaChart = new Overload({ /** * Chart via options object. * @func areaChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'area'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'area'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func areaChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.areaChart(options); } }); /** * Creates a column chart from the collection. * @type {Overload} */ Collection.prototype.columnChart = new Overload({ /** * Chart via options object. * @func columnChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'column'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'column'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func columnChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.columnChart(options); } }); /** * Creates a bar chart from the collection. * @type {Overload} */ Collection.prototype.barChart = new Overload({ /** * Chart via options object. * @func barChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'bar'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'bar'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func barChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.barChart(options); } }); /** * Creates a stacked bar chart from the collection. * @type {Overload} */ Collection.prototype.stackedBarChart = new Overload({ /** * Chart via options object. * @func stackedBarChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'bar'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'bar'; options.plotOptions = options.plotOptions || {}; options.plotOptions.series = options.plotOptions.series || {}; options.plotOptions.series.stacking = options.plotOptions.series.stacking || 'normal'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func stackedBarChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.stackedBarChart(options); } }); /** * Removes a chart from the page by it's selector. * @memberof Collection * @param {String} selector The chart selector. */ Collection.prototype.dropChart = function (selector) { if (this._highcharts && this._highcharts[selector]) { this._highcharts[selector].drop(); } }; Shared.finishModule('Highchart'); module.exports = Highchart; },{"./Overload":33,"./Shared":41}],16:[function(_dereq_,module,exports){ "use strict"; /* name(string) id(string) rebuild(null) state ?? needed? match(query, options) lookup(query, options) insert(doc) remove(doc) primaryKey(string) collection(collection) */ var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'), BinaryTree = _dereq_('./BinaryTree'), GeoHash = _dereq_('./GeoHash'), sharedPathSolver = new Path(), sharedGeoHashSolver = new GeoHash(), // GeoHash Distances in Kilometers geoHashDistance = [ 5000, 1250, 156, 39.1, 4.89, 1.22, 0.153, 0.0382, 0.00477, 0.00119, 0.000149, 0.0000372 ]; /** * The index class used to instantiate 2d indexes that the database can * use to handle high-performance geospatial queries. * @constructor */ var Index2d = function () { this.init.apply(this, arguments); }; /** * Create the index. * @param {Object} keys The object with the keys that the user wishes the index * to operate on. * @param {Object} options Can be undefined, if passed is an object with arbitrary * options keys and values. * @param {Collection} collection The collection the index should be created for. */ Index2d.prototype.init = function (keys, options, collection) { this._btree = new BinaryTree(); this._btree.index(keys); this._size = 0; this._id = this._itemKeyHash(keys, keys); this._debug = options && options.debug ? options.debug : false; this.unique(options && options.unique ? options.unique : false); if (keys !== undefined) { this.keys(keys); } if (collection !== undefined) { this.collection(collection); this._btree.primaryKey(collection.primaryKey()); } this.name(options && options.name ? options.name : this._id); this._btree.debug(this._debug); }; Shared.addModule('Index2d', Index2d); Shared.mixin(Index2d.prototype, 'Mixin.Common'); Shared.mixin(Index2d.prototype, 'Mixin.ChainReactor'); Shared.mixin(Index2d.prototype, 'Mixin.Sorting'); Index2d.prototype.id = function () { return this._id; }; Index2d.prototype.state = function () { return this._state; }; Index2d.prototype.size = function () { return this._size; }; Shared.synthesize(Index2d.prototype, 'data'); Shared.synthesize(Index2d.prototype, 'name'); Shared.synthesize(Index2d.prototype, 'collection'); Shared.synthesize(Index2d.prototype, 'type'); Shared.synthesize(Index2d.prototype, 'unique'); Index2d.prototype.keys = function (val) { if (val !== undefined) { this._keys = val; // Count the keys this._keyCount = sharedPathSolver.parse(this._keys).length; return this; } return this._keys; }; Index2d.prototype.rebuild = function () { // Do we have a collection? if (this._collection) { // Get sorted data var collection = this._collection.subset({}, { $decouple: false, $orderBy: this._keys }), collectionData = collection.find(), dataIndex, dataCount = collectionData.length; // Clear the index data for the index this._btree.clear(); this._size = 0; if (this._unique) { this._uniqueLookup = {}; } // Loop the collection data for (dataIndex = 0; dataIndex < dataCount; dataIndex++) { this.insert(collectionData[dataIndex]); } } this._state = { name: this._name, keys: this._keys, indexSize: this._size, built: new Date(), updated: new Date(), ok: true }; }; Index2d.prototype.insert = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash; dataItem = this.decouple(dataItem); if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); this._uniqueLookup[uniqueHash] = dataItem; } // Convert 2d indexed values to geohashes var keys = this._btree.keys(), pathVal, geoHash, lng, lat, i; for (i = 0; i < keys.length; i++) { pathVal = sharedPathSolver.get(dataItem, keys[i].path); if (pathVal instanceof Array) { lng = pathVal[0]; lat = pathVal[1]; geoHash = sharedGeoHashSolver.encode(lng, lat); sharedPathSolver.set(dataItem, keys[i].path, geoHash); } } if (this._btree.insert(dataItem)) { this._size++; return true; } return false; }; Index2d.prototype.remove = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); delete this._uniqueLookup[uniqueHash]; } if (this._btree.remove(dataItem)) { this._size--; return true; } return false; }; Index2d.prototype.violation = function (dataItem) { // Generate item hash var uniqueHash = this._itemHash(dataItem, this._keys); // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; Index2d.prototype.hashViolation = function (uniqueHash) { // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; /** * Looks up records that match the passed query and options. * @param query The query to execute. * @param options A query options object. * @param {Operation=} op Optional operation instance that allows * us to provide operation diagnostics and analytics back to the * main calling instance as the process is running. * @returns {*} */ Index2d.prototype.lookup = function (query, options, op) { // Loop the indexed keys and determine if the query has any operators // that we want to handle differently from a standard lookup var keys = this._btree.keys(), pathStr, pathVal, results, i; for (i = 0; i < keys.length; i++) { pathStr = keys[i].path; pathVal = sharedPathSolver.get(query, pathStr); if (typeof pathVal === 'object') { if (pathVal.$near) { results = []; // Do a near point lookup results = results.concat(this.near(pathStr, pathVal.$near, options, op)); } if (pathVal.$geoWithin) { results = []; // Do a geoWithin shape lookup results = results.concat(this.geoWithin(pathStr, pathVal.$geoWithin, options, op)); } return results; } } return this._btree.lookup(query, options); }; Index2d.prototype.near = function (pathStr, query, options, op) { var self = this, neighbours, visitedCount, visitedNodes, visitedData, search, results, finalResults = [], precision, maxDistanceKm, distance, distCache, latLng, pk = this._collection.primaryKey(), i; // Calculate the required precision to encapsulate the distance // TODO: Instead of opting for the "one size larger" than the distance boxes, // TODO: we should calculate closest divisible box size as a multiple and then // TODO: scan neighbours until we have covered the area otherwise we risk // TODO: opening the results up to vastly more information as the box size // TODO: increases dramatically between the geohash precisions if (query.$distanceUnits === 'km') { maxDistanceKm = query.$maxDistance; for (i = 0; i < geoHashDistance.length; i++) { if (maxDistanceKm > geoHashDistance[i]) { precision = i + 1; break; } } } else if (query.$distanceUnits === 'miles') { maxDistanceKm = query.$maxDistance * 1.60934; for (i = 0; i < geoHashDistance.length; i++) { if (maxDistanceKm > geoHashDistance[i]) { precision = i + 1; break; } } } if (precision === 0) { precision = 1; } // Calculate 9 box geohashes if (op) { op.time('index2d.calculateHashArea'); } neighbours = sharedGeoHashSolver.calculateHashArrayByRadius(query.$point, maxDistanceKm, precision); if (op) { op.time('index2d.calculateHashArea'); } if (op) { op.data('index2d.near.precision', precision); op.data('index2d.near.hashArea', neighbours); op.data('index2d.near.maxDistanceKm', maxDistanceKm); op.data('index2d.near.centerPointCoords', [query.$point[0], query.$point[1]]); } // Lookup all matching co-ordinates from the btree results = []; visitedCount = 0; visitedData = {}; visitedNodes = []; if (op) { op.time('index2d.near.getDocsInsideHashArea'); } for (i = 0; i < neighbours.length; i++) { search = this._btree.startsWith(pathStr, neighbours[i]); visitedData[neighbours[i]] = search; visitedCount += search._visitedCount; visitedNodes = visitedNodes.concat(search._visitedNodes); results = results.concat(search); } if (op) { op.time('index2d.near.getDocsInsideHashArea'); op.data('index2d.near.startsWith', visitedData); op.data('index2d.near.visitedTreeNodes', visitedNodes); } // Work with original data if (op) { op.time('index2d.near.lookupDocsById'); } results = this._collection._primaryIndex.lookup(results); if (op) { op.time('index2d.near.lookupDocsById'); } if (query.$distanceField) { // Decouple the results before we modify them results = this.decouple(results); } if (results.length) { distance = {}; if (op) { op.time('index2d.near.calculateDistanceFromCenter'); } // Loop the results and calculate distance for (i = 0; i < results.length; i++) { latLng = sharedPathSolver.get(results[i], pathStr); distCache = distance[results[i][pk]] = this.distanceBetweenPoints(query.$point[0], query.$point[1], latLng[0], latLng[1]); if (distCache <= maxDistanceKm) { if (query.$distanceField) { // Options specify a field to add the distance data to // so add it now sharedPathSolver.set(results[i], query.$distanceField, query.$distanceUnits === 'km' ? distCache : Math.round(distCache * 0.621371)); } if (query.$geoHashField) { // Options specify a field to add the distance data to // so add it now sharedPathSolver.set(results[i], query.$geoHashField, sharedGeoHashSolver.encode(latLng[0], latLng[1], precision)); } // Add item as it is inside radius distance finalResults.push(results[i]); } } if (op) { op.time('index2d.near.calculateDistanceFromCenter'); } // Sort by distance from center if (op) { op.time('index2d.near.sortResultsByDistance'); } finalResults.sort(function (a, b) { return self.sortAsc(distance[a[pk]], distance[b[pk]]); }); if (op) { op.time('index2d.near.sortResultsByDistance'); } } // Return data return finalResults; }; Index2d.prototype.geoWithin = function (pathStr, query, options) { console.log('geoWithin() is currently a prototype method with no actual implementation... it just returns a blank array.'); return []; }; Index2d.prototype.distanceBetweenPoints = function (lat1, lng1, lat2, lng2) { var R = 6371; // kilometres var lat1Rad = this.toRadians(lat1); var lat2Rad = this.toRadians(lat2); var lat2MinusLat1Rad = this.toRadians(lat2-lat1); var lng2MinusLng1Rad = this.toRadians(lng2-lng1); var a = Math.sin(lat2MinusLat1Rad/2) * Math.sin(lat2MinusLat1Rad/2) + Math.cos(lat1Rad) * Math.cos(lat2Rad) * Math.sin(lng2MinusLng1Rad/2) * Math.sin(lng2MinusLng1Rad/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); return R * c; }; Index2d.prototype.toRadians = function (degrees) { return degrees * 0.01747722222222; }; Index2d.prototype.match = function (query, options) { // TODO: work out how to represent that this is a better match if the query has $near than // TODO: a basic btree index which will not be able to resolve a $near operator return this._btree.match(query, options); }; Index2d.prototype._itemHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.value(item, pathData[k].path).join(':'); } return hash; }; Index2d.prototype._itemKeyHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.keyValue(item, pathData[k].path); } return hash; }; Index2d.prototype._itemHashArr = function (item, keys) { var path = new Path(), pathData, //hash = '', hashArr = [], valArr, i, k, j; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { valArr = path.value(item, pathData[k].path); for (i = 0; i < valArr.length; i++) { if (k === 0) { // Setup the initial hash array hashArr.push(valArr[i]); } else { // Loop the hash array and concat the value to it for (j = 0; j < hashArr.length; j++) { hashArr[j] = hashArr[j] + '_' + valArr[i]; } } } } return hashArr; }; // Register this index on the shared object Shared.index['2d'] = Index2d; Shared.finishModule('Index2d'); module.exports = Index2d; },{"./BinaryTree":5,"./GeoHash":13,"./Path":35,"./Shared":41}],17:[function(_dereq_,module,exports){ "use strict"; /* name(string) id(string) rebuild(null) state ?? needed? match(query, options) lookup(query, options) insert(doc) remove(doc) primaryKey(string) collection(collection) */ var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'), BinaryTree = _dereq_('./BinaryTree'); /** * The index class used to instantiate btree indexes that the database can * use to speed up queries on collections and views. * @constructor */ var IndexBinaryTree = function () { this.init.apply(this, arguments); }; IndexBinaryTree.prototype.init = function (keys, options, collection) { this._btree = new BinaryTree(); this._btree.index(keys); this._size = 0; this._id = this._itemKeyHash(keys, keys); this._debug = options && options.debug ? options.debug : false; this.unique(options && options.unique ? options.unique : false); if (keys !== undefined) { this.keys(keys); } if (collection !== undefined) { this.collection(collection); this._btree.primaryKey(collection.primaryKey()); } this.name(options && options.name ? options.name : this._id); this._btree.debug(this._debug); }; Shared.addModule('IndexBinaryTree', IndexBinaryTree); Shared.mixin(IndexBinaryTree.prototype, 'Mixin.ChainReactor'); Shared.mixin(IndexBinaryTree.prototype, 'Mixin.Sorting'); IndexBinaryTree.prototype.id = function () { return this._id; }; IndexBinaryTree.prototype.state = function () { return this._state; }; IndexBinaryTree.prototype.size = function () { return this._size; }; Shared.synthesize(IndexBinaryTree.prototype, 'data'); Shared.synthesize(IndexBinaryTree.prototype, 'name'); Shared.synthesize(IndexBinaryTree.prototype, 'collection'); Shared.synthesize(IndexBinaryTree.prototype, 'type'); Shared.synthesize(IndexBinaryTree.prototype, 'unique'); IndexBinaryTree.prototype.keys = function (val) { if (val !== undefined) { this._keys = val; // Count the keys this._keyCount = (new Path()).parse(this._keys).length; return this; } return this._keys; }; IndexBinaryTree.prototype.rebuild = function () { // Do we have a collection? if (this._collection) { // Get sorted data var collection = this._collection.subset({}, { $decouple: false, $orderBy: this._keys }), collectionData = collection.find(), dataIndex, dataCount = collectionData.length; // Clear the index data for the index this._btree.clear(); this._size = 0; if (this._unique) { this._uniqueLookup = {}; } // Loop the collection data for (dataIndex = 0; dataIndex < dataCount; dataIndex++) { this.insert(collectionData[dataIndex]); } } this._state = { name: this._name, keys: this._keys, indexSize: this._size, built: new Date(), updated: new Date(), ok: true }; }; IndexBinaryTree.prototype.insert = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); this._uniqueLookup[uniqueHash] = dataItem; } if (this._btree.insert(dataItem)) { this._size++; return true; } return false; }; IndexBinaryTree.prototype.remove = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); delete this._uniqueLookup[uniqueHash]; } if (this._btree.remove(dataItem)) { this._size--; return true; } return false; }; IndexBinaryTree.prototype.violation = function (dataItem) { // Generate item hash var uniqueHash = this._itemHash(dataItem, this._keys); // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexBinaryTree.prototype.hashViolation = function (uniqueHash) { // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexBinaryTree.prototype.lookup = function (query, options, op) { return this._btree.lookup(query, options, op); }; IndexBinaryTree.prototype.match = function (query, options) { return this._btree.match(query, options); }; IndexBinaryTree.prototype._itemHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.value(item, pathData[k].path).join(':'); } return hash; }; IndexBinaryTree.prototype._itemKeyHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.keyValue(item, pathData[k].path); } return hash; }; IndexBinaryTree.prototype._itemHashArr = function (item, keys) { var path = new Path(), pathData, //hash = '', hashArr = [], valArr, i, k, j; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { valArr = path.value(item, pathData[k].path); for (i = 0; i < valArr.length; i++) { if (k === 0) { // Setup the initial hash array hashArr.push(valArr[i]); } else { // Loop the hash array and concat the value to it for (j = 0; j < hashArr.length; j++) { hashArr[j] = hashArr[j] + '_' + valArr[i]; } } } } return hashArr; }; // Register this index on the shared object Shared.index.btree = IndexBinaryTree; Shared.finishModule('IndexBinaryTree'); module.exports = IndexBinaryTree; },{"./BinaryTree":5,"./Path":35,"./Shared":41}],18:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'); /** * The index class used to instantiate hash map indexes that the database can * use to speed up queries on collections and views. * @constructor */ var IndexHashMap = function () { this.init.apply(this, arguments); }; IndexHashMap.prototype.init = function (keys, options, collection) { this._crossRef = {}; this._size = 0; this._id = this._itemKeyHash(keys, keys); this.data({}); this.unique(options && options.unique ? options.unique : false); if (keys !== undefined) { this.keys(keys); } if (collection !== undefined) { this.collection(collection); } this.name(options && options.name ? options.name : this._id); }; Shared.addModule('IndexHashMap', IndexHashMap); Shared.mixin(IndexHashMap.prototype, 'Mixin.ChainReactor'); IndexHashMap.prototype.id = function () { return this._id; }; IndexHashMap.prototype.state = function () { return this._state; }; IndexHashMap.prototype.size = function () { return this._size; }; Shared.synthesize(IndexHashMap.prototype, 'data'); Shared.synthesize(IndexHashMap.prototype, 'name'); Shared.synthesize(IndexHashMap.prototype, 'collection'); Shared.synthesize(IndexHashMap.prototype, 'type'); Shared.synthesize(IndexHashMap.prototype, 'unique'); IndexHashMap.prototype.keys = function (val) { if (val !== undefined) { this._keys = val; // Count the keys this._keyCount = (new Path()).parse(this._keys).length; return this; } return this._keys; }; IndexHashMap.prototype.rebuild = function () { // Do we have a collection? if (this._collection) { // Get sorted data var collection = this._collection.subset({}, { $decouple: false, $orderBy: this._keys }), collectionData = collection.find(), dataIndex, dataCount = collectionData.length; // Clear the index data for the index this._data = {}; this._size = 0; if (this._unique) { this._uniqueLookup = {}; } // Loop the collection data for (dataIndex = 0; dataIndex < dataCount; dataIndex++) { this.insert(collectionData[dataIndex]); } } this._state = { name: this._name, keys: this._keys, indexSize: this._size, built: new Date(), updated: new Date(), ok: true }; }; IndexHashMap.prototype.insert = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, itemHashArr, hashIndex; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); this._uniqueLookup[uniqueHash] = dataItem; } // Generate item hash itemHashArr = this._itemHashArr(dataItem, this._keys); // Get the path search results and store them for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) { this.pushToPathValue(itemHashArr[hashIndex], dataItem); } }; IndexHashMap.prototype.update = function (dataItem, options) { // TODO: Write updates to work // 1: Get uniqueHash for the dataItem primary key value (may need to generate a store for this) // 2: Remove the uniqueHash as it currently stands // 3: Generate a new uniqueHash for dataItem // 4: Insert the new uniqueHash }; IndexHashMap.prototype.remove = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, itemHashArr, hashIndex; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); delete this._uniqueLookup[uniqueHash]; } // Generate item hash itemHashArr = this._itemHashArr(dataItem, this._keys); // Get the path search results and store them for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) { this.pullFromPathValue(itemHashArr[hashIndex], dataItem); } }; IndexHashMap.prototype.violation = function (dataItem) { // Generate item hash var uniqueHash = this._itemHash(dataItem, this._keys); // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexHashMap.prototype.hashViolation = function (uniqueHash) { // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexHashMap.prototype.pushToPathValue = function (hash, obj) { var pathValArr = this._data[hash] = this._data[hash] || []; // Make sure we have not already indexed this object at this path/value if (pathValArr.indexOf(obj) === -1) { // Index the object pathValArr.push(obj); // Record the reference to this object in our index size this._size++; // Cross-reference this association for later lookup this.pushToCrossRef(obj, pathValArr); } }; IndexHashMap.prototype.pullFromPathValue = function (hash, obj) { var pathValArr = this._data[hash], indexOfObject; // Make sure we have already indexed this object at this path/value indexOfObject = pathValArr.indexOf(obj); if (indexOfObject > -1) { // Un-index the object pathValArr.splice(indexOfObject, 1); // Record the reference to this object in our index size this._size--; // Remove object cross-reference this.pullFromCrossRef(obj, pathValArr); } // Check if we should remove the path value array if (!pathValArr.length) { // Remove the array delete this._data[hash]; } }; IndexHashMap.prototype.pull = function (obj) { // Get all places the object has been used and remove them var id = obj[this._collection.primaryKey()], crossRefArr = this._crossRef[id], arrIndex, arrCount = crossRefArr.length, arrItem; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = crossRefArr[arrIndex]; // Remove item from this index lookup array this._pullFromArray(arrItem, obj); } // Record the reference to this object in our index size this._size--; // Now remove the cross-reference entry for this object delete this._crossRef[id]; }; IndexHashMap.prototype._pullFromArray = function (arr, obj) { var arrCount = arr.length; while (arrCount--) { if (arr[arrCount] === obj) { arr.splice(arrCount, 1); } } }; IndexHashMap.prototype.pushToCrossRef = function (obj, pathValArr) { var id = obj[this._collection.primaryKey()], crObj; this._crossRef[id] = this._crossRef[id] || []; // Check if the cross-reference to the pathVal array already exists crObj = this._crossRef[id]; if (crObj.indexOf(pathValArr) === -1) { // Add the cross-reference crObj.push(pathValArr); } }; IndexHashMap.prototype.pullFromCrossRef = function (obj, pathValArr) { var id = obj[this._collection.primaryKey()]; delete this._crossRef[id]; }; IndexHashMap.prototype.lookup = function (query) { return this._data[this._itemHash(query, this._keys)] || []; }; IndexHashMap.prototype.match = function (query, options) { // Check if the passed query has data in the keys our index // operates on and if so, is the query sort matching our order var pathSolver = new Path(); var indexKeyArr = pathSolver.parseArr(this._keys), queryArr = pathSolver.parseArr(query), matchedKeys = [], matchedKeyCount = 0, i; // Loop the query array and check the order of keys against the // index key array to see if this index can be used for (i = 0; i < indexKeyArr.length; i++) { if (queryArr[i] === indexKeyArr[i]) { matchedKeyCount++; matchedKeys.push(queryArr[i]); } else { // Query match failed - this is a hash map index so partial key match won't work return { matchedKeys: [], totalKeyCount: queryArr.length, score: 0 }; } } return { matchedKeys: matchedKeys, totalKeyCount: queryArr.length, score: matchedKeyCount }; //return pathSolver.countObjectPaths(this._keys, query); }; IndexHashMap.prototype._itemHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.value(item, pathData[k].path).join(':'); } return hash; }; IndexHashMap.prototype._itemKeyHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.keyValue(item, pathData[k].path); } return hash; }; IndexHashMap.prototype._itemHashArr = function (item, keys) { var path = new Path(), pathData, //hash = '', hashArr = [], valArr, i, k, j; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { valArr = path.value(item, pathData[k].path); for (i = 0; i < valArr.length; i++) { if (k === 0) { // Setup the initial hash array hashArr.push(valArr[i]); } else { // Loop the hash array and concat the value to it for (j = 0; j < hashArr.length; j++) { hashArr[j] = hashArr[j] + '_' + valArr[i]; } } } } return hashArr; }; // Register this index on the shared object Shared.index.hashed = IndexHashMap; Shared.finishModule('IndexHashMap'); module.exports = IndexHashMap; },{"./Path":35,"./Shared":41}],19:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * The key value store class used when storing basic in-memory KV data, * and can be queried for quick retrieval. Mostly used for collection * primary key indexes and lookups. * @param {String=} name Optional KV store name. * @constructor */ var KeyValueStore = function (name) { this.init.apply(this, arguments); }; KeyValueStore.prototype.init = function (name) { this._name = name; this._data = {}; this._primaryKey = '_id'; }; Shared.addModule('KeyValueStore', KeyValueStore); Shared.mixin(KeyValueStore.prototype, 'Mixin.ChainReactor'); /** * Get / set the name of the key/value store. * @param {String} val The name to set. * @returns {*} */ Shared.synthesize(KeyValueStore.prototype, 'name'); /** * Get / set the primary key. * @param {String} key The key to set. * @returns {*} */ KeyValueStore.prototype.primaryKey = function (key) { if (key !== undefined) { this._primaryKey = key; return this; } return this._primaryKey; }; /** * Removes all data from the store. * @returns {*} */ KeyValueStore.prototype.truncate = function () { this._data = {}; return this; }; /** * Sets data against a key in the store. * @param {String} key The key to set data for. * @param {*} value The value to assign to the key. * @returns {*} */ KeyValueStore.prototype.set = function (key, value) { this._data[key] = value ? value : true; return this; }; /** * Gets data stored for the passed key. * @param {String} key The key to get data for. * @returns {*} */ KeyValueStore.prototype.get = function (key) { return this._data[key]; }; /** * Get / set the primary key. * @param {*} val A lookup query. * @returns {*} */ KeyValueStore.prototype.lookup = function (val) { var pk = this._primaryKey, valType = typeof val, arrIndex, arrCount, lookupItem, result = []; // Check for early exit conditions if (valType === 'string' || valType === 'number') { lookupItem = this.get(val); if (lookupItem !== undefined) { return [lookupItem]; } else { return []; } } else if (valType === 'object') { if (val instanceof Array) { // An array of primary keys, find all matches arrCount = val.length; result = []; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { lookupItem = this.lookup(val[arrIndex]); if (lookupItem) { if (lookupItem instanceof Array) { result = result.concat(lookupItem); } else { result.push(lookupItem); } } } return result; } else if (val[pk]) { return this.lookup(val[pk]); } } // COMMENTED AS CODE WILL NEVER BE REACHED // Complex lookup /*lookupData = this._lookupKeys(val); keys = lookupData.keys; negate = lookupData.negate; if (!negate) { // Loop keys and return values for (arrIndex = 0; arrIndex < keys.length; arrIndex++) { result.push(this.get(keys[arrIndex])); } } else { // Loop data and return non-matching keys for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (keys.indexOf(arrIndex) === -1) { result.push(this.get(arrIndex)); } } } } return result;*/ }; // COMMENTED AS WE ARE NOT CURRENTLY PASSING COMPLEX QUERIES TO KEYVALUESTORE INDEXES /*KeyValueStore.prototype._lookupKeys = function (val) { var pk = this._primaryKey, valType = typeof val, arrIndex, arrCount, lookupItem, bool, result; if (valType === 'string' || valType === 'number') { return { keys: [val], negate: false }; } else if (valType === 'object') { if (val instanceof RegExp) { // Create new data result = []; for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (val.test(arrIndex)) { result.push(arrIndex); } } } return { keys: result, negate: false }; } else if (val instanceof Array) { // An array of primary keys, find all matches arrCount = val.length; result = []; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { result = result.concat(this._lookupKeys(val[arrIndex]).keys); } return { keys: result, negate: false }; } else if (val.$in && (val.$in instanceof Array)) { return { keys: this._lookupKeys(val.$in).keys, negate: false }; } else if (val.$nin && (val.$nin instanceof Array)) { return { keys: this._lookupKeys(val.$nin).keys, negate: true }; } else if (val.$ne) { return { keys: this._lookupKeys(val.$ne, true).keys, negate: true }; } else if (val.$or && (val.$or instanceof Array)) { // Create new data result = []; for (arrIndex = 0; arrIndex < val.$or.length; arrIndex++) { result = result.concat(this._lookupKeys(val.$or[arrIndex]).keys); } return { keys: result, negate: false }; } else if (val[pk]) { return this._lookupKeys(val[pk]); } } };*/ /** * Removes data for the given key from the store. * @param {String} key The key to un-set. * @returns {*} */ KeyValueStore.prototype.unSet = function (key) { delete this._data[key]; return this; }; /** * Sets data for the give key in the store only where the given key * does not already have a value in the store. * @param {String} key The key to set data for. * @param {*} value The value to assign to the key. * @returns {Boolean} True if data was set or false if data already * exists for the key. */ KeyValueStore.prototype.uniqueSet = function (key, value) { if (this._data[key] === undefined) { this._data[key] = value; return true; } return false; }; Shared.finishModule('KeyValueStore'); module.exports = KeyValueStore; },{"./Shared":41}],20:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Operation = _dereq_('./Operation'); /** * The metrics class used to store details about operations. * @constructor */ var Metrics = function () { this.init.apply(this, arguments); }; Metrics.prototype.init = function () { this._data = []; }; Shared.addModule('Metrics', Metrics); Shared.mixin(Metrics.prototype, 'Mixin.ChainReactor'); /** * Creates an operation within the metrics instance and if metrics * are currently enabled (by calling the start() method) the operation * is also stored in the metrics log. * @param {String} name The name of the operation. * @returns {Operation} */ Metrics.prototype.create = function (name) { var op = new Operation(name); if (this._enabled) { this._data.push(op); } return op; }; /** * Starts logging operations. * @returns {Metrics} */ Metrics.prototype.start = function () { this._enabled = true; return this; }; /** * Stops logging operations. * @returns {Metrics} */ Metrics.prototype.stop = function () { this._enabled = false; return this; }; /** * Clears all logged operations. * @returns {Metrics} */ Metrics.prototype.clear = function () { this._data = []; return this; }; /** * Returns an array of all logged operations. * @returns {Array} */ Metrics.prototype.list = function () { return this._data; }; Shared.finishModule('Metrics'); module.exports = Metrics; },{"./Operation":32,"./Shared":41}],21:[function(_dereq_,module,exports){ "use strict"; var CRUD = { preSetData: function () { }, postSetData: function () { } }; module.exports = CRUD; },{}],22:[function(_dereq_,module,exports){ "use strict"; /** * The chain reactor mixin, provides methods to the target object that allow chain * reaction events to propagate to the target and be handled, processed and passed * on down the chain. * @mixin */ var ChainReactor = { /** * Creates a chain link between the current reactor node and the passed * reactor node. Chain packets that are send by this reactor node will * then be propagated to the passed node for subsequent packets. * @param {*} obj The chain reactor node to link to. */ chain: function (obj) { if (this.debug && this.debug()) { if (obj._reactorIn && obj._reactorOut) { console.log(obj._reactorIn.logIdentifier() + ' Adding target "' + obj._reactorOut.instanceIdentifier() + '" to the chain reactor target list'); } else { console.log(this.logIdentifier() + ' Adding target "' + obj.instanceIdentifier() + '" to the chain reactor target list'); } } this._chain = this._chain || []; var index = this._chain.indexOf(obj); if (index === -1) { this._chain.push(obj); } }, /** * Removes a chain link between the current reactor node and the passed * reactor node. Chain packets sent from this reactor node will no longer * be received by the passed node. * @param {*} obj The chain reactor node to unlink from. */ unChain: function (obj) { if (this.debug && this.debug()) { if (obj._reactorIn && obj._reactorOut) { console.log(obj._reactorIn.logIdentifier() + ' Removing target "' + obj._reactorOut.instanceIdentifier() + '" from the chain reactor target list'); } else { console.log(this.logIdentifier() + ' Removing target "' + obj.instanceIdentifier() + '" from the chain reactor target list'); } } if (this._chain) { var index = this._chain.indexOf(obj); if (index > -1) { this._chain.splice(index, 1); } } }, /** * Determines if this chain reactor node has any listeners downstream. * @returns {Boolean} True if there are nodes downstream of this node. */ chainWillSend: function () { return Boolean(this._chain); }, /** * Sends a chain reactor packet downstream from this node to any of its * chained targets that were linked to this node via a call to chain(). * @param {String} type The type of chain reactor packet to send. This * can be any string but the receiving reactor nodes will not react to * it unless they recognise the string. Built-in strings include: "insert", * "update", "remove", "setData" and "debug". * @param {Object} data A data object that usually contains a key called * "dataSet" which is an array of items to work on, and can contain other * custom keys that help describe the operation. * @param {Object=} options An options object. Can also contain custom * key/value pairs that your custom chain reactor code can operate on. */ chainSend: function (type, data, options) { if (this._chain) { var arr = this._chain, arrItem, count = arr.length, index, dataCopy = this.decouple(data, count); for (index = 0; index < count; index++) { arrItem = arr[index]; if (!arrItem._state || (arrItem._state && !arrItem.isDropped())) { if (this.debug && this.debug()) { if (arrItem._reactorIn && arrItem._reactorOut) { console.log(arrItem._reactorIn.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem._reactorOut.instanceIdentifier() + '"'); } else { console.log(this.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem.instanceIdentifier() + '"'); } } if (arrItem.chainReceive) { arrItem.chainReceive(this, type, dataCopy[index], options); } } else { console.log('Reactor Data:', type, data, options); console.log('Reactor Node:', arrItem); throw('Chain reactor attempting to send data to target reactor node that is in a dropped state!'); } } } }, /** * Handles receiving a chain reactor message that was sent via the chainSend() * method. Creates the chain packet object and then allows it to be processed. * @param {Object} sender The node that is sending the packet. * @param {String} type The type of packet. * @param {Object} data The data related to the packet. * @param {Object=} options An options object. */ chainReceive: function (sender, type, data, options) { var chainPacket = { sender: sender, type: type, data: data, options: options }, cancelPropagate = false; if (this.debug && this.debug()) { console.log(this.logIdentifier() + ' Received data from parent reactor node'); } // Check if we have a chain handler method if (this._chainHandler) { // Fire our internal handler cancelPropagate = this._chainHandler(chainPacket); } // Check if we were told to cancel further propagation if (!cancelPropagate) { // Propagate the message down the chain this.chainSend(chainPacket.type, chainPacket.data, chainPacket.options); } } }; module.exports = ChainReactor; },{}],23:[function(_dereq_,module,exports){ "use strict"; var idCounter = 0, Overload = _dereq_('./Overload'), Serialiser = _dereq_('./Serialiser'), Common, serialiser = new Serialiser(); /** * Provides commonly used methods to most classes in ForerunnerDB. * @mixin */ Common = { // Expose the serialiser object so it can be extended with new data handlers. serialiser: serialiser, /** * Generates a JSON serialisation-compatible object instance. After the * instance has been passed through this method, it will be able to survive * a JSON.stringify() and JSON.parse() cycle and still end up as an * instance at the end. Further information about this process can be found * in the ForerunnerDB wiki at: https://github.com/Irrelon/ForerunnerDB/wiki/Serialiser-&-Performance-Benchmarks * @param {*} val The object instance such as "new Date()" or "new RegExp()". */ make: function (val) { // This is a conversion request, hand over to serialiser return serialiser.convert(val); }, /** * Gets / sets data in the item store. The store can be used to set and * retrieve data against a key. Useful for adding arbitrary key/value data * to a collection / view etc and retrieving it later. * @param {String|*} key The key under which to store the passed value or * retrieve the existing stored value. * @param {*=} val Optional value. If passed will overwrite the existing value * stored against the specified key if one currently exists. * @returns {*} */ store: function (key, val) { if (key !== undefined) { if (val !== undefined) { // Store the data this._store = this._store || {}; this._store[key] = val; return this; } if (this._store) { return this._store[key]; } } return undefined; }, /** * Removes a previously stored key/value pair from the item store, set previously * by using the store() method. * @param {String|*} key The key of the key/value pair to remove; * @returns {Common} Returns this for chaining. */ unStore: function (key) { if (key !== undefined) { delete this._store[key]; } return this; }, /** * Returns a non-referenced version of the passed object / array. * @param {Object} data The object or array to return as a non-referenced version. * @param {Number=} copies Optional number of copies to produce. If specified, the return * value will be an array of decoupled objects, each distinct from the other. * @returns {*} */ decouple: function (data, copies) { if (data !== undefined && data !== "") { if (!copies) { return this.jParse(this.jStringify(data)); } else { var i, json = this.jStringify(data), copyArr = []; for (i = 0; i < copies; i++) { copyArr.push(this.jParse(json)); } return copyArr; } } return undefined; }, /** * Parses and returns data from stringified version. * @param {String} data The stringified version of data to parse. * @returns {Object} The parsed JSON object from the data. */ jParse: function (data) { return JSON.parse(data, serialiser.reviver()); }, /** * Converts a JSON object into a stringified version. * @param {Object} data The data to stringify. * @returns {String} The stringified data. */ jStringify: function (data) { //return serialiser.stringify(data); return JSON.stringify(data); }, /** * Generates a new 16-character hexadecimal unique ID or * generates a new 16-character hexadecimal ID based on * the passed string. Will always generate the same ID * for the same string. * @param {String=} str A string to generate the ID from. * @return {String} */ objectId: function (str) { var id, pow = Math.pow(10, 17); if (!str) { idCounter++; id = (idCounter + ( Math.random() * pow + Math.random() * pow + Math.random() * pow + Math.random() * pow )).toString(16); } else { var val = 0, count = str.length, i; for (i = 0; i < count; i++) { val += str.charCodeAt(i) * pow; } id = val.toString(16); } return id; }, /** * Generates a unique hash for the passed object. * @param {Object} obj The object to generate a hash for. * @returns {String} */ hash: function (obj) { return JSON.stringify(obj); }, /** * Gets / sets debug flag that can enable debug message output to the * console if required. * @param {Boolean} val The value to set debug flag to. * @return {Boolean} True if enabled, false otherwise. */ /** * Sets debug flag for a particular type that can enable debug message * output to the console if required. * @param {String} type The name of the debug type to set flag for. * @param {Boolean} val The value to set debug flag to. * @return {Boolean} True if enabled, false otherwise. */ debug: new Overload([ function () { return this._debug && this._debug.all; }, function (val) { if (val !== undefined) { if (typeof val === 'boolean') { this._debug = this._debug || {}; this._debug.all = val; this.chainSend('debug', this._debug); return this; } else { return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[val]) || (this._debug && this._debug.all); } } return this._debug && this._debug.all; }, function (type, val) { if (type !== undefined) { if (val !== undefined) { this._debug = this._debug || {}; this._debug[type] = val; this.chainSend('debug', this._debug); return this; } return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[type]); } return this._debug && this._debug.all; } ]), /** * Returns a string describing the class this instance is derived from. * @returns {string} */ classIdentifier: function () { return 'ForerunnerDB.' + this.className; }, /** * Returns a string describing the instance by it's class name and instance * object name. * @returns {String} The instance identifier. */ instanceIdentifier: function () { return '[' + this.className + ']' + this.name(); }, /** * Returns a string used to denote a console log against this instance, * consisting of the class identifier and instance identifier. * @returns {string} The log identifier. */ logIdentifier: function () { return 'ForerunnerDB ' + this.instanceIdentifier(); }, /** * Converts a query object with MongoDB dot notation syntax * to Forerunner's object notation syntax. * @param {Object} obj The object to convert. */ convertToFdb: function (obj) { var varName, splitArr, objCopy, i; for (i in obj) { if (obj.hasOwnProperty(i)) { objCopy = obj; if (i.indexOf('.') > -1) { // Replace .$ with a placeholder before splitting by . char i = i.replace('.$', '[|$|]'); splitArr = i.split('.'); while ((varName = splitArr.shift())) { // Replace placeholder back to original .$ varName = varName.replace('[|$|]', '.$'); if (splitArr.length) { objCopy[varName] = {}; } else { objCopy[varName] = obj[i]; } objCopy = objCopy[varName]; } delete obj[i]; } } } }, /** * Checks if the state is dropped. * @returns {boolean} True when dropped, false otherwise. */ isDropped: function () { return this._state === 'dropped'; }, /** * Registers a timed callback that will overwrite itself if * the same id is used within the timeout period. Useful * for de-bouncing fast-calls. * @param {String} id An ID for the call (use the same one * to debounce the same calls). * @param {Function} callback The callback method to call on * timeout. * @param {Number} timeout The timeout in milliseconds before * the callback is called. */ debounce: function (id, callback, timeout) { var self = this, newData; self._debounce = self._debounce || {}; if (self._debounce[id]) { // Clear timeout for this item clearTimeout(self._debounce[id].timeout); } newData = { callback: callback, timeout: setTimeout(function () { // Delete existing reference delete self._debounce[id]; // Call the callback callback(); }, timeout) }; // Save current data self._debounce[id] = newData; } }; module.exports = Common; },{"./Overload":33,"./Serialiser":40}],24:[function(_dereq_,module,exports){ "use strict"; /** * Provides some database constants. * @mixin */ var Constants = { TYPE_INSERT: 0, TYPE_UPDATE: 1, TYPE_REMOVE: 2, PHASE_BEFORE: 0, PHASE_AFTER: 1 }; module.exports = Constants; },{}],25:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); /** * Provides event emitter functionality including the methods: on, off, once, emit, deferEmit. * @mixin */ var Events = { on: new Overload({ /** * Attach an event listener to the passed event. * @param {String} event The name of the event to listen for. * @param {Function} listener The method to call when the event is fired. */ 'string, function': function (event, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || {}; this._listeners[event]['*'] = this._listeners[event]['*'] || []; this._listeners[event]['*'].push(listener); return this; }, /** * Attach an event listener to the passed event only if the passed * id matches the document id for the event being fired. * @param {String} event The name of the event to listen for. * @param {*} id The document id to match against. * @param {Function} listener The method to call when the event is fired. */ 'string, *, function': function (event, id, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || {}; this._listeners[event][id] = this._listeners[event][id] || []; this._listeners[event][id].push(listener); return this; } }), once: new Overload({ 'string, function': function (eventName, callback) { var self = this, internalCallback = function () { self.off(eventName, internalCallback); callback.apply(self, arguments); }; return this.on(eventName, internalCallback); }, 'string, *, function': function (eventName, id, callback) { var self = this, internalCallback = function () { self.off(eventName, id, internalCallback); callback.apply(self, arguments); }; return this.on(eventName, id, internalCallback); } }), off: new Overload({ 'string': function (event) { if (this._listeners && this._listeners[event] && event in this._listeners) { delete this._listeners[event]; } return this; }, 'string, function': function (event, listener) { var arr, index; if (typeof(listener) === 'string') { if (this._listeners && this._listeners[event] && this._listeners[event][listener]) { delete this._listeners[event][listener]; } } else { if (this._listeners && event in this._listeners) { arr = this._listeners[event]['*']; index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } } return this; }, 'string, *, function': function (event, id, listener) { if (this._listeners && event in this._listeners && id in this.listeners[event]) { var arr = this._listeners[event][id], index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } }, 'string, *': function (event, id) { if (this._listeners && event in this._listeners && id in this._listeners[event]) { // Kill all listeners for this event id delete this._listeners[event][id]; } } }), emit: function (event, data) { this._listeners = this._listeners || {}; if (event in this._listeners) { var arrIndex, arrCount, tmpFunc, arr, listenerIdArr, listenerIdCount, listenerIdIndex; // Handle global emit if (this._listeners[event]['*']) { arr = this._listeners[event]['*']; arrCount = arr.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { // Check we have a function to execute tmpFunc = arr[arrIndex]; if (typeof tmpFunc === 'function') { tmpFunc.apply(this, Array.prototype.slice.call(arguments, 1)); } } } // Handle individual emit if (data instanceof Array) { // Check if the array is an array of objects in the collection if (data[0] && data[0][this._primaryKey]) { // Loop the array and check for listeners against the primary key listenerIdArr = this._listeners[event]; arrCount = data.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { if (listenerIdArr[data[arrIndex][this._primaryKey]]) { // Emit for this id listenerIdCount = listenerIdArr[data[arrIndex][this._primaryKey]].length; for (listenerIdIndex = 0; listenerIdIndex < listenerIdCount; listenerIdIndex++) { tmpFunc = listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex]; if (typeof tmpFunc === 'function') { listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex].apply(this, Array.prototype.slice.call(arguments, 1)); } } } } } } } return this; }, /** * Queues an event to be fired. This has automatic de-bouncing so that any * events of the same type that occur within 100 milliseconds of a previous * one will all be wrapped into a single emit rather than emitting tons of * events for lots of chained inserts etc. Only the data from the last * de-bounced event will be emitted. * @param {String} eventName The name of the event to emit. * @param {*=} data Optional data to emit with the event. */ deferEmit: function (eventName, data) { var self = this, args; if (!this._noEmitDefer && (!this._db || (this._db && !this._db._noEmitDefer))) { args = arguments; // Check for an existing timeout this._deferTimeout = this._deferTimeout || {}; if (this._deferTimeout[eventName]) { clearTimeout(this._deferTimeout[eventName]); } // Set a timeout this._deferTimeout[eventName] = setTimeout(function () { if (self.debug()) { console.log(self.logIdentifier() + ' Emitting ' + args[0]); } self.emit.apply(self, args); }, 1); } else { this.emit.apply(this, arguments); } return this; } }; module.exports = Events; },{"./Overload":33}],26:[function(_dereq_,module,exports){ "use strict"; /** * Provides object matching algorithm methods. * @mixin */ var Matching = { /** * Internal method that checks a document against a test object. * @param {*} source The source object or value to test against. * @param {*} test The test object or value to test with. * @param {Object} queryOptions The options the query was passed with. * @param {String=} opToApply The special operation to apply to the test such * as 'and' or an 'or' operator. * @param {Object=} options An object containing options to apply to the * operation such as limiting the fields returned etc. * @returns {Boolean} True if the test was positive, false on negative. * @private */ _match: function (source, test, queryOptions, opToApply, options) { // TODO: This method is quite long, break into smaller pieces var operation, applyOp = opToApply, recurseVal, tmpIndex, sourceType = typeof source, testType = typeof test, matchedAll = true, opResult, substringCache, i; if (sourceType === 'object' && source === null) { sourceType = 'null'; } if (testType === 'object' && test === null) { testType = 'null'; } options = options || {}; queryOptions = queryOptions || {}; // Check if options currently holds a root query object if (!options.$rootQuery) { // Root query not assigned, hold the root query options.$rootQuery = test; } // Check if options currently holds a root source object if (!options.$rootSource) { // Root query not assigned, hold the root query options.$rootSource = source; } // Assign current query data options.$currentQuery = test; options.$rootData = options.$rootData || {}; // Check if the comparison data are both strings or numbers if ((sourceType === 'string' || sourceType === 'number' || sourceType === 'null') && (testType === 'string' || testType === 'number' || testType === 'null')) { // The source and test data are flat types that do not require recursive searches, // so just compare them and return the result if (sourceType === 'number' || sourceType === 'null' || testType === 'null') { // Number or null comparison if (source !== test) { matchedAll = false; } } else { // String comparison // TODO: We can probably use a queryOptions.$locale as a second parameter here // TODO: to satisfy https://github.com/Irrelon/ForerunnerDB/issues/35 if (source.localeCompare(test)) { matchedAll = false; } } } else if ((sourceType === 'string' || sourceType === 'number') && (testType === 'object' && test instanceof RegExp)) { if (!test.test(source)) { matchedAll = false; } } else { for (i in test) { if (test.hasOwnProperty(i)) { // Assign previous query data options.$previousQuery = options.$parent; // Assign parent query data options.$parent = { query: test[i], key: i, parent: options.$previousQuery }; // Reset operation flag operation = false; // Grab first two chars of the key name to check for $ substringCache = i.substr(0, 2); // Check if the property is a comment (ignorable) if (substringCache === '//') { // Skip this property continue; } // Check if the property starts with a dollar (function) if (substringCache.indexOf('$') === 0) { // Ask the _matchOp method to handle the operation opResult = this._matchOp(i, source, test[i], queryOptions, options); // Check the result of the matchOp operation // If the result is -1 then no operation took place, otherwise the result // will be a boolean denoting a match (true) or no match (false) if (opResult > -1) { if (opResult) { if (opToApply === 'or') { return true; } } else { // Set the matchedAll flag to the result of the operation // because the operation did not return true matchedAll = opResult; } // Record that an operation was handled operation = true; } } // Check for regex if (!operation && test[i] instanceof RegExp) { operation = true; if (sourceType === 'object' && source[i] !== undefined && test[i].test(source[i])) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } if (!operation) { // Check if our query is an object if (typeof(test[i]) === 'object') { // Because test[i] is an object, source must also be an object // Check if our source data we are checking the test query against // is an object or an array if (source[i] !== undefined) { if (source[i] instanceof Array && !(test[i] instanceof Array)) { // The source data is an array, so check each item until a // match is found recurseVal = false; for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) { recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else if (!(source[i] instanceof Array) && test[i] instanceof Array) { // The test key data is an array and the source key data is not so check // each item in the test key data to see if the source item matches one // of them. This is effectively an $in search. recurseVal = false; for (tmpIndex = 0; tmpIndex < test[i].length; tmpIndex++) { recurseVal = this._match(source[i], test[i][tmpIndex], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else if (typeof(source) === 'object') { // Recurse down the object tree recurseVal = this._match(source[i], test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } } else { // First check if the test match is an $exists if (test[i] && test[i].$exists !== undefined) { // Push the item through another match recurse recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { matchedAll = false; } } } else { // Check if the prop matches our test value if (source && source[i] === test[i]) { if (opToApply === 'or') { return true; } } else if (source && source[i] && source[i] instanceof Array && test[i] && typeof(test[i]) !== "object") { // We are looking for a value inside an array // The source data is an array, so check each item until a // match is found recurseVal = false; for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) { recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { matchedAll = false; } } } if (opToApply === 'and' && !matchedAll) { return false; } } } } return matchedAll; }, /** * Internal method, performs a matching process against a query operator such as $gt or $nin. * @param {String} key The property name in the test that matches the operator to perform * matching against. * @param {*} source The source data to match the query against. * @param {*} test The query to match the source against. * @param {Object} queryOptions The options the query was passed with. * @param {Object=} options An options object. * @returns {*} * @private */ _matchOp: function (key, source, test, queryOptions, options) { // Check for commands switch (key) { case '$gt': // Greater than return source > test; case '$gte': // Greater than or equal return source >= test; case '$lt': // Less than return source < test; case '$lte': // Less than or equal return source <= test; case '$exists': // Property exists return (source === undefined) !== test; case '$eq': // Equals return source == test; // jshint ignore:line case '$eeq': // Equals equals return source === test; case '$ne': // Not equals return source != test; // jshint ignore:line case '$nee': // Not equals equals return source !== test; case '$or': // Match true on ANY check to pass for (var orIndex = 0; orIndex < test.length; orIndex++) { if (this._match(source, test[orIndex], queryOptions, 'and', options)) { return true; } } return false; case '$and': // Match true on ALL checks to pass for (var andIndex = 0; andIndex < test.length; andIndex++) { if (!this._match(source, test[andIndex], queryOptions, 'and', options)) { return false; } } return true; case '$in': // In // Check that the in test is an array if (test instanceof Array) { var inArr = test, inArrCount = inArr.length, inArrIndex; for (inArrIndex = 0; inArrIndex < inArrCount; inArrIndex++) { if (this._match(source, inArr[inArrIndex], queryOptions, 'and', options)) { return true; } } return false; } else if (typeof test === 'object') { return this._match(source, test, queryOptions, 'and', options); } else { console.log(this.logIdentifier() + ' Cannot use an $in operator on a non-array key: ' + key, options.$rootQuery); return false; } break; case '$nin': // Not in // Check that the not-in test is an array if (test instanceof Array) { var notInArr = test, notInArrCount = notInArr.length, notInArrIndex; for (notInArrIndex = 0; notInArrIndex < notInArrCount; notInArrIndex++) { if (this._match(source, notInArr[notInArrIndex], queryOptions, 'and', options)) { return false; } } return true; } else if (typeof test === 'object') { return this._match(source, test, queryOptions, 'and', options); } else { console.log(this.logIdentifier() + ' Cannot use a $nin operator on a non-array key: ' + key, options.$rootQuery); return false; } break; case '$distinct': // Ensure options holds a distinct lookup options.$rootData['//distinctLookup'] = options.$rootData['//distinctLookup'] || {}; for (var distinctProp in test) { if (test.hasOwnProperty(distinctProp)) { options.$rootData['//distinctLookup'][distinctProp] = options.$rootData['//distinctLookup'][distinctProp] || {}; // Check if the options distinct lookup has this field's value if (options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]]) { // Value is already in use return false; } else { // Set the value in the lookup options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]] = true; // Allow the item in the results return true; } } } break; case '$count': var countKey, countArr, countVal; // Iterate the count object's keys for (countKey in test) { if (test.hasOwnProperty(countKey)) { // Check the property exists and is an array. If the property being counted is not // an array (or doesn't exist) then use a value of zero in any further count logic countArr = source[countKey]; if (typeof countArr === 'object' && countArr instanceof Array) { countVal = countArr.length; } else { countVal = 0; } // Now recurse down the query chain further to satisfy the query for this key (countKey) if (!this._match(countVal, test[countKey], queryOptions, 'and', options)) { return false; } } } // Allow the item in the results return true; case '$find': case '$findOne': case '$findSub': var fromType = 'collection', findQuery, findOptions, subQuery, subOptions, subPath, result, operation = {}; // Check all parts of the $find operation exist if (!test.$from) { throw(key + ' missing $from property!'); } if (test.$fromType) { fromType = test.$fromType; // Check the fromType exists as a method if (!this.db()[fromType] || typeof this.db()[fromType] !== 'function') { throw(key + ' cannot operate against $fromType "' + fromType + '" because the database does not recognise this type of object!'); } } // Perform the find operation findQuery = test.$query || {}; findOptions = test.$options || {}; if (key === '$findSub') { if (!test.$path) { throw(key + ' missing $path property!'); } subPath = test.$path; subQuery = test.$subQuery || {}; subOptions = test.$subOptions || {}; if (options.$parent && options.$parent.parent && options.$parent.parent.key) { result = this.db()[fromType](test.$from).findSub(findQuery, subPath, subQuery, subOptions); } else { // This is a root $find* query // Test the source against the main findQuery if (this._match(source, findQuery, {}, 'and', options)) { result = this._findSub([source], subPath, subQuery, subOptions); } return result && result.length > 0; } } else { result = this.db()[fromType](test.$from)[key.substr(1)](findQuery, findOptions); } operation[options.$parent.parent.key] = result; return this._match(source, operation, queryOptions, 'and', options); } return -1; }, /** * * @param {Array | Object} docArr An array of objects to run the join * operation against or a single object. * @param {Array} joinClause The join clause object array (the array in * the $join key of a normal join options object). * @param {Object} joinSource An object containing join source reference * data or a blank object if you are doing a bespoke join operation. * @param {Object} options An options object or blank object if no options. * @returns {Array} * @private */ applyJoin: function (docArr, joinClause, joinSource, options) { var self = this, joinSourceIndex, joinSourceKey, joinMatch, joinSourceType, joinSourceIdentifier, resultKeyName, joinSourceInstance, resultIndex, joinSearchQuery, joinMulti, joinRequire, joinPrefix, joinMatchIndex, joinMatchData, joinSearchOptions, joinFindResults, joinFindResult, joinItem, resultRemove = [], l; if (!(docArr instanceof Array)) { // Turn the document into an array docArr = [docArr]; } for (joinSourceIndex = 0; joinSourceIndex < joinClause.length; joinSourceIndex++) { for (joinSourceKey in joinClause[joinSourceIndex]) { if (joinClause[joinSourceIndex].hasOwnProperty(joinSourceKey)) { // Get the match data for the join joinMatch = joinClause[joinSourceIndex][joinSourceKey]; // Check if the join is to a collection (default) or a specified source type // e.g 'view' or 'collection' joinSourceType = joinMatch.$sourceType || 'collection'; joinSourceIdentifier = '$' + joinSourceType + '.' + joinSourceKey; // Set the key to store the join result in to the collection name by default // can be overridden by the '$as' clause in the join object resultKeyName = joinSourceKey; // Get the join collection instance from the DB if (joinSource[joinSourceIdentifier]) { // We have a joinSource for this identifier already (given to us by // an index when we analysed the query earlier on) and we can use // that source instead. joinSourceInstance = joinSource[joinSourceIdentifier]; } else { // We do not already have a joinSource so grab the instance from the db if (this._db[joinSourceType] && typeof this._db[joinSourceType] === 'function') { joinSourceInstance = this._db[joinSourceType](joinSourceKey); } } // Loop our result data array for (resultIndex = 0; resultIndex < docArr.length; resultIndex++) { // Loop the join conditions and build a search object from them joinSearchQuery = {}; joinMulti = false; joinRequire = false; joinPrefix = ''; for (joinMatchIndex in joinMatch) { if (joinMatch.hasOwnProperty(joinMatchIndex)) { joinMatchData = joinMatch[joinMatchIndex]; // Check the join condition name for a special command operator if (joinMatchIndex.substr(0, 1) === '$') { // Special command switch (joinMatchIndex) { case '$where': if (joinMatchData.$query || joinMatchData.$options) { if (joinMatchData.$query) { // Commented old code here, new one does dynamic reverse lookups //joinSearchQuery = joinMatchData.query; joinSearchQuery = self.resolveDynamicQuery(joinMatchData.$query, docArr[resultIndex]); } if (joinMatchData.$options) { joinSearchOptions = joinMatchData.$options; } } else { throw('$join $where clause requires "$query" and / or "$options" keys to work!'); } break; case '$as': // Rename the collection when stored in the result document resultKeyName = joinMatchData; break; case '$multi': // Return an array of documents instead of a single matching document joinMulti = joinMatchData; break; case '$require': // Remove the result item if no matching join data is found joinRequire = joinMatchData; break; case '$prefix': // Add a prefix to properties mixed in joinPrefix = joinMatchData; break; default: break; } } else { // Get the data to match against and store in the search object // Resolve complex referenced query joinSearchQuery[joinMatchIndex] = self.resolveDynamicQuery(joinMatchData, docArr[resultIndex]); } } } // Do a find on the target collection against the match data joinFindResults = joinSourceInstance.find(joinSearchQuery, joinSearchOptions); // Check if we require a joined row to allow the result item if (!joinRequire || (joinRequire && joinFindResults[0])) { // Join is not required or condition is met if (resultKeyName === '$root') { // The property name to store the join results in is $root // which means we need to mixin the results but this only // works if joinMulti is disabled if (joinMulti !== false) { // Throw an exception here as this join is not physically possible! throw(this.logIdentifier() + ' Cannot combine [$as: "$root"] with [$multi: true] in $join clause!'); } // Mixin the result joinFindResult = joinFindResults[0]; joinItem = docArr[resultIndex]; for (l in joinFindResult) { if (joinFindResult.hasOwnProperty(l) && joinItem[joinPrefix + l] === undefined) { // Properties are only mixed in if they do not already exist // in the target item (are undefined). Using a prefix denoted via // $prefix is a good way to prevent property name conflicts joinItem[joinPrefix + l] = joinFindResult[l]; } } } else { docArr[resultIndex][resultKeyName] = joinMulti === false ? joinFindResults[0] : joinFindResults; } } else { // Join required but condition not met, add item to removal queue resultRemove.push(resultIndex); } } } } } return resultRemove; }, /** * Takes a query object with dynamic references and converts the references * into actual values from the references source. * @param {Object} query The query object with dynamic references. * @param {Object} item The document to apply the references to. * @returns {*} * @private */ resolveDynamicQuery: function (query, item) { var self = this, newQuery, propType, propVal, pathResult, i; // Check for early exit conditions if (typeof query === 'string') { // Check if the property name starts with a back-reference if (query.substr(0, 3) === '$$.') { // Fill the query with a back-referenced value pathResult = this.sharedPathSolver.value(item, query.substr(3, query.length - 3)); } else { pathResult = this.sharedPathSolver.value(item, query); } if (pathResult.length > 1) { return {$in: pathResult}; } else { return pathResult[0]; } } newQuery = {}; for (i in query) { if (query.hasOwnProperty(i)) { propType = typeof query[i]; propVal = query[i]; switch (propType) { case 'string': // Check if the property name starts with a back-reference if (propVal.substr(0, 3) === '$$.') { // Fill the query with a back-referenced value newQuery[i] = this.sharedPathSolver.value(item, propVal.substr(3, propVal.length - 3))[0]; } else { newQuery[i] = propVal; } break; case 'object': newQuery[i] = self.resolveDynamicQuery(propVal, item); break; default: newQuery[i] = propVal; break; } } } return newQuery; }, spliceArrayByIndexList: function (arr, list) { var i; for (i = list.length - 1; i >= 0; i--) { arr.splice(list[i], 1); } } }; module.exports = Matching; },{}],27:[function(_dereq_,module,exports){ "use strict"; /** * Provides sorting methods. * @mixin */ var Sorting = { /** * Sorts the passed value a against the passed value b ascending. * @param {*} a The first value to compare. * @param {*} b The second value to compare. * @returns {*} 1 if a is sorted after b, -1 if a is sorted before b. */ sortAsc: function (a, b) { if (typeof(a) === 'string' && typeof(b) === 'string') { return a.localeCompare(b); } else { if (a > b) { return 1; } else if (a < b) { return -1; } } return 0; }, /** * Sorts the passed value a against the passed value b descending. * @param {*} a The first value to compare. * @param {*} b The second value to compare. * @returns {*} 1 if a is sorted after b, -1 if a is sorted before b. */ sortDesc: function (a, b) { if (typeof(a) === 'string' && typeof(b) === 'string') { return b.localeCompare(a); } else { if (a > b) { return -1; } else if (a < b) { return 1; } } return 0; } }; module.exports = Sorting; },{}],28:[function(_dereq_,module,exports){ "use strict"; var Tags, tagMap = {}; /** * Provides class instance tagging and tag operation methods. * @mixin */ Tags = { /** * Tags a class instance for later lookup. * @param {String} name The tag to add. * @returns {boolean} */ tagAdd: function (name) { var i, self = this, mapArr = tagMap[name] = tagMap[name] || []; for (i = 0; i < mapArr.length; i++) { if (mapArr[i] === self) { return true; } } mapArr.push(self); // Hook the drop event for this so we can react if (self.on) { self.on('drop', function () { // We've been dropped so remove ourselves from the tag map self.tagRemove(name); }); } return true; }, /** * Removes a tag from a class instance. * @param {String} name The tag to remove. * @returns {boolean} */ tagRemove: function (name) { var i, mapArr = tagMap[name]; if (mapArr) { for (i = 0; i < mapArr.length; i++) { if (mapArr[i] === this) { mapArr.splice(i, 1); return true; } } } return false; }, /** * Gets an array of all instances tagged with the passed tag name. * @param {String} name The tag to lookup. * @returns {Array} The array of instances that have the passed tag. */ tagLookup: function (name) { return tagMap[name] || []; }, /** * Drops all instances that are tagged with the passed tag name. * @param {String} name The tag to lookup. * @param {Function} callback Callback once dropping has completed * for all instances that match the passed tag name. * @returns {boolean} */ tagDrop: function (name, callback) { var arr = this.tagLookup(name), dropCb, dropCount, i; dropCb = function () { dropCount--; if (callback && dropCount === 0) { callback(false); } }; if (arr.length) { dropCount = arr.length; // Loop the array and drop all items for (i = arr.length - 1; i >= 0; i--) { arr[i].drop(dropCb); } } return true; } }; module.exports = Tags; },{}],29:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); /** * Provides trigger functionality methods. * @mixin */ var Triggers = { /** * When called in a before phase the newDoc object can be directly altered * to modify the data in it before the operation is carried out. * @callback addTriggerCallback * @param {Object} operation The details about the operation. * @param {Object} oldDoc The document before the operation. * @param {Object} newDoc The document after the operation. */ /** * Add a trigger by id. * @param {String} id The id of the trigger. This must be unique to the type and * phase of the trigger. Only one trigger may be added with this id per type and * phase. * @param {Constants} type The type of operation to apply the trigger to. See * Mixin.Constants for constants to use. * @param {Constants} phase The phase of an operation to fire the trigger on. See * Mixin.Constants for constants to use. * @param {addTriggerCallback} method The method to call when the trigger is fired. * @returns {boolean} True if the trigger was added successfully, false if not. */ addTrigger: function (id, type, phase, method) { var self = this, triggerIndex; // Check if the trigger already exists triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex === -1) { self.triggerStack = {}; // The trigger does not exist, create it self._trigger = self._trigger || {}; self._trigger[type] = self._trigger[type] || {}; self._trigger[type][phase] = self._trigger[type][phase] || []; self._trigger[type][phase].push({ id: id, method: method, enabled: true }); return true; } return false; }, /** * * @param {String} id The id of the trigger to remove. * @param {Number} type The type of operation to remove the trigger from. See * Mixin.Constants for constants to use. * @param {Number} phase The phase of the operation to remove the trigger from. * See Mixin.Constants for constants to use. * @returns {boolean} True if removed successfully, false if not. */ removeTrigger: function (id, type, phase) { var self = this, triggerIndex; // Check if the trigger already exists triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // The trigger exists, remove it self._trigger[type][phase].splice(triggerIndex, 1); } return false; }, /** * Tells the current instance to fire or ignore all triggers whether they * are enabled or not. * @param {Boolean} val Set to true to ignore triggers or false to not * ignore them. * @returns {*} */ ignoreTriggers: function (val) { if (val !== undefined) { this._ignoreTriggers = val; return this; } return this._ignoreTriggers; }, /** * Generates triggers that fire in the after phase for all CRUD ops * that automatically transform data back and forth and keep both * import and export collections in sync with each other. * @param {String} id The unique id for this link IO. * @param {Object} ioData The settings for the link IO. */ addLinkIO: function (id, ioData) { var self = this, matchAll, exportData, importData, exportTriggerMethod, importTriggerMethod, exportTo, importFrom, allTypes, i; // Store the linkIO self._linkIO = self._linkIO || {}; self._linkIO[id] = ioData; exportData = ioData['export']; importData = ioData['import']; if (exportData) { exportTo = self.db().collection(exportData.to); } if (importData) { importFrom = self.db().collection(importData.from); } allTypes = [ self.TYPE_INSERT, self.TYPE_UPDATE, self.TYPE_REMOVE ]; matchAll = function (data, callback) { // Match all callback(false, true); }; if (exportData) { // Check for export match method if (!exportData.match) { // No match method found, use the match all method exportData.match = matchAll; } // Check for export types if (!exportData.types) { exportData.types = allTypes; } exportTriggerMethod = function (operation, oldDoc, newDoc) { // Check if we should execute against this data exportData.match(newDoc, function (err, doExport) { if (!err && doExport) { // Get data to upsert (if any) exportData.data(newDoc, operation.type, function (err, data, callback) { if (!err && data) { // Disable all currently enabled triggers so that we // don't go into a trigger loop exportTo.ignoreTriggers(true); if (operation.type !== 'remove') { // Do upsert exportTo.upsert(data, callback); } else { // Do remove exportTo.remove(data, callback); } // Re-enable the previous triggers exportTo.ignoreTriggers(false); } }); } }); }; } if (importData) { // Check for import match method if (!importData.match) { // No match method found, use the match all method importData.match = matchAll; } // Check for import types if (!importData.types) { importData.types = allTypes; } importTriggerMethod = function (operation, oldDoc, newDoc) { // Check if we should execute against this data importData.match(newDoc, function (err, doExport) { if (!err && doExport) { // Get data to upsert (if any) importData.data(newDoc, operation.type, function (err, data, callback) { if (!err && data) { // Disable all currently enabled triggers so that we // don't go into a trigger loop exportTo.ignoreTriggers(true); if (operation.type !== 'remove') { // Do upsert self.upsert(data, callback); } else { // Do remove self.remove(data, callback); } // Re-enable the previous triggers exportTo.ignoreTriggers(false); } }); } }); }; } if (exportData) { for (i = 0; i < exportData.types.length; i++) { self.addTrigger(id + 'export' + exportData.types[i], exportData.types[i], self.PHASE_AFTER, exportTriggerMethod); } } if (importData) { for (i = 0; i < importData.types.length; i++) { importFrom.addTrigger(id + 'import' + importData.types[i], importData.types[i], self.PHASE_AFTER, importTriggerMethod); } } }, /** * Removes a previously added link IO via it's ID. * @param {String} id The id of the link IO to remove. * @returns {boolean} True if successful, false if the link IO * was not found. */ removeLinkIO: function (id) { var self = this, linkIO = self._linkIO[id], exportData, importData, importFrom, i; if (linkIO) { exportData = linkIO['export']; importData = linkIO['import']; if (exportData) { for (i = 0; i < exportData.types.length; i++) { self.removeTrigger(id + 'export' + exportData.types[i], exportData.types[i], self.db.PHASE_AFTER); } } if (importData) { importFrom = self.db().collection(importData.from); for (i = 0; i < importData.types.length; i++) { importFrom.removeTrigger(id + 'import' + importData.types[i], importData.types[i], self.db.PHASE_AFTER); } } delete self._linkIO[id]; return true; } return false; }, enableTrigger: new Overload({ 'string': function (id) { // Alter all triggers of this type var self = this, types = self._trigger, phases, triggers, result = false, i, k, j; if (types) { for (j in types) { if (types.hasOwnProperty(j)) { phases = types[j]; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set enabled flag for (k = 0; k < triggers.length; k++) { if (triggers[k].id === id) { triggers[k].enabled = true; result = true; } } } } } } } } return result; }, 'number': function (type) { // Alter all triggers of this type var self = this, phases = self._trigger[type], triggers, result = false, i, k; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set to enabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = true; result = true; } } } } return result; }, 'number, number': function (type, phase) { // Alter all triggers of this type and phase var self = this, phases = self._trigger[type], triggers, result = false, k; if (phases) { triggers = phases[phase]; if (triggers) { // Loop triggers and set to enabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = true; result = true; } } } return result; }, 'string, number, number': function (id, type, phase) { // Check if the trigger already exists var self = this, triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // Update the trigger self._trigger[type][phase][triggerIndex].enabled = true; return true; } return false; } }), disableTrigger: new Overload({ 'string': function (id) { // Alter all triggers of this type var self = this, types = self._trigger, phases, triggers, result = false, i, k, j; if (types) { for (j in types) { if (types.hasOwnProperty(j)) { phases = types[j]; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set enabled flag for (k = 0; k < triggers.length; k++) { if (triggers[k].id === id) { triggers[k].enabled = false; result = true; } } } } } } } } return result; }, 'number': function (type) { // Alter all triggers of this type var self = this, phases = self._trigger[type], triggers, result = false, i, k; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set to disabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = false; result = true; } } } } return result; }, 'number, number': function (type, phase) { // Alter all triggers of this type and phase var self = this, phases = self._trigger[type], triggers, result = false, k; if (phases) { triggers = phases[phase]; if (triggers) { // Loop triggers and set to disabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = false; result = true; } } } return result; }, 'string, number, number': function (id, type, phase) { // Check if the trigger already exists var self = this, triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // Update the trigger self._trigger[type][phase][triggerIndex].enabled = false; return true; } return false; } }), /** * Checks if a trigger will fire based on the type and phase provided. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @returns {Boolean} True if the trigger will fire, false otherwise. */ willTrigger: function (type, phase) { if (!this._ignoreTriggers && this._trigger && this._trigger[type] && this._trigger[type][phase] && this._trigger[type][phase].length) { // Check if a trigger in this array is enabled var arr = this._trigger[type][phase], i; for (i = 0; i < arr.length; i++) { if (arr[i].enabled) { return true; } } } return false; }, /** * Processes trigger actions based on the operation, type and phase. * @param {Object} operation Operation data to pass to the trigger. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @param {Object} oldDoc The document snapshot before operations are * carried out against the data. * @param {Object} newDoc The document snapshot after operations are * carried out against the data. * @returns {boolean} */ processTrigger: function (operation, type, phase, oldDoc, newDoc) { var self = this, triggerArr, triggerIndex, triggerCount, triggerItem, response, typeName, phaseName; if (!self._ignoreTriggers && self._trigger && self._trigger[type] && self._trigger[type][phase]) { triggerArr = self._trigger[type][phase]; triggerCount = triggerArr.length; for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) { triggerItem = triggerArr[triggerIndex]; // Check if the trigger is enabled if (triggerItem.enabled) { if (self.debug()) { switch (type) { case this.TYPE_INSERT: typeName = 'insert'; break; case this.TYPE_UPDATE: typeName = 'update'; break; case this.TYPE_REMOVE: typeName = 'remove'; break; default: typeName = ''; break; } switch (phase) { case this.PHASE_BEFORE: phaseName = 'before'; break; case this.PHASE_AFTER: phaseName = 'after'; break; default: phaseName = ''; break; } console.log('Triggers: Processing trigger "' + triggerItem.id + '" for ' + typeName + ' in phase "' + phaseName + '"'); } // Check if the trigger is already in the stack, if it is, // don't fire it again (this is so we avoid infinite loops // where a trigger triggers another trigger which calls this // one and so on) if (self.triggerStack && self.triggerStack[type] && self.triggerStack[type][phase] && self.triggerStack[type][phase][triggerItem.id]) { // The trigger is already in the stack, do not fire the trigger again if (self.debug()) { console.log('Triggers: Will not run trigger "' + triggerItem.id + '" for ' + typeName + ' in phase "' + phaseName + '" as it is already in the stack!'); } continue; } // Add the trigger to the stack so we don't go down an endless // trigger loop self.triggerStack = self.triggerStack || {}; self.triggerStack[type] = {}; self.triggerStack[type][phase] = {}; self.triggerStack[type][phase][triggerItem.id] = true; // Run the trigger's method and store the response response = triggerItem.method.call(self, operation, oldDoc, newDoc); // Remove the trigger from the stack self.triggerStack = self.triggerStack || {}; self.triggerStack[type] = {}; self.triggerStack[type][phase] = {}; self.triggerStack[type][phase][triggerItem.id] = false; // Check the response for a non-expected result (anything other than // [undefined, true or false] is considered a throwable error) if (response === false) { // The trigger wants us to cancel operations return false; } if (response !== undefined && response !== true && response !== false) { // Trigger responded with error, throw the error throw('ForerunnerDB.Mixin.Triggers: Trigger error: ' + response); } } } // Triggers all ran without issue, return a success (true) return true; } }, /** * Returns the index of a trigger by id based on type and phase. * @param {String} id The id of the trigger to find the index of. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @returns {number} * @private */ _triggerIndexOf: function (id, type, phase) { var self = this, triggerArr, triggerCount, triggerIndex; if (self._trigger && self._trigger[type] && self._trigger[type][phase]) { triggerArr = self._trigger[type][phase]; triggerCount = triggerArr.length; for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) { if (triggerArr[triggerIndex].id === id) { return triggerIndex; } } } return -1; } }; module.exports = Triggers; },{"./Overload":33}],30:[function(_dereq_,module,exports){ "use strict"; /** * Provides methods to handle object update operations. * @mixin */ var Updating = { /** * Updates a property on an object. * @param {Object} doc The object whose property is to be updated. * @param {String} prop The property to update. * @param {*} val The new value of the property. * @private */ _updateProperty: function (doc, prop, val) { doc[prop] = val; if (this.debug()) { console.log(this.logIdentifier() + ' Setting non-data-bound document property "' + prop + '" to val "' + val + '"'); } }, /** * Increments a value for a property on a document by the passed number. * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to increment by. * @private */ _updateIncrement: function (doc, prop, val) { doc[prop] += val; }, /** * Changes the index of an item in the passed array. * @param {Array} arr The array to modify. * @param {Number} indexFrom The index to move the item from. * @param {Number} indexTo The index to move the item to. * @private */ _updateSpliceMove: function (arr, indexFrom, indexTo) { arr.splice(indexTo, 0, arr.splice(indexFrom, 1)[0]); if (this.debug()) { console.log(this.logIdentifier() + ' Moving non-data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } }, /** * Inserts an item into the passed array at the specified index. * @param {Array} arr The array to insert into. * @param {Number} index The index to insert at. * @param {Object} doc The document to insert. * @private */ _updateSplicePush: function (arr, index, doc) { if (arr.length > index) { arr.splice(index, 0, doc); } else { arr.push(doc); } }, /** * Inserts an item at the end of an array. * @param {Array} arr The array to insert the item into. * @param {Object} doc The document to insert. * @private */ _updatePush: function (arr, doc) { arr.push(doc); }, /** * Removes an item from the passed array. * @param {Array} arr The array to modify. * @param {Number} index The index of the item in the array to remove. * @private */ _updatePull: function (arr, index) { arr.splice(index, 1); }, /** * Multiplies a value for a property on a document by the passed number. * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to multiply by. * @private */ _updateMultiply: function (doc, prop, val) { doc[prop] *= val; }, /** * Renames a property on a document to the passed property. * @param {Object} doc The document to modify. * @param {String} prop The property to rename. * @param {Number} val The new property name. * @private */ _updateRename: function (doc, prop, val) { doc[val] = doc[prop]; delete doc[prop]; }, /** * Sets a property on a document to the passed value. * @param {Object} doc The document to modify. * @param {String} prop The property to set. * @param {*} val The new property value. * @private */ _updateOverwrite: function (doc, prop, val) { doc[prop] = val; }, /** * Deletes a property on a document. * @param {Object} doc The document to modify. * @param {String} prop The property to delete. * @private */ _updateUnset: function (doc, prop) { delete doc[prop]; }, /** * Removes all properties from an object without destroying * the object instance, thereby maintaining data-bound linking. * @param {Object} doc The parent object to modify. * @param {String} prop The name of the child object to clear. * @private */ _updateClear: function (doc, prop) { var obj = doc[prop], i; if (obj && typeof obj === 'object') { for (i in obj) { if (obj.hasOwnProperty(i)) { this._updateUnset(obj, i); } } } }, /** * Pops an item or items from the array stack. * @param {Object} doc The document to modify. * @param {Number} val If set to a positive integer, will pop the number specified * from the stack, if set to a negative integer will shift the number specified * from the stack. * @return {Boolean} * @private */ _updatePop: function (doc, val) { var updated = false, i; if (doc.length > 0) { if (val > 0) { for (i = 0; i < val; i++) { doc.pop(); } updated = true; } else if (val < 0) { for (i = 0; i > val; i--) { doc.shift(); } updated = true; } } return updated; } }; module.exports = Updating; },{}],31:[function(_dereq_,module,exports){ "use strict"; // Tell JSHint about EventSource /*global EventSource */ // Import external names locally var Shared = _dereq_('./Shared'), Core, CoreInit, Collection, NodeApiClient, Overload; NodeApiClient = function () { this.init.apply(this, arguments); }; /** * The init method that can be overridden or extended. * @param {Core} core The ForerunnerDB core instance. */ NodeApiClient.prototype.init = function (core) { var self = this; self._core = core; self.rootPath('/fdb'); }; Shared.addModule('NodeApiClient', NodeApiClient); Shared.mixin(NodeApiClient.prototype, 'Mixin.Common'); Shared.mixin(NodeApiClient.prototype, 'Mixin.Events'); Shared.mixin(NodeApiClient.prototype, 'Mixin.ChainReactor'); Core = Shared.modules.Core; CoreInit = Core.prototype.init; Collection = Shared.modules.Collection; Overload = Shared.overload; Shared.synthesize(NodeApiClient.prototype, 'rootPath'); /** * Set the url of the server to use for API. * @name server * @param {String} host The server host name including protocol. E.g. * "https://0.0.0.0". * @param {String} port The server port number e.g. "8080". */ NodeApiClient.prototype.server = function (host, port) { if (host !== undefined) { if (host.substr(host.length - 1, 1) === '/') { // Strip trailing / host = host.substr(0, host.length - 1); } if (port !== undefined) { this._server = host + ":" + port; } else { this._server = host; } this._host = host; this._port = port; return this; } if (port !== undefined) { return { host: this._host, port: this._port, url: this._server }; } else { return this._server; } }; NodeApiClient.prototype.http = function (method, url, data, options, callback) { var self = this, finalUrl, sessionData, bodyData, xmlHttp = new XMLHttpRequest(); method = method.toUpperCase(); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState === 4) { if (xmlHttp.status === 200) { // Tell the callback about success if (xmlHttp.responseText) { callback(false, self.jParse(xmlHttp.responseText)); } else { callback(false, {}); } } else if (xmlHttp.status === 204) { callback(false, {}); } else { // Tell the callback about the error callback(xmlHttp.status, xmlHttp.responseText); // Emit the error code self.emit('httpError', xmlHttp.status, xmlHttp.responseText); } } }; switch (method) { case 'GET': case 'DELETE': case 'HEAD': // Check for global auth if (this._sessionData) { data = data !== undefined ? data : {}; // Add the session data to the key specified data[this._sessionData.key] = this._sessionData.obj; } finalUrl = url + (data !== undefined ? '?' + self.jStringify(data) : ''); bodyData = null; break; case 'POST': case 'PUT': case 'PATCH': // Check for global auth if (this._sessionData) { sessionData = {}; // Add the session data to the key specified sessionData[this._sessionData.key] = this._sessionData.obj; } finalUrl = url + (sessionData !== undefined ? '?' + self.jStringify(sessionData) : ''); bodyData = (data !== undefined ? self.jStringify(data) : null); break; default: return false; } xmlHttp.open(method, finalUrl, true); xmlHttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xmlHttp.send(bodyData); return this; }; // Define HTTP helper methods NodeApiClient.prototype.head = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('HEAD', this.server() + this._rootPath + path, data, options, callback); } }); NodeApiClient.prototype.get = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('GET', this.server() + this._rootPath + path, data, options, callback); } }); NodeApiClient.prototype.put = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('PUT', this.server() + this._rootPath + path, data, options, callback); } }); NodeApiClient.prototype.post = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('POST', this.server() + this._rootPath + path, data, options, callback); } }); NodeApiClient.prototype.patch = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('PATCH', this.server() + this._rootPath + path, data, options, callback); } }); NodeApiClient.prototype.postPatch = function (path, id, data, options, callback) { var self = this; // Determine if the item exists or not this.head(path + '/' + id, undefined, {}, function (err, headData) { if (err) { if (err === 404) { // Item does not exist, run post return self.http('POST', self.server() + self._rootPath + path, data, options, callback); } else { callback(err, data); } } else { // Item already exists, run patch return self.http('PATCH', self.server() + self._rootPath + path + '/' + id, data, options, callback); } }); }; NodeApiClient.prototype.delete = new Overload({ 'string, function': function (path, callback) { return this.$main.call(this, path, undefined, {}, callback); }, 'string, *, function': function (path, data, callback) { return this.$main.call(this, path, data, {}, callback); }, 'string, *, object, function': function (path, data, options, callback) { return this.$main.call(this, path, data, options, callback); }, '$main': function (path, data, options, callback) { return this.http('DELETE', this.server() + this._rootPath + path, data, options, callback); } }); /** * Gets/ sets a global object that will be sent up with client * requests to the API or REST server. * @param {String} key The key to send the session object up inside. * @param {*} obj The object / value to send up with all requests. If * a request has its own data to send up, this session data will be * mixed in to the request data under the specified key. */ NodeApiClient.prototype.session = function (key, obj) { if (key !== undefined && obj !== undefined) { this._sessionData = { key: key, obj: obj }; return this; } return this._sessionData; }; /** * Initiates a client connection to the API server. * @param collectionInstance * @param path * @param query * @param options * @param callback */ NodeApiClient.prototype.sync = function (collectionInstance, path, query, options, callback) { var self = this, source, finalPath, queryParams, queryString = '', connecting = true; if (this.debug()) { console.log(this.logIdentifier() + ' Connecting to API server ' + this.server() + this._rootPath + path); } finalPath = this.server() + this._rootPath + path + '/_sync'; // Check for global auth if (this._sessionData) { queryParams = queryParams || {}; if (this._sessionData.key) { // Add the session data to the key specified queryParams[this._sessionData.key] = this._sessionData.obj; } else { // Add the session data to the root query object Shared.mixin(queryParams, this._sessionData.obj); } } if (query) { queryParams = queryParams || {}; queryParams.$query = query; } if (options) { queryParams = queryParams || {}; if (options.$initialData === undefined) { options.$initialData = true; } queryParams.$options = options; } if (queryParams) { queryString = this.jStringify(queryParams); finalPath += '?' + queryString; } source = new EventSource(finalPath); collectionInstance.__apiConnection = source; source.addEventListener('open', function (e) { if (!options || (options && options.$initialData)) { // The connection is open, grab the initial data self.get(path, queryParams, function (err, data) { if (!err) { collectionInstance.upsert(data); } }); } }, false); source.addEventListener('error', function (e) { if (source.readyState === 2) { // The connection is dead, remove the connection collectionInstance.unSync(); } if (connecting) { connecting = false; callback(e); } }, false); source.addEventListener('insert', function(e) { var data = self.jParse(e.data); collectionInstance.insert(data.dataSet); }, false); source.addEventListener('update', function(e) { var data = self.jParse(e.data); collectionInstance.update(data.query, data.update); }, false); source.addEventListener('remove', function(e) { var data = self.jParse(e.data); collectionInstance.remove(data.query); }, false); if (callback) { source.addEventListener('connected', function (e) { if (connecting) { connecting = false; callback(false); } }, false); } }; Collection.prototype.sync = new Overload({ /** * Sync with this collection on the server-side. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'function': function (callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + this.name(), null, null, callback); }, /** * Sync with this collection on the server-side. * @param {String} collectionName The collection to sync from. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, function': function (collectionName, callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + collectionName, null, null, callback); }, /** * Sync with this collection on the server-side. * @param {Object} query A query object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'object, function': function (query, callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + this.name(), query, null, callback); }, /** * Sync with this collection on the server-side. * @param {String} objectType The type of object to sync to e.g. * "collection" or "view". * @param {String} objectName The name of the object to sync from. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, string, function': function (objectType, objectName, callback) { this.$main.call(this, '/' + this._db.name() + '/' + objectType + '/' + objectName, null, null, callback); }, /** * Sync with this collection on the server-side. * @param {String} collectionName The collection to sync from. * @param {Object} query A query object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, object, function': function (collectionName, query, callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + collectionName, query, null, callback); }, /** * Sync with this collection on the server-side. * @param {String} objectType The type of object to sync to e.g. * "collection" or "view". * @param {String} objectName The name of the object to sync from. * @param {Object} query A query object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, string, object, function': function (objectType, objectName, query, callback) { this.$main.call(this, '/' + this._db.name() + '/' + objectType + '/' + objectName, query, null, callback); }, /** * Sync with this collection on the server-side. * @param {Object} query A query object. * @param {Object} options An options object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'object, object, function': function (query, options, callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + this.name(), query, options, callback); }, /** * Sync with this collection on the server-side. * @param {String} collectionName The collection to sync from. * @param {Object} query A query object. * @param {Object} options An options object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, object, object, function': function (collectionName, query, options, callback) { this.$main.call(this, '/' + this._db.name() + '/collection/' + collectionName, query, options, callback); }, /** * Sync with this collection on the server-side. * @param {String} objectType The type of object to sync to e.g. * "collection" or "view". * @param {String} objectName The name of the object to sync from. * @param {Object} query A query object. * @param {Object} options An options object. * @param {Function} callback The callback method to call once * the connection to the server has been established. */ 'string, string, object, object, function': function (objectType, objectName, query, options, callback) { this.$main.call(this, '/' + this._db.name() + '/' + objectType + '/' + objectName, query, options, callback); }, '$main': function (path, query, options, callback) { var self = this; if (this._db && this._db._core) { // Kill any existing sync connection this.unSync(); // Create new sync connection this._db._core.api.sync(this, path, query, options, callback); // Hook on drop to call unsync this.on('drop', function () { self.unSync(); }); } else { throw(this.logIdentifier() + ' Cannot sync for an anonymous collection! (Collection must be attached to a database)'); } } }); /** * Disconnects an existing connection to a sync server. * @returns {boolean} True if a connection existed, false * if no connection existed. */ Collection.prototype.unSync = function () { if (this.__apiConnection) { if (this.__apiConnection.readyState !== 2) { this.__apiConnection.close(); } delete this.__apiConnection; return true; } return false; }; Collection.prototype.http = new Overload({ 'string, function': function (method, callback) { this.$main.call(this, method, '/' + this._db.name() + '/collection/' + this.name(), undefined, undefined, {}, callback); }, '$main': function (method, path, queryObj, queryOptions, options, callback) { if (this._db && this._db._core) { return this._db._core.api.http('GET', this._db._core.api.server() + this._rootPath + path, {"$query": queryObj, "$options": queryOptions}, options, callback); } else { throw(this.logIdentifier() + ' Cannot do HTTP for an anonymous collection! (Collection must be attached to a database)'); } } }); Collection.prototype.autoHttp = new Overload({ 'string, function': function (method, callback) { this.$main.call(this, method, '/' + this._db.name() + '/collection/' + this.name(), undefined, undefined, {}, callback); }, 'string, string, function': function (method, collectionName, callback) { this.$main.call(this, method, '/' + this._db.name() + '/collection/' + collectionName, undefined, undefined, {}, callback); }, 'string, string, string, function': function (method, objType, objName, callback) { this.$main.call(this, method, '/' + this._db.name() + '/' + objType + '/' + objName, undefined, undefined, {}, callback); }, 'string, string, string, object, function': function (method, objType, objName, queryObj, callback) { this.$main.call(this, method, '/' + this._db.name() + '/' + objType + '/' + objName, queryObj, undefined, {}, callback); }, 'string, string, string, object, object, function': function (method, objType, objName, queryObj, queryOptions, callback) { this.$main.call(this, method, '/' + this._db.name() + '/' + objType + '/' + objName, queryObj, queryOptions, {}, callback); }, '$main': function (method, path, queryObj, queryOptions, options, callback) { var self = this; if (this._db && this._db._core) { return this._db._core.api.http('GET', this._db._core.api.server() + this._db._core.api._rootPath + path, {"$query": queryObj, "$options": queryOptions}, options, function (err, data) { var i; if (!err && data) { // Check the type of method we used and operate on the collection accordingly switch (method) { // Find insert case 'GET': self.insert(data); break; // Insert case 'POST': if (data.inserted && data.inserted.length) { self.insert(data.inserted); } break; // Update overwrite case 'PUT': case 'PATCH': if (data instanceof Array) { // Update each document for (i = 0; i < data.length; i++) { self.updateById(data[i]._id, {$overwrite: data[i]}); } } else { // Update single document self.updateById(data._id, {$overwrite: data}); } break; // Remove case 'DELETE': self.remove(data); break; default: // Nothing to do with this method break; } } // Send the data back to the callback callback(err, data); }); } else { throw(this.logIdentifier() + ' Cannot do HTTP for an anonymous collection! (Collection must be attached to a database)'); } } }); // Override the Core init to instantiate the plugin Core.prototype.init = function () { CoreInit.apply(this, arguments); this.api = new NodeApiClient(this); }; Shared.finishModule('NodeApiClient'); module.exports = NodeApiClient; },{"./Shared":41}],32:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'); /** * The operation class, used to store details about an operation being * performed by the database. * @param {String} name The name of the operation. * @constructor */ var Operation = function (name) { this.pathSolver = new Path(); this.counter = 0; this.init.apply(this, arguments); }; Operation.prototype.init = function (name) { this._data = { operation: name, // The name of the operation executed such as "find", "update" etc index: { potential: [], // Indexes that could have potentially been used used: false // The index that was picked to use }, steps: [], // The steps taken to generate the query results, time: { startMs: 0, stopMs: 0, totalMs: 0, process: {} }, flag: {}, // An object with flags that denote certain execution paths log: [] // Any extra data that might be useful such as warnings or helpful hints }; }; Shared.addModule('Operation', Operation); Shared.mixin(Operation.prototype, 'Mixin.ChainReactor'); /** * Starts the operation timer. */ Operation.prototype.start = function () { this._data.time.startMs = new Date().getTime(); }; /** * Adds an item to the operation log. * @param {String} event The item to log. * @returns {*} */ Operation.prototype.log = function (event) { if (event) { var lastLogTime = this._log.length > 0 ? this._data.log[this._data.log.length - 1].time : 0, logObj = { event: event, time: new Date().getTime(), delta: 0 }; this._data.log.push(logObj); if (lastLogTime) { logObj.delta = logObj.time - lastLogTime; } return this; } return this._data.log; }; /** * Called when starting and ending a timed operation, used to time * internal calls within an operation's execution. * @param {String} section An operation name. * @returns {*} */ Operation.prototype.time = function (section) { if (section !== undefined) { var process = this._data.time.process, processObj = process[section] = process[section] || {}; if (!processObj.startMs) { // Timer started processObj.startMs = new Date().getTime(); processObj.stepObj = { name: section }; this._data.steps.push(processObj.stepObj); } else { processObj.stopMs = new Date().getTime(); processObj.totalMs = processObj.stopMs - processObj.startMs; processObj.stepObj.totalMs = processObj.totalMs; delete processObj.stepObj; } return this; } return this._data.time; }; /** * Used to set key/value flags during operation execution. * @param {String} key * @param {String} val * @returns {*} */ Operation.prototype.flag = function (key, val) { if (key !== undefined && val !== undefined) { this._data.flag[key] = val; } else if (key !== undefined) { return this._data.flag[key]; } else { return this._data.flag; } }; Operation.prototype.data = function (path, val, noTime) { if (val !== undefined) { // Assign value to object path this.pathSolver.set(this._data, path, val); return this; } return this.pathSolver.get(this._data, path); }; Operation.prototype.pushData = function (path, val, noTime) { // Assign value to object path this.pathSolver.push(this._data, path, val); }; /** * Stops the operation timer. */ Operation.prototype.stop = function () { this._data.time.stopMs = new Date().getTime(); this._data.time.totalMs = this._data.time.stopMs - this._data.time.startMs; }; Shared.finishModule('Operation'); module.exports = Operation; },{"./Path":35,"./Shared":41}],33:[function(_dereq_,module,exports){ "use strict"; /** * Allows a method to accept overloaded calls with different parameters controlling * which passed overload function is called. * @param {String=} name A name to provide this overload to help identify * it if any errors occur during the resolving phase of the overload. This * is purely for debug purposes and serves no functional purpose. * @param {Object} def The overload definition. * @returns {Function} * @constructor */ var Overload = function (name, def) { if (!def) { def = name; name = undefined; } if (def) { var self = this, index, count, tmpDef, defNewKey, sigIndex, signatures; if (!(def instanceof Array)) { tmpDef = {}; // Def is an object, make sure all prop names are devoid of spaces for (index in def) { if (def.hasOwnProperty(index)) { defNewKey = index.replace(/ /g, ''); // Check if the definition array has a * string in it if (defNewKey.indexOf('*') === -1) { // No * found tmpDef[defNewKey] = def[index]; } else { // A * was found, generate the different signatures that this // definition could represent signatures = this.generateSignaturePermutations(defNewKey); for (sigIndex = 0; sigIndex < signatures.length; sigIndex++) { if (!tmpDef[signatures[sigIndex]]) { tmpDef[signatures[sigIndex]] = def[index]; } } } } } def = tmpDef; } return function () { var arr = [], lookup, type, overloadName; // Check if we are being passed a key/function object or an array of functions if (def instanceof Array) { // We were passed an array of functions count = def.length; for (index = 0; index < count; index++) { if (def[index].length === arguments.length) { return self.callExtend(this, '$main', def, def[index], arguments); } } } else { // Generate lookup key from arguments // Copy arguments to an array for (index = 0; index < arguments.length; index++) { type = typeof arguments[index]; // Handle detecting arrays if (type === 'object' && arguments[index] instanceof Array) { type = 'array'; } // Handle been presented with a single undefined argument if (arguments.length === 1 && type === 'undefined') { break; } // Add the type to the argument types array arr.push(type); } lookup = arr.join(','); // Check for an exact lookup match if (def[lookup]) { return self.callExtend(this, '$main', def, def[lookup], arguments); } else { for (index = arr.length; index >= 0; index--) { // Get the closest match lookup = arr.slice(0, index).join(','); if (def[lookup + ',...']) { // Matched against arguments + "any other" return self.callExtend(this, '$main', def, def[lookup + ',...'], arguments); } } } } overloadName = name !== undefined ? name : typeof this.name === 'function' ? this.name() : 'Unknown'; console.log('Overload Definition:', def); throw('ForerunnerDB.Overload "' + overloadName + '": Overloaded method does not have a matching signature "' + lookup + '" for the passed arguments: ' + this.jStringify(arr)); }; } return function () {}; }; /** * Generates an array of all the different definition signatures that can be * created from the passed string with a catch-all wildcard *. E.g. it will * convert the signature: string,*,string to all potentials: * string,string,string * string,number,string * string,object,string, * string,function,string, * string,undefined,string * * @param {String} str Signature string with a wildcard in it. * @returns {Array} An array of signature strings that are generated. */ Overload.prototype.generateSignaturePermutations = function (str) { var signatures = [], newSignature, types = ['array', 'string', 'object', 'number', 'function', 'undefined'], index; if (str.indexOf('*') > -1) { // There is at least one "any" type, break out into multiple keys // We could do this at query time with regular expressions but // would be significantly slower for (index = 0; index < types.length; index++) { newSignature = str.replace('*', types[index]); signatures = signatures.concat(this.generateSignaturePermutations(newSignature)); } } else { signatures.push(str); } return signatures; }; Overload.prototype.callExtend = function (context, prop, propContext, func, args) { var tmp, ret; if (context && propContext[prop]) { tmp = context[prop]; context[prop] = propContext[prop]; ret = func.apply(context, args); context[prop] = tmp; return ret; } else { return func.apply(context, args); } }; module.exports = Overload; },{}],34:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, DbDocument; Shared = _dereq_('./Shared'); var Overview = function () { this.init.apply(this, arguments); }; Overview.prototype.init = function (name) { var self = this; this._name = name; this._data = new DbDocument('__FDB__dc_data_' + this._name); this._collData = new Collection(); this._sources = []; this._sourceDroppedWrap = function () { self._sourceDropped.apply(self, arguments); }; }; Shared.addModule('Overview', Overview); Shared.mixin(Overview.prototype, 'Mixin.Common'); Shared.mixin(Overview.prototype, 'Mixin.ChainReactor'); Shared.mixin(Overview.prototype, 'Mixin.Constants'); Shared.mixin(Overview.prototype, 'Mixin.Triggers'); Shared.mixin(Overview.prototype, 'Mixin.Events'); Shared.mixin(Overview.prototype, 'Mixin.Tags'); Collection = _dereq_('./Collection'); DbDocument = _dereq_('./Document'); Db = Shared.modules.Db; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Overview.prototype, 'state'); Shared.synthesize(Overview.prototype, 'db'); Shared.synthesize(Overview.prototype, 'name'); Shared.synthesize(Overview.prototype, 'query', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Shared.synthesize(Overview.prototype, 'queryOptions', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Shared.synthesize(Overview.prototype, 'reduce', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Overview.prototype.from = function (source) { if (source !== undefined) { if (typeof(source) === 'string') { source = this._db.collection(source); } this._setFrom(source); return this; } return this._sources; }; Overview.prototype.find = function () { return this._collData.find.apply(this._collData, arguments); }; /** * Executes and returns the response from the current reduce method * assigned to the overview. * @returns {*} */ Overview.prototype.exec = function () { var reduceFunc = this.reduce(); return reduceFunc ? reduceFunc.apply(this) : undefined; }; Overview.prototype.count = function () { return this._collData.count.apply(this._collData, arguments); }; Overview.prototype._setFrom = function (source) { // Remove all source references while (this._sources.length) { this._removeSource(this._sources[0]); } this._addSource(source); return this; }; Overview.prototype._addSource = function (source) { if (source && source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source.data(); if (this.debug()) { console.log(this.logIdentifier() + ' Using internal private data "' + source.instanceIdentifier() + '" for IO graph linking'); } } if (this._sources.indexOf(source) === -1) { this._sources.push(source); source.chain(this); source.on('drop', this._sourceDroppedWrap); this._refresh(); } return this; }; Overview.prototype._removeSource = function (source) { if (source && source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source.data(); if (this.debug()) { console.log(this.logIdentifier() + ' Using internal private data "' + source.instanceIdentifier() + '" for IO graph linking'); } } var sourceIndex = this._sources.indexOf(source); if (sourceIndex > -1) { this._sources.splice(source, 1); source.unChain(this); source.off('drop', this._sourceDroppedWrap); this._refresh(); } return this; }; Overview.prototype._sourceDropped = function (source) { if (source) { // Source was dropped, remove from overview this._removeSource(source); } }; Overview.prototype._refresh = function () { if (!this.isDropped()) { if (this._sources && this._sources[0]) { this._collData.primaryKey(this._sources[0].primaryKey()); var tempArr = [], i; for (i = 0; i < this._sources.length; i++) { tempArr = tempArr.concat(this._sources[i].find(this._query, this._queryOptions)); } this._collData.setData(tempArr); } // Now execute the reduce method if (this._reduce) { var reducedData = this._reduce.apply(this); // Update the document with the newly returned data this._data.setData(reducedData); } } }; Overview.prototype._chainHandler = function (chainPacket) { switch (chainPacket.type) { case 'setData': case 'insert': case 'update': case 'remove': this._refresh(); break; default: break; } }; /** * Gets the module's internal data collection. * @returns {Collection} */ Overview.prototype.data = function () { return this._data; }; Overview.prototype.drop = function (callback) { if (!this.isDropped()) { this._state = 'dropped'; delete this._data; delete this._collData; // Remove all source references while (this._sources.length) { this._removeSource(this._sources[0]); } delete this._sources; if (this._db && this._name) { delete this._db._overview[this._name]; } this.emit('drop', this); if (callback) { callback(false, true); } delete this._listeners; } return true; }; Db.prototype.overview = function (name) { var self = this; if (name) { // Handle being passed an instance if (name instanceof Overview) { return name; } if (this._overview && this._overview[name]) { return this._overview[name]; } this._overview = this._overview || {}; this._overview[name] = new Overview(name).db(this); self.emit('create', self._overview[name], 'overview', name); return this._overview[name]; } else { // Return an object of collection data return this._overview || {}; } }; /** * Returns an array of overviews the DB currently has. * @returns {Array} An array of objects containing details of each overview * the database is currently managing. */ Db.prototype.overviews = function () { var arr = [], item, i; for (i in this._overview) { if (this._overview.hasOwnProperty(i)) { item = this._overview[i]; arr.push({ name: i, count: item.count(), linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Overview'); module.exports = Overview; },{"./Collection":7,"./Document":12,"./Shared":41}],35:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * Path object used to resolve object paths and retrieve data from * objects by using paths. * @param {String=} path The path to assign. * @constructor */ var Path = function (path) { this.init.apply(this, arguments); }; Path.prototype.init = function (path) { if (path) { this.path(path); } }; Shared.addModule('Path', Path); Shared.mixin(Path.prototype, 'Mixin.Common'); Shared.mixin(Path.prototype, 'Mixin.ChainReactor'); /** * Gets / sets the given path for the Path instance. * @param {String=} path The path to assign. */ Path.prototype.path = function (path) { if (path !== undefined) { this._path = this.clean(path); this._pathParts = this._path.split('.'); return this; } return this._path; }; /** * Tests if the passed object has the paths that are specified and that * a value exists in those paths. * @param {Object} testKeys The object describing the paths to test for. * @param {Object} testObj The object to test paths against. * @returns {Boolean} True if the object paths exist. */ Path.prototype.hasObjectPaths = function (testKeys, testObj) { var result = true, i; for (i in testKeys) { if (testKeys.hasOwnProperty(i)) { if (testObj[i] === undefined) { return false; } if (typeof testKeys[i] === 'object') { // Recurse object result = this.hasObjectPaths(testKeys[i], testObj[i]); // Should we exit early? if (!result) { return false; } } } } return result; }; /** * Counts the total number of key endpoints in the passed object. * @param {Object} testObj The object to count key endpoints for. * @returns {Number} The number of endpoints. */ Path.prototype.countKeys = function (testObj) { var totalKeys = 0, i; for (i in testObj) { if (testObj.hasOwnProperty(i)) { if (testObj[i] !== undefined) { if (typeof testObj[i] !== 'object') { totalKeys++; } else { totalKeys += this.countKeys(testObj[i]); } } } } return totalKeys; }; /** * Tests if the passed object has the paths that are specified and that * a value exists in those paths and if so returns the number matched. * @param {Object} testKeys The object describing the paths to test for. * @param {Object} testObj The object to test paths against. * @returns {Object} Stats on the matched keys */ Path.prototype.countObjectPaths = function (testKeys, testObj) { var matchData, matchedKeys = {}, matchedKeyCount = 0, totalKeyCount = 0, i; for (i in testObj) { if (testObj.hasOwnProperty(i)) { if (typeof testObj[i] === 'object') { // The test / query object key is an object, recurse matchData = this.countObjectPaths(testKeys[i], testObj[i]); matchedKeys[i] = matchData.matchedKeys; totalKeyCount += matchData.totalKeyCount; matchedKeyCount += matchData.matchedKeyCount; } else { // The test / query object has a property that is not an object so add it as a key totalKeyCount++; // Check if the test keys also have this key and it is also not an object if (testKeys && testKeys[i] && typeof testKeys[i] !== 'object') { matchedKeys[i] = true; matchedKeyCount++; } else { matchedKeys[i] = false; } } } } return { matchedKeys: matchedKeys, matchedKeyCount: matchedKeyCount, totalKeyCount: totalKeyCount }; }; /** * Takes a non-recursive object and converts the object hierarchy into * a path string. * @param {Object} obj The object to parse. * @param {Boolean=} withValue If true will include a 'value' key in the returned * object that represents the value the object path points to. * @returns {Object} */ Path.prototype.parse = function (obj, withValue) { var paths = [], path = '', resultData, i, k; for (i in obj) { if (obj.hasOwnProperty(i)) { // Set the path to the key path = i; if (typeof(obj[i]) === 'object') { if (withValue) { resultData = this.parse(obj[i], withValue); for (k = 0; k < resultData.length; k++) { paths.push({ path: path + '.' + resultData[k].path, value: resultData[k].value }); } } else { resultData = this.parse(obj[i]); for (k = 0; k < resultData.length; k++) { paths.push({ path: path + '.' + resultData[k].path }); } } } else { if (withValue) { paths.push({ path: path, value: obj[i] }); } else { paths.push({ path: path }); } } } } return paths; }; /** * Takes a non-recursive object and converts the object hierarchy into * an array of path strings that allow you to target all possible paths * in an object. * * The options object accepts an "ignore" field with a regular expression * as the value. If any key matches the expression it is not included in * the results. * * The options object accepts a boolean "verbose" field. If set to true * the results will include all paths leading up to endpoints as well as * they endpoints themselves. * * @returns {Array} */ Path.prototype.parseArr = function (obj, options) { options = options || {}; return this._parseArr(obj, '', [], options); }; Path.prototype._parseArr = function (obj, path, paths, options) { var i, newPath = ''; path = path || ''; paths = paths || []; for (i in obj) { if (obj.hasOwnProperty(i)) { if (!options.ignore || (options.ignore && !options.ignore.test(i))) { if (path) { newPath = path + '.' + i; } else { newPath = i; } if (typeof(obj[i]) === 'object') { if (options.verbose) { paths.push(newPath); } this._parseArr(obj[i], newPath, paths, options); } else { paths.push(newPath); } } } } return paths; }; /** * Sets a value on an object for the specified path. * @param {Object} obj The object to update. * @param {String} path The path to update. * @param {*} val The value to set the object path to. * @returns {*} */ Path.prototype.set = function (obj, path, val) { if (obj !== undefined && path !== undefined) { var pathParts, part; path = this.clean(path); pathParts = path.split('.'); part = pathParts.shift(); if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = obj[part] || {}; // Recurse this.set(obj[part], pathParts.join('.'), val); } else { // Set the value obj[part] = val; } } return obj; }; /** * Gets a single value from the passed object and given path. * @param {Object} obj The object to inspect. * @param {String} path The path to retrieve data from. * @returns {*} */ Path.prototype.get = function (obj, path) { return this.value(obj, path)[0]; }; /** * Gets the value(s) that the object contains for the currently assigned path string. * @param {Object} obj The object to evaluate the path against. * @param {String=} path A path to use instead of the existing one passed in path(). * @param {Object=} options An optional options object. * @returns {Array} An array of values for the given path. */ Path.prototype.value = function (obj, path, options) { var pathParts, arr, arrCount, objPart, objPartParent, valuesArr, returnArr, i, k; // Detect early exit if (path && path.indexOf('.') === -1) { return [obj[path]]; } if (obj !== undefined && typeof obj === 'object') { if (!options || options && !options.skipArrCheck) { // Check if we were passed an array of objects and if so, // iterate over the array and return the value from each // array item if (obj instanceof Array) { returnArr = []; for (i = 0; i < obj.length; i++) { returnArr.push(this.get(obj[i], path)); } return returnArr; } } valuesArr = []; if (path !== undefined) { path = this.clean(path); pathParts = path.split('.'); } arr = pathParts || this._pathParts; arrCount = arr.length; objPart = obj; for (i = 0; i < arrCount; i++) { objPart = objPart[arr[i]]; if (objPartParent instanceof Array) { // Search inside the array for the next key for (k = 0; k < objPartParent.length; k++) { valuesArr = valuesArr.concat(this.value(objPartParent, k + '.' + arr[i], {skipArrCheck: true})); } return valuesArr; } else { if (!objPart || typeof(objPart) !== 'object') { break; } } objPartParent = objPart; } return [objPart]; } else { return []; } }; /** * Push a value to an array on an object for the specified path. * @param {Object} obj The object to update. * @param {String} path The path to the array to push to. * @param {*} val The value to push to the array at the object path. * @returns {*} */ Path.prototype.push = function (obj, path, val) { if (obj !== undefined && path !== undefined) { var pathParts, part; path = this.clean(path); pathParts = path.split('.'); part = pathParts.shift(); if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = obj[part] || {}; // Recurse this.set(obj[part], pathParts.join('.'), val); } else { // Set the value obj[part] = obj[part] || []; if (obj[part] instanceof Array) { obj[part].push(val); } else { throw('ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!'); } } } return obj; }; /** * Gets the value(s) that the object contains for the currently assigned path string * with their associated keys. * @param {Object} obj The object to evaluate the path against. * @param {String=} path A path to use instead of the existing one passed in path(). * @returns {Array} An array of values for the given path with the associated key. */ Path.prototype.keyValue = function (obj, path) { var pathParts, arr, arrCount, objPart, objPartParent, objPartHash, i; if (path !== undefined) { path = this.clean(path); pathParts = path.split('.'); } arr = pathParts || this._pathParts; arrCount = arr.length; objPart = obj; for (i = 0; i < arrCount; i++) { objPart = objPart[arr[i]]; if (!objPart || typeof(objPart) !== 'object') { objPartHash = arr[i] + ':' + objPart; break; } objPartParent = objPart; } return objPartHash; }; /** * Sets a value on an object for the specified path. * @param {Object} obj The object to update. * @param {String} path The path to update. * @param {*} val The value to set the object path to. * @returns {*} */ Path.prototype.set = function (obj, path, val) { if (obj !== undefined && path !== undefined) { var pathParts, part; path = this.clean(path); pathParts = path.split('.'); part = pathParts.shift(); if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = obj[part] || {}; // Recurse this.set(obj[part], pathParts.join('.'), val); } else { // Set the value obj[part] = val; } } return obj; }; /** * Removes leading period (.) from string and returns it. * @param {String} str The string to clean. * @returns {*} */ Path.prototype.clean = function (str) { if (str.substr(0, 1) === '.') { str = str.substr(1, str.length -1); } return str; }; Shared.finishModule('Path'); module.exports = Path; },{"./Shared":41}],36:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared = _dereq_('./Shared'), async = _dereq_('async'), localforage = _dereq_('localforage'), FdbCompress = _dereq_('./PersistCompress'),// jshint ignore:line FdbCrypto = _dereq_('./PersistCrypto'),// jshint ignore:line Db, Collection, CollectionDrop, CollectionGroup, CollectionInit, DbInit, DbDrop, Persist, Overload;//, //DataVersion = '2.0'; /** * The persistent storage class handles loading and saving data to browser * storage. * @constructor */ Persist = function () { this.init.apply(this, arguments); }; /** * The local forage library. */ Persist.prototype.localforage = localforage; /** * The init method that can be overridden or extended. * @param {Db} db The ForerunnerDB database instance. */ Persist.prototype.init = function (db) { var self = this; this._encodeSteps = [ function () { return self._encode.apply(self, arguments); } ]; this._decodeSteps = [ function () { return self._decode.apply(self, arguments); } ]; // Check environment if (db.isClient()) { if (window.Storage !== undefined) { this.mode('localforage'); localforage.config({ driver: [ localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE ], name: String(db.core().name()), storeName: 'FDB' }); } } }; Shared.addModule('Persist', Persist); Shared.mixin(Persist.prototype, 'Mixin.ChainReactor'); Shared.mixin(Persist.prototype, 'Mixin.Common'); Db = Shared.modules.Db; Collection = _dereq_('./Collection'); CollectionDrop = Collection.prototype.drop; CollectionGroup = _dereq_('./CollectionGroup'); CollectionInit = Collection.prototype.init; DbInit = Db.prototype.init; DbDrop = Db.prototype.drop; Overload = Shared.overload; /** * Gets / sets the auto flag which determines if the persistence module * will automatically load data for collections the first time they are * accessed and save data whenever it changes. This is disabled by * default. * @param {Boolean} val Set to true to enable, false to disable * @returns {*} */ Shared.synthesize(Persist.prototype, 'auto', function (val) { var self = this; if (val !== undefined) { if (val) { // Hook db events this._db.on('create', function () { self._autoLoad.apply(self, arguments); }); this._db.on('change', function () { self._autoSave.apply(self, arguments); }); if (this._db.debug()) { console.log(this._db.logIdentifier() + ' Automatic load/save enabled'); } } else { // Un-hook db events this._db.off('create', this._autoLoad); this._db.off('change', this._autoSave); if (this._db.debug()) { console.log(this._db.logIdentifier() + ' Automatic load/save disbled'); } } } return this.$super.call(this, val); }); Persist.prototype._autoLoad = function (obj, objType, name) { var self = this; if (typeof obj.load === 'function') { if (self._db.debug()) { console.log(self._db.logIdentifier() + ' Auto-loading data for ' + objType + ':', name); } obj.load(function (err, data) { if (err && self._db.debug()) { console.log(self._db.logIdentifier() + ' Automatic load failed:', err); } self.emit('load', err, data); }); } else { if (self._db.debug()) { console.log(self._db.logIdentifier() + ' Auto-load for ' + objType + ':', name, 'no load method, skipping'); } } }; Persist.prototype._autoSave = function (obj, objType, name) { var self = this; if (typeof obj.save === 'function') { if (self._db.debug()) { console.log(self._db.logIdentifier() + ' Auto-saving data for ' + objType + ':', name); } obj.save(function (err, data) { if (err && self._db.debug()) { console.log(self._db.logIdentifier() + ' Automatic save failed:', err); } self.emit('save', err, data); }); } }; /** * Gets / sets the persistent storage mode (the library used * to persist data to the browser - defaults to localForage). * @param {String} type The library to use for storage. Defaults * to localForage. * @returns {*} */ Persist.prototype.mode = function (type) { if (type !== undefined) { this._mode = type; return this; } return this._mode; }; /** * Gets / sets the driver used when persisting data. * @param {String} val Specify the driver type (LOCALSTORAGE, * WEBSQL or INDEXEDDB) * @returns {*} */ Persist.prototype.driver = function (val) { if (val !== undefined) { switch (val.toUpperCase()) { case 'LOCALSTORAGE': localforage.setDriver(localforage.LOCALSTORAGE); break; case 'WEBSQL': localforage.setDriver(localforage.WEBSQL); break; case 'INDEXEDDB': localforage.setDriver(localforage.INDEXEDDB); break; default: throw('ForerunnerDB.Persist: The persistence driver you have specified is not found. Please use either IndexedDB, WebSQL or LocalStorage!'); } return this; } return localforage.driver(); }; /** * Starts a decode waterfall process. * @param {*} val The data to be decoded. * @param {Function} finished The callback to pass final data to. */ Persist.prototype.decode = function (val, finished) { async.waterfall([function (callback) { if (callback) { callback(false, val, {}); } }].concat(this._decodeSteps), finished); }; /** * Starts an encode waterfall process. * @param {*} val The data to be encoded. * @param {Function} finished The callback to pass final data to. */ Persist.prototype.encode = function (val, finished) { async.waterfall([function (callback) { if (callback) { callback(false, val, {}); } }].concat(this._encodeSteps), finished); }; Shared.synthesize(Persist.prototype, 'encodeSteps'); Shared.synthesize(Persist.prototype, 'decodeSteps'); /** * Adds an encode/decode step to the persistent storage system so * that you can add custom functionality. * @param {Function} encode The encode method called with the data from the * previous encode step. When your method is complete it MUST call the * callback method. If you provide anything other than false to the err * parameter the encoder will fail and throw an error. * @param {Function} decode The decode method called with the data from the * previous decode step. When your method is complete it MUST call the * callback method. If you provide anything other than false to the err * parameter the decoder will fail and throw an error. * @param {Number=} index Optional index to add the encoder step to. This * allows you to place a step before or after other existing steps. If not * provided your step is placed last in the list of steps. For instance if * you are providing an encryption step it makes sense to place this last * since all previous steps will then have their data encrypted by your * final step. */ Persist.prototype.addStep = new Overload({ 'object': function (obj) { this.$main.call(this, function objEncode () { obj.encode.apply(obj, arguments); }, function objDecode () { obj.decode.apply(obj, arguments); }, 0); }, 'function, function': function (encode, decode) { this.$main.call(this, encode, decode, 0); }, 'function, function, number': function (encode, decode, index) { this.$main.call(this, encode, decode, index); }, $main: function (encode, decode, index) { if (index === 0 || index === undefined) { this._encodeSteps.push(encode); this._decodeSteps.unshift(decode); } else { // Place encoder step at index then work out correct // index to place decoder step this._encodeSteps.splice(index, 0, encode); this._decodeSteps.splice(this._decodeSteps.length - index, 0, decode); } } }); Persist.prototype.unwrap = function (dataStr) { var parts = dataStr.split('::fdb::'), data; switch (parts[0]) { case 'json': data = this.jParse(parts[1]); break; case 'raw': data = parts[1]; break; default: break; } }; /** * Takes encoded data and decodes it for use as JS native objects and arrays. * @param {String} val The currently encoded string data. * @param {Object} meta Meta data object that can be used to pass back useful * supplementary data. * @param {Function} finished The callback method to call when decoding is * completed. * @private */ Persist.prototype._decode = function (val, meta, finished) { var parts, data; if (val) { parts = val.split('::fdb::'); switch (parts[0]) { case 'json': data = this.jParse(parts[1]); break; case 'raw': data = parts[1]; break; default: break; } if (data) { meta.foundData = true; meta.rowCount = data.length || 0; } else { meta.foundData = false; meta.rowCount = 0; } if (finished) { finished(false, data, meta); } } else { meta.foundData = false; meta.rowCount = 0; if (finished) { finished(false, val, meta); } } }; /** * Takes native JS data and encodes it for for storage as a string. * @param {Object} val The current un-encoded data. * @param {Object} meta Meta data object that can be used to pass back useful * supplementary data. * @param {Function} finished The callback method to call when encoding is * completed. * @private */ Persist.prototype._encode = function (val, meta, finished) { var data = val; if (typeof val === 'object') { val = 'json::fdb::' + this.jStringify(val); } else { val = 'raw::fdb::' + val; } if (data) { meta.foundData = true; meta.rowCount = data.length || 0; } else { meta.foundData = false; meta.rowCount = 0; } if (finished) { finished(false, val, meta); } }; /** * Encodes passed data and then stores it in the browser's persistent * storage layer. * @param {String} key The key to store the data under in the persistent * storage. * @param {Object} data The data to store under the key. * @param {Function=} callback The method to call when the save process * has completed. */ Persist.prototype.save = function (key, data, callback) { switch (this.mode()) { case 'localforage': this.encode(data, function (err, data, tableStats) { if (!err) { localforage.setItem(key, data).then(function (data) { if (callback) { callback(false, data, tableStats); } }, function (err) { if (callback) { callback(err); } }); } else { callback(err); } }); break; default: if (callback) { callback('No data handler.'); } break; } }; /** * Loads and decodes data from the passed key. * @param {String} key The key to retrieve data from in the persistent * storage. * @param {Function=} callback The method to call when the load process * has completed. */ Persist.prototype.load = function (key, callback) { var self = this; switch (this.mode()) { case 'localforage': localforage.getItem(key).then(function (val) { self.decode(val, callback); }, function (err) { if (callback) { callback(err); } }); break; default: if (callback) { callback('No data handler or unrecognised data type.'); } break; } }; /** * Deletes data in persistent storage stored under the passed key. * @param {String} key The key to drop data for in the storage. * @param {Function=} callback The method to call when the data is dropped. */ Persist.prototype.drop = function (key, callback) { switch (this.mode()) { case 'localforage': localforage.removeItem(key).then(function () { if (callback) { callback(false); } }, function (err) { if (callback) { callback(err); } }); break; default: if (callback) { callback('No data handler or unrecognised data type.'); } break; } }; // Extend the Collection prototype with persist methods Collection.prototype.drop = new Overload({ /** * Drop collection and persistent storage. */ '': function () { if (!this.isDropped()) { this.drop(true); } }, /** * Drop collection and persistent storage with callback. * @param {Function} callback Callback method. */ 'function': function (callback) { if (!this.isDropped()) { this.drop(true, callback); } }, /** * Drop collection and optionally drop persistent storage. * @param {Boolean} removePersistent True to drop persistent storage, false to keep it. */ 'boolean': function (removePersistent) { if (!this.isDropped()) { // Remove persistent storage if (removePersistent) { if (this._name) { if (this._db) { // Drop the collection data from storage this._db.persist.drop(this._db._name + '-' + this._name); this._db.persist.drop(this._db._name + '-' + this._name + '-metaData'); } } else { throw('ForerunnerDB.Persist: Cannot drop a collection\'s persistent storage when no name assigned to collection!'); } } // Call the original method CollectionDrop.call(this); } }, /** * Drop collections and optionally drop persistent storage with callback. * @param {Boolean} removePersistent True to drop persistent storage, false to keep it. * @param {Function} callback Callback method. */ 'boolean, function': function (removePersistent, callback) { var self = this; if (!this.isDropped()) { // Remove persistent storage if (removePersistent) { if (this._name) { if (this._db) { // Drop the collection data from storage this._db.persist.drop(this._db._name + '-' + this._name, function () { self._db.persist.drop(self._db._name + '-' + self._name + '-metaData', callback); }); return CollectionDrop.call(this); } else { if (callback) { callback('Cannot drop a collection\'s persistent storage when the collection is not attached to a database!'); } } } else { if (callback) { callback('Cannot drop a collection\'s persistent storage when no name assigned to collection!'); } } } else { // Call the original method return CollectionDrop.call(this, callback); } } } }); /** * Saves an entire collection's data to persistent storage. * @param {Function=} callback The method to call when the save function * has completed. */ Collection.prototype.save = function (callback) { var self = this, processSave; if (self._name) { if (self._db) { processSave = function () { // Save the collection data self._db.persist.save(self._db._name + '-' + self._name, self._data, function (err, tableData, tableStats) { if (!err) { self._db.persist.save(self._db._name + '-' + self._name + '-metaData', self.metaData(), function (err, metaData, metaStats) { if (callback) { callback(err, tableStats, metaStats, { tableData: tableData, metaData: metaData, tableDataName: self._db._name + '-' + self._name, metaDataName: self._db._name + '-' + self._name + '-metaData' }); } }); } else { if (callback) { callback(err); } } }); }; // Check for processing queues if (self.isProcessingQueue()) { // Hook queue complete to process save self.on('queuesComplete', function () { processSave(); }); } else { // Process save immediately processSave(); } } else { if (callback) { callback('Cannot save a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot save a collection with no assigned name!'); } } }; /** * Loads an entire collection's data from persistent storage. * @param {Function=} callback The method to call when the load function * has completed. */ Collection.prototype.load = function (callback) { var self = this; if (self._name) { if (self._db) { // Load the collection data self._db.persist.load(self._db._name + '-' + self._name, function (err, data, tableStats) { if (!err) { // Remove all previous data self.remove({}, function () { // Now insert the new data data = data || []; self.insert(data, function () { // Now load the collection's metadata self._db.persist.load(self._db._name + '-' + self._name + '-metaData', function (err, data, metaStats) { if (!err) { if (data) { self.metaData(data); } } if (callback) { callback(err, tableStats, metaStats); } }); }); //self.setData(data); }); } else { if (callback) { callback(err); } } }); } else { if (callback) { callback('Cannot load a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot load a collection with no assigned name!'); } } }; /** * Gets the data that represents this collection for easy storage using * a third-party method / plugin instead of using the standard persistent * storage system. * @param {Function} callback The method to call with the data response. */ Collection.prototype.saveCustom = function (callback) { var self = this, myData = {}, processSave; if (self._name) { if (self._db) { processSave = function () { self.encode(self._data, function (err, data, tableStats) { if (!err) { myData.data = { name: self._db._name + '-' + self._name, store: data, tableStats: tableStats }; self.encode(self._data, function (err, data, tableStats) { if (!err) { myData.metaData = { name: self._db._name + '-' + self._name + '-metaData', store: data, tableStats: tableStats }; callback(false, myData); } else { callback(err); } }); } else { callback(err); } }); }; // Check for processing queues if (self.isProcessingQueue()) { // Hook queue complete to process save self.on('queuesComplete', function () { processSave(); }); } else { // Process save immediately processSave(); } } else { if (callback) { callback('Cannot save a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot save a collection with no assigned name!'); } } }; /** * Loads custom data loaded by a third-party plugin into the collection. * @param {Object} myData Data object previously saved by using saveCustom() * @param {Function} callback A callback method to receive notification when * data has loaded. */ Collection.prototype.loadCustom = function (myData, callback) { var self = this; if (self._name) { if (self._db) { if (myData.data && myData.data.store) { if (myData.metaData && myData.metaData.store) { self.decode(myData.data.store, function (err, data, tableStats) { if (!err) { if (data) { // Remove all previous data self.remove({}); self.insert(data); self.decode(myData.metaData.store, function (err, data, metaStats) { if (!err) { if (data) { self.metaData(data); if (callback) { callback(err, tableStats, metaStats); } } } else { callback(err); } }); } } else { callback(err); } }); } else { callback('No "metaData" key found in passed object!'); } } else { callback('No "data" key found in passed object!'); } } else { if (callback) { callback('Cannot load a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot load a collection with no assigned name!'); } } }; // Override the DB init to instantiate the plugin Db.prototype.init = function () { DbInit.apply(this, arguments); this.persist = new Persist(this); }; Db.prototype.load = new Overload({ /** * Loads an entire database's data from persistent storage. * @param {Function=} callback The method to call when the load function * has completed. */ 'function': function (callback) { this.$main.call(this, {}, callback); }, 'object, function': function (myData, callback) { this.$main.call(this, myData, callback); }, '$main': function (myData, callback) { // Loop the collections in the database var obj = this._collection, keys = obj.keys(), keyCount = keys.length, loadCallback, index; loadCallback = function (err) { if (!err) { keyCount--; if (keyCount === 0) { if (callback) { callback(false); } } } else { if (callback) { callback(err); } } }; for (index in obj) { if (obj.hasOwnProperty(index)) { // Call the collection load method if (!myData) { obj[index].load(loadCallback); } else { obj[index].loadCustom(myData, loadCallback); } } } } }); Db.prototype.save = new Overload({ /** * Saves an entire database's data to persistent storage. * @param {Function=} callback The method to call when the save function * has completed. */ 'function': function (callback) { this.$main.call(this, {}, callback); }, 'object, function': function (options, callback) { this.$main.call(this, options, callback); }, '$main': function (options, callback) { // Loop the collections in the database var obj = this._collection, keys = obj.keys(), keyCount = keys.length, saveCallback, index; saveCallback = function (err) { if (!err) { keyCount--; if (keyCount === 0) { if (callback) { callback(false); } } } else { if (callback) { callback(err); } } }; for (index in obj) { if (obj.hasOwnProperty(index)) { // Call the collection save method if (!options.custom) { obj[index].save(saveCallback); } else { obj[index].saveCustom(saveCallback); } } } } }); Shared.finishModule('Persist'); module.exports = Persist; },{"./Collection":7,"./CollectionGroup":8,"./PersistCompress":37,"./PersistCrypto":38,"./Shared":41,"async":45,"localforage":83}],37:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), pako = _dereq_('pako'); var Plugin = function () { this.init.apply(this, arguments); }; Plugin.prototype.init = function (options) { }; Shared.mixin(Plugin.prototype, 'Mixin.Common'); Plugin.prototype.encode = function (val, meta, finished) { var wrapper = { data: val, type: 'fdbCompress', enabled: false }, before, after, compressedVal; // Compress the data before = val.length; compressedVal = pako.deflate(val, {to: 'string'}); after = compressedVal.length; // If the compressed version is smaller than the original, use it! if (after < before) { wrapper.data = compressedVal; wrapper.enabled = true; } meta.compression = { enabled: wrapper.enabled, compressedBytes: after, uncompressedBytes: before, effect: Math.round((100 / before) * after) + '%' }; finished(false, this.jStringify(wrapper), meta); }; Plugin.prototype.decode = function (wrapper, meta, finished) { var compressionEnabled = false, data; if (wrapper) { wrapper = this.jParse(wrapper); // Check if we need to decompress the string if (wrapper.enabled) { data = pako.inflate(wrapper.data, {to: 'string'}); compressionEnabled = true; } else { data = wrapper.data; compressionEnabled = false; } meta.compression = { enabled: compressionEnabled }; if (finished) { finished(false, data, meta); } } else { if (finished) { finished(false, data, meta); } } }; // Register this plugin with ForerunnerDB Shared.plugins.FdbCompress = Plugin; module.exports = Plugin; },{"./Shared":41,"pako":85}],38:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), CryptoJS = _dereq_('crypto-js'); var Plugin = function () { this.init.apply(this, arguments); }; Plugin.prototype.init = function (options) { // Ensure at least a password is passed in options if (!options || !options.pass) { throw('Cannot initialise persistent storage encryption without a passphrase provided in the passed options object as the "pass" field.'); } this._algo = options.algo || 'AES'; this._pass = options.pass; }; Shared.mixin(Plugin.prototype, 'Mixin.Common'); /** * Gets / sets the current pass-phrase being used to encrypt / decrypt * data with the plugin. */ Shared.synthesize(Plugin.prototype, 'pass'); Plugin.prototype.stringify = function (cipherParams) { // create json object with ciphertext var jsonObj = { ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64) }; // optionally add iv and salt if (cipherParams.iv) { jsonObj.iv = cipherParams.iv.toString(); } if (cipherParams.salt) { jsonObj.s = cipherParams.salt.toString(); } // stringify json object return this.jStringify(jsonObj); }; Plugin.prototype.parse = function (jsonStr) { // parse json string var jsonObj = this.jParse(jsonStr); // extract ciphertext from json object, and create cipher params object var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct) }); // optionally extract iv and salt if (jsonObj.iv) { cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv); } if (jsonObj.s) { cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s); } return cipherParams; }; Plugin.prototype.encode = function (val, meta, finished) { var self = this, wrapper = { type: 'fdbCrypto' }, encryptedVal; // Encrypt the data encryptedVal = CryptoJS[this._algo].encrypt(val, this._pass, { format: { stringify: function () { return self.stringify.apply(self, arguments); }, parse: function () { return self.parse.apply(self, arguments); } } }); wrapper.data = encryptedVal.toString(); wrapper.enabled = true; meta.encryption = { enabled: wrapper.enabled }; if (finished) { finished(false, this.jStringify(wrapper), meta); } }; Plugin.prototype.decode = function (wrapper, meta, finished) { var self = this, data; if (wrapper) { wrapper = this.jParse(wrapper); data = CryptoJS[this._algo].decrypt(wrapper.data, this._pass, { format: { stringify: function () { return self.stringify.apply(self, arguments); }, parse: function () { return self.parse.apply(self, arguments); } } }).toString(CryptoJS.enc.Utf8); if (finished) { finished(false, data, meta); } } else { if (finished) { finished(false, wrapper, meta); } } }; // Register this plugin with ForerunnerDB Shared.plugins.FdbCrypto = Plugin; module.exports = Plugin; },{"./Shared":41,"crypto-js":54}],39:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * Provides chain reactor node linking so that a chain reaction can propagate * down a node tree. Effectively creates a chain link between the reactorIn and * reactorOut objects where a chain reaction from the reactorIn is passed through * the reactorProcess before being passed to the reactorOut object. Reactor * packets are only passed through to the reactorOut if the reactor IO method * chainSend is used. * @param {*} reactorIn An object that has the Mixin.ChainReactor methods mixed * in to it. Chain reactions that occur inside this object will be passed through * to the reactorOut object. * @param {*} reactorOut An object that has the Mixin.ChainReactor methods mixed * in to it. Chain reactions that occur in the reactorIn object will be passed * through to this object. * @param {Function} reactorProcess The processing method to use when chain * reactions occur. * @constructor */ var ReactorIO = function (reactorIn, reactorOut, reactorProcess) { if (reactorIn && reactorOut && reactorProcess) { this._reactorIn = reactorIn; this._reactorOut = reactorOut; this._chainHandler = reactorProcess; if (!reactorIn.chain) { throw('ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!'); } // Register the reactorIO with the input reactorIn.chain(this); // Register the output with the reactorIO this.chain(reactorOut); } else { throw('ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!'); } }; Shared.addModule('ReactorIO', ReactorIO); /** * Drop a reactor IO object, breaking the reactor link between the in and out * reactor nodes. * @returns {boolean} */ ReactorIO.prototype.drop = function () { if (!this.isDropped()) { this._state = 'dropped'; // Remove links if (this._reactorIn) { this._reactorIn.unChain(this); } if (this._reactorOut) { this.unChain(this._reactorOut); } delete this._reactorIn; delete this._reactorOut; delete this._chainHandler; this.emit('drop', this); delete this._listeners; } return true; }; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(ReactorIO.prototype, 'state'); Shared.mixin(ReactorIO.prototype, 'Mixin.Common'); Shared.mixin(ReactorIO.prototype, 'Mixin.ChainReactor'); Shared.mixin(ReactorIO.prototype, 'Mixin.Events'); Shared.finishModule('ReactorIO'); module.exports = ReactorIO; },{"./Shared":41}],40:[function(_dereq_,module,exports){ "use strict"; /** * Provides functionality to encode and decode JavaScript objects to strings * and back again. This differs from JSON.stringify and JSON.parse in that * special objects such as dates can be encoded to strings and back again * so that the reconstituted version of the string still contains a JavaScript * date object. * @constructor */ var Serialiser = function () { this.init.apply(this, arguments); }; Serialiser.prototype.init = function () { var self = this; this._encoder = []; this._decoder = []; // Handler for Date() objects this.registerHandler('$date', function (objInstance) { if (objInstance instanceof Date) { // Augment this date object with a new toJSON method objInstance.toJSON = function () { return "$date:" + this.toISOString(); }; // Tell the converter we have matched this object return true; } // Tell converter to keep looking, we didn't match this object return false; }, function (data) { if (typeof data === 'string' && data.indexOf('$date:') === 0) { return self.convert(new Date(data.substr(6))); } return undefined; }); // Handler for RegExp() objects this.registerHandler('$regexp', function (objInstance) { if (objInstance instanceof RegExp) { objInstance.toJSON = function () { return "$regexp:" + this.source.length + ":" + this.source + ":" + (this.global ? 'g' : '') + (this.ignoreCase ? 'i' : ''); /*return { source: this.source, params: '' + (this.global ? 'g' : '') + (this.ignoreCase ? 'i' : '') };*/ }; // Tell the converter we have matched this object return true; } // Tell converter to keep looking, we didn't match this object return false; }, function (data) { if (typeof data === 'string' && data.indexOf('$regexp:') === 0) { var dataStr = data.substr(8),//± lengthEnd = dataStr.indexOf(':'), sourceLength = Number(dataStr.substr(0, lengthEnd)), source = dataStr.substr(lengthEnd + 1, sourceLength), params = dataStr.substr(lengthEnd + sourceLength + 2); return self.convert(new RegExp(source, params)); } return undefined; }); }; Serialiser.prototype.registerHandler = function (handles, encoder, decoder) { if (handles !== undefined) { // Register encoder this._encoder.push(encoder); // Register decoder this._decoder.push(decoder); } }; Serialiser.prototype.convert = function (data) { // Run through converters and check for match var arr = this._encoder, i; for (i = 0; i < arr.length; i++) { if (arr[i](data)) { // The converter we called matched the object and converted it // so let's return it now. return data; } } // No converter matched the object, return the unaltered one return data; }; Serialiser.prototype.reviver = function () { var arr = this._decoder; return function (key, value) { // Check if we have a decoder method for this key var decodedData, i; for (i = 0; i < arr.length; i++) { decodedData = arr[i](value); if (decodedData !== undefined) { // The decoder we called matched the object and decoded it // so let's return it now. return decodedData; } } // No decoder, return basic value return value; }; }; module.exports = Serialiser; },{}],41:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); /** * A shared object that can be used to store arbitrary data between class * instances, and access helper methods. * @mixin */ var Shared = { version: '1.3.788', modules: {}, plugins: {}, index: {}, _synth: {}, /** * Adds a module to ForerunnerDB. * @memberof Shared * @param {String} name The name of the module. * @param {Function} module The module class. */ addModule: function (name, module) { // Store the module in the module registry this.modules[name] = module; // Tell the universe we are loading this module this.emit('moduleLoad', [name, module]); }, /** * Called by the module once all processing has been completed. Used to determine * if the module is ready for use by other modules. * @memberof Shared * @param {String} name The name of the module. */ finishModule: function (name) { if (this.modules[name]) { // Set the finished loading flag to true this.modules[name]._fdbFinished = true; // Assign the module name to itself so it knows what it // is called if (this.modules[name].prototype) { this.modules[name].prototype.className = name; } else { this.modules[name].className = name; } this.emit('moduleFinished', [name, this.modules[name]]); } else { throw('ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): ' + name); } }, /** * Will call your callback method when the specified module has loaded. If the module * is already loaded the callback is called immediately. * @memberof Shared * @param {String} name The name of the module. * @param {Function} callback The callback method to call when the module is loaded. */ moduleFinished: function (name, callback) { if (this.modules[name] && this.modules[name]._fdbFinished) { if (callback) { callback(name, this.modules[name]); } } else { this.on('moduleFinished', callback); } }, /** * Determines if a module has been added to ForerunnerDB or not. * @memberof Shared * @param {String} name The name of the module. * @returns {Boolean} True if the module exists or false if not. */ moduleExists: function (name) { return Boolean(this.modules[name]); }, mixin: new Overload({ /** * Adds the properties and methods defined in the mixin to the passed * object. * @memberof Shared * @name mixin * @param {Object} obj The target object to add mixin key/values to. * @param {String} mixinName The name of the mixin to add to the object. */ 'object, string': function (obj, mixinName) { var mixinObj; if (typeof mixinName === 'string') { mixinObj = this.mixins[mixinName]; if (!mixinObj) { throw('ForerunnerDB.Shared: Cannot find mixin named: ' + mixinName); } } return this.$main.call(this, obj, mixinObj); }, /** * Adds the properties and methods defined in the mixin to the passed * object. * @memberof Shared * @name mixin * @param {Object} obj The target object to add mixin key/values to. * @param {Object} mixinObj The object containing the keys to mix into * the target object. */ 'object, *': function (obj, mixinObj) { return this.$main.call(this, obj, mixinObj); }, '$main': function (obj, mixinObj) { if (mixinObj && typeof mixinObj === 'object') { for (var i in mixinObj) { if (mixinObj.hasOwnProperty(i)) { obj[i] = mixinObj[i]; } } } return obj; } }), /** * Generates a generic getter/setter method for the passed method name. * @memberof Shared * @param {Object} obj The object to add the getter/setter to. * @param {String} name The name of the getter/setter to generate. * @param {Function=} extend A method to call before executing the getter/setter. * The existing getter/setter can be accessed from the extend method via the * $super e.g. this.$super(); */ synthesize: function (obj, name, extend) { this._synth[name] = this._synth[name] || function (val) { if (val !== undefined) { this['_' + name] = val; return this; } return this['_' + name]; }; if (extend) { var self = this; obj[name] = function () { var tmp = this.$super, ret; this.$super = self._synth[name]; ret = extend.apply(this, arguments); this.$super = tmp; return ret; }; } else { obj[name] = this._synth[name]; } }, /** * Allows a method to be overloaded. * @memberof Shared * @param arr * @returns {Function} * @constructor */ overload: Overload, /** * Define the mixins that other modules can use as required. * @memberof Shared */ mixins: { 'Mixin.Common': _dereq_('./Mixin.Common'), 'Mixin.Events': _dereq_('./Mixin.Events'), 'Mixin.ChainReactor': _dereq_('./Mixin.ChainReactor'), 'Mixin.CRUD': _dereq_('./Mixin.CRUD'), 'Mixin.Constants': _dereq_('./Mixin.Constants'), 'Mixin.Triggers': _dereq_('./Mixin.Triggers'), 'Mixin.Sorting': _dereq_('./Mixin.Sorting'), 'Mixin.Matching': _dereq_('./Mixin.Matching'), 'Mixin.Updating': _dereq_('./Mixin.Updating'), 'Mixin.Tags': _dereq_('./Mixin.Tags') } }; // Add event handling to shared Shared.mixin(Shared, 'Mixin.Events'); module.exports = Shared; },{"./Mixin.CRUD":21,"./Mixin.ChainReactor":22,"./Mixin.Common":23,"./Mixin.Constants":24,"./Mixin.Events":25,"./Mixin.Matching":26,"./Mixin.Sorting":27,"./Mixin.Tags":28,"./Mixin.Triggers":29,"./Mixin.Updating":30,"./Overload":33}],42:[function(_dereq_,module,exports){ /* jshint strict:false */ if (!Array.prototype.filter) { Array.prototype.filter = function(fun/*, thisArg*/) { if (this === void 0 || this === null) { throw new TypeError(); } var t = Object(this); var len = t.length >>> 0; // jshint ignore:line if (typeof fun !== 'function') { throw new TypeError(); } var res = []; var thisArg = arguments.length >= 2 ? arguments[1] : void 0; for (var i = 0; i < len; i++) { if (i in t) { var val = t[i]; // NOTE: Technically this should Object.defineProperty at // the next index, as push can be affected by // properties on Object.prototype and Array.prototype. // But that method's new, and collisions should be // rare, so use the more-compatible alternative. if (fun.call(thisArg, val, i, t)) { res.push(val); } } } return res; }; } if (typeof Object.create !== 'function') { Object.create = (function() { var Temp = function() {}; return function (prototype) { if (arguments.length > 1) { throw Error('Second argument not supported'); } if (typeof prototype !== 'object') { throw TypeError('Argument must be an object'); } Temp.prototype = prototype; var result = new Temp(); Temp.prototype = null; return result; }; })(); } // Production steps of ECMA-262, Edition 5, 15.4.4.14 // Reference: http://es5.github.io/#x15.4.4.14e if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement, fromIndex) { var k; // 1. Let O be the result of calling ToObject passing // the this value as the argument. if (this === null) { throw new TypeError('"this" is null or not defined'); } var O = Object(this); // 2. Let lenValue be the result of calling the Get // internal method of O with the argument "length". // 3. Let len be ToUint32(lenValue). var len = O.length >>> 0; // jshint ignore:line // 4. If len is 0, return -1. if (len === 0) { return -1; } // 5. If argument fromIndex was passed let n be // ToInteger(fromIndex); else let n be 0. var n = +fromIndex || 0; if (Math.abs(n) === Infinity) { n = 0; } // 6. If n >= len, return -1. if (n >= len) { return -1; } // 7. If n >= 0, then Let k be n. // 8. Else, n<0, Let k be len - abs(n). // If k is less than 0, then let k be 0. k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); // 9. Repeat, while k < len while (k < len) { // a. Let Pk be ToString(k). // This is implicit for LHS operands of the in operator // b. Let kPresent be the result of calling the // HasProperty internal method of O with argument Pk. // This step can be combined with c // c. If kPresent is true, then // i. Let elementK be the result of calling the Get // internal method of O with the argument ToString(k). // ii. Let same be the result of applying the // Strict Equality Comparison Algorithm to // searchElement and elementK. // iii. If same is true, return k. if (k in O && O[k] === searchElement) { return k; } k++; } return -1; }; } module.exports = {}; },{}],43:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, CollectionGroup, CollectionInit, DbInit, ReactorIO, ActiveBucket, Overload = _dereq_('./Overload'), Path, sharedPathSolver; Shared = _dereq_('./Shared'); /** * Creates a new view instance. * @param {String} name The name of the view. * @param {Object=} query The view's query. * @param {Object=} options An options object. * @constructor */ var View = function (name, query, options) { this.init.apply(this, arguments); }; Shared.addModule('View', View); Shared.mixin(View.prototype, 'Mixin.Common'); Shared.mixin(View.prototype, 'Mixin.Matching'); Shared.mixin(View.prototype, 'Mixin.ChainReactor'); Shared.mixin(View.prototype, 'Mixin.Constants'); Shared.mixin(View.prototype, 'Mixin.Triggers'); Shared.mixin(View.prototype, 'Mixin.Tags'); Collection = _dereq_('./Collection'); CollectionGroup = _dereq_('./CollectionGroup'); ActiveBucket = _dereq_('./ActiveBucket'); ReactorIO = _dereq_('./ReactorIO'); CollectionInit = Collection.prototype.init; Db = Shared.modules.Db; DbInit = Db.prototype.init; Path = Shared.modules.Path; sharedPathSolver = new Path(); View.prototype.init = function (name, query, options) { var self = this; this.sharedPathSolver = sharedPathSolver; this._name = name; this._listeners = {}; this._querySettings = {}; this._debug = {}; this.query(query, options, false); this._collectionDroppedWrap = function () { self._collectionDropped.apply(self, arguments); }; this._data = new Collection(this.name() + '_internal'); }; /** * This reactor IO node is given data changes from source data and * then acts as a firewall process between the source and view data. * Data needs to meet the requirements this IO node imposes before * the data is passed down the reactor chain (to the view). This * allows us to intercept data changes from the data source and act * on them such as applying transforms, checking the data matches * the view's query, applying joins to the data etc before sending it * down the reactor chain via the this.chainSend() calls. * * Update packets are especially complex to handle because an update * on the underlying source data could translate into an insert, * update or remove call on the view. Take a scenario where the view's * query limits the data see from the source. If the source data is * updated and the data now falls inside the view's query limitations * the data is technically now an insert on the view, not an update. * The same is true in reverse where the update becomes a remove. If * the updated data already exists in the view and will still exist * after the update operation then the update can remain an update. * @param {Object} chainPacket The chain reactor packet representing the * data operation that has just been processed on the source data. * @param {View} self The reference to the view we are operating for. * @private */ View.prototype._handleChainIO = function (chainPacket, self) { var type = chainPacket.type, hasActiveJoin, hasActiveQuery, hasTransformIn, sharedData; // NOTE: "self" in this context is the view instance. // NOTE: "this" in this context is the ReactorIO node sitting in // between the source (sender) and the destination (listener) and // in this case the source is the view's "from" data source and the // destination is the view's _data collection. This means // that "this.chainSend()" is asking the ReactorIO node to send the // packet on to the destination listener. // EARLY EXIT: Check that the packet is not a CRUD operation if (type !== 'setData' && type !== 'insert' && type !== 'update' && type !== 'remove') { // This packet is NOT a CRUD operation packet so exit early! // Returning false informs the chain reactor to continue propagation // of the chain packet down the graph tree return false; } // We only need to check packets under three conditions // 1) We have a limiting query on the view "active query", // 2) We have a query options with a $join clause on the view "active join" // 3) We have a transformIn operation registered on the view. // If none of these conditions exist we can just allow the chain // packet to proceed as normal hasActiveJoin = Boolean(self._querySettings.options && self._querySettings.options.$join); hasActiveQuery = Boolean(self._querySettings.query); hasTransformIn = self._data._transformIn !== undefined; // EARLY EXIT: Check for any complex operation flags and if none // exist, send the packet on and exit early if (!hasActiveJoin && !hasActiveQuery && !hasTransformIn) { // We don't have any complex operation flags so exit early! // Returning false informs the chain reactor to continue propagation // of the chain packet down the graph tree return false; } // We have either an active query, active join or a transformIn // function registered on the view // We create a shared data object here so that the disparate method // calls can share data with each other via this object whilst // still remaining separate methods to keep code relatively clean. sharedData = { dataArr: [], removeArr: [] }; // Check the packet type to get the data arrays to work on if (chainPacket.type === 'insert') { // Check if the insert data is an array if (chainPacket.data.dataSet instanceof Array) { // Use the insert data array sharedData.dataArr = chainPacket.data.dataSet; } else { // Generate an array from the single insert object sharedData.dataArr = [chainPacket.data.dataSet]; } } else if (chainPacket.type === 'update') { // Use the dataSet array sharedData.dataArr = chainPacket.data.dataSet; } else if (chainPacket.type === 'remove') { if (chainPacket.data.dataSet instanceof Array) { // Use the remove data array sharedData.removeArr = chainPacket.data.dataSet; } else { // Generate an array from the single remove object sharedData.removeArr = [chainPacket.data.dataSet]; } } // Safety check if (!(sharedData.dataArr instanceof Array)) { // This shouldn't happen, let's log it console.warn('WARNING: dataArr being processed by chain reactor in View class is inconsistent!'); sharedData.dataArr = []; } if (!(sharedData.removeArr instanceof Array)) { // This shouldn't happen, let's log it console.warn('WARNING: removeArr being processed by chain reactor in View class is inconsistent!'); sharedData.removeArr = []; } // We need to operate in this order: // 1) Check if there is an active join - active joins are operated // against the SOURCE data. The joined data can potentially be // utilised by any active query or transformIn so we do this step first. // 2) Check if there is an active query - this is a query that is run // against the SOURCE data after any active joins have been resolved // on the source data. This allows an active query to operate on data // that would only exist after an active join has been executed. // If the source data does not fall inside the limiting factors of the // active query then we add it to a removal array. If it does fall // inside the limiting factors when we add it to an upsert array. This // is because data that falls inside the query could end up being // either new data or updated data after a transformIn operation. // 3) Check if there is a transformIn function. If a transformIn function // exist we run it against the data after doing any active join and // active query. if (hasActiveJoin) { if (this.debug()) { console.time(this.logIdentifier() + ' :: _handleChainIO_ActiveJoin'); } self._handleChainIO_ActiveJoin(chainPacket, sharedData); if (this.debug()) { console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_ActiveJoin'); } } if (hasActiveQuery) { if (this.debug()) { console.time(this.logIdentifier() + ' :: _handleChainIO_ActiveQuery'); } self._handleChainIO_ActiveQuery(chainPacket, sharedData); if (this.debug()) { console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_ActiveQuery'); } } if (hasTransformIn) { if (this.debug()) { console.time(this.logIdentifier() + ' :: _handleChainIO_TransformIn'); } self._handleChainIO_TransformIn(chainPacket, sharedData); if (this.debug()) { console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_TransformIn'); } } // Check if we still have data to operate on and exit // if there is none left if (!sharedData.dataArr.length && !sharedData.removeArr.length) { // There is no more data to operate on, exit without // sending any data down the chain reactor (return true // will tell reactor to exit without continuing)! return true; } // Grab the public data collection's primary key sharedData.pk = self._data.primaryKey(); // We still have data left, let's work out how to handle it // first let's loop through the removals as these are easy if (sharedData.removeArr.length) { if (this.debug()) { console.time(this.logIdentifier() + ' :: _handleChainIO_RemovePackets'); } self._handleChainIO_RemovePackets(this, chainPacket, sharedData); if (this.debug()) { console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_RemovePackets'); } } if (sharedData.dataArr.length) { if (this.debug()) { console.time(this.logIdentifier() + ' :: _handleChainIO_UpsertPackets'); } self._handleChainIO_UpsertPackets(this, chainPacket, sharedData); if (this.debug()) { console.timeEnd(this.logIdentifier() + ' :: _handleChainIO_UpsertPackets'); } } // Now return true to tell the chain reactor not to propagate // the data itself as we have done all that work here return true; }; View.prototype._handleChainIO_ActiveJoin = function (chainPacket, sharedData) { var dataArr = sharedData.dataArr, removeArr; // Since we have an active join, all we need to do is operate // the join clause on each item in the packet's data array. removeArr = this.applyJoin(dataArr, this._querySettings.options.$join, {}, {}); // Now that we've run our join keep in mind that joins can exclude data // if there is no matching joined data and the require: true clause in // the join options is enabled. This means we have to store a removal // array that tells us which items from the original data we sent to // join did not match the join data and were set with a require flag. // Now that we have our array of items to remove, let's run through the // original data and remove them from there. this.spliceArrayByIndexList(dataArr, removeArr); // Make sure we add any items we removed to the shared removeArr sharedData.removeArr = sharedData.removeArr.concat(removeArr); }; View.prototype._handleChainIO_ActiveQuery = function (chainPacket, sharedData) { var self = this, dataArr = sharedData.dataArr, i; // Now we need to run the data against the active query to // see if the data should be in the final data list or not, // so we use the _match method. // Loop backwards so we can safely splice from the array // while we are looping for (i = dataArr.length - 1; i >= 0; i--) { if (!self._match(dataArr[i], self._querySettings.query, self._querySettings.options, 'and', {})) { // The data didn't match the active query, add it // to the shared removeArr sharedData.removeArr.push(dataArr[i]); // Now remove it from the shared dataArr dataArr.splice(i, 1); } } }; View.prototype._handleChainIO_TransformIn = function (chainPacket, sharedData) { var self = this, dataArr = sharedData.dataArr, removeArr = sharedData.removeArr, dataIn = self._data._transformIn, i; // At this stage we take the remaining items still left in the data // array and run our transformIn method on each one, modifying it // from what it was to what it should be on the view. We also have // to run this on items we want to remove too because transforms can // affect primary keys and therefore stop us from identifying the // correct items to run removal operations on. // It is important that these are transformed BEFORE they are passed // to the CRUD methods because we use the CU data to check the position // of the item in the array and that can only happen if it is already // pre-transformed. The removal stuff also needs pre-transformed // because ids can be modified by a transform. for (i = 0; i < dataArr.length; i++) { // Assign the new value dataArr[i] = dataIn(dataArr[i]); } for (i = 0; i < removeArr.length; i++) { // Assign the new value removeArr[i] = dataIn(removeArr[i]); } }; View.prototype._handleChainIO_RemovePackets = function (ioObj, chainPacket, sharedData) { var $or = [], pk = sharedData.pk, removeArr = sharedData.removeArr, packet = { dataSet: removeArr, query: { $or: $or } }, orObj, i; for (i = 0; i < removeArr.length; i++) { orObj = {}; orObj[pk] = removeArr[i][pk]; $or.push(orObj); } ioObj.chainSend('remove', packet); }; View.prototype._handleChainIO_UpsertPackets = function (ioObj, chainPacket, sharedData) { var data = this._data, primaryIndex = data._primaryIndex, primaryCrc = data._primaryCrc, pk = sharedData.pk, dataArr = sharedData.dataArr, arrItem, insertArr = [], updateArr = [], query, i; // Let's work out what type of operation this data should // generate between an insert or an update. for (i = 0; i < dataArr.length; i++) { arrItem = dataArr[i]; // Check if the data already exists in the data if (primaryIndex.get(arrItem[pk])) { // Matching item exists, check if the data is the same if (primaryCrc.get(arrItem[pk]) !== this.hash(arrItem[pk])) { // The document exists in the data collection but data differs, update required updateArr.push(arrItem); } } else { // The document is missing from this collection, insert required insertArr.push(arrItem); } } if (insertArr.length) { ioObj.chainSend('insert', { dataSet: insertArr }); } if (updateArr.length) { for (i = 0; i < updateArr.length; i++) { arrItem = updateArr[i]; query = {}; query[pk] = arrItem[pk]; ioObj.chainSend('update', { query: query, update: arrItem, dataSet: [arrItem] }); } } }; /** * Executes an insert against the view's underlying data-source. * @see Collection::insert() */ View.prototype.insert = function () { this._from.insert.apply(this._from, arguments); }; /** * Executes an update against the view's underlying data-source. * @see Collection::update() */ View.prototype.update = function () { this._from.update.apply(this._from, arguments); }; /** * Executes an updateById against the view's underlying data-source. * @see Collection::updateById() */ View.prototype.updateById = function () { this._from.updateById.apply(this._from, arguments); }; /** * Executes a remove against the view's underlying data-source. * @see Collection::remove() */ View.prototype.remove = function () { this._from.remove.apply(this._from, arguments); }; /** * Queries the view data. * @see Collection::find() * @returns {Array} The result of the find query. */ View.prototype.find = function (query, options) { return this._data.find(query, options); }; /** * Queries the view data for a single document. * @see Collection::findOne() * @returns {Object} The result of the find query. */ View.prototype.findOne = function (query, options) { return this._data.findOne(query, options); }; /** * Queries the view data by specific id. * @see Collection::findById() * @returns {Array} The result of the find query. */ View.prototype.findById = function (id, options) { return this._data.findById(id, options); }; /** * Queries the view data in a sub-array. * @see Collection::findSub() * @returns {Array} The result of the find query. */ View.prototype.findSub = function (match, path, subDocQuery, subDocOptions) { return this._data.findSub(match, path, subDocQuery, subDocOptions); }; /** * Queries the view data in a sub-array and returns first match. * @see Collection::findSubOne() * @returns {Object} The result of the find query. */ View.prototype.findSubOne = function (match, path, subDocQuery, subDocOptions) { return this._data.findSubOne(match, path, subDocQuery, subDocOptions); }; /** * Gets the module's internal data collection. * @returns {Collection} */ View.prototype.data = function () { return this._data; }; /** * Sets the source from which the view will assemble its data. * @param {Collection|View} source The source to use to assemble view data. * @param {Function=} callback A callback method. * @returns {*} If no argument is passed, returns the current value of from, * otherwise returns itself for chaining. */ View.prototype.from = function (source, callback) { var self = this; if (source !== undefined) { // Check if we have an existing from if (this._from) { // Remove the listener to the drop event this._from.off('drop', this._collectionDroppedWrap); // Remove the current reference to the _from since we // are about to replace it with a new one delete this._from; } // Check if we have an existing reactor io that links the // previous _from source to the view's internal data if (this._io) { // Drop the io and remove it this._io.drop(); delete this._io; } // Check if we were passed a source name rather than a // reference to a source object if (typeof(source) === 'string') { // We were passed a name, assume it is a collection and // get the reference to the collection of that name source = this._db.collection(source); } // Check if we were passed a reference to a view rather than // a collection. Views need to be handled slightly differently // since their data is stored in an internal data collection // rather than actually being a direct data source themselves. if (source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source._data; if (this.debug()) { console.log(this.logIdentifier() + ' Using internal data "' + source.instanceIdentifier() + '" for IO graph linking'); } } // Assign the new data source as the view's _from this._from = source; // Hook the new data source's drop event so we can unhook // it as a data source if it gets dropped. This is important // so that we don't run into problems using a dropped source // for active data. this._from.on('drop', this._collectionDroppedWrap); // Create a new reactor IO graph node that intercepts chain packets from the // view's _from source and determines how they should be interpreted by // this view. See the _handleChainIO() method which does all the chain packet // processing for the view. this._io = new ReactorIO(this._from, this, function (chainPacket) { return self._handleChainIO.call(this, chainPacket, self); }); // Set the view's internal data primary key to the same as the // current active _from data source this._data.primaryKey(source.primaryKey()); // Do the initial data lookup and populate the view's internal data // since at this point we don't actually have any data in the view // yet. var collData = source.find(this._querySettings.query, this._querySettings.options); this._data.setData(collData, {}, callback); // If we have an active query and that query has an $orderBy clause, // update our active bucket which allows us to keep track of where // data should be placed in our internal data array. This is about // ordering of data and making sure that we maintain an ordered array // so that if we have data-binding we can place an item in the data- // bound view at the correct location. Active buckets use quick-sort // algorithms to quickly determine the position of an item inside an // existing array based on a sort protocol. if (this._querySettings.options && this._querySettings.options.$orderBy) { this.rebuildActiveBucket(this._querySettings.options.$orderBy); } else { this.rebuildActiveBucket(); } return this; } return this._from; }; /** * The chain reaction handler method for the view. * @param {Object} chainPacket The chain reaction packet to handle. * @private */ View.prototype._chainHandler = function (chainPacket) { var //self = this, arr, count, index, insertIndex, updates, primaryKey, item, currentIndex; if (this.debug()) { console.log(this.logIdentifier() + ' Received chain reactor data: ' + chainPacket.type); } switch (chainPacket.type) { case 'setData': if (this.debug()) { console.log(this.logIdentifier() + ' Setting data in underlying (internal) view collection "' + this._data.name() + '"'); } // Get the new data from our underlying data source sorted as we want var collData = this._from.find(this._querySettings.query, this._querySettings.options); this._data.setData(collData); // Rebuild active bucket as well this.rebuildActiveBucket(this._querySettings.options); break; case 'insert': if (this.debug()) { console.log(this.logIdentifier() + ' Inserting some data into underlying (internal) view collection "' + this._data.name() + '"'); } // Decouple the data to ensure we are working with our own copy chainPacket.data.dataSet = this.decouple(chainPacket.data.dataSet); // Make sure we are working with an array if (!(chainPacket.data.dataSet instanceof Array)) { chainPacket.data.dataSet = [chainPacket.data.dataSet]; } if (this._querySettings.options && this._querySettings.options.$orderBy) { // Loop the insert data and find each item's index arr = chainPacket.data.dataSet; count = arr.length; for (index = 0; index < count; index++) { insertIndex = this._activeBucket.insert(arr[index]); this._data._insertHandle(arr[index], insertIndex); } } else { // Set the insert index to the passed index, or if none, the end of the view data array insertIndex = this._data._data.length; this._data._insertHandle(chainPacket.data.dataSet, insertIndex); } break; case 'update': if (this.debug()) { console.log(this.logIdentifier() + ' Updating some data in underlying (internal) view collection "' + this._data.name() + '"'); } primaryKey = this._data.primaryKey(); // Do the update updates = this._data._handleUpdate( chainPacket.data.query, chainPacket.data.update, chainPacket.data.options ); if (this._querySettings.options && this._querySettings.options.$orderBy) { // TODO: This would be a good place to improve performance by somehow // TODO: inspecting the change that occurred when update was performed // TODO: above and determining if it affected the order clause keys // TODO: and if not, skipping the active bucket updates here // Loop the updated items and work out their new sort locations count = updates.length; for (index = 0; index < count; index++) { item = updates[index]; // Remove the item from the active bucket (via it's id) this._activeBucket.remove(item); // Get the current location of the item currentIndex = this._data._data.indexOf(item); // Add the item back in to the active bucket insertIndex = this._activeBucket.insert(item); if (currentIndex !== insertIndex) { // Move the updated item to the new index this._data._updateSpliceMove(this._data._data, currentIndex, insertIndex); } } } break; case 'remove': if (this.debug()) { console.log(this.logIdentifier() + ' Removing some data from underlying (internal) view collection "' + this._data.name() + '"'); } this._data.remove(chainPacket.data.query, chainPacket.options); if (this._querySettings.options && this._querySettings.options.$orderBy) { // Loop the dataSet and remove the objects from the ActiveBucket arr = chainPacket.data.dataSet; count = arr.length; for (index = 0; index < count; index++) { this._activeBucket.remove(arr[index]); } } break; default: break; } }; /** * Handles when an underlying collection the view is using as a data * source is dropped. * @param {Collection} collection The collection that has been dropped. * @private */ View.prototype._collectionDropped = function (collection) { if (collection) { // Collection was dropped, remove from view delete this._from; } }; /** * Creates an index on the view. * @see Collection::ensureIndex() * @returns {*} */ View.prototype.ensureIndex = function () { return this._data.ensureIndex.apply(this._data, arguments); }; /** /** * Listens for an event. * @see Mixin.Events::on() */ View.prototype.on = function () { return this._data.on.apply(this._data, arguments); }; /** * Cancels an event listener. * @see Mixin.Events::off() */ View.prototype.off = function () { return this._data.off.apply(this._data, arguments); }; /** * Emits an event. * @see Mixin.Events::emit() */ View.prototype.emit = function () { return this._data.emit.apply(this._data, arguments); }; /** * Emits an event. * @see Mixin.Events::deferEmit() */ View.prototype.deferEmit = function () { return this._data.deferEmit.apply(this._data, arguments); }; /** * Find the distinct values for a specified field across a single collection and * returns the results in an array. * @param {String} key The field path to return distinct values for e.g. "person.name". * @param {Object=} query The query to use to filter the documents used to return values from. * @param {Object=} options The query options to use when running the query. * @returns {Array} */ View.prototype.distinct = function (key, query, options) { return this._data.distinct(key, query, options); }; /** * Gets the primary key for this view from the assigned collection. * @see Collection::primaryKey() * @returns {String} */ View.prototype.primaryKey = function () { return this._data.primaryKey(); }; /** * Drops a view and all it's stored data from the database. * @returns {boolean} True on success, false on failure. */ View.prototype.drop = function (callback) { if (!this.isDropped()) { if (this._from) { this._from.off('drop', this._collectionDroppedWrap); this._from._removeView(this); } if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; // Clear io and chains if (this._io) { this._io.drop(); } // Drop the view's internal collection if (this._data) { this._data.drop(); } if (this._db && this._name) { delete this._db._view[this._name]; } this.emit('drop', this); if (callback) { callback(false, true); } delete this._chain; delete this._from; delete this._data; delete this._io; delete this._listeners; delete this._querySettings; delete this._db; return true; } return false; }; /** * Gets / sets the query object and query options that the view uses * to build it's data set. This call modifies both the query and * query options at the same time. * @param {Object=} query The query to set. * @param {Boolean=} options The query options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} * @deprecated Use query(<query>, <options>, <refresh>) instead. Query * now supports being presented with multiple different variations of * arguments. */ View.prototype.queryData = function (query, options, refresh) { if (query !== undefined) { this._querySettings.query = query; if (query.$findSub && !query.$findSub.$from) { query.$findSub.$from = this._data.name(); } if (query.$findSubOne && !query.$findSubOne.$from) { query.$findSubOne.$from = this._data.name(); } } if (options !== undefined) { this._querySettings.options = options; } if (query !== undefined || options !== undefined) { if (refresh === undefined || refresh === true) { this.refresh(); } } if (query !== undefined) { this.emit('queryChange', query); } if (options !== undefined) { this.emit('queryOptionsChange', options); } if (query !== undefined || options !== undefined) { return this; } return this._querySettings; }; /** * Add data to the existing query. * @param {Object} obj The data whose keys will be added to the existing * query object. * @param {Boolean} overwrite Whether or not to overwrite data that already * exists in the query object. Defaults to true. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ View.prototype.queryAdd = function (obj, overwrite, refresh) { this._querySettings.query = this._querySettings.query || {}; var query = this._querySettings.query, i; if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { if (query[i] === undefined || (query[i] !== undefined && overwrite !== false)) { query[i] = obj[i]; } } } } if (refresh === undefined || refresh === true) { this.refresh(); } if (query !== undefined) { this.emit('queryChange', query); } }; /** * Remove data from the existing query. * @param {Object} obj The data whose keys will be removed from the existing * query object. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ View.prototype.queryRemove = function (obj, refresh) { var query = this._querySettings.query, i; if (query) { if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { delete query[i]; } } } if (refresh === undefined || refresh === true) { this.refresh(); } if (query !== undefined) { this.emit('queryChange', query); } } }; /** * Gets / sets the query being used to generate the view data. It * does not change or modify the view's query options. * @param {Object=} query The query to set. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ View.prototype.query = new Overload({ '': function () { return this.decouple(this._querySettings.query); }, 'object': function (query) { return this.$main.call(this, query, undefined, true); }, '*, boolean': function (query, refresh) { return this.$main.call(this, query, undefined, refresh); }, 'object, object': function (query, options) { return this.$main.call(this, query, options, true); }, '*, *, boolean': function (query, options, refresh) { return this.$main.call(this, query, options, refresh); }, '$main': function (query, options, refresh) { if (query !== undefined) { this._querySettings.query = query; if (query.$findSub && !query.$findSub.$from) { query.$findSub.$from = this._data.name(); } if (query.$findSubOne && !query.$findSubOne.$from) { query.$findSubOne.$from = this._data.name(); } } if (options !== undefined) { this._querySettings.options = options; } if (query !== undefined || options !== undefined) { if (refresh === undefined || refresh === true) { this.refresh(); } } if (query !== undefined) { this.emit('queryChange', query); } if (options !== undefined) { this.emit('queryOptionsChange', options); } if (query !== undefined || options !== undefined) { return this; } return this.decouple(this._querySettings); } }); /** * Gets / sets the orderBy clause in the query options for the view. * @param {Object=} val The order object. * @returns {*} */ View.prototype.orderBy = function (val) { if (val !== undefined) { var queryOptions = this.queryOptions() || {}; queryOptions.$orderBy = val; this.queryOptions(queryOptions); return this; } return (this.queryOptions() || {}).$orderBy; }; /** * Gets / sets the page clause in the query options for the view. * @param {Number=} val The page number to change to (zero index). * @returns {*} */ View.prototype.page = function (val) { if (val !== undefined) { var queryOptions = this.queryOptions() || {}; // Only execute a query options update if page has changed if (val !== queryOptions.$page) { queryOptions.$page = val; this.queryOptions(queryOptions); } return this; } return (this.queryOptions() || {}).$page; }; /** * Jump to the first page in the data set. * @returns {*} */ View.prototype.pageFirst = function () { return this.page(0); }; /** * Jump to the last page in the data set. * @returns {*} */ View.prototype.pageLast = function () { var pages = this.cursor().pages, lastPage = pages !== undefined ? pages : 0; return this.page(lastPage - 1); }; /** * Move forward or backwards in the data set pages by passing a positive * or negative integer of the number of pages to move. * @param {Number} val The number of pages to move. * @returns {*} */ View.prototype.pageScan = function (val) { if (val !== undefined) { var pages = this.cursor().pages, queryOptions = this.queryOptions() || {}, currentPage = queryOptions.$page !== undefined ? queryOptions.$page : 0; currentPage += val; if (currentPage < 0) { currentPage = 0; } if (currentPage >= pages) { currentPage = pages - 1; } return this.page(currentPage); } }; /** * Gets / sets the query options used when applying sorting etc to the * view data set. * @param {Object=} options An options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ View.prototype.queryOptions = function (options, refresh) { if (options !== undefined) { this._querySettings.options = options; if (options.$decouple === undefined) { options.$decouple = true; } if (refresh === undefined || refresh === true) { this.refresh(); } else { // TODO: This could be wasteful if the previous options $orderBy was identical, do a hash and check first! this.rebuildActiveBucket(options.$orderBy); } if (options !== undefined) { this.emit('queryOptionsChange', options); } return this; } return this._querySettings.options; }; /** * Clears the existing active bucket and builds a new one based * on the passed orderBy object (if one is passed). * @param {Object=} orderBy The orderBy object describing how to * order any data. */ View.prototype.rebuildActiveBucket = function (orderBy) { if (orderBy) { var arr = this._data._data, arrCount = arr.length; // Build a new active bucket this._activeBucket = new ActiveBucket(orderBy); this._activeBucket.primaryKey(this._data.primaryKey()); // Loop the current view data and add each item for (var i = 0; i < arrCount; i++) { this._activeBucket.insert(arr[i]); } } else { // Remove any existing active bucket delete this._activeBucket; } }; /** * Refreshes the view data such as ordering etc. */ View.prototype.refresh = function () { var self = this, refreshResults, joinArr, i, k; if (this._from) { // Clear the private data collection which will propagate to the public data // collection automatically via the chain reactor node between them this._data.remove(); // Grab all the data from the underlying data source refreshResults = this._from.find(this._querySettings.query, this._querySettings.options); this.cursor(refreshResults.$cursor); // Insert the underlying data into the private data collection this._data.insert(refreshResults); // Store the current cursor data this._data._data.$cursor = refreshResults.$cursor; } if (this._querySettings && this._querySettings.options && this._querySettings.options.$join && this._querySettings.options.$join.length) { // Define the change handler method self.__joinChange = self.__joinChange || function () { self._joinChange(); }; // Check for existing join collections if (this._joinCollections && this._joinCollections.length) { // Loop the join collections and remove change listeners // Loop the collections and hook change events for (i = 0; i < this._joinCollections.length; i++) { this._db.collection(this._joinCollections[i]).off('immediateChange', self.__joinChange); } } // Now start hooking any new / existing joins joinArr = this._querySettings.options.$join; this._joinCollections = []; // Loop the joined collections and hook change events for (i = 0; i < joinArr.length; i++) { for (k in joinArr[i]) { if (joinArr[i].hasOwnProperty(k)) { this._joinCollections.push(k); } } } if (this._joinCollections.length) { // Loop the collections and hook change events for (i = 0; i < this._joinCollections.length; i++) { this._db.collection(this._joinCollections[i]).on('immediateChange', self.__joinChange); } } } if (this._querySettings.options && this._querySettings.options.$orderBy) { this.rebuildActiveBucket(this._querySettings.options.$orderBy); } else { this.rebuildActiveBucket(); } return this; }; /** * Handles when a change has occurred on a collection that is joined * by query to this view. * @param objName * @param objType * @private */ View.prototype._joinChange = function (objName, objType) { this.emit('joinChange'); // TODO: This is a really dirty solution because it will require a complete // TODO: rebuild of the view data. We need to implement an IO handler to // TODO: selectively update the data of the view based on the joined // TODO: collection data operation. // FIXME: This isnt working, major performance killer, invest in some IO from chain reactor to make this a targeted call this.refresh(); }; /** * Returns the number of documents currently in the view. * @returns {Number} */ View.prototype.count = function () { return this._data.count.apply(this._data, arguments); }; // Call underlying View.prototype.subset = function () { return this._data.subset.apply(this._data, arguments); }; /** * Takes the passed data and uses it to set transform methods and globally * enable or disable the transform system for the view. * @param {Object} obj The new transform system settings "enabled", "dataIn" * and "dataOut": * { * "enabled": true, * "dataIn": function (data) { return data; }, * "dataOut": function (data) { return data; } * } * @returns {*} */ View.prototype.transform = function (obj) { var currentSettings, newSettings; currentSettings = this._data.transform(); this._data.transform(obj); newSettings = this._data.transform(); // Check if transforms are enabled, a dataIn method is set and these // settings did not match the previous transform settings if (newSettings.enabled && newSettings.dataIn && (currentSettings.enabled !== newSettings.enabled || currentSettings.dataIn !== newSettings.dataIn)) { // The data in the view is now stale, refresh it this.refresh(); } return newSettings; }; /** * Executes a method against each document that matches query and returns an * array of documents that may have been modified by the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the results. * @param {Object=} options Optional options object. * @returns {Array} */ View.prototype.filter = function (query, func, options) { return this._data.filter(query, func, options); }; /** * Returns the non-transformed data the view holds as a collection * reference. * @return {Collection} The non-transformed collection reference. */ View.prototype.data = function () { return this._data; }; /** * @see Collection.indexOf * @returns {*} */ View.prototype.indexOf = function () { return this._data.indexOf.apply(this._data, arguments); }; /** * Gets / sets the db instance this class instance belongs to. * @param {Db=} db The db instance. * @memberof View * @returns {*} */ Shared.synthesize(View.prototype, 'db', function (db) { if (db) { this._data.db(db); // Apply the same debug settings this.debug(db.debug()); this._data.debug(db.debug()); } return this.$super.apply(this, arguments); }); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(View.prototype, 'state'); /** * Gets / sets the current name. * @param {String=} val The new name to set. * @returns {*} */ Shared.synthesize(View.prototype, 'name'); /** * Gets / sets the current cursor. * @param {String=} val The new cursor to set. * @returns {*} */ Shared.synthesize(View.prototype, 'cursor', function (val) { if (val === undefined) { return this._cursor || {}; } this.$super.apply(this, arguments); }); // Extend collection with view init Collection.prototype.init = function () { this._view = []; CollectionInit.apply(this, arguments); }; /** * Creates a view and assigns the collection as its data source. * @param {String} name The name of the new view. * @param {Object} query The query to apply to the new view. * @param {Object} options The options object to apply to the view. * @returns {*} */ Collection.prototype.view = function (name, query, options) { if (this._db && this._db._view ) { if (!this._db._view[name]) { var view = new View(name, query, options) .db(this._db) .from(this); this._view = this._view || []; this._view.push(view); return view; } else { throw(this.logIdentifier() + ' Cannot create a view using this collection because a view with this name already exists: ' + name); } } }; /** * Adds a view to the internal view lookup. * @param {View} view The view to add. * @returns {Collection} * @private */ Collection.prototype._addView = CollectionGroup.prototype._addView = function (view) { if (view !== undefined) { this._view.push(view); } return this; }; /** * Removes a view from the internal view lookup. * @param {View} view The view to remove. * @returns {Collection} * @private */ Collection.prototype._removeView = CollectionGroup.prototype._removeView = function (view) { if (view !== undefined) { var index = this._view.indexOf(view); if (index > -1) { this._view.splice(index, 1); } } return this; }; // Extend DB with views init Db.prototype.init = function () { this._view = {}; DbInit.apply(this, arguments); }; /** * Gets a view by it's name. * @param {String} name The name of the view to retrieve. * @returns {*} */ Db.prototype.view = function (name) { var self = this; // Handle being passed an instance if (name instanceof View) { return name; } if (this._view[name]) { return this._view[name]; } if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating view ' + name); } this._view[name] = new View(name).db(this); self.emit('create', self._view[name], 'view', name); return this._view[name]; }; /** * Determine if a view with the passed name already exists. * @param {String} name The name of the view to check for. * @returns {boolean} */ Db.prototype.viewExists = function (name) { return Boolean(this._view[name]); }; /** * Returns an array of views the DB currently has. * @returns {Array} An array of objects containing details of each view * the database is currently managing. */ Db.prototype.views = function () { var arr = [], view, i; for (i in this._view) { if (this._view.hasOwnProperty(i)) { view = this._view[i]; arr.push({ name: i, count: view.count(), linked: view.isLinked !== undefined ? view.isLinked() : false }); } } return arr; }; Shared.finishModule('View'); module.exports = View; },{"./ActiveBucket":3,"./Collection":7,"./CollectionGroup":8,"./Overload":33,"./ReactorIO":39,"./Shared":41}],44:[function(_dereq_,module,exports){ (function (process){ // Use the fastest possible means to execute a task in a future turn // of the event loop. // linked list of tasks (single, with head node) var head = {task: void 0, next: null}; var tail = head; var flushing = false; var requestFlush = void 0; var isNodeJS = false; function flush() { /* jshint loopfunc: true */ while (head.next) { head = head.next; var task = head.task; head.task = void 0; var domain = head.domain; if (domain) { head.domain = void 0; domain.enter(); } try { task(); } catch (e) { if (isNodeJS) { // In node, uncaught exceptions are considered fatal errors. // Re-throw them synchronously to interrupt flushing! // Ensure continuation if the uncaught exception is suppressed // listening "uncaughtException" events (as domains does). // Continue in next event to avoid tick recursion. if (domain) { domain.exit(); } setTimeout(flush, 0); if (domain) { domain.enter(); } throw e; } else { // In browsers, uncaught exceptions are not fatal. // Re-throw them asynchronously to avoid slow-downs. setTimeout(function() { throw e; }, 0); } } if (domain) { domain.exit(); } } flushing = false; } if (typeof process !== "undefined" && process.nextTick) { // Node.js before 0.9. Note that some fake-Node environments, like the // Mocha test runner, introduce a `process` global without a `nextTick`. isNodeJS = true; requestFlush = function () { process.nextTick(flush); }; } else if (typeof setImmediate === "function") { // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate if (typeof window !== "undefined") { requestFlush = setImmediate.bind(window, flush); } else { requestFlush = function () { setImmediate(flush); }; } } else if (typeof MessageChannel !== "undefined") { // modern browsers // http://www.nonblocking.io/2011/06/windownexttick.html var channel = new MessageChannel(); channel.port1.onmessage = flush; requestFlush = function () { channel.port2.postMessage(0); }; } else { // old browsers requestFlush = function () { setTimeout(flush, 0); }; } function asap(task) { tail = tail.next = { task: task, domain: isNodeJS && process.domain, next: null }; if (!flushing) { flushing = true; requestFlush(); } }; module.exports = asap; }).call(this,_dereq_('_process')) },{"_process":101}],45:[function(_dereq_,module,exports){ (function (process,global){ /*! * async * https://github.com/caolan/async * * Copyright 2010-2014 Caolan McMahon * Released under the MIT license */ (function () { var async = {}; function noop() {} function identity(v) { return v; } function toBool(v) { return !!v; } function notId(v) { return !v; } // global on the server, window in the browser var previous_async; // Establish the root object, `window` (`self`) in the browser, `global` // on the server, or `this` in some virtual machines. We use `self` // instead of `window` for `WebWorker` support. var root = typeof self === 'object' && self.self === self && self || typeof global === 'object' && global.global === global && global || this; if (root != null) { previous_async = root.async; } async.noConflict = function () { root.async = previous_async; return async; }; function only_once(fn) { return function() { if (fn === null) throw new Error("Callback was already called."); fn.apply(this, arguments); fn = null; }; } function _once(fn) { return function() { if (fn === null) return; fn.apply(this, arguments); fn = null; }; } //// cross-browser compatiblity functions //// var _toString = Object.prototype.toString; var _isArray = Array.isArray || function (obj) { return _toString.call(obj) === '[object Array]'; }; // Ported from underscore.js isObject var _isObject = function(obj) { var type = typeof obj; return type === 'function' || type === 'object' && !!obj; }; function _isArrayLike(arr) { return _isArray(arr) || ( // has a positive integer length property typeof arr.length === "number" && arr.length >= 0 && arr.length % 1 === 0 ); } function _arrayEach(arr, iterator) { var index = -1, length = arr.length; while (++index < length) { iterator(arr[index], index, arr); } } function _map(arr, iterator) { var index = -1, length = arr.length, result = Array(length); while (++index < length) { result[index] = iterator(arr[index], index, arr); } return result; } function _range(count) { return _map(Array(count), function (v, i) { return i; }); } function _reduce(arr, iterator, memo) { _arrayEach(arr, function (x, i, a) { memo = iterator(memo, x, i, a); }); return memo; } function _forEachOf(object, iterator) { _arrayEach(_keys(object), function (key) { iterator(object[key], key); }); } function _indexOf(arr, item) { for (var i = 0; i < arr.length; i++) { if (arr[i] === item) return i; } return -1; } var _keys = Object.keys || function (obj) { var keys = []; for (var k in obj) { if (obj.hasOwnProperty(k)) { keys.push(k); } } return keys; }; function _keyIterator(coll) { var i = -1; var len; var keys; if (_isArrayLike(coll)) { len = coll.length; return function next() { i++; return i < len ? i : null; }; } else { keys = _keys(coll); len = keys.length; return function next() { i++; return i < len ? keys[i] : null; }; } } // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) // This accumulates the arguments passed into an array, after a given index. // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). function _restParam(func, startIndex) { startIndex = startIndex == null ? func.length - 1 : +startIndex; return function() { var length = Math.max(arguments.length - startIndex, 0); var rest = Array(length); for (var index = 0; index < length; index++) { rest[index] = arguments[index + startIndex]; } switch (startIndex) { case 0: return func.call(this, rest); case 1: return func.call(this, arguments[0], rest); } // Currently unused but handle cases outside of the switch statement: // var args = Array(startIndex + 1); // for (index = 0; index < startIndex; index++) { // args[index] = arguments[index]; // } // args[startIndex] = rest; // return func.apply(this, args); }; } function _withoutIndex(iterator) { return function (value, index, callback) { return iterator(value, callback); }; } //// exported async module functions //// //// nextTick implementation with browser-compatible fallback //// // capture the global reference to guard against fakeTimer mocks var _setImmediate = typeof setImmediate === 'function' && setImmediate; var _delay = _setImmediate ? function(fn) { // not a direct alias for IE10 compatibility _setImmediate(fn); } : function(fn) { setTimeout(fn, 0); }; if (typeof process === 'object' && typeof process.nextTick === 'function') { async.nextTick = process.nextTick; } else { async.nextTick = _delay; } async.setImmediate = _setImmediate ? _delay : async.nextTick; async.forEach = async.each = function (arr, iterator, callback) { return async.eachOf(arr, _withoutIndex(iterator), callback); }; async.forEachSeries = async.eachSeries = function (arr, iterator, callback) { return async.eachOfSeries(arr, _withoutIndex(iterator), callback); }; async.forEachLimit = async.eachLimit = function (arr, limit, iterator, callback) { return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); }; async.forEachOf = async.eachOf = function (object, iterator, callback) { callback = _once(callback || noop); object = object || []; var iter = _keyIterator(object); var key, completed = 0; while ((key = iter()) != null) { completed += 1; iterator(object[key], key, only_once(done)); } if (completed === 0) callback(null); function done(err) { completed--; if (err) { callback(err); } // Check key is null in case iterator isn't exhausted // and done resolved synchronously. else if (key === null && completed <= 0) { callback(null); } } }; async.forEachOfSeries = async.eachOfSeries = function (obj, iterator, callback) { callback = _once(callback || noop); obj = obj || []; var nextKey = _keyIterator(obj); var key = nextKey(); function iterate() { var sync = true; if (key === null) { return callback(null); } iterator(obj[key], key, only_once(function (err) { if (err) { callback(err); } else { key = nextKey(); if (key === null) { return callback(null); } else { if (sync) { async.setImmediate(iterate); } else { iterate(); } } } })); sync = false; } iterate(); }; async.forEachOfLimit = async.eachOfLimit = function (obj, limit, iterator, callback) { _eachOfLimit(limit)(obj, iterator, callback); }; function _eachOfLimit(limit) { return function (obj, iterator, callback) { callback = _once(callback || noop); obj = obj || []; var nextKey = _keyIterator(obj); if (limit <= 0) { return callback(null); } var done = false; var running = 0; var errored = false; (function replenish () { if (done && running <= 0) { return callback(null); } while (running < limit && !errored) { var key = nextKey(); if (key === null) { done = true; if (running <= 0) { callback(null); } return; } running += 1; iterator(obj[key], key, only_once(function (err) { running -= 1; if (err) { callback(err); errored = true; } else { replenish(); } })); } })(); }; } function doParallel(fn) { return function (obj, iterator, callback) { return fn(async.eachOf, obj, iterator, callback); }; } function doParallelLimit(fn) { return function (obj, limit, iterator, callback) { return fn(_eachOfLimit(limit), obj, iterator, callback); }; } function doSeries(fn) { return function (obj, iterator, callback) { return fn(async.eachOfSeries, obj, iterator, callback); }; } function _asyncMap(eachfn, arr, iterator, callback) { callback = _once(callback || noop); arr = arr || []; var results = _isArrayLike(arr) ? [] : {}; eachfn(arr, function (value, index, callback) { iterator(value, function (err, v) { results[index] = v; callback(err); }); }, function (err) { callback(err, results); }); } async.map = doParallel(_asyncMap); async.mapSeries = doSeries(_asyncMap); async.mapLimit = doParallelLimit(_asyncMap); // reduce only has a series version, as doing reduce in parallel won't // work in many situations. async.inject = async.foldl = async.reduce = function (arr, memo, iterator, callback) { async.eachOfSeries(arr, function (x, i, callback) { iterator(memo, x, function (err, v) { memo = v; callback(err); }); }, function (err) { callback(err, memo); }); }; async.foldr = async.reduceRight = function (arr, memo, iterator, callback) { var reversed = _map(arr, identity).reverse(); async.reduce(reversed, memo, iterator, callback); }; async.transform = function (arr, memo, iterator, callback) { if (arguments.length === 3) { callback = iterator; iterator = memo; memo = _isArray(arr) ? [] : {}; } async.eachOf(arr, function(v, k, cb) { iterator(memo, v, k, cb); }, function(err) { callback(err, memo); }); }; function _filter(eachfn, arr, iterator, callback) { var results = []; eachfn(arr, function (x, index, callback) { iterator(x, function (v) { if (v) { results.push({index: index, value: x}); } callback(); }); }, function () { callback(_map(results.sort(function (a, b) { return a.index - b.index; }), function (x) { return x.value; })); }); } async.select = async.filter = doParallel(_filter); async.selectLimit = async.filterLimit = doParallelLimit(_filter); async.selectSeries = async.filterSeries = doSeries(_filter); function _reject(eachfn, arr, iterator, callback) { _filter(eachfn, arr, function(value, cb) { iterator(value, function(v) { cb(!v); }); }, callback); } async.reject = doParallel(_reject); async.rejectLimit = doParallelLimit(_reject); async.rejectSeries = doSeries(_reject); function _createTester(eachfn, check, getResult) { return function(arr, limit, iterator, cb) { function done() { if (cb) cb(getResult(false, void 0)); } function iteratee(x, _, callback) { if (!cb) return callback(); iterator(x, function (v) { if (cb && check(v)) { cb(getResult(true, x)); cb = iterator = false; } callback(); }); } if (arguments.length > 3) { eachfn(arr, limit, iteratee, done); } else { cb = iterator; iterator = limit; eachfn(arr, iteratee, done); } }; } async.any = async.some = _createTester(async.eachOf, toBool, identity); async.someLimit = _createTester(async.eachOfLimit, toBool, identity); async.all = async.every = _createTester(async.eachOf, notId, notId); async.everyLimit = _createTester(async.eachOfLimit, notId, notId); function _findGetResult(v, x) { return x; } async.detect = _createTester(async.eachOf, identity, _findGetResult); async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); async.sortBy = function (arr, iterator, callback) { async.map(arr, function (x, callback) { iterator(x, function (err, criteria) { if (err) { callback(err); } else { callback(null, {value: x, criteria: criteria}); } }); }, function (err, results) { if (err) { return callback(err); } else { callback(null, _map(results.sort(comparator), function (x) { return x.value; })); } }); function comparator(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; } }; async.auto = function (tasks, concurrency, callback) { if (typeof arguments[1] === 'function') { // concurrency is optional, shift the args. callback = concurrency; concurrency = null; } callback = _once(callback || noop); var keys = _keys(tasks); var remainingTasks = keys.length; if (!remainingTasks) { return callback(null); } if (!concurrency) { concurrency = remainingTasks; } var results = {}; var runningTasks = 0; var hasError = false; var listeners = []; function addListener(fn) { listeners.unshift(fn); } function removeListener(fn) { var idx = _indexOf(listeners, fn); if (idx >= 0) listeners.splice(idx, 1); } function taskComplete() { remainingTasks--; _arrayEach(listeners.slice(0), function (fn) { fn(); }); } addListener(function () { if (!remainingTasks) { callback(null, results); } }); _arrayEach(keys, function (k) { if (hasError) return; var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; var taskCallback = _restParam(function(err, args) { runningTasks--; if (args.length <= 1) { args = args[0]; } if (err) { var safeResults = {}; _forEachOf(results, function(val, rkey) { safeResults[rkey] = val; }); safeResults[k] = args; hasError = true; callback(err, safeResults); } else { results[k] = args; async.setImmediate(taskComplete); } }); var requires = task.slice(0, task.length - 1); // prevent dead-locks var len = requires.length; var dep; while (len--) { if (!(dep = tasks[requires[len]])) { throw new Error('Has nonexistent dependency in ' + requires.join(', ')); } if (_isArray(dep) && _indexOf(dep, k) >= 0) { throw new Error('Has cyclic dependencies'); } } function ready() { return runningTasks < concurrency && _reduce(requires, function (a, x) { return (a && results.hasOwnProperty(x)); }, true) && !results.hasOwnProperty(k); } if (ready()) { runningTasks++; task[task.length - 1](taskCallback, results); } else { addListener(listener); } function listener() { if (ready()) { runningTasks++; removeListener(listener); task[task.length - 1](taskCallback, results); } } }); }; async.retry = function(times, task, callback) { var DEFAULT_TIMES = 5; var DEFAULT_INTERVAL = 0; var attempts = []; var opts = { times: DEFAULT_TIMES, interval: DEFAULT_INTERVAL }; function parseTimes(acc, t){ if(typeof t === 'number'){ acc.times = parseInt(t, 10) || DEFAULT_TIMES; } else if(typeof t === 'object'){ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; } else { throw new Error('Unsupported argument type for \'times\': ' + typeof t); } } var length = arguments.length; if (length < 1 || length > 3) { throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)'); } else if (length <= 2 && typeof times === 'function') { callback = task; task = times; } if (typeof times !== 'function') { parseTimes(opts, times); } opts.callback = callback; opts.task = task; function wrappedTask(wrappedCallback, wrappedResults) { function retryAttempt(task, finalAttempt) { return function(seriesCallback) { task(function(err, result){ seriesCallback(!err || finalAttempt, {err: err, result: result}); }, wrappedResults); }; } function retryInterval(interval){ return function(seriesCallback){ setTimeout(function(){ seriesCallback(null); }, interval); }; } while (opts.times) { var finalAttempt = !(opts.times-=1); attempts.push(retryAttempt(opts.task, finalAttempt)); if(!finalAttempt && opts.interval > 0){ attempts.push(retryInterval(opts.interval)); } } async.series(attempts, function(done, data){ data = data[data.length - 1]; (wrappedCallback || opts.callback)(data.err, data.result); }); } // If a callback is passed, run this as a controll flow return opts.callback ? wrappedTask() : wrappedTask; }; async.waterfall = function (tasks, callback) { callback = _once(callback || noop); if (!_isArray(tasks)) { var err = new Error('First argument to waterfall must be an array of functions'); return callback(err); } if (!tasks.length) { return callback(); } function wrapIterator(iterator) { return _restParam(function (err, args) { if (err) { callback.apply(null, [err].concat(args)); } else { var next = iterator.next(); if (next) { args.push(wrapIterator(next)); } else { args.push(callback); } ensureAsync(iterator).apply(null, args); } }); } wrapIterator(async.iterator(tasks))(); }; function _parallel(eachfn, tasks, callback) { callback = callback || noop; var results = _isArrayLike(tasks) ? [] : {}; eachfn(tasks, function (task, key, callback) { task(_restParam(function (err, args) { if (args.length <= 1) { args = args[0]; } results[key] = args; callback(err); })); }, function (err) { callback(err, results); }); } async.parallel = function (tasks, callback) { _parallel(async.eachOf, tasks, callback); }; async.parallelLimit = function(tasks, limit, callback) { _parallel(_eachOfLimit(limit), tasks, callback); }; async.series = function(tasks, callback) { _parallel(async.eachOfSeries, tasks, callback); }; async.iterator = function (tasks) { function makeCallback(index) { function fn() { if (tasks.length) { tasks[index].apply(null, arguments); } return fn.next(); } fn.next = function () { return (index < tasks.length - 1) ? makeCallback(index + 1): null; }; return fn; } return makeCallback(0); }; async.apply = _restParam(function (fn, args) { return _restParam(function (callArgs) { return fn.apply( null, args.concat(callArgs) ); }); }); function _concat(eachfn, arr, fn, callback) { var result = []; eachfn(arr, function (x, index, cb) { fn(x, function (err, y) { result = result.concat(y || []); cb(err); }); }, function (err) { callback(err, result); }); } async.concat = doParallel(_concat); async.concatSeries = doSeries(_concat); async.whilst = function (test, iterator, callback) { callback = callback || noop; if (test()) { var next = _restParam(function(err, args) { if (err) { callback(err); } else if (test.apply(this, args)) { iterator(next); } else { callback.apply(null, [null].concat(args)); } }); iterator(next); } else { callback(null); } }; async.doWhilst = function (iterator, test, callback) { var calls = 0; return async.whilst(function() { return ++calls <= 1 || test.apply(this, arguments); }, iterator, callback); }; async.until = function (test, iterator, callback) { return async.whilst(function() { return !test.apply(this, arguments); }, iterator, callback); }; async.doUntil = function (iterator, test, callback) { return async.doWhilst(iterator, function() { return !test.apply(this, arguments); }, callback); }; async.during = function (test, iterator, callback) { callback = callback || noop; var next = _restParam(function(err, args) { if (err) { callback(err); } else { args.push(check); test.apply(this, args); } }); var check = function(err, truth) { if (err) { callback(err); } else if (truth) { iterator(next); } else { callback(null); } }; test(check); }; async.doDuring = function (iterator, test, callback) { var calls = 0; async.during(function(next) { if (calls++ < 1) { next(null, true); } else { test.apply(this, arguments); } }, iterator, callback); }; function _queue(worker, concurrency, payload) { if (concurrency == null) { concurrency = 1; } else if(concurrency === 0) { throw new Error('Concurrency must not be zero'); } function _insert(q, data, pos, callback) { if (callback != null && typeof callback !== "function") { throw new Error("task callback must be a function"); } q.started = true; if (!_isArray(data)) { data = [data]; } if(data.length === 0 && q.idle()) { // call drain immediately if there are no tasks return async.setImmediate(function() { q.drain(); }); } _arrayEach(data, function(task) { var item = { data: task, callback: callback || noop }; if (pos) { q.tasks.unshift(item); } else { q.tasks.push(item); } if (q.tasks.length === q.concurrency) { q.saturated(); } }); async.setImmediate(q.process); } function _next(q, tasks) { return function(){ workers -= 1; var removed = false; var args = arguments; _arrayEach(tasks, function (task) { _arrayEach(workersList, function (worker, index) { if (worker === task && !removed) { workersList.splice(index, 1); removed = true; } }); task.callback.apply(task, args); }); if (q.tasks.length + workers === 0) { q.drain(); } q.process(); }; } var workers = 0; var workersList = []; var q = { tasks: [], concurrency: concurrency, payload: payload, saturated: noop, empty: noop, drain: noop, started: false, paused: false, push: function (data, callback) { _insert(q, data, false, callback); }, kill: function () { q.drain = noop; q.tasks = []; }, unshift: function (data, callback) { _insert(q, data, true, callback); }, process: function () { while(!q.paused && workers < q.concurrency && q.tasks.length){ var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length); var data = _map(tasks, function (task) { return task.data; }); if (q.tasks.length === 0) { q.empty(); } workers += 1; workersList.push(tasks[0]); var cb = only_once(_next(q, tasks)); worker(data, cb); } }, length: function () { return q.tasks.length; }, running: function () { return workers; }, workersList: function () { return workersList; }, idle: function() { return q.tasks.length + workers === 0; }, pause: function () { q.paused = true; }, resume: function () { if (q.paused === false) { return; } q.paused = false; var resumeCount = Math.min(q.concurrency, q.tasks.length); // Need to call q.process once per concurrent // worker to preserve full concurrency after pause for (var w = 1; w <= resumeCount; w++) { async.setImmediate(q.process); } } }; return q; } async.queue = function (worker, concurrency) { var q = _queue(function (items, cb) { worker(items[0], cb); }, concurrency, 1); return q; }; async.priorityQueue = function (worker, concurrency) { function _compareTasks(a, b){ return a.priority - b.priority; } function _binarySearch(sequence, item, compare) { var beg = -1, end = sequence.length - 1; while (beg < end) { var mid = beg + ((end - beg + 1) >>> 1); if (compare(item, sequence[mid]) >= 0) { beg = mid; } else { end = mid - 1; } } return beg; } function _insert(q, data, priority, callback) { if (callback != null && typeof callback !== "function") { throw new Error("task callback must be a function"); } q.started = true; if (!_isArray(data)) { data = [data]; } if(data.length === 0) { // call drain immediately if there are no tasks return async.setImmediate(function() { q.drain(); }); } _arrayEach(data, function(task) { var item = { data: task, priority: priority, callback: typeof callback === 'function' ? callback : noop }; q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); if (q.tasks.length === q.concurrency) { q.saturated(); } async.setImmediate(q.process); }); } // Start with a normal queue var q = async.queue(worker, concurrency); // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback); }; // Remove unshift function delete q.unshift; return q; }; async.cargo = function (worker, payload) { return _queue(worker, 1, payload); }; function _console_fn(name) { return _restParam(function (fn, args) { fn.apply(null, args.concat([_restParam(function (err, args) { if (typeof console === 'object') { if (err) { if (console.error) { console.error(err); } } else if (console[name]) { _arrayEach(args, function (x) { console[name](x); }); } } })])); }); } async.log = _console_fn('log'); async.dir = _console_fn('dir'); /*async.info = _console_fn('info'); async.warn = _console_fn('warn'); async.error = _console_fn('error');*/ async.memoize = function (fn, hasher) { var memo = {}; var queues = {}; var has = Object.prototype.hasOwnProperty; hasher = hasher || identity; var memoized = _restParam(function memoized(args) { var callback = args.pop(); var key = hasher.apply(null, args); if (has.call(memo, key)) { async.setImmediate(function () { callback.apply(null, memo[key]); }); } else if (has.call(queues, key)) { queues[key].push(callback); } else { queues[key] = [callback]; fn.apply(null, args.concat([_restParam(function (args) { memo[key] = args; var q = queues[key]; delete queues[key]; for (var i = 0, l = q.length; i < l; i++) { q[i].apply(null, args); } })])); } }); memoized.memo = memo; memoized.unmemoized = fn; return memoized; }; async.unmemoize = function (fn) { return function () { return (fn.unmemoized || fn).apply(null, arguments); }; }; function _times(mapper) { return function (count, iterator, callback) { mapper(_range(count), iterator, callback); }; } async.times = _times(async.map); async.timesSeries = _times(async.mapSeries); async.timesLimit = function (count, limit, iterator, callback) { return async.mapLimit(_range(count), limit, iterator, callback); }; async.seq = function (/* functions... */) { var fns = arguments; return _restParam(function (args) { var that = this; var callback = args[args.length - 1]; if (typeof callback == 'function') { args.pop(); } else { callback = noop; } async.reduce(fns, args, function (newargs, fn, cb) { fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { cb(err, nextargs); })])); }, function (err, results) { callback.apply(that, [err].concat(results)); }); }); }; async.compose = function (/* functions... */) { return async.seq.apply(null, Array.prototype.reverse.call(arguments)); }; function _applyEach(eachfn) { return _restParam(function(fns, args) { var go = _restParam(function(args) { var that = this; var callback = args.pop(); return eachfn(fns, function (fn, _, cb) { fn.apply(that, args.concat([cb])); }, callback); }); if (args.length) { return go.apply(this, args); } else { return go; } }); } async.applyEach = _applyEach(async.eachOf); async.applyEachSeries = _applyEach(async.eachOfSeries); async.forever = function (fn, callback) { var done = only_once(callback || noop); var task = ensureAsync(fn); function next(err) { if (err) { return done(err); } task(next); } next(); }; function ensureAsync(fn) { return _restParam(function (args) { var callback = args.pop(); args.push(function () { var innerArgs = arguments; if (sync) { async.setImmediate(function () { callback.apply(null, innerArgs); }); } else { callback.apply(null, innerArgs); } }); var sync = true; fn.apply(this, args); sync = false; }); } async.ensureAsync = ensureAsync; async.constant = _restParam(function(values) { var args = [null].concat(values); return function (callback) { return callback.apply(this, args); }; }); async.wrapSync = async.asyncify = function asyncify(func) { return _restParam(function (args) { var callback = args.pop(); var result; try { result = func.apply(this, args); } catch (e) { return callback(e); } // if result is Promise object if (_isObject(result) && typeof result.then === "function") { result.then(function(value) { callback(null, value); })["catch"](function(err) { callback(err.message ? err : new Error(err)); }); } else { callback(null, result); } }); }; // Node.js if (typeof module === 'object' && module.exports) { module.exports = async; } // AMD / RequireJS else if (typeof define === 'function' && define.amd) { define([], function () { return async; }); } // included directly via <script> tag else { root.async = async; } }()); }).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":101}],46:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Lookup tables var SBOX = []; var INV_SBOX = []; var SUB_MIX_0 = []; var SUB_MIX_1 = []; var SUB_MIX_2 = []; var SUB_MIX_3 = []; var INV_SUB_MIX_0 = []; var INV_SUB_MIX_1 = []; var INV_SUB_MIX_2 = []; var INV_SUB_MIX_3 = []; // Compute lookup tables (function () { // Compute double table var d = []; for (var i = 0; i < 256; i++) { if (i < 128) { d[i] = i << 1; } else { d[i] = (i << 1) ^ 0x11b; } } // Walk GF(2^8) var x = 0; var xi = 0; for (var i = 0; i < 256; i++) { // Compute sbox var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; SBOX[x] = sx; INV_SBOX[sx] = x; // Compute multiplication var x2 = d[x]; var x4 = d[x2]; var x8 = d[x4]; // Compute sub bytes, mix columns tables var t = (d[sx] * 0x101) ^ (sx * 0x1010100); SUB_MIX_0[x] = (t << 24) | (t >>> 8); SUB_MIX_1[x] = (t << 16) | (t >>> 16); SUB_MIX_2[x] = (t << 8) | (t >>> 24); SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); INV_SUB_MIX_3[sx] = t; // Compute next counter if (!x) { x = xi = 1; } else { x = x2 ^ d[d[d[x8 ^ x2]]]; xi ^= d[d[xi]]; } } }()); // Precomputed Rcon lookup var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; /** * AES block cipher algorithm. */ var AES = C_algo.AES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; var keySize = key.sigBytes / 4; // Compute number of rounds var nRounds = this._nRounds = keySize + 6 // Compute number of key schedule rows var ksRows = (nRounds + 1) * 4; // Compute key schedule var keySchedule = this._keySchedule = []; for (var ksRow = 0; ksRow < ksRows; ksRow++) { if (ksRow < keySize) { keySchedule[ksRow] = keyWords[ksRow]; } else { var t = keySchedule[ksRow - 1]; if (!(ksRow % keySize)) { // Rot word t = (t << 8) | (t >>> 24); // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; // Mix Rcon t ^= RCON[(ksRow / keySize) | 0] << 24; } else if (keySize > 6 && ksRow % keySize == 4) { // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; } keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; } } // Compute inv key schedule var invKeySchedule = this._invKeySchedule = []; for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { var ksRow = ksRows - invKsRow; if (invKsRow % 4) { var t = keySchedule[ksRow]; } else { var t = keySchedule[ksRow - 4]; } if (invKsRow < 4 || ksRow <= 4) { invKeySchedule[invKsRow] = t; } else { invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; } } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); }, decryptBlock: function (M, offset) { // Swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; }, _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { // Shortcut var nRounds = this._nRounds; // Get input, add round key var s0 = M[offset] ^ keySchedule[0]; var s1 = M[offset + 1] ^ keySchedule[1]; var s2 = M[offset + 2] ^ keySchedule[2]; var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter var ksRow = 4; // Rounds for (var round = 1; round < nRounds; round++) { // Shift rows, sub bytes, mix columns, add round key var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state s0 = t0; s1 = t1; s2 = t2; s3 = t3; } // Shift rows, sub bytes, add round key var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output M[offset] = t0; M[offset + 1] = t1; M[offset + 2] = t2; M[offset + 3] = t3; }, keySize: 256/32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); */ C.AES = BlockCipher._createHelper(AES); }()); return CryptoJS.AES; })); },{"./cipher-core":47,"./core":48,"./enc-base64":49,"./evpkdf":51,"./md5":56}],47:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Cipher core components. */ CryptoJS.lib.Cipher || (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var Base64 = C_enc.Base64; var C_algo = C.algo; var EvpKDF = C_algo.EvpKDF; /** * Abstract base cipher template. * * @property {number} keySize This cipher's key size. Default: 4 (128 bits) * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. */ var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ /** * Configuration options. * * @property {WordArray} iv The IV to use for this operation. */ cfg: Base.extend(), /** * Creates this cipher in encryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); */ createEncryptor: function (key, cfg) { return this.create(this._ENC_XFORM_MODE, key, cfg); }, /** * Creates this cipher in decryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); */ createDecryptor: function (key, cfg) { return this.create(this._DEC_XFORM_MODE, key, cfg); }, /** * Initializes a newly created cipher. * * @param {number} xformMode Either the encryption or decryption transormation mode constant. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @example * * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); */ init: function (xformMode, key, cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Store transform mode and key this._xformMode = xformMode; this._key = key; // Set initial values this.reset(); }, /** * Resets this cipher to its initial state. * * @example * * cipher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic this._doReset(); }, /** * Adds data to be encrypted or decrypted. * * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. * * @return {WordArray} The data after processing. * * @example * * var encrypted = cipher.process('data'); * var encrypted = cipher.process(wordArray); */ process: function (dataUpdate) { // Append this._append(dataUpdate); // Process available blocks return this._process(); }, /** * Finalizes the encryption or decryption process. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. * * @return {WordArray} The data after final processing. * * @example * * var encrypted = cipher.finalize(); * var encrypted = cipher.finalize('data'); * var encrypted = cipher.finalize(wordArray); */ finalize: function (dataUpdate) { // Final data update if (dataUpdate) { this._append(dataUpdate); } // Perform concrete-cipher logic var finalProcessedData = this._doFinalize(); return finalProcessedData; }, keySize: 128/32, ivSize: 128/32, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, /** * Creates shortcut functions to a cipher's object interface. * * @param {Cipher} cipher The cipher to create a helper for. * * @return {Object} An object with encrypt and decrypt shortcut functions. * * @static * * @example * * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); */ _createHelper: (function () { function selectCipherStrategy(key) { if (typeof key == 'string') { return PasswordBasedCipher; } else { return SerializableCipher; } } return function (cipher) { return { encrypt: function (message, key, cfg) { return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); }, decrypt: function (ciphertext, key, cfg) { return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); } }; }; }()) }); /** * Abstract base stream cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) */ var StreamCipher = C_lib.StreamCipher = Cipher.extend({ _doFinalize: function () { // Process partial blocks var finalProcessedBlocks = this._process(!!'flush'); return finalProcessedBlocks; }, blockSize: 1 }); /** * Mode namespace. */ var C_mode = C.mode = {}; /** * Abstract base block cipher mode template. */ var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ /** * Creates this mode for encryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); */ createEncryptor: function (cipher, iv) { return this.Encryptor.create(cipher, iv); }, /** * Creates this mode for decryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); */ createDecryptor: function (cipher, iv) { return this.Decryptor.create(cipher, iv); }, /** * Initializes a newly created mode. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @example * * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); */ init: function (cipher, iv) { this._cipher = cipher; this._iv = iv; } }); /** * Cipher Block Chaining mode. */ var CBC = C_mode.CBC = (function () { /** * Abstract base CBC mode. */ var CBC = BlockCipherMode.extend(); /** * CBC encryptor. */ CBC.Encryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // XOR and encrypt xorBlock.call(this, words, offset, blockSize); cipher.encryptBlock(words, offset); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); /** * CBC decryptor. */ CBC.Decryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR cipher.decryptBlock(words, offset); xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block this._prevBlock = thisBlock; } }); function xorBlock(words, offset, blockSize) { // Shortcut var iv = this._iv; // Choose mixing block if (iv) { var block = iv; // Remove IV for subsequent blocks this._iv = undefined; } else { var block = this._prevBlock; } // XOR blocks for (var i = 0; i < blockSize; i++) { words[offset + i] ^= block[i]; } } return CBC; }()); /** * Padding namespace. */ var C_pad = C.pad = {}; /** * PKCS #5/7 padding strategy. */ var Pkcs7 = C_pad.Pkcs7 = { /** * Pads data using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to pad. * @param {number} blockSize The multiple that the data should be padded to. * * @static * * @example * * CryptoJS.pad.Pkcs7.pad(wordArray, 4); */ pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; // Create padding var paddingWords = []; for (var i = 0; i < nPaddingBytes; i += 4) { paddingWords.push(paddingWord); } var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding data.concat(padding); }, /** * Unpads data that had been padded using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to unpad. * * @static * * @example * * CryptoJS.pad.Pkcs7.unpad(wordArray); */ unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; /** * Abstract base block cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) */ var BlockCipher = C_lib.BlockCipher = Cipher.extend({ /** * Configuration options. * * @property {Mode} mode The block mode to use. Default: CBC * @property {Padding} padding The padding strategy to use. Default: Pkcs7 */ cfg: Cipher.cfg.extend({ mode: CBC, padding: Pkcs7 }), reset: function () { // Reset cipher Cipher.reset.call(this); // Shortcuts var cfg = this.cfg; var iv = cfg.iv; var mode = cfg.mode; // Reset block mode if (this._xformMode == this._ENC_XFORM_MODE) { var modeCreator = mode.createEncryptor; } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding this._minBufferSize = 1; } this._mode = modeCreator.call(mode, this, iv && iv.words); }, _doProcessBlock: function (words, offset) { this._mode.processBlock(words, offset); }, _doFinalize: function () { // Shortcut var padding = this.cfg.padding; // Finalize if (this._xformMode == this._ENC_XFORM_MODE) { // Pad data padding.pad(this._data, this.blockSize); // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); // Unpad data padding.unpad(finalProcessedBlocks); } return finalProcessedBlocks; }, blockSize: 128/32 }); /** * A collection of cipher parameters. * * @property {WordArray} ciphertext The raw ciphertext. * @property {WordArray} key The key to this ciphertext. * @property {WordArray} iv The IV used in the ciphering operation. * @property {WordArray} salt The salt used with a key derivation function. * @property {Cipher} algorithm The cipher algorithm. * @property {Mode} mode The block mode used in the ciphering operation. * @property {Padding} padding The padding scheme used in the ciphering operation. * @property {number} blockSize The block size of the cipher. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. */ var CipherParams = C_lib.CipherParams = Base.extend({ /** * Initializes a newly created cipher params object. * * @param {Object} cipherParams An object with any of the possible cipher parameters. * * @example * * var cipherParams = CryptoJS.lib.CipherParams.create({ * ciphertext: ciphertextWordArray, * key: keyWordArray, * iv: ivWordArray, * salt: saltWordArray, * algorithm: CryptoJS.algo.AES, * mode: CryptoJS.mode.CBC, * padding: CryptoJS.pad.PKCS7, * blockSize: 4, * formatter: CryptoJS.format.OpenSSL * }); */ init: function (cipherParams) { this.mixIn(cipherParams); }, /** * Converts this cipher params object to a string. * * @param {Format} formatter (Optional) The formatting strategy to use. * * @return {string} The stringified cipher params. * * @throws Error If neither the formatter nor the default formatter is set. * * @example * * var string = cipherParams + ''; * var string = cipherParams.toString(); * var string = cipherParams.toString(CryptoJS.format.OpenSSL); */ toString: function (formatter) { return (formatter || this.formatter).stringify(this); } }); /** * Format namespace. */ var C_format = C.format = {}; /** * OpenSSL formatting strategy. */ var OpenSSLFormatter = C_format.OpenSSL = { /** * Converts a cipher params object to an OpenSSL-compatible string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The OpenSSL-compatible string. * * @static * * @example * * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); */ stringify: function (cipherParams) { // Shortcuts var ciphertext = cipherParams.ciphertext; var salt = cipherParams.salt; // Format if (salt) { var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); } else { var wordArray = ciphertext; } return wordArray.toString(Base64); }, /** * Converts an OpenSSL-compatible string to a cipher params object. * * @param {string} openSSLStr The OpenSSL-compatible string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); */ parse: function (openSSLStr) { // Parse base64 var ciphertext = Base64.parse(openSSLStr); // Shortcut var ciphertextWords = ciphertext.words; // Test for salt if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { // Extract salt var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext ciphertextWords.splice(0, 4); ciphertext.sigBytes -= 16; } return CipherParams.create({ ciphertext: ciphertext, salt: salt }); } }; /** * A cipher wrapper that returns ciphertext as a serializable cipher params object. */ var SerializableCipher = C_lib.SerializableCipher = Base.extend({ /** * Configuration options. * * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL */ cfg: Base.extend({ format: OpenSSLFormatter }), /** * Encrypts a message. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Encrypt var encryptor = cipher.createEncryptor(key, cfg); var ciphertext = encryptor.finalize(message); // Shortcut var cipherCfg = encryptor.cfg; // Create and return serializable cipher params return CipherParams.create({ ciphertext: ciphertext, key: key, iv: cipherCfg.iv, algorithm: cipher, mode: cipherCfg.mode, padding: cipherCfg.padding, blockSize: cipher.blockSize, formatter: cfg.format }); }, /** * Decrypts serialized ciphertext. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Decrypt var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); return plaintext; }, /** * Converts serialized ciphertext to CipherParams, * else assumed CipherParams already and returns ciphertext unchanged. * * @param {CipherParams|string} ciphertext The ciphertext. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. * * @return {CipherParams} The unserialized ciphertext. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); */ _parse: function (ciphertext, format) { if (typeof ciphertext == 'string') { return format.parse(ciphertext, this); } else { return ciphertext; } } }); /** * Key derivation function namespace. */ var C_kdf = C.kdf = {}; /** * OpenSSL key derivation function. */ var OpenSSLKdf = C_kdf.OpenSSL = { /** * Derives a key and IV from a password. * * @param {string} password The password to derive from. * @param {number} keySize The size in words of the key to generate. * @param {number} ivSize The size in words of the IV to generate. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. * * @return {CipherParams} A cipher params object with the key, IV, and salt. * * @static * * @example * * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); */ execute: function (password, keySize, ivSize, salt) { // Generate random salt if (!salt) { salt = WordArray.random(64/8); } // Derive key and IV var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); // Separate key and IV var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); key.sigBytes = keySize * 4; // Return params return CipherParams.create({ key: key, iv: iv, salt: salt }); } }; /** * A serializable cipher wrapper that derives the key from a password, * and returns ciphertext as a serializable cipher params object. */ var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ /** * Configuration options. * * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL */ cfg: SerializableCipher.cfg.extend({ kdf: OpenSSLKdf }), /** * Encrypts a message using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config cfg.iv = derivedParams.iv; // Encrypt var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params ciphertext.mixIn(derivedParams); return ciphertext; }, /** * Decrypts serialized ciphertext using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config cfg.iv = derivedParams.iv; // Decrypt var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); return plaintext; } }); }()); })); },{"./core":48}],48:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(); } else if (typeof define === "function" && define.amd) { // AMD define([], factory); } else { // Global (browser) root.CryptoJS = factory(); } }(this, function () { /** * CryptoJS core components. */ var CryptoJS = CryptoJS || (function (Math, undefined) { /** * CryptoJS namespace. */ var C = {}; /** * Library namespace. */ var C_lib = C.lib = {}; /** * Base object for prototypal inheritance. */ var Base = C_lib.Base = (function () { function F() {} return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function (overrides) { // Spawn F.prototype = this; var subtype = new F(); // Augment if (overrides) { subtype.mixIn(overrides); } // Create default initializer if (!subtype.hasOwnProperty('init')) { subtype.init = function () { subtype.$super.init.apply(this, arguments); }; } // Initializer's prototype is the subtype object subtype.init.prototype = subtype; // Reference supertype subtype.$super = this; return subtype; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function () { var instance = this.extend(); instance.init.apply(instance, arguments); return instance; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function () { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function (properties) { for (var propertyName in properties) { if (properties.hasOwnProperty(propertyName)) { this[propertyName] = properties[propertyName]; } } // IE won't copy toString using the loop above if (properties.hasOwnProperty('toString')) { this.toString = properties.toString; } }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function () { return this.init.prototype.extend(this); } }; }()); /** * An array of 32-bit words. * * @property {Array} words The array of 32-bit words. * @property {number} sigBytes The number of significant bytes in this word array. */ var WordArray = C_lib.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 4; } }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function (encoder) { return (encoder || Hex).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function (wordArray) { // Shortcuts var thisWords = this.words; var thatWords = wordArray.words; var thisSigBytes = this.sigBytes; var thatSigBytes = wordArray.sigBytes; // Clamp excess bits this.clamp(); // Concat if (thisSigBytes % 4) { // Copy one byte at a time for (var i = 0; i < thatSigBytes; i++) { var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); } } else { // Copy one word at a time for (var i = 0; i < thatSigBytes; i += 4) { thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; } } this.sigBytes += thatSigBytes; // Chainable return this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function () { // Shortcuts var words = this.words; var sigBytes = this.sigBytes; // Clamp words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); words.length = Math.ceil(sigBytes / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); clone.words = this.words.slice(0); return clone; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function (nBytes) { var words = []; var r = (function (m_w) { var m_w = m_w; var m_z = 0x3ade68b1; var mask = 0xffffffff; return function () { m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; var result = ((m_z << 0x10) + m_w) & mask; result /= 0x100000000; result += 0.5; return result * (Math.random() > .5 ? 1 : -1); } }); for (var i = 0, rcache; i < nBytes; i += 4) { var _r = r((rcache || Math.random()) * 0x100000000); rcache = _r() * 0x3ade67b7; words.push((_r() * 0x100000000) | 0); } return new WordArray.init(words, nBytes); } }); /** * Encoder namespace. */ var C_enc = C.enc = {}; /** * Hex encoding strategy. */ var Hex = C_enc.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var hexChars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 0x0f).toString(16)); } return hexChars.join(''); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function (hexStr) { // Shortcut var hexStrLength = hexStr.length; // Convert var words = []; for (var i = 0; i < hexStrLength; i += 2) { words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); } return new WordArray.init(words, hexStrLength / 2); } }; /** * Latin1 encoding strategy. */ var Latin1 = C_enc.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var latin1Chars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; latin1Chars.push(String.fromCharCode(bite)); } return latin1Chars.join(''); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function (latin1Str) { // Shortcut var latin1StrLength = latin1Str.length; // Convert var words = []; for (var i = 0; i < latin1StrLength; i++) { words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); } return new WordArray.init(words, latin1StrLength); } }; /** * UTF-8 encoding strategy. */ var Utf8 = C_enc.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function (wordArray) { try { return decodeURIComponent(escape(Latin1.stringify(wordArray))); } catch (e) { throw new Error('Malformed UTF-8 data'); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function (utf8Str) { return Latin1.parse(unescape(encodeURIComponent(utf8Str))); } }; /** * Abstract buffered block algorithm template. * * The property blockSize must be implemented in a concrete subtype. * * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 */ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function () { // Initial values this._data = new WordArray.init(); this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function (data) { // Convert string to WordArray, else assume WordArray already if (typeof data == 'string') { data = Utf8.parse(data); } // Append this._data.concat(data); this._nDataBytes += data.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function (doFlush) { // Shortcuts var data = this._data; var dataWords = data.words; var dataSigBytes = data.sigBytes; var blockSize = this.blockSize; var blockSizeBytes = blockSize * 4; // Count blocks ready var nBlocksReady = dataSigBytes / blockSizeBytes; if (doFlush) { // Round up to include partial blocks nBlocksReady = Math.ceil(nBlocksReady); } else { // Round down to include only full blocks, // less the number of blocks that must remain in the buffer nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); } // Count words ready var nWordsReady = nBlocksReady * blockSize; // Count bytes ready var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks if (nWordsReady) { for (var offset = 0; offset < nWordsReady; offset += blockSize) { // Perform concrete-algorithm logic this._doProcessBlock(dataWords, offset); } // Remove processed words var processedWords = dataWords.splice(0, nWordsReady); data.sigBytes -= nBytesReady; } // Return processed words return new WordArray.init(processedWords, nBytesReady); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function () { var clone = Base.clone.call(this); clone._data = this._data.clone(); return clone; }, _minBufferSize: 0 }); /** * Abstract hasher template. * * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) */ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ /** * Configuration options. */ cfg: Base.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function (cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Set initial values this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function (messageUpdate) { // Append this._append(messageUpdate); // Update the hash this._process(); // Chainable return this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Final message update if (messageUpdate) { this._append(messageUpdate); } // Perform concrete-hasher logic var hash = this._doFinalize(); return hash; }, blockSize: 512/32, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function (hasher) { return function (message, cfg) { return new hasher.init(cfg).finalize(message); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function (hasher) { return function (message, key) { return new C_algo.HMAC.init(hasher, key).finalize(message); }; } }); /** * Algorithm namespace. */ var C_algo = C.algo = {}; return C; }(Math)); return CryptoJS; })); },{}],49:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * Base64 encoding strategy. */ var Base64 = C_enc.Base64 = { /** * Converts a word array to a Base64 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. * * @static * * @example * * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; var map = this._map; // Clamp excess bits wordArray.clamp(); // Convert var base64Chars = []; for (var i = 0; i < sigBytes; i += 3) { var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; var triplet = (byte1 << 16) | (byte2 << 8) | byte3; for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); } } // Add padding var paddingChar = map.charAt(64); if (paddingChar) { while (base64Chars.length % 4) { base64Chars.push(paddingChar); } } return base64Chars.join(''); }, /** * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ parse: function (base64Str) { // Shortcuts var base64StrLength = base64Str.length; var map = this._map; // Ignore padding var paddingChar = map.charAt(64); if (paddingChar) { var paddingIndex = base64Str.indexOf(paddingChar); if (paddingIndex != -1) { base64StrLength = paddingIndex; } } // Convert var words = []; var nBytes = 0; for (var i = 0; i < base64StrLength; i++) { if (i % 4) { var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); var bitsCombined = bits1 | bits2; words[nBytes >>> 2] |= (bitsCombined) << (24 - (nBytes % 4) * 8); nBytes++; } } return WordArray.create(words, nBytes); }, _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' }; }()); return CryptoJS.enc.Base64; })); },{"./core":48}],50:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * UTF-16 BE encoding strategy. */ var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { /** * Converts a word array to a UTF-16 BE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 BE string. * * @static * * @example * * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 BE string to a word array. * * @param {string} utf16Str The UTF-16 BE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); } return WordArray.create(words, utf16StrLength * 2); } }; /** * UTF-16 LE encoding strategy. */ C_enc.Utf16LE = { /** * Converts a word array to a UTF-16 LE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 LE string. * * @static * * @example * * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 LE string to a word array. * * @param {string} utf16Str The UTF-16 LE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); } return WordArray.create(words, utf16StrLength * 2); } }; function swapEndian(word) { return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); } }()); return CryptoJS.enc.Utf16; })); },{"./core":48}],51:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha1", "./hmac"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var MD5 = C_algo.MD5; /** * This key derivation function is meant to conform with EVP_BytesToKey. * www.openssl.org/docs/crypto/EVP_BytesToKey.html */ var EvpKDF = C_algo.EvpKDF = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hash algorithm to use. Default: MD5 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128/32, hasher: MD5, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.EvpKDF.create(); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init hasher var hasher = cfg.hasher.create(); // Initial values var derivedKey = WordArray.create(); // Shortcuts var derivedKeyWords = derivedKey.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { if (block) { hasher.update(block); } var block = hasher.update(password).finalize(salt); hasher.reset(); // Iterations for (var i = 1; i < iterations; i++) { block = hasher.finalize(block); hasher.reset(); } derivedKey.concat(block); } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.EvpKDF(password, salt); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); */ C.EvpKDF = function (password, salt, cfg) { return EvpKDF.create(cfg).compute(password, salt); }; }()); return CryptoJS.EvpKDF; })); },{"./core":48,"./hmac":53,"./sha1":72}],52:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var CipherParams = C_lib.CipherParams; var C_enc = C.enc; var Hex = C_enc.Hex; var C_format = C.format; var HexFormatter = C_format.Hex = { /** * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The hexadecimally encoded string. * * @static * * @example * * var hexString = CryptoJS.format.Hex.stringify(cipherParams); */ stringify: function (cipherParams) { return cipherParams.ciphertext.toString(Hex); }, /** * Converts a hexadecimally encoded ciphertext string to a cipher params object. * * @param {string} input The hexadecimally encoded string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.Hex.parse(hexString); */ parse: function (input) { var ciphertext = Hex.parse(input); return CipherParams.create({ ciphertext: ciphertext }); } }; }()); return CryptoJS.format.Hex; })); },{"./cipher-core":47,"./core":48}],53:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var C_algo = C.algo; /** * HMAC algorithm. */ var HMAC = C_algo.HMAC = Base.extend({ /** * Initializes a newly created HMAC. * * @param {Hasher} hasher The hash algorithm to use. * @param {WordArray|string} key The secret key. * * @example * * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ init: function (hasher, key) { // Init hasher hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already if (typeof key == 'string') { key = Utf8.parse(key); } // Shortcuts var hasherBlockSize = hasher.blockSize; var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys if (key.sigBytes > hasherBlockSizeBytes) { key = hasher.finalize(key); } // Clamp excess bits key.clamp(); // Clone key for inner and outer pads var oKey = this._oKey = key.clone(); var iKey = this._iKey = key.clone(); // Shortcuts var oKeyWords = oKey.words; var iKeyWords = iKey.words; // XOR keys with pad constants for (var i = 0; i < hasherBlockSize; i++) { oKeyWords[i] ^= 0x5c5c5c5c; iKeyWords[i] ^= 0x36363636; } oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values this.reset(); }, /** * Resets this HMAC to its initial state. * * @example * * hmacHasher.reset(); */ reset: function () { // Shortcut var hasher = this._hasher; // Reset hasher.reset(); hasher.update(this._iKey); }, /** * Updates this HMAC with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {HMAC} This HMAC instance. * * @example * * hmacHasher.update('message'); * hmacHasher.update(wordArray); */ update: function (messageUpdate) { this._hasher.update(messageUpdate); // Chainable return this; }, /** * Finalizes the HMAC computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The HMAC. * * @example * * var hmac = hmacHasher.finalize(); * var hmac = hmacHasher.finalize('message'); * var hmac = hmacHasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Shortcut var hasher = this._hasher; // Compute HMAC var innerHash = hasher.finalize(messageUpdate); hasher.reset(); var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); return hmac; } }); }()); })); },{"./core":48}],54:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./lib-typedarrays"), _dereq_("./enc-utf16"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./sha1"), _dereq_("./sha256"), _dereq_("./sha224"), _dereq_("./sha512"), _dereq_("./sha384"), _dereq_("./sha3"), _dereq_("./ripemd160"), _dereq_("./hmac"), _dereq_("./pbkdf2"), _dereq_("./evpkdf"), _dereq_("./cipher-core"), _dereq_("./mode-cfb"), _dereq_("./mode-ctr"), _dereq_("./mode-ctr-gladman"), _dereq_("./mode-ofb"), _dereq_("./mode-ecb"), _dereq_("./pad-ansix923"), _dereq_("./pad-iso10126"), _dereq_("./pad-iso97971"), _dereq_("./pad-zeropadding"), _dereq_("./pad-nopadding"), _dereq_("./format-hex"), _dereq_("./aes"), _dereq_("./tripledes"), _dereq_("./rc4"), _dereq_("./rabbit"), _dereq_("./rabbit-legacy")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); } else { // Global (browser) root.CryptoJS = factory(root.CryptoJS); } }(this, function (CryptoJS) { return CryptoJS; })); },{"./aes":46,"./cipher-core":47,"./core":48,"./enc-base64":49,"./enc-utf16":50,"./evpkdf":51,"./format-hex":52,"./hmac":53,"./lib-typedarrays":55,"./md5":56,"./mode-cfb":57,"./mode-ctr":59,"./mode-ctr-gladman":58,"./mode-ecb":60,"./mode-ofb":61,"./pad-ansix923":62,"./pad-iso10126":63,"./pad-iso97971":64,"./pad-nopadding":65,"./pad-zeropadding":66,"./pbkdf2":67,"./rabbit":69,"./rabbit-legacy":68,"./rc4":70,"./ripemd160":71,"./sha1":72,"./sha224":73,"./sha256":74,"./sha3":75,"./sha384":76,"./sha512":77,"./tripledes":78,"./x64-core":79}],55:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Check if typed arrays are supported if (typeof ArrayBuffer != 'function') { return; } // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; // Reference original init var superInit = WordArray.init; // Augment WordArray.init to handle typed arrays var subInit = WordArray.init = function (typedArray) { // Convert buffers to uint8 if (typedArray instanceof ArrayBuffer) { typedArray = new Uint8Array(typedArray); } // Convert other array views to uint8 if ( typedArray instanceof Int8Array || (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array ) { typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); } // Handle Uint8Array if (typedArray instanceof Uint8Array) { // Shortcut var typedArrayByteLength = typedArray.byteLength; // Extract bytes var words = []; for (var i = 0; i < typedArrayByteLength; i++) { words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); } // Initialize this word array superInit.call(this, words, typedArrayByteLength); } else { // Else call normal init superInit.apply(this, arguments); } }; subInit.prototype = WordArray; }()); return CryptoJS.lib.WordArray; })); },{"./core":48}],56:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var T = []; // Compute constants (function () { for (var i = 0; i < 64; i++) { T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; } }()); /** * MD5 hash algorithm. */ var MD5 = C_algo.MD5 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 ]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcuts var H = this._hash.words; var M_offset_0 = M[offset + 0]; var M_offset_1 = M[offset + 1]; var M_offset_2 = M[offset + 2]; var M_offset_3 = M[offset + 3]; var M_offset_4 = M[offset + 4]; var M_offset_5 = M[offset + 5]; var M_offset_6 = M[offset + 6]; var M_offset_7 = M[offset + 7]; var M_offset_8 = M[offset + 8]; var M_offset_9 = M[offset + 9]; var M_offset_10 = M[offset + 10]; var M_offset_11 = M[offset + 11]; var M_offset_12 = M[offset + 12]; var M_offset_13 = M[offset + 13]; var M_offset_14 = M[offset + 14]; var M_offset_15 = M[offset + 15]; // Working varialbes var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; // Computation a = FF(a, b, c, d, M_offset_0, 7, T[0]); d = FF(d, a, b, c, M_offset_1, 12, T[1]); c = FF(c, d, a, b, M_offset_2, 17, T[2]); b = FF(b, c, d, a, M_offset_3, 22, T[3]); a = FF(a, b, c, d, M_offset_4, 7, T[4]); d = FF(d, a, b, c, M_offset_5, 12, T[5]); c = FF(c, d, a, b, M_offset_6, 17, T[6]); b = FF(b, c, d, a, M_offset_7, 22, T[7]); a = FF(a, b, c, d, M_offset_8, 7, T[8]); d = FF(d, a, b, c, M_offset_9, 12, T[9]); c = FF(c, d, a, b, M_offset_10, 17, T[10]); b = FF(b, c, d, a, M_offset_11, 22, T[11]); a = FF(a, b, c, d, M_offset_12, 7, T[12]); d = FF(d, a, b, c, M_offset_13, 12, T[13]); c = FF(c, d, a, b, M_offset_14, 17, T[14]); b = FF(b, c, d, a, M_offset_15, 22, T[15]); a = GG(a, b, c, d, M_offset_1, 5, T[16]); d = GG(d, a, b, c, M_offset_6, 9, T[17]); c = GG(c, d, a, b, M_offset_11, 14, T[18]); b = GG(b, c, d, a, M_offset_0, 20, T[19]); a = GG(a, b, c, d, M_offset_5, 5, T[20]); d = GG(d, a, b, c, M_offset_10, 9, T[21]); c = GG(c, d, a, b, M_offset_15, 14, T[22]); b = GG(b, c, d, a, M_offset_4, 20, T[23]); a = GG(a, b, c, d, M_offset_9, 5, T[24]); d = GG(d, a, b, c, M_offset_14, 9, T[25]); c = GG(c, d, a, b, M_offset_3, 14, T[26]); b = GG(b, c, d, a, M_offset_8, 20, T[27]); a = GG(a, b, c, d, M_offset_13, 5, T[28]); d = GG(d, a, b, c, M_offset_2, 9, T[29]); c = GG(c, d, a, b, M_offset_7, 14, T[30]); b = GG(b, c, d, a, M_offset_12, 20, T[31]); a = HH(a, b, c, d, M_offset_5, 4, T[32]); d = HH(d, a, b, c, M_offset_8, 11, T[33]); c = HH(c, d, a, b, M_offset_11, 16, T[34]); b = HH(b, c, d, a, M_offset_14, 23, T[35]); a = HH(a, b, c, d, M_offset_1, 4, T[36]); d = HH(d, a, b, c, M_offset_4, 11, T[37]); c = HH(c, d, a, b, M_offset_7, 16, T[38]); b = HH(b, c, d, a, M_offset_10, 23, T[39]); a = HH(a, b, c, d, M_offset_13, 4, T[40]); d = HH(d, a, b, c, M_offset_0, 11, T[41]); c = HH(c, d, a, b, M_offset_3, 16, T[42]); b = HH(b, c, d, a, M_offset_6, 23, T[43]); a = HH(a, b, c, d, M_offset_9, 4, T[44]); d = HH(d, a, b, c, M_offset_12, 11, T[45]); c = HH(c, d, a, b, M_offset_15, 16, T[46]); b = HH(b, c, d, a, M_offset_2, 23, T[47]); a = II(a, b, c, d, M_offset_0, 6, T[48]); d = II(d, a, b, c, M_offset_7, 10, T[49]); c = II(c, d, a, b, M_offset_14, 15, T[50]); b = II(b, c, d, a, M_offset_5, 21, T[51]); a = II(a, b, c, d, M_offset_12, 6, T[52]); d = II(d, a, b, c, M_offset_3, 10, T[53]); c = II(c, d, a, b, M_offset_10, 15, T[54]); b = II(b, c, d, a, M_offset_1, 21, T[55]); a = II(a, b, c, d, M_offset_8, 6, T[56]); d = II(d, a, b, c, M_offset_15, 10, T[57]); c = II(c, d, a, b, M_offset_6, 15, T[58]); b = II(b, c, d, a, M_offset_13, 21, T[59]); a = II(a, b, c, d, M_offset_4, 6, T[60]); d = II(d, a, b, c, M_offset_11, 10, T[61]); c = II(c, d, a, b, M_offset_2, 15, T[62]); b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); var nBitsTotalL = nBitsTotal; dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) ); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 4; i++) { // Shortcut var H_i = H[i]; H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function FF(a, b, c, d, x, s, t) { var n = a + ((b & c) | (~b & d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function GG(a, b, c, d, x, s, t) { var n = a + ((b & d) | (c & ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function HH(a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function II(a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.MD5('message'); * var hash = CryptoJS.MD5(wordArray); */ C.MD5 = Hasher._createHelper(MD5); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacMD5(message, key); */ C.HmacMD5 = Hasher._createHmacHelper(MD5); }(Math)); return CryptoJS.MD5; })); },{"./core":48}],57:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Cipher Feedback block mode. */ CryptoJS.mode.CFB = (function () { var CFB = CryptoJS.lib.BlockCipherMode.extend(); CFB.Encryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); CFB.Decryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // This block becomes the previous block this._prevBlock = thisBlock; } }); function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { // Shortcut var iv = this._iv; // Generate keystream if (iv) { var keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } else { var keystream = this._prevBlock; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } return CFB; }()); return CryptoJS.mode.CFB; })); },{"./cipher-core":47,"./core":48}],58:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** @preserve * Counter block mode compatible with Dr Brian Gladman fileenc.c * derived from CryptoJS.mode.CTR * Jan Hruby jhruby.web@gmail.com */ CryptoJS.mode.CTRGladman = (function () { var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); function incWord(word) { if (((word >> 24) & 0xff) === 0xff) { //overflow var b1 = (word >> 16)&0xff; var b2 = (word >> 8)&0xff; var b3 = word & 0xff; if (b1 === 0xff) // overflow b1 { b1 = 0; if (b2 === 0xff) { b2 = 0; if (b3 === 0xff) { b3 = 0; } else { ++b3; } } else { ++b2; } } else { ++b1; } word = 0; word += (b1 << 16); word += (b2 << 8); word += b3; } else { word += (0x01 << 24); } return word; } function incCounter(counter) { if ((counter[0] = incWord(counter[0])) === 0) { // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 counter[1] = incWord(counter[1]); } return counter; } var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } incCounter(counter); var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTRGladman.Decryptor = Encryptor; return CTRGladman; }()); return CryptoJS.mode.CTRGladman; })); },{"./cipher-core":47,"./core":48}],59:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Counter block mode. */ CryptoJS.mode.CTR = (function () { var CTR = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = CTR.Encryptor = CTR.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Increment counter counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTR.Decryptor = Encryptor; return CTR; }()); return CryptoJS.mode.CTR; })); },{"./cipher-core":47,"./core":48}],60:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Electronic Codebook block mode. */ CryptoJS.mode.ECB = (function () { var ECB = CryptoJS.lib.BlockCipherMode.extend(); ECB.Encryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.encryptBlock(words, offset); } }); ECB.Decryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.decryptBlock(words, offset); } }); return ECB; }()); return CryptoJS.mode.ECB; })); },{"./cipher-core":47,"./core":48}],61:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Output Feedback block mode. */ CryptoJS.mode.OFB = (function () { var OFB = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = OFB.Encryptor = OFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var keystream = this._keystream; // Generate keystream if (iv) { keystream = this._keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); OFB.Decryptor = Encryptor; return OFB; }()); return CryptoJS.mode.OFB; })); },{"./cipher-core":47,"./core":48}],62:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ANSI X.923 padding strategy. */ CryptoJS.pad.AnsiX923 = { pad: function (data, blockSize) { // Shortcuts var dataSigBytes = data.sigBytes; var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; // Compute last byte position var lastBytePos = dataSigBytes + nPaddingBytes - 1; // Pad data.clamp(); data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); data.sigBytes += nPaddingBytes; }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; return CryptoJS.pad.Ansix923; })); },{"./cipher-core":47,"./core":48}],63:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ISO 10126 padding strategy. */ CryptoJS.pad.Iso10126 = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Pad data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; return CryptoJS.pad.Iso10126; })); },{"./cipher-core":47,"./core":48}],64:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ISO/IEC 9797-1 Padding Method 2. */ CryptoJS.pad.Iso97971 = { pad: function (data, blockSize) { // Add 0x80 byte data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); // Zero pad the rest CryptoJS.pad.ZeroPadding.pad(data, blockSize); }, unpad: function (data) { // Remove zero padding CryptoJS.pad.ZeroPadding.unpad(data); // Remove one more byte -- the 0x80 byte data.sigBytes--; } }; return CryptoJS.pad.Iso97971; })); },{"./cipher-core":47,"./core":48}],65:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * A noop padding strategy. */ CryptoJS.pad.NoPadding = { pad: function () { }, unpad: function () { } }; return CryptoJS.pad.NoPadding; })); },{"./cipher-core":47,"./core":48}],66:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Zero padding strategy. */ CryptoJS.pad.ZeroPadding = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Pad data.clamp(); data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); }, unpad: function (data) { // Shortcut var dataWords = data.words; // Unpad var i = data.sigBytes - 1; while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { i--; } data.sigBytes = i + 1; } }; return CryptoJS.pad.ZeroPadding; })); },{"./cipher-core":47,"./core":48}],67:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha1", "./hmac"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA1 = C_algo.SHA1; var HMAC = C_algo.HMAC; /** * Password-Based Key Derivation Function 2 algorithm. */ var PBKDF2 = C_algo.PBKDF2 = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hasher to use. Default: SHA1 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128/32, hasher: SHA1, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.PBKDF2.create(); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init HMAC var hmac = HMAC.create(cfg.hasher, password); // Initial values var derivedKey = WordArray.create(); var blockIndex = WordArray.create([0x00000001]); // Shortcuts var derivedKeyWords = derivedKey.words; var blockIndexWords = blockIndex.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { var block = hmac.update(salt).finalize(blockIndex); hmac.reset(); // Shortcuts var blockWords = block.words; var blockWordsLength = blockWords.length; // Iterations var intermediate = block; for (var i = 1; i < iterations; i++) { intermediate = hmac.finalize(intermediate); hmac.reset(); // Shortcut var intermediateWords = intermediate.words; // XOR intermediate with block for (var j = 0; j < blockWordsLength; j++) { blockWords[j] ^= intermediateWords[j]; } } derivedKey.concat(block); blockIndexWords[0]++; } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.PBKDF2(password, salt); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); */ C.PBKDF2 = function (password, salt, cfg) { return PBKDF2.create(cfg).compute(password, salt); }; }()); return CryptoJS.PBKDF2; })); },{"./core":48,"./hmac":53,"./sha1":72}],68:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm. * * This is a legacy version that neglected to convert the key to little-endian. * This error doesn't affect the cipher's security, * but it does affect its compatibility with other implementations. */ var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128/32, ivSize: 64/32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); */ C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); }()); return CryptoJS.RabbitLegacy; })); },{"./cipher-core":47,"./core":48,"./enc-base64":49,"./evpkdf":51,"./md5":56}],69:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm */ var Rabbit = C_algo.Rabbit = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Swap endian for (var i = 0; i < 4; i++) { K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); } // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128/32, ivSize: 64/32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); */ C.Rabbit = StreamCipher._createHelper(Rabbit); }()); return CryptoJS.Rabbit; })); },{"./cipher-core":47,"./core":48,"./enc-base64":49,"./evpkdf":51,"./md5":56}],70:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; /** * RC4 stream cipher algorithm. */ var RC4 = C_algo.RC4 = StreamCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; var keySigBytes = key.sigBytes; // Init sbox var S = this._S = []; for (var i = 0; i < 256; i++) { S[i] = i; } // Key setup for (var i = 0, j = 0; i < 256; i++) { var keyByteIndex = i % keySigBytes; var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; j = (j + S[i] + keyByte) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; } // Counters this._i = this._j = 0; }, _doProcessBlock: function (M, offset) { M[offset] ^= generateKeystreamWord.call(this); }, keySize: 256/32, ivSize: 0 }); function generateKeystreamWord() { // Shortcuts var S = this._S; var i = this._i; var j = this._j; // Generate keystream word var keystreamWord = 0; for (var n = 0; n < 4; n++) { i = (i + 1) % 256; j = (j + S[i]) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); } // Update counters this._i = i; this._j = j; return keystreamWord; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); */ C.RC4 = StreamCipher._createHelper(RC4); /** * Modified RC4 stream cipher algorithm. */ var RC4Drop = C_algo.RC4Drop = RC4.extend({ /** * Configuration options. * * @property {number} drop The number of keystream words to drop. Default 192 */ cfg: RC4.cfg.extend({ drop: 192 }), _doReset: function () { RC4._doReset.call(this); // Drop for (var i = this.cfg.drop; i > 0; i--) { generateKeystreamWord.call(this); } } }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); */ C.RC4Drop = StreamCipher._createHelper(RC4Drop); }()); return CryptoJS.RC4; })); },{"./cipher-core":47,"./core":48,"./enc-base64":49,"./evpkdf":51,"./md5":56}],71:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** @preserve (c) 2012 by Cédric Mesnil. 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. 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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 (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var _zl = WordArray.create([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); var _zr = WordArray.create([ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); var _sl = WordArray.create([ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); var _sr = WordArray.create([ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); /** * RIPEMD160 hash algorithm. */ var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ _doReset: function () { this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; // Swap M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcut var H = this._hash.words; var hl = _hl.words; var hr = _hr.words; var zl = _zl.words; var zr = _zr.words; var sl = _sl.words; var sr = _sr.words; // Working variables var al, bl, cl, dl, el; var ar, br, cr, dr, er; ar = al = H[0]; br = bl = H[1]; cr = cl = H[2]; dr = dl = H[3]; er = el = H[4]; // Computation var t; for (var i = 0; i < 80; i += 1) { t = (al + M[offset+zl[i]])|0; if (i<16){ t += f1(bl,cl,dl) + hl[0]; } else if (i<32) { t += f2(bl,cl,dl) + hl[1]; } else if (i<48) { t += f3(bl,cl,dl) + hl[2]; } else if (i<64) { t += f4(bl,cl,dl) + hl[3]; } else {// if (i<80) { t += f5(bl,cl,dl) + hl[4]; } t = t|0; t = rotl(t,sl[i]); t = (t+el)|0; al = el; el = dl; dl = rotl(cl, 10); cl = bl; bl = t; t = (ar + M[offset+zr[i]])|0; if (i<16){ t += f5(br,cr,dr) + hr[0]; } else if (i<32) { t += f4(br,cr,dr) + hr[1]; } else if (i<48) { t += f3(br,cr,dr) + hr[2]; } else if (i<64) { t += f2(br,cr,dr) + hr[3]; } else {// if (i<80) { t += f1(br,cr,dr) + hr[4]; } t = t|0; t = rotl(t,sr[i]) ; t = (t+er)|0; ar = er; er = dr; dr = rotl(cr, 10); cr = br; br = t; } // Intermediate hash value t = (H[1] + cl + dr)|0; H[1] = (H[2] + dl + er)|0; H[2] = (H[3] + el + ar)|0; H[3] = (H[4] + al + br)|0; H[4] = (H[0] + bl + cr)|0; H[0] = t; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 5; i++) { // Shortcut var H_i = H[i]; // Swap H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function f1(x, y, z) { return ((x) ^ (y) ^ (z)); } function f2(x, y, z) { return (((x)&(y)) | ((~x)&(z))); } function f3(x, y, z) { return (((x) | (~(y))) ^ (z)); } function f4(x, y, z) { return (((x) & (z)) | ((y)&(~(z)))); } function f5(x, y, z) { return ((x) ^ ((y) |(~(z)))); } function rotl(x,n) { return (x<<n) | (x>>>(32-n)); } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.RIPEMD160('message'); * var hash = CryptoJS.RIPEMD160(wordArray); */ C.RIPEMD160 = Hasher._createHelper(RIPEMD160); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacRIPEMD160(message, key); */ C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); }(Math)); return CryptoJS.RIPEMD160; })); },{"./core":48}],72:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Reusable object var W = []; /** * SHA-1 hash algorithm. */ var SHA1 = C_algo.SHA1 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; // Computation for (var i = 0; i < 80; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = (n << 1) | (n >>> 31); } var t = ((a << 5) | (a >>> 27)) + e + W[i]; if (i < 20) { t += ((b & c) | (~b & d)) + 0x5a827999; } else if (i < 40) { t += (b ^ c ^ d) + 0x6ed9eba1; } else if (i < 60) { t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; } else /* if (i < 80) */ { t += (b ^ c ^ d) - 0x359d3e2a; } e = d; d = c; c = (b << 30) | (b >>> 2); b = a; a = t; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA1('message'); * var hash = CryptoJS.SHA1(wordArray); */ C.SHA1 = Hasher._createHelper(SHA1); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA1(message, key); */ C.HmacSHA1 = Hasher._createHmacHelper(SHA1); }()); return CryptoJS.SHA1; })); },{"./core":48}],73:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha256")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha256"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA256 = C_algo.SHA256; /** * SHA-224 hash algorithm. */ var SHA224 = C_algo.SHA224 = SHA256.extend({ _doReset: function () { this._hash = new WordArray.init([ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]); }, _doFinalize: function () { var hash = SHA256._doFinalize.call(this); hash.sigBytes -= 4; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA224('message'); * var hash = CryptoJS.SHA224(wordArray); */ C.SHA224 = SHA256._createHelper(SHA224); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA224(message, key); */ C.HmacSHA224 = SHA256._createHmacHelper(SHA224); }()); return CryptoJS.SHA224; })); },{"./core":48,"./sha256":74}],74:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Initialization and round constants tables var H = []; var K = []; // Compute constants (function () { function isPrime(n) { var sqrtN = Math.sqrt(n); for (var factor = 2; factor <= sqrtN; factor++) { if (!(n % factor)) { return false; } } return true; } function getFractionalBits(n) { return ((n - (n | 0)) * 0x100000000) | 0; } var n = 2; var nPrime = 0; while (nPrime < 64) { if (isPrime(n)) { if (nPrime < 8) { H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); } K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); nPrime++; } n++; } }()); // Reusable object var W = []; /** * SHA-256 hash algorithm. */ var SHA256 = C_algo.SHA256 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init(H.slice(0)); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; var f = H[5]; var g = H[6]; var h = H[7]; // Computation for (var i = 0; i < 64; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var gamma0x = W[i - 15]; var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ ((gamma0x << 14) | (gamma0x >>> 18)) ^ (gamma0x >>> 3); var gamma1x = W[i - 2]; var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ ((gamma1x << 13) | (gamma1x >>> 19)) ^ (gamma1x >>> 10); W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; } var ch = (e & f) ^ (~e & g); var maj = (a & b) ^ (a & c) ^ (b & c); var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); var t1 = h + sigma1 + ch + K[i] + W[i]; var t2 = sigma0 + maj; h = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; H[5] = (H[5] + f) | 0; H[6] = (H[6] + g) | 0; H[7] = (H[7] + h) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA256('message'); * var hash = CryptoJS.SHA256(wordArray); */ C.SHA256 = Hasher._createHelper(SHA256); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA256(message, key); */ C.HmacSHA256 = Hasher._createHmacHelper(SHA256); }(Math)); return CryptoJS.SHA256; })); },{"./core":48}],75:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var C_algo = C.algo; // Constants tables var RHO_OFFSETS = []; var PI_INDEXES = []; var ROUND_CONSTANTS = []; // Compute Constants (function () { // Compute rho offset constants var x = 1, y = 0; for (var t = 0; t < 24; t++) { RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; var newX = y % 5; var newY = (2 * x + 3 * y) % 5; x = newX; y = newY; } // Compute pi index constants for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; } } // Compute round constants var LFSR = 0x01; for (var i = 0; i < 24; i++) { var roundConstantMsw = 0; var roundConstantLsw = 0; for (var j = 0; j < 7; j++) { if (LFSR & 0x01) { var bitPosition = (1 << j) - 1; if (bitPosition < 32) { roundConstantLsw ^= 1 << bitPosition; } else /* if (bitPosition >= 32) */ { roundConstantMsw ^= 1 << (bitPosition - 32); } } // Compute next LFSR if (LFSR & 0x80) { // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 LFSR = (LFSR << 1) ^ 0x71; } else { LFSR <<= 1; } } ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); } }()); // Reusable objects for temporary values var T = []; (function () { for (var i = 0; i < 25; i++) { T[i] = X64Word.create(); } }()); /** * SHA-3 hash algorithm. */ var SHA3 = C_algo.SHA3 = Hasher.extend({ /** * Configuration options. * * @property {number} outputLength * The desired number of bits in the output hash. * Only values permitted are: 224, 256, 384, 512. * Default: 512 */ cfg: Hasher.cfg.extend({ outputLength: 512 }), _doReset: function () { var state = this._state = [] for (var i = 0; i < 25; i++) { state[i] = new X64Word.init(); } this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; }, _doProcessBlock: function (M, offset) { // Shortcuts var state = this._state; var nBlockSizeLanes = this.blockSize / 2; // Absorb for (var i = 0; i < nBlockSizeLanes; i++) { // Shortcuts var M2i = M[offset + 2 * i]; var M2i1 = M[offset + 2 * i + 1]; // Swap endian M2i = ( (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) ); M2i1 = ( (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) ); // Absorb message into state var lane = state[i]; lane.high ^= M2i1; lane.low ^= M2i; } // Rounds for (var round = 0; round < 24; round++) { // Theta for (var x = 0; x < 5; x++) { // Mix column lanes var tMsw = 0, tLsw = 0; for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; tMsw ^= lane.high; tLsw ^= lane.low; } // Temporary values var Tx = T[x]; Tx.high = tMsw; Tx.low = tLsw; } for (var x = 0; x < 5; x++) { // Shortcuts var Tx4 = T[(x + 4) % 5]; var Tx1 = T[(x + 1) % 5]; var Tx1Msw = Tx1.high; var Tx1Lsw = Tx1.low; // Mix surrounding columns var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; lane.high ^= tMsw; lane.low ^= tLsw; } } // Rho Pi for (var laneIndex = 1; laneIndex < 25; laneIndex++) { // Shortcuts var lane = state[laneIndex]; var laneMsw = lane.high; var laneLsw = lane.low; var rhoOffset = RHO_OFFSETS[laneIndex]; // Rotate lanes if (rhoOffset < 32) { var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); } else /* if (rhoOffset >= 32) */ { var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); } // Transpose lanes var TPiLane = T[PI_INDEXES[laneIndex]]; TPiLane.high = tMsw; TPiLane.low = tLsw; } // Rho pi at x = y = 0 var T0 = T[0]; var state0 = state[0]; T0.high = state0.high; T0.low = state0.low; // Chi for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { // Shortcuts var laneIndex = x + 5 * y; var lane = state[laneIndex]; var TLane = T[laneIndex]; var Tx1Lane = T[((x + 1) % 5) + 5 * y]; var Tx2Lane = T[((x + 2) % 5) + 5 * y]; // Mix rows lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); } } // Iota var lane = state[0]; var roundConstant = ROUND_CONSTANTS[round]; lane.high ^= roundConstant.high; lane.low ^= roundConstant.low;; } }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; var blockSizeBits = this.blockSize * 32; // Add padding dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Shortcuts var state = this._state; var outputLengthBytes = this.cfg.outputLength / 8; var outputLengthLanes = outputLengthBytes / 8; // Squeeze var hashWords = []; for (var i = 0; i < outputLengthLanes; i++) { // Shortcuts var lane = state[i]; var laneMsw = lane.high; var laneLsw = lane.low; // Swap endian laneMsw = ( (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) ); laneLsw = ( (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) ); // Squeeze state to retrieve hash hashWords.push(laneLsw); hashWords.push(laneMsw); } // Return final computed hash return new WordArray.init(hashWords, outputLengthBytes); }, clone: function () { var clone = Hasher.clone.call(this); var state = clone._state = this._state.slice(0); for (var i = 0; i < 25; i++) { state[i] = state[i].clone(); } return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA3('message'); * var hash = CryptoJS.SHA3(wordArray); */ C.SHA3 = Hasher._createHelper(SHA3); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA3(message, key); */ C.HmacSHA3 = Hasher._createHmacHelper(SHA3); }(Math)); return CryptoJS.SHA3; })); },{"./core":48,"./x64-core":79}],76:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./sha512")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core", "./sha512"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; var SHA512 = C_algo.SHA512; /** * SHA-384 hash algorithm. */ var SHA384 = C_algo.SHA384 = SHA512.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) ]); }, _doFinalize: function () { var hash = SHA512._doFinalize.call(this); hash.sigBytes -= 16; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA384('message'); * var hash = CryptoJS.SHA384(wordArray); */ C.SHA384 = SHA512._createHelper(SHA384); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA384(message, key); */ C.HmacSHA384 = SHA512._createHmacHelper(SHA384); }()); return CryptoJS.SHA384; })); },{"./core":48,"./sha512":77,"./x64-core":79}],77:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; function X64Word_create() { return X64Word.create.apply(X64Word, arguments); } // Constants var K = [ X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) ]; // Reusable objects var W = []; (function () { for (var i = 0; i < 80; i++) { W[i] = X64Word_create(); } }()); /** * SHA-512 hash algorithm. */ var SHA512 = C_algo.SHA512 = Hasher.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) ]); }, _doProcessBlock: function (M, offset) { // Shortcuts var H = this._hash.words; var H0 = H[0]; var H1 = H[1]; var H2 = H[2]; var H3 = H[3]; var H4 = H[4]; var H5 = H[5]; var H6 = H[6]; var H7 = H[7]; var H0h = H0.high; var H0l = H0.low; var H1h = H1.high; var H1l = H1.low; var H2h = H2.high; var H2l = H2.low; var H3h = H3.high; var H3l = H3.low; var H4h = H4.high; var H4l = H4.low; var H5h = H5.high; var H5l = H5.low; var H6h = H6.high; var H6l = H6.low; var H7h = H7.high; var H7l = H7.low; // Working variables var ah = H0h; var al = H0l; var bh = H1h; var bl = H1l; var ch = H2h; var cl = H2l; var dh = H3h; var dl = H3l; var eh = H4h; var el = H4l; var fh = H5h; var fl = H5l; var gh = H6h; var gl = H6l; var hh = H7h; var hl = H7l; // Rounds for (var i = 0; i < 80; i++) { // Shortcut var Wi = W[i]; // Extend message if (i < 16) { var Wih = Wi.high = M[offset + i * 2] | 0; var Wil = Wi.low = M[offset + i * 2 + 1] | 0; } else { // Gamma0 var gamma0x = W[i - 15]; var gamma0xh = gamma0x.high; var gamma0xl = gamma0x.low; var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); // Gamma1 var gamma1x = W[i - 2]; var gamma1xh = gamma1x.high; var gamma1xl = gamma1x.low; var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] var Wi7 = W[i - 7]; var Wi7h = Wi7.high; var Wi7l = Wi7.low; var Wi16 = W[i - 16]; var Wi16h = Wi16.high; var Wi16l = Wi16.low; var Wil = gamma0l + Wi7l; var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); var Wil = Wil + gamma1l; var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); var Wil = Wil + Wi16l; var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); Wi.high = Wih; Wi.low = Wil; } var chh = (eh & fh) ^ (~eh & gh); var chl = (el & fl) ^ (~el & gl); var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); var majl = (al & bl) ^ (al & cl) ^ (bl & cl); var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); // t1 = h + sigma1 + ch + K[i] + W[i] var Ki = K[i]; var Kih = Ki.high; var Kil = Ki.low; var t1l = hl + sigma1l; var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); var t1l = t1l + chl; var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); var t1l = t1l + Kil; var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); var t1l = t1l + Wil; var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); // t2 = sigma0 + maj var t2l = sigma0l + majl; var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); // Update working variables hh = gh; hl = gl; gh = fh; gl = fl; fh = eh; fl = el; el = (dl + t1l) | 0; eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; dh = ch; dl = cl; ch = bh; cl = bl; bh = ah; bl = al; al = (t1l + t2l) | 0; ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; } // Intermediate hash value H0l = H0.low = (H0l + al); H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); H1l = H1.low = (H1l + bl); H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); H2l = H2.low = (H2l + cl); H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); H3l = H3.low = (H3l + dl); H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); H4l = H4.low = (H4l + el); H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); H5l = H5.low = (H5l + fl); H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); H6l = H6.low = (H6l + gl); H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); H7l = H7.low = (H7l + hl); H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Convert hash to 32-bit word array before returning var hash = this._hash.toX32(); // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; }, blockSize: 1024/32 }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA512('message'); * var hash = CryptoJS.SHA512(wordArray); */ C.SHA512 = Hasher._createHelper(SHA512); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA512(message, key); */ C.HmacSHA512 = Hasher._createHmacHelper(SHA512); }()); return CryptoJS.SHA512; })); },{"./core":48,"./x64-core":79}],78:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Permuted Choice 1 constants var PC1 = [ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 ]; // Permuted Choice 2 constants var PC2 = [ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 ]; // Cumulative bit shift constants var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; // SBOXes and round permutation constants var SBOX_P = [ { 0x0: 0x808200, 0x10000000: 0x8000, 0x20000000: 0x808002, 0x30000000: 0x2, 0x40000000: 0x200, 0x50000000: 0x808202, 0x60000000: 0x800202, 0x70000000: 0x800000, 0x80000000: 0x202, 0x90000000: 0x800200, 0xa0000000: 0x8200, 0xb0000000: 0x808000, 0xc0000000: 0x8002, 0xd0000000: 0x800002, 0xe0000000: 0x0, 0xf0000000: 0x8202, 0x8000000: 0x0, 0x18000000: 0x808202, 0x28000000: 0x8202, 0x38000000: 0x8000, 0x48000000: 0x808200, 0x58000000: 0x200, 0x68000000: 0x808002, 0x78000000: 0x2, 0x88000000: 0x800200, 0x98000000: 0x8200, 0xa8000000: 0x808000, 0xb8000000: 0x800202, 0xc8000000: 0x800002, 0xd8000000: 0x8002, 0xe8000000: 0x202, 0xf8000000: 0x800000, 0x1: 0x8000, 0x10000001: 0x2, 0x20000001: 0x808200, 0x30000001: 0x800000, 0x40000001: 0x808002, 0x50000001: 0x8200, 0x60000001: 0x200, 0x70000001: 0x800202, 0x80000001: 0x808202, 0x90000001: 0x808000, 0xa0000001: 0x800002, 0xb0000001: 0x8202, 0xc0000001: 0x202, 0xd0000001: 0x800200, 0xe0000001: 0x8002, 0xf0000001: 0x0, 0x8000001: 0x808202, 0x18000001: 0x808000, 0x28000001: 0x800000, 0x38000001: 0x200, 0x48000001: 0x8000, 0x58000001: 0x800002, 0x68000001: 0x2, 0x78000001: 0x8202, 0x88000001: 0x8002, 0x98000001: 0x800202, 0xa8000001: 0x202, 0xb8000001: 0x808200, 0xc8000001: 0x800200, 0xd8000001: 0x0, 0xe8000001: 0x8200, 0xf8000001: 0x808002 }, { 0x0: 0x40084010, 0x1000000: 0x4000, 0x2000000: 0x80000, 0x3000000: 0x40080010, 0x4000000: 0x40000010, 0x5000000: 0x40084000, 0x6000000: 0x40004000, 0x7000000: 0x10, 0x8000000: 0x84000, 0x9000000: 0x40004010, 0xa000000: 0x40000000, 0xb000000: 0x84010, 0xc000000: 0x80010, 0xd000000: 0x0, 0xe000000: 0x4010, 0xf000000: 0x40080000, 0x800000: 0x40004000, 0x1800000: 0x84010, 0x2800000: 0x10, 0x3800000: 0x40004010, 0x4800000: 0x40084010, 0x5800000: 0x40000000, 0x6800000: 0x80000, 0x7800000: 0x40080010, 0x8800000: 0x80010, 0x9800000: 0x0, 0xa800000: 0x4000, 0xb800000: 0x40080000, 0xc800000: 0x40000010, 0xd800000: 0x84000, 0xe800000: 0x40084000, 0xf800000: 0x4010, 0x10000000: 0x0, 0x11000000: 0x40080010, 0x12000000: 0x40004010, 0x13000000: 0x40084000, 0x14000000: 0x40080000, 0x15000000: 0x10, 0x16000000: 0x84010, 0x17000000: 0x4000, 0x18000000: 0x4010, 0x19000000: 0x80000, 0x1a000000: 0x80010, 0x1b000000: 0x40000010, 0x1c000000: 0x84000, 0x1d000000: 0x40004000, 0x1e000000: 0x40000000, 0x1f000000: 0x40084010, 0x10800000: 0x84010, 0x11800000: 0x80000, 0x12800000: 0x40080000, 0x13800000: 0x4000, 0x14800000: 0x40004000, 0x15800000: 0x40084010, 0x16800000: 0x10, 0x17800000: 0x40000000, 0x18800000: 0x40084000, 0x19800000: 0x40000010, 0x1a800000: 0x40004010, 0x1b800000: 0x80010, 0x1c800000: 0x0, 0x1d800000: 0x4010, 0x1e800000: 0x40080010, 0x1f800000: 0x84000 }, { 0x0: 0x104, 0x100000: 0x0, 0x200000: 0x4000100, 0x300000: 0x10104, 0x400000: 0x10004, 0x500000: 0x4000004, 0x600000: 0x4010104, 0x700000: 0x4010000, 0x800000: 0x4000000, 0x900000: 0x4010100, 0xa00000: 0x10100, 0xb00000: 0x4010004, 0xc00000: 0x4000104, 0xd00000: 0x10000, 0xe00000: 0x4, 0xf00000: 0x100, 0x80000: 0x4010100, 0x180000: 0x4010004, 0x280000: 0x0, 0x380000: 0x4000100, 0x480000: 0x4000004, 0x580000: 0x10000, 0x680000: 0x10004, 0x780000: 0x104, 0x880000: 0x4, 0x980000: 0x100, 0xa80000: 0x4010000, 0xb80000: 0x10104, 0xc80000: 0x10100, 0xd80000: 0x4000104, 0xe80000: 0x4010104, 0xf80000: 0x4000000, 0x1000000: 0x4010100, 0x1100000: 0x10004, 0x1200000: 0x10000, 0x1300000: 0x4000100, 0x1400000: 0x100, 0x1500000: 0x4010104, 0x1600000: 0x4000004, 0x1700000: 0x0, 0x1800000: 0x4000104, 0x1900000: 0x4000000, 0x1a00000: 0x4, 0x1b00000: 0x10100, 0x1c00000: 0x4010000, 0x1d00000: 0x104, 0x1e00000: 0x10104, 0x1f00000: 0x4010004, 0x1080000: 0x4000000, 0x1180000: 0x104, 0x1280000: 0x4010100, 0x1380000: 0x0, 0x1480000: 0x10004, 0x1580000: 0x4000100, 0x1680000: 0x100, 0x1780000: 0x4010004, 0x1880000: 0x10000, 0x1980000: 0x4010104, 0x1a80000: 0x10104, 0x1b80000: 0x4000004, 0x1c80000: 0x4000104, 0x1d80000: 0x4010000, 0x1e80000: 0x4, 0x1f80000: 0x10100 }, { 0x0: 0x80401000, 0x10000: 0x80001040, 0x20000: 0x401040, 0x30000: 0x80400000, 0x40000: 0x0, 0x50000: 0x401000, 0x60000: 0x80000040, 0x70000: 0x400040, 0x80000: 0x80000000, 0x90000: 0x400000, 0xa0000: 0x40, 0xb0000: 0x80001000, 0xc0000: 0x80400040, 0xd0000: 0x1040, 0xe0000: 0x1000, 0xf0000: 0x80401040, 0x8000: 0x80001040, 0x18000: 0x40, 0x28000: 0x80400040, 0x38000: 0x80001000, 0x48000: 0x401000, 0x58000: 0x80401040, 0x68000: 0x0, 0x78000: 0x80400000, 0x88000: 0x1000, 0x98000: 0x80401000, 0xa8000: 0x400000, 0xb8000: 0x1040, 0xc8000: 0x80000000, 0xd8000: 0x400040, 0xe8000: 0x401040, 0xf8000: 0x80000040, 0x100000: 0x400040, 0x110000: 0x401000, 0x120000: 0x80000040, 0x130000: 0x0, 0x140000: 0x1040, 0x150000: 0x80400040, 0x160000: 0x80401000, 0x170000: 0x80001040, 0x180000: 0x80401040, 0x190000: 0x80000000, 0x1a0000: 0x80400000, 0x1b0000: 0x401040, 0x1c0000: 0x80001000, 0x1d0000: 0x400000, 0x1e0000: 0x40, 0x1f0000: 0x1000, 0x108000: 0x80400000, 0x118000: 0x80401040, 0x128000: 0x0, 0x138000: 0x401000, 0x148000: 0x400040, 0x158000: 0x80000000, 0x168000: 0x80001040, 0x178000: 0x40, 0x188000: 0x80000040, 0x198000: 0x1000, 0x1a8000: 0x80001000, 0x1b8000: 0x80400040, 0x1c8000: 0x1040, 0x1d8000: 0x80401000, 0x1e8000: 0x400000, 0x1f8000: 0x401040 }, { 0x0: 0x80, 0x1000: 0x1040000, 0x2000: 0x40000, 0x3000: 0x20000000, 0x4000: 0x20040080, 0x5000: 0x1000080, 0x6000: 0x21000080, 0x7000: 0x40080, 0x8000: 0x1000000, 0x9000: 0x20040000, 0xa000: 0x20000080, 0xb000: 0x21040080, 0xc000: 0x21040000, 0xd000: 0x0, 0xe000: 0x1040080, 0xf000: 0x21000000, 0x800: 0x1040080, 0x1800: 0x21000080, 0x2800: 0x80, 0x3800: 0x1040000, 0x4800: 0x40000, 0x5800: 0x20040080, 0x6800: 0x21040000, 0x7800: 0x20000000, 0x8800: 0x20040000, 0x9800: 0x0, 0xa800: 0x21040080, 0xb800: 0x1000080, 0xc800: 0x20000080, 0xd800: 0x21000000, 0xe800: 0x1000000, 0xf800: 0x40080, 0x10000: 0x40000, 0x11000: 0x80, 0x12000: 0x20000000, 0x13000: 0x21000080, 0x14000: 0x1000080, 0x15000: 0x21040000, 0x16000: 0x20040080, 0x17000: 0x1000000, 0x18000: 0x21040080, 0x19000: 0x21000000, 0x1a000: 0x1040000, 0x1b000: 0x20040000, 0x1c000: 0x40080, 0x1d000: 0x20000080, 0x1e000: 0x0, 0x1f000: 0x1040080, 0x10800: 0x21000080, 0x11800: 0x1000000, 0x12800: 0x1040000, 0x13800: 0x20040080, 0x14800: 0x20000000, 0x15800: 0x1040080, 0x16800: 0x80, 0x17800: 0x21040000, 0x18800: 0x40080, 0x19800: 0x21040080, 0x1a800: 0x0, 0x1b800: 0x21000000, 0x1c800: 0x1000080, 0x1d800: 0x40000, 0x1e800: 0x20040000, 0x1f800: 0x20000080 }, { 0x0: 0x10000008, 0x100: 0x2000, 0x200: 0x10200000, 0x300: 0x10202008, 0x400: 0x10002000, 0x500: 0x200000, 0x600: 0x200008, 0x700: 0x10000000, 0x800: 0x0, 0x900: 0x10002008, 0xa00: 0x202000, 0xb00: 0x8, 0xc00: 0x10200008, 0xd00: 0x202008, 0xe00: 0x2008, 0xf00: 0x10202000, 0x80: 0x10200000, 0x180: 0x10202008, 0x280: 0x8, 0x380: 0x200000, 0x480: 0x202008, 0x580: 0x10000008, 0x680: 0x10002000, 0x780: 0x2008, 0x880: 0x200008, 0x980: 0x2000, 0xa80: 0x10002008, 0xb80: 0x10200008, 0xc80: 0x0, 0xd80: 0x10202000, 0xe80: 0x202000, 0xf80: 0x10000000, 0x1000: 0x10002000, 0x1100: 0x10200008, 0x1200: 0x10202008, 0x1300: 0x2008, 0x1400: 0x200000, 0x1500: 0x10000000, 0x1600: 0x10000008, 0x1700: 0x202000, 0x1800: 0x202008, 0x1900: 0x0, 0x1a00: 0x8, 0x1b00: 0x10200000, 0x1c00: 0x2000, 0x1d00: 0x10002008, 0x1e00: 0x10202000, 0x1f00: 0x200008, 0x1080: 0x8, 0x1180: 0x202000, 0x1280: 0x200000, 0x1380: 0x10000008, 0x1480: 0x10002000, 0x1580: 0x2008, 0x1680: 0x10202008, 0x1780: 0x10200000, 0x1880: 0x10202000, 0x1980: 0x10200008, 0x1a80: 0x2000, 0x1b80: 0x202008, 0x1c80: 0x200008, 0x1d80: 0x0, 0x1e80: 0x10000000, 0x1f80: 0x10002008 }, { 0x0: 0x100000, 0x10: 0x2000401, 0x20: 0x400, 0x30: 0x100401, 0x40: 0x2100401, 0x50: 0x0, 0x60: 0x1, 0x70: 0x2100001, 0x80: 0x2000400, 0x90: 0x100001, 0xa0: 0x2000001, 0xb0: 0x2100400, 0xc0: 0x2100000, 0xd0: 0x401, 0xe0: 0x100400, 0xf0: 0x2000000, 0x8: 0x2100001, 0x18: 0x0, 0x28: 0x2000401, 0x38: 0x2100400, 0x48: 0x100000, 0x58: 0x2000001, 0x68: 0x2000000, 0x78: 0x401, 0x88: 0x100401, 0x98: 0x2000400, 0xa8: 0x2100000, 0xb8: 0x100001, 0xc8: 0x400, 0xd8: 0x2100401, 0xe8: 0x1, 0xf8: 0x100400, 0x100: 0x2000000, 0x110: 0x100000, 0x120: 0x2000401, 0x130: 0x2100001, 0x140: 0x100001, 0x150: 0x2000400, 0x160: 0x2100400, 0x170: 0x100401, 0x180: 0x401, 0x190: 0x2100401, 0x1a0: 0x100400, 0x1b0: 0x1, 0x1c0: 0x0, 0x1d0: 0x2100000, 0x1e0: 0x2000001, 0x1f0: 0x400, 0x108: 0x100400, 0x118: 0x2000401, 0x128: 0x2100001, 0x138: 0x1, 0x148: 0x2000000, 0x158: 0x100000, 0x168: 0x401, 0x178: 0x2100400, 0x188: 0x2000001, 0x198: 0x2100000, 0x1a8: 0x0, 0x1b8: 0x2100401, 0x1c8: 0x100401, 0x1d8: 0x400, 0x1e8: 0x2000400, 0x1f8: 0x100001 }, { 0x0: 0x8000820, 0x1: 0x20000, 0x2: 0x8000000, 0x3: 0x20, 0x4: 0x20020, 0x5: 0x8020820, 0x6: 0x8020800, 0x7: 0x800, 0x8: 0x8020000, 0x9: 0x8000800, 0xa: 0x20800, 0xb: 0x8020020, 0xc: 0x820, 0xd: 0x0, 0xe: 0x8000020, 0xf: 0x20820, 0x80000000: 0x800, 0x80000001: 0x8020820, 0x80000002: 0x8000820, 0x80000003: 0x8000000, 0x80000004: 0x8020000, 0x80000005: 0x20800, 0x80000006: 0x20820, 0x80000007: 0x20, 0x80000008: 0x8000020, 0x80000009: 0x820, 0x8000000a: 0x20020, 0x8000000b: 0x8020800, 0x8000000c: 0x0, 0x8000000d: 0x8020020, 0x8000000e: 0x8000800, 0x8000000f: 0x20000, 0x10: 0x20820, 0x11: 0x8020800, 0x12: 0x20, 0x13: 0x800, 0x14: 0x8000800, 0x15: 0x8000020, 0x16: 0x8020020, 0x17: 0x20000, 0x18: 0x0, 0x19: 0x20020, 0x1a: 0x8020000, 0x1b: 0x8000820, 0x1c: 0x8020820, 0x1d: 0x20800, 0x1e: 0x820, 0x1f: 0x8000000, 0x80000010: 0x20000, 0x80000011: 0x800, 0x80000012: 0x8020020, 0x80000013: 0x20820, 0x80000014: 0x20, 0x80000015: 0x8020000, 0x80000016: 0x8000000, 0x80000017: 0x8000820, 0x80000018: 0x8020820, 0x80000019: 0x8000020, 0x8000001a: 0x8000800, 0x8000001b: 0x0, 0x8000001c: 0x20800, 0x8000001d: 0x820, 0x8000001e: 0x20020, 0x8000001f: 0x8020800 } ]; // Masks that select the SBOX input var SBOX_MASK = [ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f ]; /** * DES block cipher algorithm. */ var DES = C_algo.DES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Select 56 bits according to PC1 var keyBits = []; for (var i = 0; i < 56; i++) { var keyBitPos = PC1[i] - 1; keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; } // Assemble 16 subkeys var subKeys = this._subKeys = []; for (var nSubKey = 0; nSubKey < 16; nSubKey++) { // Create subkey var subKey = subKeys[nSubKey] = []; // Shortcut var bitShift = BIT_SHIFTS[nSubKey]; // Select 48 bits according to PC2 for (var i = 0; i < 24; i++) { // Select from the left 28 key bits subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); // Select from the right 28 key bits subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); } // Since each subkey is applied to an expanded 32-bit input, // the subkey can be broken into 8 values scaled to 32-bits, // which allows the key to be used without expansion subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); for (var i = 1; i < 7; i++) { subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); } subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); } // Compute inverse subkeys var invSubKeys = this._invSubKeys = []; for (var i = 0; i < 16; i++) { invSubKeys[i] = subKeys[15 - i]; } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._subKeys); }, decryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._invSubKeys); }, _doCryptBlock: function (M, offset, subKeys) { // Get input this._lBlock = M[offset]; this._rBlock = M[offset + 1]; // Initial permutation exchangeLR.call(this, 4, 0x0f0f0f0f); exchangeLR.call(this, 16, 0x0000ffff); exchangeRL.call(this, 2, 0x33333333); exchangeRL.call(this, 8, 0x00ff00ff); exchangeLR.call(this, 1, 0x55555555); // Rounds for (var round = 0; round < 16; round++) { // Shortcuts var subKey = subKeys[round]; var lBlock = this._lBlock; var rBlock = this._rBlock; // Feistel function var f = 0; for (var i = 0; i < 8; i++) { f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; } this._lBlock = rBlock; this._rBlock = lBlock ^ f; } // Undo swap from last round var t = this._lBlock; this._lBlock = this._rBlock; this._rBlock = t; // Final permutation exchangeLR.call(this, 1, 0x55555555); exchangeRL.call(this, 8, 0x00ff00ff); exchangeRL.call(this, 2, 0x33333333); exchangeLR.call(this, 16, 0x0000ffff); exchangeLR.call(this, 4, 0x0f0f0f0f); // Set output M[offset] = this._lBlock; M[offset + 1] = this._rBlock; }, keySize: 64/32, ivSize: 64/32, blockSize: 64/32 }); // Swap bits across the left and right words function exchangeLR(offset, mask) { var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; this._rBlock ^= t; this._lBlock ^= t << offset; } function exchangeRL(offset, mask) { var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; this._lBlock ^= t; this._rBlock ^= t << offset; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); */ C.DES = BlockCipher._createHelper(DES); /** * Triple-DES block cipher algorithm. */ var TripleDES = C_algo.TripleDES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Create DES instances this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2))); this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4))); this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6))); }, encryptBlock: function (M, offset) { this._des1.encryptBlock(M, offset); this._des2.decryptBlock(M, offset); this._des3.encryptBlock(M, offset); }, decryptBlock: function (M, offset) { this._des3.decryptBlock(M, offset); this._des2.encryptBlock(M, offset); this._des1.decryptBlock(M, offset); }, keySize: 192/32, ivSize: 64/32, blockSize: 64/32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); */ C.TripleDES = BlockCipher._createHelper(TripleDES); }()); return CryptoJS.TripleDES; })); },{"./cipher-core":47,"./core":48,"./enc-base64":49,"./evpkdf":51,"./md5":56}],79:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var X32WordArray = C_lib.WordArray; /** * x64 namespace. */ var C_x64 = C.x64 = {}; /** * A 64-bit word. */ var X64Word = C_x64.Word = Base.extend({ /** * Initializes a newly created 64-bit word. * * @param {number} high The high 32 bits. * @param {number} low The low 32 bits. * * @example * * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); */ init: function (high, low) { this.high = high; this.low = low; } /** * Bitwise NOTs this word. * * @return {X64Word} A new x64-Word object after negating. * * @example * * var negated = x64Word.not(); */ // not: function () { // var high = ~this.high; // var low = ~this.low; // return X64Word.create(high, low); // }, /** * Bitwise ANDs this word with the passed word. * * @param {X64Word} word The x64-Word to AND with this word. * * @return {X64Word} A new x64-Word object after ANDing. * * @example * * var anded = x64Word.and(anotherX64Word); */ // and: function (word) { // var high = this.high & word.high; // var low = this.low & word.low; // return X64Word.create(high, low); // }, /** * Bitwise ORs this word with the passed word. * * @param {X64Word} word The x64-Word to OR with this word. * * @return {X64Word} A new x64-Word object after ORing. * * @example * * var ored = x64Word.or(anotherX64Word); */ // or: function (word) { // var high = this.high | word.high; // var low = this.low | word.low; // return X64Word.create(high, low); // }, /** * Bitwise XORs this word with the passed word. * * @param {X64Word} word The x64-Word to XOR with this word. * * @return {X64Word} A new x64-Word object after XORing. * * @example * * var xored = x64Word.xor(anotherX64Word); */ // xor: function (word) { // var high = this.high ^ word.high; // var low = this.low ^ word.low; // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the left. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftL(25); */ // shiftL: function (n) { // if (n < 32) { // var high = (this.high << n) | (this.low >>> (32 - n)); // var low = this.low << n; // } else { // var high = this.low << (n - 32); // var low = 0; // } // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the right. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftR(7); */ // shiftR: function (n) { // if (n < 32) { // var low = (this.low >>> n) | (this.high << (32 - n)); // var high = this.high >>> n; // } else { // var low = this.high >>> (n - 32); // var high = 0; // } // return X64Word.create(high, low); // }, /** * Rotates this word n bits to the left. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotL(25); */ // rotL: function (n) { // return this.shiftL(n).or(this.shiftR(64 - n)); // }, /** * Rotates this word n bits to the right. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotR(7); */ // rotR: function (n) { // return this.shiftR(n).or(this.shiftL(64 - n)); // }, /** * Adds this word with the passed word. * * @param {X64Word} word The x64-Word to add with this word. * * @return {X64Word} A new x64-Word object after adding. * * @example * * var added = x64Word.add(anotherX64Word); */ // add: function (word) { // var low = (this.low + word.low) | 0; // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; // var high = (this.high + word.high + carry) | 0; // return X64Word.create(high, low); // } }); /** * An array of 64-bit words. * * @property {Array} words The array of CryptoJS.x64.Word objects. * @property {number} sigBytes The number of significant bytes in this word array. */ var X64WordArray = C_x64.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.x64.WordArray.create(); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ]); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ], 10); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 8; } }, /** * Converts this 64-bit word array to a 32-bit word array. * * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. * * @example * * var x32WordArray = x64WordArray.toX32(); */ toX32: function () { // Shortcuts var x64Words = this.words; var x64WordsLength = x64Words.length; // Convert var x32Words = []; for (var i = 0; i < x64WordsLength; i++) { var x64Word = x64Words[i]; x32Words.push(x64Word.high); x32Words.push(x64Word.low); } return X32WordArray.create(x32Words, this.sigBytes); }, /** * Creates a copy of this word array. * * @return {X64WordArray} The clone. * * @example * * var clone = x64WordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); // Clone "words" array var words = clone.words = this.words.slice(0); // Clone each X64Word object var wordsLength = words.length; for (var i = 0; i < wordsLength; i++) { words[i] = words[i].clone(); } return clone; } }); }()); return CryptoJS; })); },{"./core":48}],80:[function(_dereq_,module,exports){ // Some code originally from async_storage.js in // [Gaia](https://github.com/mozilla-b2g/gaia). (function() { 'use strict'; // Originally found in https://github.com/mozilla-b2g/gaia/blob/e8f624e4cc9ea945727278039b3bc9bcb9f8667a/shared/js/async_storage.js // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; // Initialize IndexedDB; fall back to vendor-prefixed versions if needed. var indexedDB = indexedDB || this.indexedDB || this.webkitIndexedDB || this.mozIndexedDB || this.OIndexedDB || this.msIndexedDB; // If IndexedDB isn't available, we get outta here! if (!indexedDB) { return; } var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support'; var supportsBlobs; // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). function _createBlob(parts, properties) { parts = parts || []; properties = properties || {}; try { return new Blob(parts, properties); } catch (e) { if (e.name !== 'TypeError') { throw e; } var BlobBuilder = window.BlobBuilder || window.MSBlobBuilder || window.MozBlobBuilder || window.WebKitBlobBuilder; var builder = new BlobBuilder(); for (var i = 0; i < parts.length; i += 1) { builder.append(parts[i]); } return builder.getBlob(properties.type); } } // Transform a binary string to an array buffer, because otherwise // weird stuff happens when you try to work with the binary string directly. // It is known. // From http://stackoverflow.com/questions/14967647/ (continues on next line) // encode-decode-image-with-base64-breaks-image (2013-04-21) function _binStringToArrayBuffer(bin) { var length = bin.length; var buf = new ArrayBuffer(length); var arr = new Uint8Array(buf); for (var i = 0; i < length; i++) { arr[i] = bin.charCodeAt(i); } return buf; } // Fetch a blob using ajax. This reveals bugs in Chrome < 43. // For details on all this junk: // https://github.com/nolanlawson/state-of-binary-data-in-the-browser#readme function _blobAjax(url) { return new Promise(function(resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.withCredentials = true; xhr.responseType = 'arraybuffer'; xhr.onreadystatechange = function() { if (xhr.readyState !== 4) { return; } if (xhr.status === 200) { return resolve({ response: xhr.response, type: xhr.getResponseHeader('Content-Type') }); } reject({status: xhr.status, response: xhr.response}); }; xhr.send(); }); } // // Detect blob support. Chrome didn't support it until version 38. // In version 37 they had a broken version where PNGs (and possibly // other binary types) aren't stored correctly, because when you fetch // them, the content type is always null. // // Furthermore, they have some outstanding bugs where blobs occasionally // are read by FileReader as null, or by ajax as 404s. // // Sadly we use the 404 bug to detect the FileReader bug, so if they // get fixed independently and released in different versions of Chrome, // then the bug could come back. So it's worthwhile to watch these issues: // 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916 // FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836 // function _checkBlobSupportWithoutCaching(idb) { return new Promise(function(resolve, reject) { var blob = _createBlob([''], {type: 'image/png'}); var txn = idb.transaction([DETECT_BLOB_SUPPORT_STORE], 'readwrite'); txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key'); txn.oncomplete = function() { // have to do it in a separate transaction, else the correct // content type is always returned var blobTxn = idb.transaction([DETECT_BLOB_SUPPORT_STORE], 'readwrite'); var getBlobReq = blobTxn.objectStore( DETECT_BLOB_SUPPORT_STORE).get('key'); getBlobReq.onerror = reject; getBlobReq.onsuccess = function(e) { var storedBlob = e.target.result; var url = URL.createObjectURL(storedBlob); _blobAjax(url).then(function(res) { resolve(!!(res && res.type === 'image/png')); }, function() { resolve(false); }).then(function() { URL.revokeObjectURL(url); }); }; }; })['catch'](function() { return false; // error, so assume unsupported }); } function _checkBlobSupport(idb) { if (typeof supportsBlobs === 'boolean') { return Promise.resolve(supportsBlobs); } return _checkBlobSupportWithoutCaching(idb).then(function(value) { supportsBlobs = value; return supportsBlobs; }); } // encode a blob for indexeddb engines that don't support blobs function _encodeBlob(blob) { return new Promise(function(resolve, reject) { var reader = new FileReader(); reader.onerror = reject; reader.onloadend = function(e) { var base64 = btoa(e.target.result || ''); resolve({ __local_forage_encoded_blob: true, data: base64, type: blob.type }); }; reader.readAsBinaryString(blob); }); } // decode an encoded blob function _decodeBlob(encodedBlob) { var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data)); return _createBlob([arrayBuff], { type: encodedBlob.type}); } // is this one of our fancy encoded blobs? function _isEncodedBlob(value) { return value && value.__local_forage_encoded_blob; } // Open the IndexedDB database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } return new Promise(function(resolve, reject) { var openreq = indexedDB.open(dbInfo.name, dbInfo.version); openreq.onerror = function() { reject(openreq.error); }; openreq.onupgradeneeded = function(e) { // First time setup: create an empty object store openreq.result.createObjectStore(dbInfo.storeName); if (e.oldVersion <= 1) { // added when support for blob shims was added openreq.result.createObjectStore(DETECT_BLOB_SUPPORT_STORE); } }; openreq.onsuccess = function() { dbInfo.db = openreq.result; self._dbInfo = dbInfo; resolve(); }; }); } function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.get(key); req.onsuccess = function() { var value = req.result; if (value === undefined) { value = null; } if (_isEncodedBlob(value)) { value = _decodeBlob(value); } resolve(value); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Iterate over all items stored in database. function iterate(iterator, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.openCursor(); var iterationNumber = 1; req.onsuccess = function() { var cursor = req.result; if (cursor) { var value = cursor.value; if (_isEncodedBlob(value)) { value = _decodeBlob(value); } var result = iterator(value, cursor.key, iterationNumber++); if (result !== void(0)) { resolve(result); } else { cursor['continue'](); } } else { resolve(); } }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { var dbInfo; self.ready().then(function() { dbInfo = self._dbInfo; return _checkBlobSupport(dbInfo.db); }).then(function(blobSupport) { if (!blobSupport && value instanceof Blob) { return _encodeBlob(value); } return value; }).then(function(value) { var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); // The reason we don't _save_ null is because IE 10 does // not support saving the `null` type in IndexedDB. How // ironic, given the bug below! // See: https://github.com/mozilla/localForage/issues/161 if (value === null) { value = undefined; } var req = store.put(value, key); transaction.oncomplete = function() { // Cast to undefined so the value passed to // callback/promise is the same as what one would get out // of `getItem()` later. This leads to some weirdness // (setItem('foo', undefined) will return `null`), but // it's not my fault localStorage is our baseline and that // it's weird. if (value === undefined) { value = null; } resolve(value); }; transaction.onabort = transaction.onerror = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); // We use a Grunt task to make this safe for IE and some // versions of Android (including those used by Cordova). // Normally IE won't like `['delete']()` and will insist on // using `['delete']()`, but we have a build step that // fixes this for us now. var req = store['delete'](key); transaction.oncomplete = function() { resolve(); }; transaction.onerror = function() { reject(req.error); }; // The request will be also be aborted if we've exceeded our storage // space. transaction.onabort = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function clear(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); var req = store.clear(); transaction.oncomplete = function() { resolve(); }; transaction.onabort = transaction.onerror = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function length(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.count(); req.onsuccess = function() { resolve(req.result); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function key(n, callback) { var self = this; var promise = new Promise(function(resolve, reject) { if (n < 0) { resolve(null); return; } self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var advanced = false; var req = store.openCursor(); req.onsuccess = function() { var cursor = req.result; if (!cursor) { // this means there weren't enough keys resolve(null); return; } if (n === 0) { // We have the first key, return it if that's what they // wanted. resolve(cursor.key); } else { if (!advanced) { // Otherwise, ask the cursor to skip ahead n // records. advanced = true; cursor.advance(n); } else { // When we get here, we've got the nth key. resolve(cursor.key); } } }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.openCursor(); var keys = []; req.onsuccess = function() { var cursor = req.result; if (!cursor) { resolve(keys); return; } keys.push(cursor.key); cursor['continue'](); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var asyncStorage = { _driver: 'asyncStorage', _initStorage: _initStorage, iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { module.exports = asyncStorage; } else if (typeof define === 'function' && define.amd) { define('asyncStorage', function() { return asyncStorage; }); } else { this.asyncStorage = asyncStorage; } }).call(window); },{"promise":103}],81:[function(_dereq_,module,exports){ // If IndexedDB isn't available, we'll fall back to localStorage. // Note that this will have considerable performance and storage // side-effects (all data will be serialized on save and only data that // can be converted to a string via `JSON.stringify()` will be saved). (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; var globalObject = this; var serializer = null; var localStorage = null; // If the app is running inside a Google Chrome packaged webapp, or some // other context where localStorage isn't available, we don't use // localStorage. This feature detection is preferred over the old // `if (window.chrome && window.chrome.runtime)` code. // See: https://github.com/mozilla/localForage/issues/68 try { // If localStorage isn't available, we get outta here! // This should be inside a try catch if (!this.localStorage || !('setItem' in this.localStorage)) { return; } // Initialize localStorage and create a variable to use throughout // the code. localStorage = this.localStorage; } catch (e) { return; } var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Config the localStorage backend, using options set in the config. function _initStorage(options) { var self = this; var dbInfo = {}; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } dbInfo.keyPrefix = dbInfo.name + '/'; self._dbInfo = dbInfo; var serializerPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_(['localforageSerializer'], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly resolve(_dereq_('./../utils/serializer')); } else { resolve(globalObject.localforageSerializer); } }); return serializerPromise.then(function(lib) { serializer = lib; return Promise.resolve(); }); } // Remove all keys from the datastore, effectively destroying all data in // the app's key/value store! function clear(callback) { var self = this; var promise = self.ready().then(function() { var keyPrefix = self._dbInfo.keyPrefix; for (var i = localStorage.length - 1; i >= 0; i--) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) === 0) { localStorage.removeItem(key); } } }); executeCallback(promise, callback); return promise; } // Retrieve an item from the store. Unlike the original async_storage // library in Gaia, we don't modify return values at all. If a key's value // is `undefined`, we pass that value to the callback function. function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var result = localStorage.getItem(dbInfo.keyPrefix + key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the key // is likely undefined and we'll pass it straight to the // callback. if (result) { result = serializer.deserialize(result); } return result; }); executeCallback(promise, callback); return promise; } // Iterate over all items in the store. function iterate(iterator, callback) { var self = this; var promise = self.ready().then(function() { var keyPrefix = self._dbInfo.keyPrefix; var keyPrefixLength = keyPrefix.length; var length = localStorage.length; // We use a dedicated iterator instead of the `i` variable below // so other keys we fetch in localStorage aren't counted in // the `iterationNumber` argument passed to the `iterate()` // callback. // // See: github.com/mozilla/localForage/pull/435#discussion_r38061530 var iterationNumber = 1; for (var i = 0; i < length; i++) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) !== 0) { continue; } var value = localStorage.getItem(key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the // key is likely undefined and we'll pass it straight // to the iterator. if (value) { value = serializer.deserialize(value); } value = iterator(value, key.substring(keyPrefixLength), iterationNumber++); if (value !== void(0)) { return value; } } }); executeCallback(promise, callback); return promise; } // Same as localStorage's key() method, except takes a callback. function key(n, callback) { var self = this; var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var result; try { result = localStorage.key(n); } catch (error) { result = null; } // Remove the prefix from the key, if a key is found. if (result) { result = result.substring(dbInfo.keyPrefix.length); } return result; }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var length = localStorage.length; var keys = []; for (var i = 0; i < length; i++) { if (localStorage.key(i).indexOf(dbInfo.keyPrefix) === 0) { keys.push(localStorage.key(i).substring(dbInfo.keyPrefix.length)); } } return keys; }); executeCallback(promise, callback); return promise; } // Supply the number of keys in the datastore to the callback function. function length(callback) { var self = this; var promise = self.keys().then(function(keys) { return keys.length; }); executeCallback(promise, callback); return promise; } // Remove an item from the store, nice and simple. function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { var dbInfo = self._dbInfo; localStorage.removeItem(dbInfo.keyPrefix + key); }); executeCallback(promise, callback); return promise; } // Set a key's value and run an optional callback once the value is set. // Unlike Gaia's implementation, the callback function is passed the value, // in case you want to operate on that value only after you're sure it // saved, or something like that. function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { // Convert undefined values to null. // https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; return new Promise(function(resolve, reject) { serializer.serialize(value, function(value, error) { if (error) { reject(error); } else { try { var dbInfo = self._dbInfo; localStorage.setItem(dbInfo.keyPrefix + key, value); resolve(originalValue); } catch (e) { // localStorage capacity exceeded. // TODO: Make this a specific error/event. if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { reject(e); } reject(e); } } }); }); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var localStorageWrapper = { _driver: 'localStorageWrapper', _initStorage: _initStorage, // Default API, from Gaia/localStorage. iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (moduleType === ModuleType.EXPORT) { module.exports = localStorageWrapper; } else if (moduleType === ModuleType.DEFINE) { define('localStorageWrapper', function() { return localStorageWrapper; }); } else { this.localStorageWrapper = localStorageWrapper; } }).call(window); },{"./../utils/serializer":84,"promise":103}],82:[function(_dereq_,module,exports){ /* * Includes code from: * * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer * * Copyright (c) 2012 Niklas von Hertzen * Licensed under the MIT license. */ (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; var globalObject = this; var serializer = null; var openDatabase = this.openDatabase; // If WebSQL methods aren't available, we can stop now. if (!openDatabase) { return; } var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Open the WebSQL database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = typeof(options[i]) !== 'string' ? options[i].toString() : options[i]; } } var serializerPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_(['localforageSerializer'], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly resolve(_dereq_('./../utils/serializer')); } else { resolve(globalObject.localforageSerializer); } }); var dbInfoPromise = new Promise(function(resolve, reject) { // Open the database; the openDatabase API will automatically // create it for us if it doesn't exist. try { dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size); } catch (e) { return self.setDriver(self.LOCALSTORAGE).then(function() { return self._initStorage(options); }).then(resolve)['catch'](reject); } // Create our key/value table if it doesn't exist. dbInfo.db.transaction(function(t) { t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' (id INTEGER PRIMARY KEY, key unique, value)', [], function() { self._dbInfo = dbInfo; resolve(); }, function(t, error) { reject(error); }); }); }); return serializerPromise.then(function(lib) { serializer = lib; return dbInfoPromise; }); } function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function(t, results) { var result = results.rows.length ? results.rows.item(0).value : null; // Check to see if this is serialized content we need to // unpack. if (result) { result = serializer.deserialize(result); } resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function iterate(iterator, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT * FROM ' + dbInfo.storeName, [], function(t, results) { var rows = results.rows; var length = rows.length; for (var i = 0; i < length; i++) { var item = rows.item(i); var result = item.value; // Check to see if this is serialized content // we need to unpack. if (result) { result = serializer.deserialize(result); } result = iterator(result, item.key, i + 1); // void(0) prevents problems with redefinition // of `undefined`. if (result !== void(0)) { resolve(result); return; } } resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { // The localStorage API doesn't return undefined values in an // "expected" way, so undefined is always cast to null in all // drivers. See: https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; serializer.serialize(value, function(value, error) { if (error) { reject(error); } else { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('INSERT OR REPLACE INTO ' + dbInfo.storeName + ' (key, value) VALUES (?, ?)', [key, value], function() { resolve(originalValue); }, function(t, error) { reject(error); }); }, function(sqlError) { // The transaction failed; check // to see if it's a quota error. if (sqlError.code === sqlError.QUOTA_ERR) { // We reject the callback outright for now, but // it's worth trying to re-run the transaction. // Even if the user accepts the prompt to use // more storage on Safari, this error will // be called. // // TODO: Try to re-run the transaction. reject(sqlError); } }); } }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function() { resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Deletes every item in the table. // TODO: Find out if this resets the AUTO_INCREMENT number. function clear(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('DELETE FROM ' + dbInfo.storeName, [], function() { resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Does a simple `COUNT(key)` to get the number of items stored in // localForage. function length(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { // Ahhh, SQL makes this one soooooo easy. t.executeSql('SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function(t, results) { var result = results.rows.item(0).c; resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Return the key located at key index X; essentially gets the key from a // `WHERE id = ?`. This is the most efficient way I can think to implement // this rarely-used (in my experience) part of the API, but it can seem // inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so // the ID of each key will change every time it's updated. Perhaps a stored // procedure for the `setItem()` SQL would solve this problem? // TODO: Don't change ID on `setItem()`. function key(n, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function(t, results) { var result = results.rows.length ? results.rows.item(0).key : null; resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT key FROM ' + dbInfo.storeName, [], function(t, results) { var keys = []; for (var i = 0; i < results.rows.length; i++) { keys.push(results.rows.item(i).key); } resolve(keys); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var webSQLStorage = { _driver: 'webSQLStorage', _initStorage: _initStorage, iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (moduleType === ModuleType.DEFINE) { define('webSQLStorage', function() { return webSQLStorage; }); } else if (moduleType === ModuleType.EXPORT) { module.exports = webSQLStorage; } else { this.webSQLStorage = webSQLStorage; } }).call(window); },{"./../utils/serializer":84,"promise":103}],83:[function(_dereq_,module,exports){ (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; // Custom drivers are stored here when `defineDriver()` is called. // They are shared across all instances of localForage. var CustomDrivers = {}; var DriverType = { INDEXEDDB: 'asyncStorage', LOCALSTORAGE: 'localStorageWrapper', WEBSQL: 'webSQLStorage' }; var DefaultDriverOrder = [ DriverType.INDEXEDDB, DriverType.WEBSQL, DriverType.LOCALSTORAGE ]; var LibraryMethods = [ 'clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem' ]; var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; var DefaultConfig = { description: '', driver: DefaultDriverOrder.slice(), name: 'localforage', // Default DB size is _JUST UNDER_ 5MB, as it's the highest size // we can use without a prompt. size: 4980736, storeName: 'keyvaluepairs', version: 1.0 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Check to see if IndexedDB is available and if it is the latest // implementation; it's our preferred backend library. We use "_spec_test" // as the name of the database because it's not the one we'll operate on, // but it's useful to make sure its using the right spec. // See: https://github.com/mozilla/localForage/issues/128 var driverSupport = (function(self) { // Initialize IndexedDB; fall back to vendor-prefixed versions // if needed. var indexedDB = indexedDB || self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.OIndexedDB || self.msIndexedDB; var result = {}; result[DriverType.WEBSQL] = !!self.openDatabase; result[DriverType.INDEXEDDB] = !!(function() { // We mimic PouchDB here; just UA test for Safari (which, as of // iOS 8/Yosemite, doesn't properly support IndexedDB). // IndexedDB support is broken and different from Blink's. // This is faster than the test case (and it's sync), so we just // do this. *SIGH* // http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/ // // We test for openDatabase because IE Mobile identifies itself // as Safari. Oh the lulz... if (typeof self.openDatabase !== 'undefined' && self.navigator && self.navigator.userAgent && /Safari/.test(self.navigator.userAgent) && !/Chrome/.test(self.navigator.userAgent)) { return false; } try { return indexedDB && typeof indexedDB.open === 'function' && // Some Samsung/HTC Android 4.0-4.3 devices // have older IndexedDB specs; if this isn't available // their IndexedDB is too old for us to use. // (Replaces the onupgradeneeded test.) typeof self.IDBKeyRange !== 'undefined'; } catch (e) { return false; } })(); result[DriverType.LOCALSTORAGE] = !!(function() { try { return (self.localStorage && ('setItem' in self.localStorage) && (self.localStorage.setItem)); } catch (e) { return false; } })(); return result; })(this); var isArray = Array.isArray || function(arg) { return Object.prototype.toString.call(arg) === '[object Array]'; }; function callWhenReady(localForageInstance, libraryMethod) { localForageInstance[libraryMethod] = function() { var _args = arguments; return localForageInstance.ready().then(function() { return localForageInstance[libraryMethod].apply(localForageInstance, _args); }); }; } function extend() { for (var i = 1; i < arguments.length; i++) { var arg = arguments[i]; if (arg) { for (var key in arg) { if (arg.hasOwnProperty(key)) { if (isArray(arg[key])) { arguments[0][key] = arg[key].slice(); } else { arguments[0][key] = arg[key]; } } } } } return arguments[0]; } function isLibraryDriver(driverName) { for (var driver in DriverType) { if (DriverType.hasOwnProperty(driver) && DriverType[driver] === driverName) { return true; } } return false; } var globalObject = this; function LocalForage(options) { this._config = extend({}, DefaultConfig, options); this._driverSet = null; this._ready = false; this._dbInfo = null; // Add a stub for each driver API method that delays the call to the // corresponding driver method until localForage is ready. These stubs // will be replaced by the driver methods as soon as the driver is // loaded, so there is no performance impact. for (var i = 0; i < LibraryMethods.length; i++) { callWhenReady(this, LibraryMethods[i]); } this.setDriver(this._config.driver); } LocalForage.prototype.INDEXEDDB = DriverType.INDEXEDDB; LocalForage.prototype.LOCALSTORAGE = DriverType.LOCALSTORAGE; LocalForage.prototype.WEBSQL = DriverType.WEBSQL; // Set any config values for localForage; can be called anytime before // the first API call (e.g. `getItem`, `setItem`). // We loop through options so we don't overwrite existing config // values. LocalForage.prototype.config = function(options) { // If the options argument is an object, we use it to set values. // Otherwise, we return either a specified config value or all // config values. if (typeof(options) === 'object') { // If localforage is ready and fully initialized, we can't set // any new configuration values. Instead, we return an error. if (this._ready) { return new Error("Can't call config() after localforage " + 'has been used.'); } for (var i in options) { if (i === 'storeName') { options[i] = options[i].replace(/\W/g, '_'); } this._config[i] = options[i]; } // after all config options are set and // the driver option is used, try setting it if ('driver' in options && options.driver) { this.setDriver(this._config.driver); } return true; } else if (typeof(options) === 'string') { return this._config[options]; } else { return this._config; } }; // Used to define a custom driver, shared across all instances of // localForage. LocalForage.prototype.defineDriver = function(driverObject, callback, errorCallback) { var defineDriver = new Promise(function(resolve, reject) { try { var driverName = driverObject._driver; var complianceError = new Error( 'Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver' ); var namingError = new Error( 'Custom driver name already in use: ' + driverObject._driver ); // A driver name should be defined and not overlap with the // library-defined, default drivers. if (!driverObject._driver) { reject(complianceError); return; } if (isLibraryDriver(driverObject._driver)) { reject(namingError); return; } var customDriverMethods = LibraryMethods.concat('_initStorage'); for (var i = 0; i < customDriverMethods.length; i++) { var customDriverMethod = customDriverMethods[i]; if (!customDriverMethod || !driverObject[customDriverMethod] || typeof driverObject[customDriverMethod] !== 'function') { reject(complianceError); return; } } var supportPromise = Promise.resolve(true); if ('_support' in driverObject) { if (driverObject._support && typeof driverObject._support === 'function') { supportPromise = driverObject._support(); } else { supportPromise = Promise.resolve(!!driverObject._support); } } supportPromise.then(function(supportResult) { driverSupport[driverName] = supportResult; CustomDrivers[driverName] = driverObject; resolve(); }, reject); } catch (e) { reject(e); } }); defineDriver.then(callback, errorCallback); return defineDriver; }; LocalForage.prototype.driver = function() { return this._driver || null; }; LocalForage.prototype.ready = function(callback) { var self = this; var ready = new Promise(function(resolve, reject) { self._driverSet.then(function() { if (self._ready === null) { self._ready = self._initStorage(self._config); } self._ready.then(resolve, reject); })['catch'](reject); }); ready.then(callback, callback); return ready; }; LocalForage.prototype.setDriver = function(drivers, callback, errorCallback) { var self = this; if (typeof drivers === 'string') { drivers = [drivers]; } this._driverSet = new Promise(function(resolve, reject) { var driverName = self._getFirstSupportedDriver(drivers); var error = new Error('No available storage method found.'); if (!driverName) { self._driverSet = Promise.reject(error); reject(error); return; } self._dbInfo = null; self._ready = null; if (isLibraryDriver(driverName)) { var driverPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_([driverName], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly switch (driverName) { case self.INDEXEDDB: resolve(_dereq_('./drivers/indexeddb')); break; case self.LOCALSTORAGE: resolve(_dereq_('./drivers/localstorage')); break; case self.WEBSQL: resolve(_dereq_('./drivers/websql')); break; } } else { resolve(globalObject[driverName]); } }); driverPromise.then(function(driver) { self._extend(driver); resolve(); }); } else if (CustomDrivers[driverName]) { self._extend(CustomDrivers[driverName]); resolve(); } else { self._driverSet = Promise.reject(error); reject(error); } }); function setDriverToConfig() { self._config.driver = self.driver(); } this._driverSet.then(setDriverToConfig, setDriverToConfig); this._driverSet.then(callback, errorCallback); return this._driverSet; }; LocalForage.prototype.supports = function(driverName) { return !!driverSupport[driverName]; }; LocalForage.prototype._extend = function(libraryMethodsAndProperties) { extend(this, libraryMethodsAndProperties); }; // Used to determine which driver we should use as the backend for this // instance of localForage. LocalForage.prototype._getFirstSupportedDriver = function(drivers) { if (drivers && isArray(drivers)) { for (var i = 0; i < drivers.length; i++) { var driver = drivers[i]; if (this.supports(driver)) { return driver; } } } return null; }; LocalForage.prototype.createInstance = function(options) { return new LocalForage(options); }; // The actual localForage object that we expose as a module or via a // global. It's extended by pulling in one of our other libraries. var localForage = new LocalForage(); // We allow localForage to be declared as a module or as a library // available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { define('localforage', function() { return localForage; }); } else if (moduleType === ModuleType.EXPORT) { module.exports = localForage; } else { this.localforage = localForage; } }).call(window); },{"./drivers/indexeddb":80,"./drivers/localstorage":81,"./drivers/websql":82,"promise":103}],84:[function(_dereq_,module,exports){ (function() { 'use strict'; // Sadly, the best way to save binary data in WebSQL/localStorage is serializing // it to Base64, so this is how we store it to prevent very strange errors with less // verbose ways of binary <-> string data storage. var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var BLOB_TYPE_PREFIX = '~~local_forage_type~'; var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/; var SERIALIZED_MARKER = '__lfsc__:'; var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length; // OMG the serializations! var TYPE_ARRAYBUFFER = 'arbf'; var TYPE_BLOB = 'blob'; var TYPE_INT8ARRAY = 'si08'; var TYPE_UINT8ARRAY = 'ui08'; var TYPE_UINT8CLAMPEDARRAY = 'uic8'; var TYPE_INT16ARRAY = 'si16'; var TYPE_INT32ARRAY = 'si32'; var TYPE_UINT16ARRAY = 'ur16'; var TYPE_UINT32ARRAY = 'ui32'; var TYPE_FLOAT32ARRAY = 'fl32'; var TYPE_FLOAT64ARRAY = 'fl64'; var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length; // Get out of our habit of using `window` inline, at least. var globalObject = this; // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). function _createBlob(parts, properties) { parts = parts || []; properties = properties || {}; try { return new Blob(parts, properties); } catch (err) { if (err.name !== 'TypeError') { throw err; } var BlobBuilder = globalObject.BlobBuilder || globalObject.MSBlobBuilder || globalObject.MozBlobBuilder || globalObject.WebKitBlobBuilder; var builder = new BlobBuilder(); for (var i = 0; i < parts.length; i += 1) { builder.append(parts[i]); } return builder.getBlob(properties.type); } } // Serialize a value, afterwards executing a callback (which usually // instructs the `setItem()` callback/promise to be executed). This is how // we store binary data with localStorage. function serialize(value, callback) { var valueString = ''; if (value) { valueString = value.toString(); } // Cannot use `value instanceof ArrayBuffer` or such here, as these // checks fail when running the tests using casper.js... // // TODO: See why those tests fail and use a better solution. if (value && (value.toString() === '[object ArrayBuffer]' || value.buffer && value.buffer.toString() === '[object ArrayBuffer]')) { // Convert binary arrays to a string and prefix the string with // a special marker. var buffer; var marker = SERIALIZED_MARKER; if (value instanceof ArrayBuffer) { buffer = value; marker += TYPE_ARRAYBUFFER; } else { buffer = value.buffer; if (valueString === '[object Int8Array]') { marker += TYPE_INT8ARRAY; } else if (valueString === '[object Uint8Array]') { marker += TYPE_UINT8ARRAY; } else if (valueString === '[object Uint8ClampedArray]') { marker += TYPE_UINT8CLAMPEDARRAY; } else if (valueString === '[object Int16Array]') { marker += TYPE_INT16ARRAY; } else if (valueString === '[object Uint16Array]') { marker += TYPE_UINT16ARRAY; } else if (valueString === '[object Int32Array]') { marker += TYPE_INT32ARRAY; } else if (valueString === '[object Uint32Array]') { marker += TYPE_UINT32ARRAY; } else if (valueString === '[object Float32Array]') { marker += TYPE_FLOAT32ARRAY; } else if (valueString === '[object Float64Array]') { marker += TYPE_FLOAT64ARRAY; } else { callback(new Error('Failed to get type for BinaryArray')); } } callback(marker + bufferToString(buffer)); } else if (valueString === '[object Blob]') { // Conver the blob to a binaryArray and then to a string. var fileReader = new FileReader(); fileReader.onload = function() { // Backwards-compatible prefix for the blob type. var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result); callback(SERIALIZED_MARKER + TYPE_BLOB + str); }; fileReader.readAsArrayBuffer(value); } else { try { callback(JSON.stringify(value)); } catch (e) { console.error("Couldn't convert value into a JSON string: ", value); callback(null, e); } } } // Deserialize data we've inserted into a value column/field. We place // special markers into our strings to mark them as encoded; this isn't // as nice as a meta field, but it's the only sane thing we can do whilst // keeping localStorage support intact. // // Oftentimes this will just deserialize JSON content, but if we have a // special marker (SERIALIZED_MARKER, defined above), we will extract // some kind of arraybuffer/binary data/typed array out of the string. function deserialize(value) { // If we haven't marked this string as being specially serialized (i.e. // something other than serialized JSON), we can just return it and be // done with it. if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) { return JSON.parse(value); } // The following code deals with deserializing some kind of Blob or // TypedArray. First we separate out the type of data we're dealing // with from the data itself. var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH); var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH); var blobType; // Backwards-compatible blob type serialization strategy. // DBs created with older versions of localForage will simply not have the blob type. if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) { var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX); blobType = matcher[1]; serializedString = serializedString.substring(matcher[0].length); } var buffer = stringToBuffer(serializedString); // Return the right type based on the code/type set during // serialization. switch (type) { case TYPE_ARRAYBUFFER: return buffer; case TYPE_BLOB: return _createBlob([buffer], {type: blobType}); case TYPE_INT8ARRAY: return new Int8Array(buffer); case TYPE_UINT8ARRAY: return new Uint8Array(buffer); case TYPE_UINT8CLAMPEDARRAY: return new Uint8ClampedArray(buffer); case TYPE_INT16ARRAY: return new Int16Array(buffer); case TYPE_UINT16ARRAY: return new Uint16Array(buffer); case TYPE_INT32ARRAY: return new Int32Array(buffer); case TYPE_UINT32ARRAY: return new Uint32Array(buffer); case TYPE_FLOAT32ARRAY: return new Float32Array(buffer); case TYPE_FLOAT64ARRAY: return new Float64Array(buffer); default: throw new Error('Unkown type: ' + type); } } function stringToBuffer(serializedString) { // Fill the string into a ArrayBuffer. var bufferLength = serializedString.length * 0.75; var len = serializedString.length; var i; var p = 0; var encoded1, encoded2, encoded3, encoded4; if (serializedString[serializedString.length - 1] === '=') { bufferLength--; if (serializedString[serializedString.length - 2] === '=') { bufferLength--; } } var buffer = new ArrayBuffer(bufferLength); var bytes = new Uint8Array(buffer); for (i = 0; i < len; i+=4) { encoded1 = BASE_CHARS.indexOf(serializedString[i]); encoded2 = BASE_CHARS.indexOf(serializedString[i+1]); encoded3 = BASE_CHARS.indexOf(serializedString[i+2]); encoded4 = BASE_CHARS.indexOf(serializedString[i+3]); /*jslint bitwise: true */ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); } return buffer; } // Converts a buffer to a string to store, serialized, in the backend // storage library. function bufferToString(buffer) { // base64-arraybuffer var bytes = new Uint8Array(buffer); var base64String = ''; var i; for (i = 0; i < bytes.length; i += 3) { /*jslint bitwise: true */ base64String += BASE_CHARS[bytes[i] >> 2]; base64String += BASE_CHARS[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; base64String += BASE_CHARS[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; base64String += BASE_CHARS[bytes[i + 2] & 63]; } if ((bytes.length % 3) === 2) { base64String = base64String.substring(0, base64String.length - 1) + '='; } else if (bytes.length % 3 === 1) { base64String = base64String.substring(0, base64String.length - 2) + '=='; } return base64String; } var localforageSerializer = { serialize: serialize, deserialize: deserialize, stringToBuffer: stringToBuffer, bufferToString: bufferToString }; if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { module.exports = localforageSerializer; } else if (typeof define === 'function' && define.amd) { define('localforageSerializer', function() { return localforageSerializer; }); } else { this.localforageSerializer = localforageSerializer; } }).call(window); },{}],85:[function(_dereq_,module,exports){ // Top level file is just a mixin of submodules & constants 'use strict'; var assign = _dereq_('./lib/utils/common').assign; var deflate = _dereq_('./lib/deflate'); var inflate = _dereq_('./lib/inflate'); var constants = _dereq_('./lib/zlib/constants'); var pako = {}; assign(pako, deflate, inflate, constants); module.exports = pako; },{"./lib/deflate":86,"./lib/inflate":87,"./lib/utils/common":88,"./lib/zlib/constants":91}],86:[function(_dereq_,module,exports){ 'use strict'; var zlib_deflate = _dereq_('./zlib/deflate'); var utils = _dereq_('./utils/common'); var strings = _dereq_('./utils/strings'); var msg = _dereq_('./zlib/messages'); var ZStream = _dereq_('./zlib/zstream'); var toString = Object.prototype.toString; /* Public constants ==========================================================*/ /* ===========================================================================*/ var Z_NO_FLUSH = 0; var Z_FINISH = 4; var Z_OK = 0; var Z_STREAM_END = 1; var Z_SYNC_FLUSH = 2; var Z_DEFAULT_COMPRESSION = -1; var Z_DEFAULT_STRATEGY = 0; var Z_DEFLATED = 8; /* ===========================================================================*/ /** * class Deflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[deflate]], * [[deflateRaw]] and [[gzip]]. **/ /* internal * Deflate.chunks -> Array * * Chunks of output data, if [[Deflate#onData]] not overriden. **/ /** * Deflate.result -> Uint8Array|Array * * Compressed result, generated by default [[Deflate#onData]] * and [[Deflate#onEnd]] handlers. Filled after you push last chunk * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Deflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Deflate.err -> Number * * Error code after deflate finished. 0 (Z_OK) on success. * You will not need it in real life, because deflate errors * are possible only on wrong options or bad `onData` / `onEnd` * custom handlers. **/ /** * Deflate.msg -> String * * Error message, if [[Deflate.err]] != 0 **/ /** * new Deflate(options) * - options (Object): zlib deflate options. * * Creates new deflator instance with specified params. Throws exception * on bad params. Supported options: * * - `level` * - `windowBits` * - `memLevel` * - `strategy` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw deflate * - `gzip` (Boolean) - create gzip wrapper * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * - `header` (Object) - custom header for gzip * - `text` (Boolean) - true if compressed data believed to be text * - `time` (Number) - modification time, unix timestamp * - `os` (Number) - operation system code * - `extra` (Array) - array of bytes with extra data (max 65536) * - `name` (String) - file name (binary string) * - `comment` (String) - comment (binary string) * - `hcrc` (Boolean) - true if header crc should be added * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var deflate = new pako.Deflate({ level: 3}); * * deflate.push(chunk1, false); * deflate.push(chunk2, true); // true -> last chunk * * if (deflate.err) { throw new Error(deflate.err); } * * console.log(deflate.result); * ``` **/ function Deflate(options) { if (!(this instanceof Deflate)) return new Deflate(options); this.options = utils.assign({ level: Z_DEFAULT_COMPRESSION, method: Z_DEFLATED, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Z_DEFAULT_STRATEGY, to: '' }, options || {}); var opt = this.options; if (opt.raw && (opt.windowBits > 0)) { opt.windowBits = -opt.windowBits; } else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { opt.windowBits += 16; } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_deflate.deflateInit2( this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy ); if (status !== Z_OK) { throw new Error(msg[status]); } if (opt.header) { zlib_deflate.deflateSetHeader(this.strm, opt.header); } } /** * Deflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be * converted to utf8 byte sequence. * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. * * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with * new compressed chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the compression context. * * On fail call [[Deflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * array format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Deflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var status, _mode; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // If we need to compress text, change encoding to utf8. strm.input = strings.string2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ if (status !== Z_STREAM_END && status !== Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { if (this.options.to === 'string') { this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); // Finalize on the last chunk. if (_mode === Z_FINISH) { status = zlib_deflate.deflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === Z_SYNC_FLUSH) { this.onEnd(Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Deflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): ouput data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Deflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Deflate#onEnd(status) -> Void * - status (Number): deflate status. 0 (Z_OK) on success, * other if not. * * Called once after you tell deflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Deflate.prototype.onEnd = function (status) { // On success - join if (status === Z_OK) { if (this.options.to === 'string') { this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * deflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * Compress `data` with deflate algorithm and `options`. * * Supported options are: * * - level * - windowBits * - memLevel * - strategy * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * * ##### Example: * * ```javascript * var pako = require('pako') * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); * * console.log(pako.deflate(data)); * ``` **/ function deflate(input, options) { var deflator = new Deflate(options); deflator.push(input, true); // That will never happens, if you don't cheat with options :) if (deflator.err) { throw deflator.msg; } return deflator.result; } /** * deflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function deflateRaw(input, options) { options = options || {}; options.raw = true; return deflate(input, options); } /** * gzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but create gzip wrapper instead of * deflate one. **/ function gzip(input, options) { options = options || {}; options.gzip = true; return deflate(input, options); } exports.Deflate = Deflate; exports.deflate = deflate; exports.deflateRaw = deflateRaw; exports.gzip = gzip; },{"./utils/common":88,"./utils/strings":89,"./zlib/deflate":93,"./zlib/messages":98,"./zlib/zstream":100}],87:[function(_dereq_,module,exports){ 'use strict'; var zlib_inflate = _dereq_('./zlib/inflate'); var utils = _dereq_('./utils/common'); var strings = _dereq_('./utils/strings'); var c = _dereq_('./zlib/constants'); var msg = _dereq_('./zlib/messages'); var ZStream = _dereq_('./zlib/zstream'); var GZheader = _dereq_('./zlib/gzheader'); var toString = Object.prototype.toString; /** * class Inflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[inflate]] * and [[inflateRaw]]. **/ /* internal * inflate.chunks -> Array * * Chunks of output data, if [[Inflate#onData]] not overriden. **/ /** * Inflate.result -> Uint8Array|Array|String * * Uncompressed result, generated by default [[Inflate#onData]] * and [[Inflate#onEnd]] handlers. Filled after you push last chunk * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Inflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Inflate.err -> Number * * Error code after inflate finished. 0 (Z_OK) on success. * Should be checked if broken data possible. **/ /** * Inflate.msg -> String * * Error message, if [[Inflate.err]] != 0 **/ /** * new Inflate(options) * - options (Object): zlib inflate options. * * Creates new inflator instance with specified params. Throws exception * on bad params. Supported options: * * - `windowBits` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw inflate * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * By default, when no options set, autodetect deflate/gzip data format via * wrapper header. * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var inflate = new pako.Inflate({ level: 3}); * * inflate.push(chunk1, false); * inflate.push(chunk2, true); // true -> last chunk * * if (inflate.err) { throw new Error(inflate.err); } * * console.log(inflate.result); * ``` **/ function Inflate(options) { if (!(this instanceof Inflate)) return new Inflate(options); this.options = utils.assign({ chunkSize: 16384, windowBits: 0, to: '' }, options || {}); var opt = this.options; // Force window size for `raw` data, if not set directly, // because we have no header for autodetect. if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { opt.windowBits = -opt.windowBits; if (opt.windowBits === 0) { opt.windowBits = -15; } } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate if ((opt.windowBits >= 0) && (opt.windowBits < 16) && !(options && options.windowBits)) { opt.windowBits += 32; } // Gzip header has no info about windows size, we can do autodetect only // for deflate. So, if window size not set, force it to max when gzip possible if ((opt.windowBits > 15) && (opt.windowBits < 48)) { // bit 3 (16) -> gzipped data // bit 4 (32) -> autodetect gzip/deflate if ((opt.windowBits & 15) === 0) { opt.windowBits |= 15; } } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_inflate.inflateInit2( this.strm, opt.windowBits ); if (status !== c.Z_OK) { throw new Error(msg[status]); } this.header = new GZheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); } /** * Inflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. * * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with * new output chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the decompression context. * * On fail call [[Inflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Inflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var status, _mode; var next_out_utf8, tail, utf8str; // Flag to properly process Z_BUF_ERROR on testing inflate call // when we check that all output data was flushed. var allowBufError = false; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ if (status === c.Z_BUF_ERROR && allowBufError === true) { status = c.Z_OK; allowBufError = false; } if (status !== c.Z_STREAM_END && status !== c.Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.next_out) { if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { if (this.options.to === 'string') { next_out_utf8 = strings.utf8border(strm.output, strm.next_out); tail = strm.next_out - next_out_utf8; utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail strm.next_out = tail; strm.avail_out = chunkSize - tail; if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } this.onData(utf8str); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } // When no more input data, we should check that internal inflate buffers // are flushed. The only way to do it when avail_out = 0 - run one more // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. // Here we set flag to process this error properly. // // NOTE. Deflate does not return error in this case and does not needs such // logic. if (strm.avail_in === 0 && strm.avail_out === 0) { allowBufError = true; } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); if (status === c.Z_STREAM_END) { _mode = c.Z_FINISH; } // Finalize on the last chunk. if (_mode === c.Z_FINISH) { status = zlib_inflate.inflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === c.Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === c.Z_SYNC_FLUSH) { this.onEnd(c.Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Inflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): ouput data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Inflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Inflate#onEnd(status) -> Void * - status (Number): inflate status. 0 (Z_OK) on success, * other if not. * * Called either after you tell inflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Inflate.prototype.onEnd = function (status) { // On success - join if (status === c.Z_OK) { if (this.options.to === 'string') { // Glue & convert here, until we teach pako to send // utf8 alligned strings to onData this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * inflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Decompress `data` with inflate/ungzip and `options`. Autodetect * format via wrapper header by default. That's why we don't provide * separate `ungzip` method. * * Supported options are: * * - windowBits * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * * ##### Example: * * ```javascript * var pako = require('pako') * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) * , output; * * try { * output = pako.inflate(input); * } catch (err) * console.log(err); * } * ``` **/ function inflate(input, options) { var inflator = new Inflate(options); inflator.push(input, true); // That will never happens, if you don't cheat with options :) if (inflator.err) { throw inflator.msg; } return inflator.result; } /** * inflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * The same as [[inflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); } /** * ungzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Just shortcut to [[inflate]], because it autodetects format * by header.content. Done for convenience. **/ exports.Inflate = Inflate; exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; },{"./utils/common":88,"./utils/strings":89,"./zlib/constants":91,"./zlib/gzheader":94,"./zlib/inflate":96,"./zlib/messages":98,"./zlib/zstream":100}],88:[function(_dereq_,module,exports){ 'use strict'; var TYPED_OK = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Int32Array !== 'undefined'); exports.assign = function (obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); while (sources.length) { var source = sources.shift(); if (!source) { continue; } if (typeof source !== 'object') { throw new TypeError(source + 'must be non-object'); } for (var p in source) { if (source.hasOwnProperty(p)) { obj[p] = source[p]; } } } return obj; }; // reduce buffer size, avoiding mem copy exports.shrinkBuf = function (buf, size) { if (buf.length === size) { return buf; } if (buf.subarray) { return buf.subarray(0, size); } buf.length = size; return buf; }; var fnTyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { if (src.subarray && dest.subarray) { dest.set(src.subarray(src_offs, src_offs + len), dest_offs); return; } // Fallback to ordinary array for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { var i, l, len, pos, chunk, result; // calculate data length len = 0; for (i = 0, l = chunks.length; i < l; i++) { len += chunks[i].length; } // join chunks result = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { chunk = chunks[i]; result.set(chunk, pos); pos += chunk.length; } return result; } }; var fnUntyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { return [].concat.apply([], chunks); } }; // Enable/Disable typed arrays use, for testing // exports.setTyped = function (on) { if (on) { exports.Buf8 = Uint8Array; exports.Buf16 = Uint16Array; exports.Buf32 = Int32Array; exports.assign(exports, fnTyped); } else { exports.Buf8 = Array; exports.Buf16 = Array; exports.Buf32 = Array; exports.assign(exports, fnUntyped); } }; exports.setTyped(TYPED_OK); },{}],89:[function(_dereq_,module,exports){ // String encode/decode helpers 'use strict'; var utils = _dereq_('./common'); // Quick check if we can use fast array to bin string conversion // // - apply(Array) can fail on Android 2.2 // - apply(Uint8Array) can fail on iOS 5.1 Safary // var STR_APPLY_OK = true; var STR_APPLY_UIA_OK = true; try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new utils.Buf8(256); for (var q = 0; q < 256; q++) { _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); } _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start // convert string to array (typed, when possible) exports.string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer buf = new utils.Buf8(buf_len); // convert for (i = 0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Helper (used in 2 places) function buf2binstring(buf, len) { // use fallback for big arrays to avoid stack overflow if (len < 65537) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for (var i = 0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; } // Convert byte array to binary string exports.buf2binstring = function (buf) { return buf2binstring(buf, buf.length); }; // Convert binary string (typed, when possible) exports.binstring2buf = function (str) { var buf = new utils.Buf8(str.length); for (var i = 0, len = buf.length; i < len; i++) { buf[i] = str.charCodeAt(i); } return buf; }; // convert array to string exports.buf2string = function (buf, max) { var i, out, c, c_len; var len = max || buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len * 2); for (out = 0, i = 0; i < len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } return buf2binstring(utf16buf, out); }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); exports.utf8border = function (buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max - 1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Fuckup - very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means vuffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; },{"./common":88}],90:[function(_dereq_,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It doesn't worth to make additional optimizationa as in original. // Small size is preferable. function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; } module.exports = adler32; },{}],91:[function(_dereq_,module,exports){ 'use strict'; module.exports = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, //Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; },{}],92:[function(_dereq_,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for (var n = 0; n < 256; n++) { c = n; for (var k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc ^= -1; for (var i = pos; i < end; i++) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = crc32; },{}],93:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var trees = _dereq_('./trees'); var adler32 = _dereq_('./adler32'); var crc32 = _dereq_('./crc32'); var msg = _dereq_('./messages'); /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ var Z_NO_FLUSH = 0; var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; //var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; //var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; //var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* compression levels */ //var Z_NO_COMPRESSION = 0; //var Z_BEST_SPEED = 1; //var Z_BEST_COMPRESSION = 9; var Z_DEFAULT_COMPRESSION = -1; var Z_FILTERED = 1; var Z_HUFFMAN_ONLY = 2; var Z_RLE = 3; var Z_FIXED = 4; var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ //var Z_BINARY = 0; //var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /* The deflate compression method */ var Z_DEFLATED = 8; /*============================================================================*/ var MAX_MEM_LEVEL = 9; /* Maximum value for memLevel in deflateInit2 */ var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_MEM_LEVEL = 8; var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2 * L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var MIN_MATCH = 3; var MAX_MATCH = 258; var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); var PRESET_DICT = 0x20; var INIT_STATE = 42; var EXTRA_STATE = 69; var NAME_STATE = 73; var COMMENT_STATE = 91; var HCRC_STATE = 103; var BUSY_STATE = 113; var FINISH_STATE = 666; var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ var BS_BLOCK_DONE = 2; /* block flush performed */ var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. function err(strm, errorCode) { strm.msg = msg[errorCode]; return errorCode; } function rank(f) { return ((f) << 1) - ((f) > 4 ? 9 : 0); } function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->output buffer and copying into it. * (See also read_buf()). */ function flush_pending(strm) { var s = strm.state; //_tr_flush_bits(s); var len = s.pending; if (len > strm.avail_out) { len = strm.avail_out; } if (len === 0) { return; } utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); strm.next_out += len; s.pending_out += len; strm.total_out += len; strm.avail_out -= len; s.pending -= len; if (s.pending === 0) { s.pending_out = 0; } } function flush_block_only(s, last) { trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); s.block_start = s.strstart; flush_pending(s.strm); } function put_byte(s, b) { s.pending_buf[s.pending++] = b; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ function putShortMSB(s, b) { // put_byte(s, (Byte)(b >> 8)); // put_byte(s, (Byte)(b & 0xff)); s.pending_buf[s.pending++] = (b >>> 8) & 0xff; s.pending_buf[s.pending++] = b & 0xff; } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->input buffer and copying from it. * (See also flush_pending()). */ function read_buf(strm, buf, start, size) { var len = strm.avail_in; if (len > size) { len = size; } if (len === 0) { return 0; } strm.avail_in -= len; utils.arraySet(buf, strm.input, strm.next_in, len, start); if (strm.state.wrap === 1) { strm.adler = adler32(strm.adler, buf, len, start); } else if (strm.state.wrap === 2) { strm.adler = crc32(strm.adler, buf, len, start); } strm.next_in += len; strm.total_in += len; return len; } /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ function longest_match(s, cur_match) { var chain_length = s.max_chain_length; /* max hash chain length */ var scan = s.strstart; /* current string */ var match; /* matched string */ var len; /* length of current match */ var best_len = s.prev_length; /* best match length so far */ var nice_match = s.nice_match; /* stop if match long enough */ var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; var _win = s.window; // shortcut var wmask = s.w_mask; var prev = s.prev; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ var strend = s.strstart + MAX_MATCH; var scan_end1 = _win[scan + best_len - 1]; var scan_end = _win[scan + best_len]; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s.prev_length >= s.good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if (nice_match > s.lookahead) { nice_match = s.lookahead; } // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { // Assert(cur_match < s->strstart, "no future"); match = cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { continue; } /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2; match++; // Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { /*jshint noempty:false*/ } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (strend - scan); scan = strend - MAX_MATCH; if (len > best_len) { s.match_start = cur_match; best_len = len; if (len >= nice_match) { break; } scan_end1 = _win[scan + best_len - 1]; scan_end = _win[scan + best_len]; } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); if (best_len <= s.lookahead) { return best_len; } return s.lookahead; } /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ function fill_window(s) { var _w_size = s.w_size; var p, n, m, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { more = s.window_size - s.lookahead - s.strstart; // JS ints have 32 bit, block below not needed /* Deal with !@#$% 64K limit: */ //if (sizeof(int) <= 2) { // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { // more = wsize; // // } else if (more == (unsigned)(-1)) { // /* Very unlikely, but possible on 16 bit machine if // * strstart == 0 && lookahead == 1 (input done a byte at time) // */ // more--; // } //} /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { utils.arraySet(s.window, s.window, _w_size, _w_size, 0); s.match_start -= _w_size; s.strstart -= _w_size; /* we now have strstart >= MAX_DIST */ s.block_start -= _w_size; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s.hash_size; p = n; do { m = s.head[--p]; s.head[p] = (m >= _w_size ? m - _w_size : 0); } while (--n); n = _w_size; p = n; do { m = s.prev[--p]; s.prev[p] = (m >= _w_size ? m - _w_size : 0); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); more += _w_size; } if (s.strm.avail_in === 0) { break; } /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ //Assert(more >= 2, "more < 2"); n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); s.lookahead += n; /* Initialize the hash value now that we have some input: */ if (s.lookahead + s.insert >= MIN_MATCH) { str = s.strstart - s.insert; s.ins_h = s.window[str]; /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call update_hash() MIN_MATCH-3 more times //#endif while (s.insert) { /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; s.prev[str & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = str; str++; s.insert--; if (s.lookahead + s.insert < MIN_MATCH) { break; } } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ // if (s.high_water < s.window_size) { // var curr = s.strstart + s.lookahead; // var init = 0; // // if (s.high_water < curr) { // /* Previous high water mark below current data -- zero WIN_INIT // * bytes or up to end of window, whichever is less. // */ // init = s.window_size - curr; // if (init > WIN_INIT) // init = WIN_INIT; // zmemzero(s->window + curr, (unsigned)init); // s->high_water = curr + init; // } // else if (s->high_water < (ulg)curr + WIN_INIT) { // /* High water mark at or above current data, but below current data // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up // * to end of window, whichever is less. // */ // init = (ulg)curr + WIN_INIT - s->high_water; // if (init > s->window_size - s->high_water) // init = s->window_size - s->high_water; // zmemzero(s->window + s->high_water, (unsigned)init); // s->high_water += init; // } // } // // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, // "not enough room for search"); } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ function deflate_stored(s, flush) { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ var max_block_size = 0xffff; if (max_block_size > s.pending_buf_size - 5) { max_block_size = s.pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s.lookahead <= 1) { //Assert(s->strstart < s->w_size+MAX_DIST(s) || // s->block_start >= (long)s->w_size, "slide too late"); // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || // s.block_start >= s.w_size)) { // throw new Error("slide too late"); // } fill_window(s); if (s.lookahead === 0 && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } //Assert(s->block_start >= 0L, "block gone"); // if (s.block_start < 0) throw new Error("block gone"); s.strstart += s.lookahead; s.lookahead = 0; /* Emit a stored block if pending_buf will be full: */ var max_start = s.block_start + max_block_size; if (s.strstart === 0 || s.strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s.lookahead = s.strstart - max_start; s.strstart = max_start; /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.strstart > s.block_start) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_NEED_MORE; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ function deflate_fast(s, flush) { var hash_head; /* head of the hash chain */ var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; /* flush the current block */ } } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ } if (s.match_length >= MIN_MATCH) { // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only /*** _tr_tally_dist(s, s.strstart - s.match_start, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { s.match_length--; /* string at strstart already in table */ do { s.strstart++; /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s.match_length !== 0); s.strstart++; } else { s.strstart += s.match_length; s.match_length = 0; s.ins_h = s.window[s.strstart]; /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call UPDATE_HASH() MIN_MATCH-3 more times //#endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s.window[s.strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ function deflate_slow(s, flush) { var hash_head; /* head of hash chain */ var bflush; /* set if current block must be flushed */ var max_insert; /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. */ s.prev_length = s.match_length; s.prev_match = s.match_start; s.match_length = MIN_MATCH - 1; if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ if (s.match_length <= 5 && (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s.match_length = MIN_MATCH - 1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { max_insert = s.strstart + s.lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ //check_match(s, s.strstart-1, s.prev_match, s.prev_length); /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH, bflush);***/ bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s.lookahead -= s.prev_length - 1; s.prev_length -= 2; do { if (++s.strstart <= max_insert) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } } while (--s.prev_length !== 0); s.match_available = 0; s.match_length = MIN_MATCH - 1; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } else if (s.match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); if (bflush) { /*** FLUSH_BLOCK_ONLY(s, 0) ***/ flush_block_only(s, false); /***/ } s.strstart++; s.lookahead--; if (s.strm.avail_out === 0) { return BS_NEED_MORE; } } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s.match_available = 1; s.strstart++; s.lookahead--; } } //Assert (flush != Z_NO_FLUSH, "no flush?"); if (s.match_available) { //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); s.match_available = 0; } s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ function deflate_rle(s, flush) { var bflush; /* set if current block must be flushed */ var prev; /* byte at distance one to match */ var scan, strend; /* scan goes up to strend for length of run */ var _win = s.window; for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (s.lookahead <= MAX_MATCH) { fill_window(s); if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* See how many times the previous byte repeats */ s.match_length = 0; if (s.lookahead >= MIN_MATCH && s.strstart > 0) { scan = s.strstart - 1; prev = _win[scan]; if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { strend = s.strstart + MAX_MATCH; do { /*jshint noempty:false*/ } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); s.match_length = MAX_MATCH - (strend - scan); if (s.match_length > s.lookahead) { s.match_length = s.lookahead; } } //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s.match_length >= MIN_MATCH) { //check_match(s, s.strstart, s.strstart - 1, s.match_length); /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; s.strstart += s.match_length; s.match_length = 0; } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ function deflate_huff(s, flush) { var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s.lookahead === 0) { fill_window(s); if (s.lookahead === 0) { if (flush === Z_NO_FLUSH) { return BS_NEED_MORE; } break; /* flush the current block */ } } /* Output a literal byte */ s.match_length = 0; //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ function Config(good_length, max_lazy, nice_length, max_chain, func) { this.good_length = good_length; this.max_lazy = max_lazy; this.nice_length = nice_length; this.max_chain = max_chain; this.func = func; } var configuration_table; configuration_table = [ /* good lazy nice chain */ new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ new Config(4, 5, 16, 8, deflate_fast), /* 2 */ new Config(4, 6, 32, 32, deflate_fast), /* 3 */ new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ new Config(8, 16, 32, 32, deflate_slow), /* 5 */ new Config(8, 16, 128, 128, deflate_slow), /* 6 */ new Config(8, 32, 128, 256, deflate_slow), /* 7 */ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ ]; /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ function lm_init(s) { s.window_size = 2 * s.w_size; /*** CLEAR_HASH(s); ***/ zero(s.head); // Fill with NIL (= 0); /* Set the default configuration parameters: */ s.max_lazy_match = configuration_table[s.level].max_lazy; s.good_match = configuration_table[s.level].good_length; s.nice_match = configuration_table[s.level].nice_length; s.max_chain_length = configuration_table[s.level].max_chain; s.strstart = 0; s.block_start = 0; s.lookahead = 0; s.insert = 0; s.match_length = s.prev_length = MIN_MATCH - 1; s.match_available = 0; s.ins_h = 0; } function DeflateState() { this.strm = null; /* pointer back to this zlib stream */ this.status = 0; /* as the name implies */ this.pending_buf = null; /* output still pending */ this.pending_buf_size = 0; /* size of pending_buf */ this.pending_out = 0; /* next pending byte to output to the stream */ this.pending = 0; /* nb of bytes in the pending buffer */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.gzhead = null; /* gzip header information to write */ this.gzindex = 0; /* where in extra, name, or comment */ this.method = Z_DEFLATED; /* can only be DEFLATED */ this.last_flush = -1; /* value of flush param for previous deflate call */ this.w_size = 0; /* LZ77 window size (32K by default) */ this.w_bits = 0; /* log2(w_size) (8..16) */ this.w_mask = 0; /* w_size - 1 */ this.window = null; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. */ this.window_size = 0; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ this.prev = null; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ this.head = null; /* Heads of the hash chains or NIL. */ this.ins_h = 0; /* hash index of string to be inserted */ this.hash_size = 0; /* number of elements in hash table */ this.hash_bits = 0; /* log2(hash_size) */ this.hash_mask = 0; /* hash_size-1 */ this.hash_shift = 0; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ this.block_start = 0; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ this.match_length = 0; /* length of best match */ this.prev_match = 0; /* previous match */ this.match_available = 0; /* set if previous match exists */ this.strstart = 0; /* start of string to insert */ this.match_start = 0; /* start of matching string */ this.lookahead = 0; /* number of valid bytes ahead in window */ this.prev_length = 0; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ this.max_chain_length = 0; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ this.max_lazy_match = 0; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ // That's alias to max_lazy_match, don't use directly //this.max_insert_length = 0; /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ this.level = 0; /* compression level (1..9) */ this.strategy = 0; /* favor or force Huffman coding*/ this.good_match = 0; /* Use a faster search when the previous match is longer than this */ this.nice_match = 0; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to suppress compiler warning */ // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ // Use flat array of DOUBLE size, with interleaved fata, // because JS does not support effective this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); zero(this.dyn_ltree); zero(this.dyn_dtree); zero(this.bl_tree); this.l_desc = null; /* desc. for literal tree */ this.d_desc = null; /* desc. for distance tree */ this.bl_desc = null; /* desc. for bit length tree */ //ush bl_count[MAX_BITS+1]; this.bl_count = new utils.Buf16(MAX_BITS + 1); /* number of codes at each bit length for an optimal tree */ //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ zero(this.heap); this.heap_len = 0; /* number of elements in the heap */ this.heap_max = 0; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; zero(this.depth); /* Depth of each subtree used as tie breaker for trees of equal frequency */ this.l_buf = 0; /* buffer index for literals or lengths */ this.lit_bufsize = 0; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ this.last_lit = 0; /* running index in l_buf */ this.d_buf = 0; /* Buffer index for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ this.opt_len = 0; /* bit length of current block with optimal trees */ this.static_len = 0; /* bit length of current block with static trees */ this.matches = 0; /* number of string matches in current block */ this.insert = 0; /* bytes at end of window left to insert */ this.bi_buf = 0; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ this.bi_valid = 0; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ // Used for window memory init. We safely ignore it for JS. That makes // sense only for pointers and memory check tools. //this.high_water = 0; /* High water mark offset in window for initialized bytes -- bytes above * this are set to zero in order to avoid memory check warnings when * longest match routines access bytes past the input. This is then * updated to the new high water mark. */ } function deflateResetKeep(strm) { var s; if (!strm || !strm.state) { return err(strm, Z_STREAM_ERROR); } strm.total_in = strm.total_out = 0; strm.data_type = Z_UNKNOWN; s = strm.state; s.pending = 0; s.pending_out = 0; if (s.wrap < 0) { s.wrap = -s.wrap; /* was made negative by deflate(..., Z_FINISH); */ } s.status = (s.wrap ? INIT_STATE : BUSY_STATE); strm.adler = (s.wrap === 2) ? 0 // crc32(0, Z_NULL, 0) : 1; // adler32(0, Z_NULL, 0) s.last_flush = Z_NO_FLUSH; trees._tr_init(s); return Z_OK; } function deflateReset(strm) { var ret = deflateResetKeep(strm); if (ret === Z_OK) { lm_init(strm.state); } return ret; } function deflateSetHeader(strm, head) { if (!strm || !strm.state) { return Z_STREAM_ERROR; } if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } strm.state.gzhead = head; return Z_OK; } function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { if (!strm) { // === Z_NULL return Z_STREAM_ERROR; } var wrap = 1; if (level === Z_DEFAULT_COMPRESSION) { level = 6; } if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return err(strm, Z_STREAM_ERROR); } if (windowBits === 8) { windowBits = 9; } /* until 256-byte window bug fixed */ var s = new DeflateState(); strm.state = s; s.strm = strm; s.wrap = wrap; s.gzhead = null; s.w_bits = windowBits; s.w_size = 1 << s.w_bits; s.w_mask = s.w_size - 1; s.hash_bits = memLevel + 7; s.hash_size = 1 << s.hash_bits; s.hash_mask = s.hash_size - 1; s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); s.window = new utils.Buf8(s.w_size * 2); s.head = new utils.Buf16(s.hash_size); s.prev = new utils.Buf16(s.w_size); // Don't need mem init magic for JS. //s.high_water = 0; /* nothing written to s->window yet */ s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ s.pending_buf_size = s.lit_bufsize * 4; s.pending_buf = new utils.Buf8(s.pending_buf_size); s.d_buf = s.lit_bufsize >> 1; s.l_buf = (1 + 2) * s.lit_bufsize; s.level = level; s.strategy = strategy; s.method = method; return deflateReset(strm); } function deflateInit(strm, level) { return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); } function deflate(strm, flush) { var old_flush, s; var beg, val; // for gzip header write only if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) { return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; } s = strm.state; if (!strm.output || (!strm.input && strm.avail_in !== 0) || (s.status === FINISH_STATE && flush !== Z_FINISH)) { return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); } s.strm = strm; /* just in case */ old_flush = s.last_flush; s.last_flush = flush; /* Write the header */ if (s.status === INIT_STATE) { if (s.wrap === 2) { // GZIP header strm.adler = 0; //crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (!s.gzhead) { // s->gzhead == Z_NULL put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s.status = BUSY_STATE; } else { put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) ); put_byte(s, s.gzhead.time & 0xff); put_byte(s, (s.gzhead.time >> 8) & 0xff); put_byte(s, (s.gzhead.time >> 16) & 0xff); put_byte(s, (s.gzhead.time >> 24) & 0xff); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, s.gzhead.os & 0xff); if (s.gzhead.extra && s.gzhead.extra.length) { put_byte(s, s.gzhead.extra.length & 0xff); put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); } if (s.gzhead.hcrc) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); } s.gzindex = 0; s.status = EXTRA_STATE; } } else // DEFLATE header { var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; var level_flags = -1; if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { level_flags = 0; } else if (s.level < 6) { level_flags = 1; } else if (s.level === 6) { level_flags = 2; } else { level_flags = 3; } header |= (level_flags << 6); if (s.strstart !== 0) { header |= PRESET_DICT; } header += 31 - (header % 31); s.status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s.strstart !== 0) { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } strm.adler = 1; // adler32(0L, Z_NULL, 0); } } //#ifdef GZIP if (s.status === EXTRA_STATE) { if (s.gzhead.extra/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { break; } } put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); s.gzindex++; } if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (s.gzindex === s.gzhead.extra.length) { s.gzindex = 0; s.status = NAME_STATE; } } else { s.status = NAME_STATE; } } if (s.status === NAME_STATE) { if (s.gzhead.name/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.name.length) { val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.gzindex = 0; s.status = COMMENT_STATE; } } else { s.status = COMMENT_STATE; } } if (s.status === COMMENT_STATE) { if (s.gzhead.comment/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.comment.length) { val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.status = HCRC_STATE; } } else { s.status = HCRC_STATE; } } if (s.status === HCRC_STATE) { if (s.gzhead.hcrc) { if (s.pending + 2 > s.pending_buf_size) { flush_pending(strm); } if (s.pending + 2 <= s.pending_buf_size) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); strm.adler = 0; //crc32(0L, Z_NULL, 0); s.status = BUSY_STATE; } } else { s.status = BUSY_STATE; } } //#endif /* Flush as much pending output as possible */ if (s.pending !== 0) { flush_pending(strm); if (strm.avail_out === 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s.last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { return err(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s.status === FINISH_STATE && strm.avail_in !== 0) { return err(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm.avail_in !== 0 || s.lookahead !== 0 || (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : (s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush)); if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { s.status = FINISH_STATE; } if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate === BS_BLOCK_DONE) { if (flush === Z_PARTIAL_FLUSH) { trees._tr_align(s); } else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ trees._tr_stored_block(s, 0, 0, false); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush === Z_FULL_FLUSH) { /*** CLEAR_HASH(s); ***/ /* forget history */ zero(s.head); // Fill with NIL (= 0); if (s.lookahead === 0) { s.strstart = 0; s.block_start = 0; s.insert = 0; } } } flush_pending(strm); if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } //Assert(strm->avail_out > 0, "bug2"); //if (strm.avail_out <= 0) { throw new Error("bug2");} if (flush !== Z_FINISH) { return Z_OK; } if (s.wrap <= 0) { return Z_STREAM_END; } /* Write the trailer */ if (s.wrap === 2) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); put_byte(s, (strm.adler >> 16) & 0xff); put_byte(s, (strm.adler >> 24) & 0xff); put_byte(s, strm.total_in & 0xff); put_byte(s, (strm.total_in >> 8) & 0xff); put_byte(s, (strm.total_in >> 16) & 0xff); put_byte(s, (strm.total_in >> 24) & 0xff); } else { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s.wrap > 0) { s.wrap = -s.wrap; } /* write the trailer only once! */ return s.pending !== 0 ? Z_OK : Z_STREAM_END; } function deflateEnd(strm) { var status; if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { return Z_STREAM_ERROR; } status = strm.state.status; if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE ) { return err(strm, Z_STREAM_ERROR); } strm.state = null; return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; } /* ========================================================================= * Copy the source state to the destination state */ //function deflateCopy(dest, source) { // //} exports.deflateInit = deflateInit; exports.deflateInit2 = deflateInit2; exports.deflateReset = deflateReset; exports.deflateResetKeep = deflateResetKeep; exports.deflateSetHeader = deflateSetHeader; exports.deflate = deflate; exports.deflateEnd = deflateEnd; exports.deflateInfo = 'pako deflate (from Nodeca project)'; /* Not implemented exports.deflateBound = deflateBound; exports.deflateCopy = deflateCopy; exports.deflateSetDictionary = deflateSetDictionary; exports.deflateParams = deflateParams; exports.deflatePending = deflatePending; exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ },{"../utils/common":88,"./adler32":90,"./crc32":92,"./messages":98,"./trees":99}],94:[function(_dereq_,module,exports){ 'use strict'; function GZheader() { /* true if compressed data believed to be text */ this.text = 0; /* modification time */ this.time = 0; /* extra flags (not used when writing a gzip file) */ this.xflags = 0; /* operating system */ this.os = 0; /* pointer to extra field or Z_NULL if none */ this.extra = null; /* extra field length (valid if extra != Z_NULL) */ this.extra_len = 0; // Actually, we don't need it in JS, // but leave for few code modifications // // Setup limits is not necessary because in js we should not preallocate memory // for inflate use constant limit in 65536 bytes // /* space at extra (only when reading header) */ // this.extra_max = 0; /* pointer to zero-terminated file name or Z_NULL */ this.name = ''; /* space at name (only when reading header) */ // this.name_max = 0; /* pointer to zero-terminated comment or Z_NULL */ this.comment = ''; /* space at comment (only when reading header) */ // this.comm_max = 0; /* true if there was or will be a header crc */ this.hcrc = 0; /* true when done reading gzip header (not used when writing a gzip file) */ this.done = false; } module.exports = GZheader; },{}],95:[function(_dereq_,module,exports){ 'use strict'; // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* window size or zero if not using window */ var whave; /* valid bytes in the window */ var wnext; /* window write index */ // Use `s_window` instead `window`, avoid conflict with instrumentation tools var s_window; /* allocated sliding window, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; s_window = state.window; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // window index from_source = s_window; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; }; },{}],96:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var adler32 = _dereq_('./adler32'); var crc32 = _dereq_('./crc32'); var inflate_fast = _dereq_('./inffast'); var inflate_table = _dereq_('./inftrees'); var CODES = 0; var LENS = 1; var DISTS = 2; /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ //var Z_NO_FLUSH = 0; //var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; //var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* The deflate compression method */ var Z_DEFLATED = 8; /* STATES ====================================================================*/ /* ===========================================================================*/ var HEAD = 1; /* i: waiting for magic header */ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ var TIME = 3; /* i: waiting for modification time (gzip) */ var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ var EXLEN = 5; /* i: waiting for extra length (gzip) */ var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ var NAME = 7; /* i: waiting for end of file name (gzip) */ var COMMENT = 8; /* i: waiting for end of comment (gzip) */ var HCRC = 9; /* i: waiting for header crc (gzip) */ var DICTID = 10; /* i: waiting for dictionary check value */ var DICT = 11; /* waiting for inflateSetDictionary() call */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ var STORED = 14; /* i: waiting for stored size (length and complement) */ var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ var COPY = 16; /* i/o: waiting for input or output to copy stored block */ var TABLE = 17; /* i: waiting for dynamic block table lengths */ var LENLENS = 18; /* i: waiting for code length code lengths */ var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ var LEN_ = 20; /* i: same as LEN below, but only first time in */ var LEN = 21; /* i: waiting for length/lit/eob code */ var LENEXT = 22; /* i: waiting for length extra bits */ var DIST = 23; /* i: waiting for distance code */ var DISTEXT = 24; /* i: waiting for distance extra bits */ var MATCH = 25; /* o: waiting for output space to copy string */ var LIT = 26; /* o: waiting for output space to write literal */ var CHECK = 27; /* i: waiting for 32-bit check value */ var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ var DONE = 29; /* finished check, done -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */ var MEM = 31; /* got an inflate() memory error -- remain here until reset */ var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ /* ===========================================================================*/ var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_WBITS = MAX_WBITS; function zswap32(q) { return (((q >>> 24) & 0xff) + ((q >>> 8) & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24)); } function InflateState() { this.mode = 0; /* current inflate mode */ this.last = false; /* true if processing last block */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.havedict = false; /* true if dictionary provided */ this.flags = 0; /* gzip header method and flags (0 if zlib) */ this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ this.check = 0; /* protected copy of check value */ this.total = 0; /* protected copy of output count */ // TODO: may be {} this.head = null; /* where to save gzip header information */ /* sliding window */ this.wbits = 0; /* log base 2 of requested window size */ this.wsize = 0; /* window size or zero if not using window */ this.whave = 0; /* valid bytes in the window */ this.wnext = 0; /* window write index */ this.window = null; /* allocated sliding window, if needed */ /* bit accumulator */ this.hold = 0; /* input bit accumulator */ this.bits = 0; /* number of bits in "in" */ /* for string and stored block copying */ this.length = 0; /* literal or length of data to copy */ this.offset = 0; /* distance back to copy string from */ /* for table and code decoding */ this.extra = 0; /* extra bits needed */ /* fixed and dynamic code tables */ this.lencode = null; /* starting table for length/literal codes */ this.distcode = null; /* starting table for distance codes */ this.lenbits = 0; /* index bits for lencode */ this.distbits = 0; /* index bits for distcode */ /* dynamic table building */ this.ncode = 0; /* number of code length code lengths */ this.nlen = 0; /* number of length code lengths */ this.ndist = 0; /* number of distance code lengths */ this.have = 0; /* number of code lengths in lens[] */ this.next = null; /* next available space in codes[] */ this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ this.work = new utils.Buf16(288); /* work area for code table building */ /* because we don't have pointers in js, we use lencode and distcode directly as buffers so we don't need codes */ //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ this.distdyn = null; /* dynamic table for distance codes (JS specific) */ this.sane = 0; /* if false, allow invalid distance too far */ this.back = 0; /* bits back of last unprocessed length/lit */ this.was = 0; /* initial length of match */ } function inflateResetKeep(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; strm.total_in = strm.total_out = state.total = 0; strm.msg = ''; /*Z_NULL*/ if (state.wrap) { /* to support ill-conceived Java test suite */ strm.adler = state.wrap & 1; } state.mode = HEAD; state.last = 0; state.havedict = 0; state.dmax = 32768; state.head = null/*Z_NULL*/; state.hold = 0; state.bits = 0; //state.lencode = state.distcode = state.next = state.codes; state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); state.sane = 1; state.back = -1; //Tracev((stderr, "inflate: reset\n")); return Z_OK; } function inflateReset(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; state.wsize = 0; state.whave = 0; state.wnext = 0; return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { var wrap; var state; /* get the state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) { return Z_STREAM_ERROR; } if (state.window !== null && state.wbits !== windowBits) { state.window = null; } /* update state and reset the rest of it */ state.wrap = wrap; state.wbits = windowBits; return inflateReset(strm); } function inflateInit2(strm, windowBits) { var ret; var state; if (!strm) { return Z_STREAM_ERROR; } //strm.msg = Z_NULL; /* in case we return an error */ state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR; //Tracev((stderr, "inflate: allocated\n")); strm.state = state; state.window = null/*Z_NULL*/; ret = inflateReset2(strm, windowBits); if (ret !== Z_OK) { strm.state = null/*Z_NULL*/; } return ret; } function inflateInit(strm) { return inflateInit2(strm, DEF_WBITS); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ var virgin = true; var lenfix, distfix; // We have no pointers in JS, so keep tables separate function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; } /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the window */ if (state.window === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.window = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state.wsize) { utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->window + state->wnext, end - copy, dist); utils.arraySet(state.window, src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->window, end - copy, copy); utils.arraySet(state.window, src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; } function inflate(strm, flush) { var state; var input, output; // input/output buffers var next; /* next input INDEX */ var put; /* next output INDEX */ var have, left; /* available input and output */ var hold; /* bit buffer */ var bits; /* bits in bit buffer */ var _in, _out; /* save starting available input and output */ var copy; /* number of stored or match bytes to copy */ var from; /* where to copy match bytes from */ var from_source; var here = 0; /* current decoding table entry */ var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) //var last; /* parent table entry */ var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) var len; /* length to copy for repeats, bits to drop */ var ret; /* return code */ var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ var opts; var n; // temporary var for NEED_BITS var order = /* permutation of code lengths */ [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) { return Z_STREAM_ERROR; } state = strm.state; if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- _in = have; _out = left; ret = Z_OK; inf_leave: // goto emulation for (;;) { switch (state.mode) { case HEAD: if (state.wrap === 0) { state.mode = TYPEDO; break; } //=== NEEDBITS(16); while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ state.check = 0/*crc32(0L, Z_NULL, 0)*/; //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = FLAGS; break; } state.flags = 0; /* expect zlib header */ if (state.head) { state.head.done = false; } if (!(state.wrap & 1) || /* check if zlib header allowed */ (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { strm.msg = 'incorrect header check'; state.mode = BAD; break; } if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// len = (hold & 0x0f)/*BITS(4)*/ + 8; if (state.wbits === 0) { state.wbits = len; } else if (len > state.wbits) { strm.msg = 'invalid window size'; state.mode = BAD; break; } state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n")); strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS(); hold = 0; bits = 0; //===// break; case FLAGS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.flags = hold; if ((state.flags & 0xff) !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } if (state.flags & 0xe000) { strm.msg = 'unknown header flags set'; state.mode = BAD; break; } if (state.head) { state.head.text = ((hold >> 8) & 1); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = TIME; /* falls through */ case TIME: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.time = hold; } if (state.flags & 0x0200) { //=== CRC4(state.check, hold) hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; hbuf[2] = (hold >>> 16) & 0xff; hbuf[3] = (hold >>> 24) & 0xff; state.check = crc32(state.check, hbuf, 4, 0); //=== } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = OS; /* falls through */ case OS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.xflags = (hold & 0xff); state.head.os = (hold >> 8); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = EXLEN; /* falls through */ case EXLEN: if (state.flags & 0x0400) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length = hold; if (state.head) { state.head.extra_len = hold; } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// } else if (state.head) { state.head.extra = null/*Z_NULL*/; } state.mode = EXTRA; /* falls through */ case EXTRA: if (state.flags & 0x0400) { copy = state.length; if (copy > have) { copy = have; } if (copy) { if (state.head) { len = state.head.extra_len - state.length; if (!state.head.extra) { // Use untyped array for more conveniend processing later state.head.extra = new Array(state.head.extra_len); } utils.arraySet( state.head.extra, input, next, // extra field is limited to 65536 bytes // - no need for additional size check copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ len ); //zmemcpy(state.head.extra + len, next, // len + copy > state.head.extra_max ? // state.head.extra_max - len : copy); } if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; state.length -= copy; } if (state.length) { break inf_leave; } } state.length = 0; state.mode = NAME; /* falls through */ case NAME: if (state.flags & 0x0800) { if (have === 0) { break inf_leave; } copy = 0; do { // TODO: 2 or 1 bytes? len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.name_max*/)) { state.head.name += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.name = null; } state.length = 0; state.mode = COMMENT; /* falls through */ case COMMENT: if (state.flags & 0x1000) { if (have === 0) { break inf_leave; } copy = 0; do { len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.comm_max*/)) { state.head.comment += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.comment = null; } state.mode = HCRC; /* falls through */ case HCRC: if (state.flags & 0x0200) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.check & 0xffff)) { strm.msg = 'header crc mismatch'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// } if (state.head) { state.head.hcrc = ((state.flags >> 9) & 1); state.head.done = true; } strm.adler = state.check = 0; state.mode = TYPE; break; case DICTID: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// strm.adler = state.check = zswap32(hold); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = DICT; /* falls through */ case DICT: if (state.havedict === 0) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- return Z_NEED_DICT; } strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = TYPE; /* falls through */ case TYPE: if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } /* falls through */ case TYPEDO: if (state.last) { //--- BYTEBITS() ---// hold >>>= bits & 7; bits -= bits & 7; //---// state.mode = CHECK; break; } //=== NEEDBITS(3); */ while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.last = (hold & 0x01)/*BITS(1)*/; //--- DROPBITS(1) ---// hold >>>= 1; bits -= 1; //---// switch ((hold & 0x03)/*BITS(2)*/) { case 0: /* stored block */ //Tracev((stderr, "inflate: stored block%s\n", // state.last ? " (last)" : "")); state.mode = STORED; break; case 1: /* fixed block */ fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n", // state.last ? " (last)" : "")); state.mode = LEN_; /* decode codes */ if (flush === Z_TREES) { //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break inf_leave; } break; case 2: /* dynamic block */ //Tracev((stderr, "inflate: dynamic codes block%s\n", // state.last ? " (last)" : "")); state.mode = TABLE; break; case 3: strm.msg = 'invalid block type'; state.mode = BAD; } //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break; case STORED: //--- BYTEBITS() ---// /* go to byte boundary */ hold >>>= bits & 7; bits -= bits & 7; //---// //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { strm.msg = 'invalid stored block lengths'; state.mode = BAD; break; } state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n", // state.length)); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = COPY_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case COPY_: state.mode = COPY; /* falls through */ case COPY: copy = state.length; if (copy) { if (copy > have) { copy = have; } if (copy > left) { copy = left; } if (copy === 0) { break inf_leave; } //--- zmemcpy(put, next, copy); --- utils.arraySet(output, input, next, copy, put); //---// have -= copy; next += copy; left -= copy; put += copy; state.length -= copy; break; } //Tracev((stderr, "inflate: stored end\n")); state.mode = TYPE; break; case TABLE: //=== NEEDBITS(14); */ while (bits < 14) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// //#ifndef PKZIP_BUG_WORKAROUND if (state.nlen > 286 || state.ndist > 30) { strm.msg = 'too many length or distance symbols'; state.mode = BAD; break; } //#endif //Tracev((stderr, "inflate: table sizes ok\n")); state.have = 0; state.mode = LENLENS; /* falls through */ case LENLENS: while (state.have < state.ncode) { //=== NEEDBITS(3); while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } while (state.have < 19) { state.lens[order[state.have++]] = 0; } // We have separate tables & no pointers. 2 commented lines below not needed. //state.next = state.codes; //state.lencode = state.next; // Switch to use dynamic table state.lencode = state.lendyn; state.lenbits = 7; opts = { bits: state.lenbits }; ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); state.lenbits = opts.bits; if (ret) { strm.msg = 'invalid code lengths set'; state.mode = BAD; break; } //Tracev((stderr, "inflate: code lengths ok\n")); state.have = 0; state.mode = CODELENS; /* falls through */ case CODELENS: while (state.have < state.nlen + state.ndist) { for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_val < 16) { //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.lens[state.have++] = here_val; } else { if (here_val === 16) { //=== NEEDBITS(here.bits + 2); n = here_bits + 2; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// if (state.have === 0) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } len = state.lens[state.have - 1]; copy = 3 + (hold & 0x03);//BITS(2); //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// } else if (here_val === 17) { //=== NEEDBITS(here.bits + 3); n = here_bits + 3; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 3 + (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } else { //=== NEEDBITS(here.bits + 7); n = here_bits + 7; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 11 + (hold & 0x7f);//BITS(7); //--- DROPBITS(7) ---// hold >>>= 7; bits -= 7; //---// } if (state.have + copy > state.nlen + state.ndist) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } while (copy--) { state.lens[state.have++] = len; } } } /* handle error breaks in while */ if (state.mode === BAD) { break; } /* check for end-of-block code (better have one) */ if (state.lens[256] === 0) { strm.msg = 'invalid code -- missing end-of-block'; state.mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state.lenbits = 9; opts = { bits: state.lenbits }; ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.lenbits = opts.bits; // state.lencode = state.next; if (ret) { strm.msg = 'invalid literal/lengths set'; state.mode = BAD; break; } state.distbits = 6; //state.distcode.copy(state.codes); // Switch to use dynamic table state.distcode = state.distdyn; opts = { bits: state.distbits }; ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.distbits = opts.bits; // state.distcode = state.next; if (ret) { strm.msg = 'invalid distances set'; state.mode = BAD; break; } //Tracev((stderr, 'inflate: codes ok\n')); state.mode = LEN_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case LEN_: state.mode = LEN; /* falls through */ case LEN: if (have >= 6 && left >= 258) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- inflate_fast(strm, _out); //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- if (state.mode === TYPE) { state.back = -1; } break; } state.back = 0; for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if (here_bits <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_op && (here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; state.length = here_val; if (here_op === 0) { //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); state.mode = LIT; break; } if (here_op & 32) { //Tracevv((stderr, "inflate: end of block\n")); state.back = -1; state.mode = TYPE; break; } if (here_op & 64) { strm.msg = 'invalid literal/length code'; state.mode = BAD; break; } state.extra = here_op & 15; state.mode = LENEXT; /* falls through */ case LENEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //Tracevv((stderr, "inflate: length %u\n", state.length)); state.was = state.length; state.mode = DIST; /* falls through */ case DIST: for (;;) { here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if ((here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; if (here_op & 64) { strm.msg = 'invalid distance code'; state.mode = BAD; break; } state.offset = here_val; state.extra = (here_op) & 15; state.mode = DISTEXT; /* falls through */ case DISTEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //#ifdef INFLATE_STRICT if (state.offset > state.dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } //#endif //Tracevv((stderr, "inflate: distance %u\n", state.offset)); state.mode = MATCH; /* falls through */ case MATCH: if (left === 0) { break inf_leave; } copy = _out - left; if (state.offset > copy) { /* copy from window */ copy = state.offset - copy; if (copy > state.whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // Trace((stderr, "inflate.c too far\n")); // copy -= state.whave; // if (copy > state.length) { copy = state.length; } // if (copy > left) { copy = left; } // left -= copy; // state.length -= copy; // do { // output[put++] = 0; // } while (--copy); // if (state.length === 0) { state.mode = LEN; } // break; //#endif } if (copy > state.wnext) { copy -= state.wnext; from = state.wsize - copy; } else { from = state.wnext - copy; } if (copy > state.length) { copy = state.length; } from_source = state.window; } else { /* copy from output */ from_source = output; from = put - state.offset; copy = state.length; } if (copy > left) { copy = left; } left -= copy; state.length -= copy; do { output[put++] = from_source[from++]; } while (--copy); if (state.length === 0) { state.mode = LEN; } break; case LIT: if (left === 0) { break inf_leave; } output[put++] = state.length; left--; state.mode = LEN; break; case CHECK: if (state.wrap) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; // Use '|' insdead of '+' to make sure that result is signed hold |= input[next++] << bits; bits += 8; } //===// _out -= left; strm.total_out += _out; state.total += _out; if (_out) { strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); } _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too if ((state.flags ? hold : zswap32(hold)) !== state.check) { strm.msg = 'incorrect data check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: check matches trailer\n")); } state.mode = LENGTH; /* falls through */ case LENGTH: if (state.wrap && state.flags) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.total & 0xffffffff)) { strm.msg = 'incorrect length check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: length matches trailer\n")); } state.mode = DONE; /* falls through */ case DONE: ret = Z_STREAM_END; break inf_leave; case BAD: ret = Z_DATA_ERROR; break inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: /* falls through */ default: return Z_STREAM_ERROR; } } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) { if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { state.mode = MEM; return Z_MEM_ERROR; } } _in -= strm.avail_in; _out -= strm.avail_out; strm.total_in += _in; strm.total_out += _out; state.total += _out; if (state.wrap && _out) { strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); } strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { ret = Z_BUF_ERROR; } return ret; } function inflateEnd(strm) { if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { return Z_STREAM_ERROR; } var state = strm.state; if (state.window) { state.window = null; } strm.state = null; return Z_OK; } function inflateGetHeader(strm, head) { var state; /* check state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } /* save header structure */ state.head = head; head.done = false; return Z_OK; } exports.inflateReset = inflateReset; exports.inflateReset2 = inflateReset2; exports.inflateResetKeep = inflateResetKeep; exports.inflateInit = inflateInit; exports.inflateInit2 = inflateInit2; exports.inflate = inflate; exports.inflateEnd = inflateEnd; exports.inflateGetHeader = inflateGetHeader; exports.inflateInfo = 'pako inflate (from Nodeca project)'; /* Not implemented exports.inflateCopy = inflateCopy; exports.inflateGetDictionary = inflateGetDictionary; exports.inflateMark = inflateMark; exports.inflatePrime = inflatePrime; exports.inflateSetDictionary = inflateSetDictionary; exports.inflateSync = inflateSync; exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ },{"../utils/common":88,"./adler32":90,"./crc32":92,"./inffast":95,"./inftrees":97}],97:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var MAXBITS = 15; var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var CODES = 0; var LENS = 1; var DISTS = 2; var lbase = [ /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ]; var lext = [ /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ]; var dbase = [ /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ]; var dext = [ /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ]; module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { var bits = opts.bits; //here = opts.here; /* table entry for duplication */ var len = 0; /* a code's length in bits */ var sym = 0; /* index of code symbols */ var min = 0, max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */ var low; /* low bits for current root entry */ var mask; /* mask for low root bits */ var next; /* next available space in table */ var base = null; /* base value table to use */ var base_index = 0; // var shoextra; /* extra bits table to use */ var end; /* use base and extra for symbol > end */ var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ var extra = null; var extra_index = 0; var here_bits, here_op, here_val; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) { count[len] = 0; } for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } /* bound code lengths, force root to be within code lengths */ root = bits; for (max = MAXBITS; max >= 1; max--) { if (count[max] !== 0) { break; } } if (root > max) { root = max; } if (max === 0) { /* no symbols to code at all */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.val[opts.table_index++] = 0; //here.val = (var short)0; table[table_index++] = (1 << 24) | (64 << 16) | 0; //table.op[opts.table_index] = 64; //table.bits[opts.table_index] = 1; //table.val[opts.table_index++] = 0; table[table_index++] = (1 << 24) | (64 << 16) | 0; opts.bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) { if (count[min] !== 0) { break; } } if (root < min) { root = min; } /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) { return -1; } /* over-subscribed */ } if (left > 0 && (type === CODES || max !== 1)) { return -1; /* incomplete set */ } /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) { offs[len + 1] = offs[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) { if (lens[lens_index + sym] !== 0) { work[offs[lens[lens_index + sym]]++] = sym; } } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ // poor man optimization - use if-else instead of switch, // to avoid deopts in old v8 if (type === CODES) { base = extra = work; /* dummy value--not used */ end = 19; } else if (type === LENS) { base = lbase; base_index -= 257; extra = lext; extra_index -= 257; end = 256; } else { /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize opts for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = table_index; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = -1; /* trigger new sub-table when len > root */ used = 1 << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } var i = 0; /* process all codes and make table entries */ for (;;) { i++; /* create table entry */ here_bits = len - drop; if (work[sym] < end) { here_op = 0; here_val = work[sym]; } else if (work[sym] > end) { here_op = extra[extra_index + work[sym]]; here_val = base[base_index + work[sym]]; } else { here_op = 32 + 64; /* end of block */ here_val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1 << (len - drop); fill = 1 << curr; min = fill; /* save offset to next table */ do { fill -= incr; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; } while (fill !== 0); /* backwards increment the len-bit code huff */ incr = 1 << (len - 1); while (huff & incr) { incr >>= 1; } if (incr !== 0) { huff &= incr - 1; huff += incr; } else { huff = 0; } /* go to next symbol, update count, len */ sym++; if (--count[len] === 0) { if (len === max) { break; } len = lens[lens_index + work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) !== low) { /* if first time, transition to sub-tables */ if (drop === 0) { drop = root; } /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = 1 << curr; while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) { break; } curr++; left <<= 1; } /* check for enough space */ used += 1 << curr; if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* point entry in root table to sub-table */ low = huff & mask; /*table.op[low] = curr; table.bits[low] = root; table.val[low] = next - opts.table_index;*/ table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff !== 0) { //table.op[next + huff] = 64; /* invalid code marker */ //table.bits[next + huff] = len - drop; //table.val[next + huff] = 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; } /* set return parameters */ //opts.table_index += used; opts.bits = root; return 0; }; },{"../utils/common":88}],98:[function(_dereq_,module,exports){ 'use strict'; module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ 1: 'stream end', /* Z_STREAM_END 1 */ 0: '', /* Z_OK 0 */ '-1': 'file error', /* Z_ERRNO (-1) */ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ '-3': 'data error', /* Z_DATA_ERROR (-3) */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; },{}],99:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); /* Public constants ==========================================================*/ /* ===========================================================================*/ //var Z_FILTERED = 1; //var Z_HUFFMAN_ONLY = 2; //var Z_RLE = 3; var Z_FIXED = 4; //var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ var Z_BINARY = 0; var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /*============================================================================*/ function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } // From zutil.h var STORED_BLOCK = 0; var STATIC_TREES = 1; var DYN_TREES = 2; /* The three kinds of block type */ var MIN_MATCH = 3; var MAX_MATCH = 258; /* The minimum and maximum match lengths */ // From deflate.h /* =========================================================================== * Internal compression state. */ var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2 * L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var Buf_size = 16; /* size of bit buffer in bi_buf */ /* =========================================================================== * Constants */ var MAX_BL_BITS = 7; /* Bit length codes must not exceed MAX_BL_BITS bits */ var END_BLOCK = 256; /* end of block literal code */ var REP_3_6 = 16; /* repeat previous bit length 3-6 times (2 bits of repeat count) */ var REPZ_3_10 = 17; /* repeat a zero length 3-10 times (3 bits of repeat count) */ var REPZ_11_138 = 18; /* repeat a zero length 11-138 times (7 bits of repeat count) */ /* eslint-disable comma-spacing,array-bracket-spacing */ var extra_lbits = /* extra bits for each length code */ [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; var extra_dbits = /* extra bits for each distance code */ [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; var extra_blbits = /* extra bits for each bit length code */ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; var bl_order = [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; /* eslint-enable comma-spacing,array-bracket-spacing */ /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ /* =========================================================================== * Local data. These are initialized only once. */ // We pre-fill arrays with 0 to avoid uninitialized gaps var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ // !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 var static_ltree = new Array((L_CODES + 2) * 2); zero(static_ltree); /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ var static_dtree = new Array(D_CODES * 2); zero(static_dtree); /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ var _dist_code = new Array(DIST_CODE_LEN); zero(_dist_code); /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); zero(_length_code); /* length code for each normalized match length (0 == MIN_MATCH) */ var base_length = new Array(LENGTH_CODES); zero(base_length); /* First normalized length for each code (0 = MIN_MATCH) */ var base_dist = new Array(D_CODES); zero(base_dist); /* First normalized distance for each code (0 = distance of 1) */ function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { this.static_tree = static_tree; /* static tree or NULL */ this.extra_bits = extra_bits; /* extra bits for each code or NULL */ this.extra_base = extra_base; /* base index for extra_bits */ this.elems = elems; /* max number of elements in the tree */ this.max_length = max_length; /* max bit length for the codes */ // show if `static_tree` has data or dummy - needed for monomorphic objects this.has_stree = static_tree && static_tree.length; } var static_l_desc; var static_d_desc; var static_bl_desc; function TreeDesc(dyn_tree, stat_desc) { this.dyn_tree = dyn_tree; /* the dynamic tree */ this.max_code = 0; /* largest code with non zero frequency */ this.stat_desc = stat_desc; /* the corresponding static tree */ } function d_code(dist) { return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; } /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ function put_short(s, w) { // put_byte(s, (uch)((w) & 0xff)); // put_byte(s, (uch)((ush)(w) >> 8)); s.pending_buf[s.pending++] = (w) & 0xff; s.pending_buf[s.pending++] = (w >>> 8) & 0xff; } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ function send_bits(s, value, length) { if (s.bi_valid > (Buf_size - length)) { s.bi_buf |= (value << s.bi_valid) & 0xffff; put_short(s, s.bi_buf); s.bi_buf = value >> (Buf_size - s.bi_valid); s.bi_valid += length - Buf_size; } else { s.bi_buf |= (value << s.bi_valid) & 0xffff; s.bi_valid += length; } } function send_code(s, c, tree) { send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ function bi_reverse(code, len) { var res = 0; do { res |= code & 1; code >>>= 1; res <<= 1; } while (--len > 0); return res >>> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ function bi_flush(s) { if (s.bi_valid === 16) { put_short(s, s.bi_buf); s.bi_buf = 0; s.bi_valid = 0; } else if (s.bi_valid >= 8) { s.pending_buf[s.pending++] = s.bi_buf & 0xff; s.bi_buf >>= 8; s.bi_valid -= 8; } } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ function gen_bitlen(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var max_code = desc.max_code; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var extra = desc.stat_desc.extra_bits; var base = desc.stat_desc.extra_base; var max_length = desc.stat_desc.max_length; var h; /* heap index */ var n, m; /* iterate over the tree elements */ var bits; /* bit length */ var xbits; /* extra bits */ var f; /* frequency */ var overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) { s.bl_count[bits] = 0; } /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { n = s.heap[h]; bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; if (bits > max_length) { bits = max_length; overflow++; } tree[n * 2 + 1]/*.Len*/ = bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) { continue; } /* not a leaf node */ s.bl_count[bits]++; xbits = 0; if (n >= base) { xbits = extra[n - base]; } f = tree[n * 2]/*.Freq*/; s.opt_len += f * (bits + xbits); if (has_stree) { s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); } } if (overflow === 0) { return; } // Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length - 1; while (s.bl_count[bits] === 0) { bits--; } s.bl_count[bits]--; /* move one leaf down the tree */ s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s.bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits !== 0; bits--) { n = s.bl_count[bits]; while (n !== 0) { m = s.heap[--h]; if (m > max_code) { continue; } if (tree[m * 2 + 1]/*.Len*/ !== bits) { // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; tree[m * 2 + 1]/*.Len*/ = bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ function gen_codes(tree, max_code, bl_count) // ct_data *tree; /* the tree to decorate */ // int max_code; /* largest code with non zero frequency */ // ushf *bl_count; /* number of codes at each bit length */ { var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ var code = 0; /* running code value */ var bits; /* bit index */ var n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits - 1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, // "inconsistent bit counts"); //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); for (n = 0; n <= max_code; n++) { var len = tree[n * 2 + 1]/*.Len*/; if (len === 0) { continue; } /* Now reverse the bits */ tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len); //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); } } /* =========================================================================== * Initialize the various 'constant' tables. */ function tr_static_init() { var n; /* iterates over tree elements */ var bits; /* bit counter */ var length; /* length value */ var code; /* code value */ var dist; /* distance index */ var bl_count = new Array(MAX_BITS + 1); /* number of codes at each bit length for an optimal tree */ // do check in _tr_init() //if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ /*#ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif*/ /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES - 1; code++) { base_length[code] = length; for (n = 0; n < (1 << extra_lbits[code]); n++) { _length_code[length++] = code; } } //Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ _length_code[length - 1] = code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (code = 0; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1 << extra_dbits[code]); n++) { _dist_code[dist++] = code; } } //Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for (; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = code; } } //Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) { bl_count[bits] = 0; } n = 0; while (n <= 143) { static_ltree[n * 2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } while (n <= 255) { static_ltree[n * 2 + 1]/*.Len*/ = 9; n++; bl_count[9]++; } while (n <= 279) { static_ltree[n * 2 + 1]/*.Len*/ = 7; n++; bl_count[7]++; } while (n <= 287) { static_ltree[n * 2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes(static_ltree, L_CODES + 1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n * 2 + 1]/*.Len*/ = 5; static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); } // Now data ready and we can init static trees static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); //static_init_done = true; } /* =========================================================================== * Initialize a new block. */ function init_block(s) { var n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; s.opt_len = s.static_len = 0; s.last_lit = s.matches = 0; } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ function bi_windup(s) { if (s.bi_valid > 8) { put_short(s, s.bi_buf); } else if (s.bi_valid > 0) { //put_byte(s, (Byte)s->bi_buf); s.pending_buf[s.pending++] = s.bi_buf; } s.bi_buf = 0; s.bi_valid = 0; } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ function copy_block(s, buf, len, header) //DeflateState *s; //charf *buf; /* the input data */ //unsigned len; /* its length */ //int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ if (header) { put_short(s, len); put_short(s, ~len); } // while (len--) { // put_byte(s, *buf++); // } utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); s.pending += len; } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ function smaller(tree, n, m, depth) { var _n2 = n * 2; var _m2 = m * 2; return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); } /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ function pqdownheap(s, tree, k) // deflate_state *s; // ct_data *tree; /* the tree to restore */ // int k; /* node to move down */ { var v = s.heap[k]; var j = k << 1; /* left son of k */ while (j <= s.heap_len) { /* Set j to the smallest of the two sons: */ if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s.heap[j], s.depth)) { break; } /* Exchange v with the smallest son */ s.heap[k] = s.heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s.heap[k] = v; } // inlined manually // var SMALLEST = 1; /* =========================================================================== * Send the block data compressed using the given Huffman trees */ function compress_block(s, ltree, dtree) // deflate_state *s; // const ct_data *ltree; /* literal tree */ // const ct_data *dtree; /* distance tree */ { var dist; /* distance of matched string */ var lc; /* match length or unmatched char (if dist == 0) */ var lx = 0; /* running index in l_buf */ var code; /* the code to send */ var extra; /* number of extra bits to send */ if (s.last_lit !== 0) { do { dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); lc = s.pending_buf[s.l_buf + lx]; lx++; if (dist === 0) { send_code(s, lc, ltree); /* send a literal byte */ //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code + LITERALS + 1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra !== 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); //Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra !== 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, // "pendingBuf overflow"); } while (lx < s.last_lit); } send_code(s, END_BLOCK, ltree); } /* =========================================================================== * Construct one Huffman tree and assigns the code bit strings and lengths. * Update the total bit length for the current block. * IN assertion: the field freq is set for all tree elements. * OUT assertions: the fields len and code are set to the optimal bit length * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ function build_tree(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var elems = desc.stat_desc.elems; var n, m; /* iterate over heap elements */ var max_code = -1; /* largest code with non zero frequency */ var node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s.heap_len = 0; s.heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n * 2]/*.Freq*/ !== 0) { s.heap[++s.heap_len] = max_code = n; s.depth[n] = 0; } else { tree[n * 2 + 1]/*.Len*/ = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s.heap_len < 2) { node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); tree[node * 2]/*.Freq*/ = 1; s.depth[node] = 0; s.opt_len--; if (has_stree) { s.static_len -= stree[node * 2 + 1]/*.Len*/; } /* node is 0 or 1 so it does not have extra bits */ } desc.max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { //pqremove(s, tree, n); /* n = node of least frequency */ /*** pqremove ***/ n = s.heap[1/*SMALLEST*/]; s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; pqdownheap(s, tree, 1/*SMALLEST*/); /***/ m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ s.heap[--s.heap_max] = m; /* Create a new node father of n and m */ tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; /* and insert the new node in the heap */ s.heap[1/*SMALLEST*/] = node++; pqdownheap(s, tree, 1/*SMALLEST*/); } while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, desc); /* The field len is now set, we can generate the bit codes */ gen_codes(tree, max_code, s.bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ function scan_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ if (nextlen === 0) { max_count = 138; min_count = 3; } tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { s.bl_tree[curlen * 2]/*.Freq*/ += count; } else if (curlen !== 0) { if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } s.bl_tree[REP_3_6 * 2]/*.Freq*/++; } else if (count <= 10) { s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; } else { s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ function send_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen === 0) { max_count = 138; min_count = 3; } for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); } else if (curlen !== 0) { if (curlen !== prevlen) { send_code(s, curlen, s.bl_tree); count--; } //Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s.bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s.bl_tree); send_bits(s, count - 3, 3); } else { send_code(s, REPZ_11_138, s.bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ function build_bl_tree(s) { var max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, s.dyn_ltree, s.l_desc.max_code); scan_tree(s, s.dyn_dtree, s.d_desc.max_code); /* Build the bit length tree: */ build_tree(s, s.bl_desc); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { break; } } /* Update opt_len to include the bit length tree and counts */ s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", // s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ function send_all_trees(s, lcodes, dcodes, blcodes) // deflate_state *s; // int lcodes, dcodes, blcodes; /* number of codes for each tree */ { var rank; /* index in bl_order */ //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, // "too many codes"); //Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes - 1, 5); send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); } //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the * "black list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ function detect_data_type(s) { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ var black_mask = 0xf3ffc07f; var n; /* Check for non-textual ("black-listed") bytes. */ for (n = 0; n <= 31; n++, black_mask >>>= 1) { if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { return Z_BINARY; } } /* Check for textual ("white-listed") bytes. */ if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { return Z_TEXT; } for (n = 32; n < LITERALS; n++) { if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { return Z_TEXT; } } /* There are no "black-listed" or "white-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; } var static_init_done = false; /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ function _tr_init(s) { if (!static_init_done) { tr_static_init(); static_init_done = true; } s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); s.bi_buf = 0; s.bi_valid = 0; /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Send a stored block */ function _tr_stored_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ copy_block(s, buf, stored_len, true); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ function _tr_align(s) { send_bits(s, STATIC_TREES << 1, 3); send_code(s, END_BLOCK, static_ltree); bi_flush(s); } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ function _tr_flush_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block, or NULL if too old */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ var max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s.level > 0) { /* Check if the file is binary or text */ if (s.strm.data_type === Z_UNKNOWN) { s.strm.data_type = detect_data_type(s); } /* Construct the literal and distance trees */ build_tree(s, s.l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); build_tree(s, s.d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s.opt_len + 3 + 7) >>> 3; static_lenb = (s.static_len + 3 + 7) >>> 3; // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, // s->last_lit)); if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } } else { // Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { /* 4: two words for the lengths */ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); compress_block(s, static_ltree, static_dtree); } else { send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); compress_block(s, s.dyn_ltree, s.dyn_dtree); } // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { bi_windup(s); } // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, // s->compressed_len-7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ function _tr_tally(s, dist, lc) // deflate_state *s; // unsigned dist; /* distance of matched string */ // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { //var out_length, in_length, dcode; s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; s.last_lit++; if (dist === 0) { /* lc is the unmatched char */ s.dyn_ltree[lc * 2]/*.Freq*/++; } else { s.matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ //Assert((ush)dist < (ush)MAX_DIST(s) && // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef TRUNCATE_BLOCK // /* Try to guess if it is profitable to stop the current block here */ // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { // /* Compute an upper bound for the compressed length */ // out_length = s.last_lit*8; // in_length = s.strstart - s.block_start; // // for (dcode = 0; dcode < D_CODES; dcode++) { // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); // } // out_length >>>= 3; // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", // // s->last_lit, in_length, out_length, // // 100L - out_length*100L/in_length)); // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { // return true; // } // } //#endif return (s.last_lit === s.lit_bufsize - 1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } exports._tr_init = _tr_init; exports._tr_stored_block = _tr_stored_block; exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; },{"../utils/common":88}],100:[function(_dereq_,module,exports){ 'use strict'; function ZStream() { /* next input byte */ this.input = null; // JS specific, because we have no pointers this.next_in = 0; /* number of bytes available at input */ this.avail_in = 0; /* total number of input bytes read so far */ this.total_in = 0; /* next output byte should be put there */ this.output = null; // JS specific, because we have no pointers this.next_out = 0; /* remaining free space at output */ this.avail_out = 0; /* total number of bytes output so far */ this.total_out = 0; /* last error message, NULL if no error */ this.msg = ''/*Z_NULL*/; /* not visible by applications */ this.state = null; /* best guess about the data type: binary or text */ this.data_type = 2/*Z_UNKNOWN*/; /* adler32 value of the uncompressed data */ this.adler = 0; } module.exports = ZStream; },{}],101:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = setTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; clearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { setTimeout(drainQueue, 0); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],102:[function(_dereq_,module,exports){ 'use strict'; var asap = _dereq_('asap') module.exports = Promise function Promise(fn) { if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new') if (typeof fn !== 'function') throw new TypeError('not a function') var state = null var value = null var deferreds = [] var self = this this.then = function(onFulfilled, onRejected) { return new Promise(function(resolve, reject) { handle(new Handler(onFulfilled, onRejected, resolve, reject)) }) } function handle(deferred) { if (state === null) { deferreds.push(deferred) return } asap(function() { var cb = state ? deferred.onFulfilled : deferred.onRejected if (cb === null) { (state ? deferred.resolve : deferred.reject)(value) return } var ret try { ret = cb(value) } catch (e) { deferred.reject(e) return } deferred.resolve(ret) }) } function resolve(newValue) { try { //Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.') if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { var then = newValue.then if (typeof then === 'function') { doResolve(then.bind(newValue), resolve, reject) return } } state = true value = newValue finale() } catch (e) { reject(e) } } function reject(newValue) { state = false value = newValue finale() } function finale() { for (var i = 0, len = deferreds.length; i < len; i++) handle(deferreds[i]) deferreds = null } doResolve(fn, resolve, reject) } function Handler(onFulfilled, onRejected, resolve, reject){ this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null this.onRejected = typeof onRejected === 'function' ? onRejected : null this.resolve = resolve this.reject = reject } /** * Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony. */ function doResolve(fn, onFulfilled, onRejected) { var done = false; try { fn(function (value) { if (done) return done = true onFulfilled(value) }, function (reason) { if (done) return done = true onRejected(reason) }) } catch (ex) { if (done) return done = true onRejected(ex) } } },{"asap":44}],103:[function(_dereq_,module,exports){ 'use strict'; //This file contains then/promise specific extensions to the core promise API var Promise = _dereq_('./core.js') var asap = _dereq_('asap') module.exports = Promise /* Static Functions */ function ValuePromise(value) { this.then = function (onFulfilled) { if (typeof onFulfilled !== 'function') return this return new Promise(function (resolve, reject) { asap(function () { try { resolve(onFulfilled(value)) } catch (ex) { reject(ex); } }) }) } } ValuePromise.prototype = Object.create(Promise.prototype) var TRUE = new ValuePromise(true) var FALSE = new ValuePromise(false) var NULL = new ValuePromise(null) var UNDEFINED = new ValuePromise(undefined) var ZERO = new ValuePromise(0) var EMPTYSTRING = new ValuePromise('') Promise.resolve = function (value) { if (value instanceof Promise) return value if (value === null) return NULL if (value === undefined) return UNDEFINED if (value === true) return TRUE if (value === false) return FALSE if (value === 0) return ZERO if (value === '') return EMPTYSTRING if (typeof value === 'object' || typeof value === 'function') { try { var then = value.then if (typeof then === 'function') { return new Promise(then.bind(value)) } } catch (ex) { return new Promise(function (resolve, reject) { reject(ex) }) } } return new ValuePromise(value) } Promise.from = Promise.cast = function (value) { var err = new Error('Promise.from and Promise.cast are deprecated, use Promise.resolve instead') err.name = 'Warning' console.warn(err.stack) return Promise.resolve(value) } Promise.denodeify = function (fn, argumentCount) { argumentCount = argumentCount || Infinity return function () { var self = this var args = Array.prototype.slice.call(arguments) return new Promise(function (resolve, reject) { while (args.length && args.length > argumentCount) { args.pop() } args.push(function (err, res) { if (err) reject(err) else resolve(res) }) fn.apply(self, args) }) } } Promise.nodeify = function (fn) { return function () { var args = Array.prototype.slice.call(arguments) var callback = typeof args[args.length - 1] === 'function' ? args.pop() : null try { return fn.apply(this, arguments).nodeify(callback) } catch (ex) { if (callback === null || typeof callback == 'undefined') { return new Promise(function (resolve, reject) { reject(ex) }) } else { asap(function () { callback(ex) }) } } } } Promise.all = function () { var calledWithArray = arguments.length === 1 && Array.isArray(arguments[0]) var args = Array.prototype.slice.call(calledWithArray ? arguments[0] : arguments) if (!calledWithArray) { var err = new Error('Promise.all should be called with a single array, calling it with multiple arguments is deprecated') err.name = 'Warning' console.warn(err.stack) } return new Promise(function (resolve, reject) { if (args.length === 0) return resolve([]) var remaining = args.length function res(i, val) { try { if (val && (typeof val === 'object' || typeof val === 'function')) { var then = val.then if (typeof then === 'function') { then.call(val, function (val) { res(i, val) }, reject) return } } args[i] = val if (--remaining === 0) { resolve(args); } } catch (ex) { reject(ex) } } for (var i = 0; i < args.length; i++) { res(i, args[i]) } }) } Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); }); } Promise.race = function (values) { return new Promise(function (resolve, reject) { values.forEach(function(value){ Promise.resolve(value).then(resolve, reject); }) }); } /* Prototype Methods */ Promise.prototype.done = function (onFulfilled, onRejected) { var self = arguments.length ? this.then.apply(this, arguments) : this self.then(null, function (err) { asap(function () { throw err }) }) } Promise.prototype.nodeify = function (callback) { if (typeof callback != 'function') return this this.then(function (value) { asap(function () { callback(null, value) }) }, function (err) { asap(function () { callback(err) }) }) } Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); } },{"./core.js":102,"asap":44}]},{},[1]);
ajax/libs/intl-tel-input/8.4.0/js/intlTelInput.js
sashberd/cdnjs
/* * International Telephone Input v8.4.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ // wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js (function(factory) { if (typeof define === "function" && define.amd) { define([ "jquery" ], function($) { factory($, window, document); }); } else if (typeof module === "object" && module.exports) { module.exports = factory(require("jquery"), window, document); } else { factory(jQuery, window, document); } })(function($, window, document, undefined) { "use strict"; // these vars persist through all instances of the plugin var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling defaults = { // whether or not to allow the dropdown allowDropdown: true, // if there is just a dial code in the input: remove it on blur, and re-add it on focus autoHideDialCode: true, // add or remove input placeholder with an example number for the selected country autoPlaceholder: true, // append menu to a specific element dropdownContainer: "", // don't display these countries excludeCountries: [], // format the input value during initialisation formatOnInit: true, // geoIp lookup function geoIpLookup: null, // initial country initialCountry: "", // don't insert international dial codes nationalMode: true, // number type to use for placeholders numberType: "MOBILE", // display only these countries onlyCountries: [], // the countries at the top of the list. defaults to united states and united kingdom preferredCountries: [ "us", "gb" ], // display the country dial code next to the selected flag so it's not part of the typed number separateDialCode: false, // specify the path to the libphonenumber script to enable validation/formatting utilsScript: "" }, keys = { UP: 38, DOWN: 40, ENTER: 13, ESC: 27, PLUS: 43, A: 65, Z: 90, ZERO: 48, NINE: 57, SPACE: 32, BSPACE: 8, TAB: 9, DEL: 46, CTRL: 17, CMD1: 91, // Chrome CMD2: 224 }, windowLoaded = false; // keep track of if the window.load event has fired as impossible to check after the fact $(window).load(function() { windowLoaded = true; }); function Plugin(element, options) { this.element = element; this.options = $.extend({}, defaults, options); this._defaults = defaults; // event namespace this.ns = "." + pluginName + id++; // Chrome, FF, Safari, IE9+ this.isGoodBrowser = Boolean(element.setSelectionRange); this.hadInitialPlaceholder = Boolean($(element).attr("placeholder")); this._name = pluginName; } Plugin.prototype = { _init: function() { // if in nationalMode, disable options relating to dial codes if (this.options.nationalMode) { this.options.autoHideDialCode = false; } // if separateDialCode then doesn't make sense to A) insert dial code into input (autoHideDialCode), and B) display national numbers (because we're displaying the country dial code next to them) if (this.options.separateDialCode) { this.options.autoHideDialCode = this.options.nationalMode = false; // let's force this for now for simplicity - we can support this later if need be this.options.allowDropdown = true; } // we cannot just test screen size as some smartphones/website meta tags will report desktop resolutions // Note: for some reason jasmine breaks if you put this in the main Plugin function with the rest of these declarations // Note: to target Android Mobiles (and not Tablets), we must find "Android" and "Mobile" this.isMobile = /Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); if (this.isMobile) { // trigger the mobile dropdown css $("body").addClass("iti-mobile"); // on mobile, we want a full screen dropdown, so we must append it to the body if (!this.options.dropdownContainer) { this.options.dropdownContainer = "body"; } } // we return these deferred objects from the _init() call so they can be watched, and then we resolve them when each specific request returns // Note: again, jasmine breaks when I put these in the Plugin function this.autoCountryDeferred = new $.Deferred(); this.utilsScriptDeferred = new $.Deferred(); // process all the data: onlyCountries, excludeCountries, preferredCountries etc this._processCountryData(); // generate the markup this._generateMarkup(); // set the initial state of the input value and the selected flag this._setInitialState(); // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click this._initListeners(); // utils script, and auto country this._initRequests(); // return the deferreds return [ this.autoCountryDeferred, this.utilsScriptDeferred ]; }, /******************** * PRIVATE METHODS ********************/ // prepare all of the country data, including onlyCountries, excludeCountries and preferredCountries options _processCountryData: function() { // process onlyCountries or excludeCountries array if present this._processAllCountries(); // process the countryCodes map this._processCountryCodes(); // process the preferredCountries this._processPreferredCountries(); }, // add a country code to this.countryCodes _addCountryCode: function(iso2, dialCode, priority) { if (!(dialCode in this.countryCodes)) { this.countryCodes[dialCode] = []; } var index = priority || 0; this.countryCodes[dialCode][index] = iso2; }, // filter the given countries using the process function _filterCountries: function(countryArray, processFunc) { var i; // standardise case for (i = 0; i < countryArray.length; i++) { countryArray[i] = countryArray[i].toLowerCase(); } // build instance country array this.countries = []; for (i = 0; i < allCountries.length; i++) { if (processFunc($.inArray(allCountries[i].iso2, countryArray))) { this.countries.push(allCountries[i]); } } }, // process onlyCountries or excludeCountries array if present _processAllCountries: function() { if (this.options.onlyCountries.length) { // process onlyCountries option this._filterCountries(this.options.onlyCountries, function(inArray) { // if country is in array return inArray != -1; }); } else if (this.options.excludeCountries.length) { // process excludeCountries option this._filterCountries(this.options.excludeCountries, function(inArray) { // if country is not in array return inArray == -1; }); } else { this.countries = allCountries; } }, // process the countryCodes map _processCountryCodes: function() { this.countryCodes = {}; for (var i = 0; i < this.countries.length; i++) { var c = this.countries[i]; this._addCountryCode(c.iso2, c.dialCode, c.priority); // area codes if (c.areaCodes) { for (var j = 0; j < c.areaCodes.length; j++) { // full dial code is country code + dial code this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]); } } } }, // process preferred countries - iterate through the preferences, fetching the country data for each one _processPreferredCountries: function() { this.preferredCountries = []; for (var i = 0; i < this.options.preferredCountries.length; i++) { var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true); if (countryData) { this.preferredCountries.push(countryData); } } }, // generate all of the markup for the plugin: the selected flag overlay, and the dropdown _generateMarkup: function() { // telephone input this.telInput = $(this.element); // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode) this.telInput.attr("autocomplete", "off"); // containers (mostly for positioning) var parentClass = "intl-tel-input"; if (this.options.allowDropdown) { parentClass += " allow-dropdown"; } if (this.options.separateDialCode) { parentClass += " separate-dial-code"; } this.telInput.wrap($("<div>", { "class": parentClass })); this.flagsContainer = $("<div>", { "class": "flag-container" }).insertBefore(this.telInput); // currently selected flag (displayed to left of input) var selectedFlag = $("<div>", { "class": "selected-flag" }); selectedFlag.appendTo(this.flagsContainer); this.selectedFlagInner = $("<div>", { "class": "iti-flag" }).appendTo(selectedFlag); if (this.options.separateDialCode) { this.selectedDialCode = $("<div>", { "class": "selected-dial-code" }).appendTo(selectedFlag); } if (this.options.allowDropdown) { // make element focusable and tab naviagable selectedFlag.attr("tabindex", "0"); // CSS triangle $("<div>", { "class": "iti-arrow" }).appendTo(selectedFlag); // country dropdown: preferred countries, then divider, then all countries this.countryList = $("<ul>", { "class": "country-list hide" }); if (this.preferredCountries.length) { this._appendListItems(this.preferredCountries, "preferred"); $("<li>", { "class": "divider" }).appendTo(this.countryList); } this._appendListItems(this.countries, ""); // this is useful in lots of places this.countryListItems = this.countryList.children(".country"); // create dropdownContainer markup if (this.options.dropdownContainer) { this.dropdown = $("<div>", { "class": "intl-tel-input iti-container" }).append(this.countryList); } else { this.countryList.appendTo(this.flagsContainer); } } else { // a little hack so we don't break anything this.countryListItems = $(); } }, // add a country <li> to the countryList <ul> container _appendListItems: function(countries, className) { // we create so many DOM elements, it is faster to build a temp string // and then add everything to the DOM in one go at the end var tmp = ""; // for each country for (var i = 0; i < countries.length; i++) { var c = countries[i]; // open the list item tmp += "<li class='country " + className + "' data-dial-code='" + c.dialCode + "' data-country-code='" + c.iso2 + "'>"; // add the flag tmp += "<div class='flag-box'><div class='iti-flag " + c.iso2 + "'></div></div>"; // and the country name and dial code tmp += "<span class='country-name'>" + c.name + "</span>"; tmp += "<span class='dial-code'>+" + c.dialCode + "</span>"; // close the list item tmp += "</li>"; } this.countryList.append(tmp); }, // set the initial state of the input value and the selected flag by: // 1. extracting a dial code from the given number // 2. using explicit initialCountry // 3. picking the first preferred country // 4. picking the first country _setInitialState: function() { var val = this.telInput.val(); // if we already have a dial code we can go ahead and set the flag, else fall back to default if (this._getDialCode(val)) { this._updateFlagFromNumber(val, true); } else if (this.options.initialCountry !== "auto") { // see if we should select a flag if (this.options.initialCountry) { this._setFlag(this.options.initialCountry, true); } else { // no dial code and no initialCountry, so default to first in list this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; if (!val) { this._setFlag(this.defaultCountry, true); } } // if empty and no nationalMode and no autoHideDialCode then insert the default dial code if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) { this.telInput.val("+" + this.selectedCountryData.dialCode); } } // NOTE: if initialCountry is set to auto, that will be handled separately // format if (val) { // this wont be run after _updateDialCode as that's only called if no val this._updateValFromNumber(val, this.options.formatOnInit); } }, // initialise the main event listeners: input keyup, and click selected flag _initListeners: function() { this._initKeyListeners(); if (this.options.autoHideDialCode) { this._initFocusListeners(); } if (this.options.allowDropdown) { this._initDropdownListeners(); } }, // initialise the dropdown listeners _initDropdownListeners: function() { var that = this; // hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again var label = this.telInput.closest("label"); if (label.length) { label.on("click" + this.ns, function(e) { // if the dropdown is closed, then focus the input, else ignore the click if (that.countryList.hasClass("hide")) { that.telInput.focus(); } else { e.preventDefault(); } }); } // toggle country dropdown on click var selectedFlag = this.selectedFlagInner.parent(); selectedFlag.on("click" + this.ns, function(e) { // only intercept this event if we're opening the dropdown // else let it bubble up to the top ("click-off-to-close" listener) // we cannot just stopPropagation as it may be needed to close another instance if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) { that._showDropdown(); } }); // open dropdown list if currently focused this.flagsContainer.on("keydown" + that.ns, function(e) { var isDropdownHidden = that.countryList.hasClass("hide"); if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) { // prevent form from being submitted if "ENTER" was pressed e.preventDefault(); // prevent event from being handled again by document e.stopPropagation(); that._showDropdown(); } // allow navigation from dropdown to input on TAB if (e.which == keys.TAB) { that._closeDropdown(); } }); }, // init many requests: utils script / geo ip lookup _initRequests: function() { var that = this; // if the user has specified the path to the utils script, fetch it on window.load, else resolve if (this.options.utilsScript) { // if the plugin is being initialised after the window.load event has already been fired if (windowLoaded) { $.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred); } else { // wait until the load event so we don't block any other requests e.g. the flags image $(window).load(function() { $.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred); }); } } else { this.utilsScriptDeferred.resolve(); } if (this.options.initialCountry === "auto") { this._loadAutoCountry(); } else { this.autoCountryDeferred.resolve(); } }, // perform the geo ip lookup _loadAutoCountry: function() { var that = this; // check for cookie var cookieAutoCountry = window.Cookies ? Cookies.get("itiAutoCountry") : ""; if (cookieAutoCountry) { $.fn[pluginName].autoCountry = cookieAutoCountry; } // 3 options: // 1) already loaded (we're done) // 2) not already started loading (start) // 3) already started loading (do nothing - just wait for loading callback to fire) if ($.fn[pluginName].autoCountry) { this.handleAutoCountry(); } else if (!$.fn[pluginName].startedLoadingAutoCountry) { // don't do this twice! $.fn[pluginName].startedLoadingAutoCountry = true; if (typeof this.options.geoIpLookup === "function") { this.options.geoIpLookup(function(countryCode) { $.fn[pluginName].autoCountry = countryCode.toLowerCase(); if (window.Cookies) { Cookies.set("itiAutoCountry", $.fn[pluginName].autoCountry, { path: "/" }); } // tell all instances the auto country is ready // TODO: this should just be the current instances // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight away (e.g. if they have already done the geo ip lookup somewhere else). Using setTimeout means that the current thread of execution will finish before executing this, which allows the plugin to finish initialising. setTimeout(function() { $(".intl-tel-input input").intlTelInput("handleAutoCountry"); }); }); } } }, // initialize any key listeners _initKeyListeners: function() { var that = this; // update flag on keyup // (keep this listener separate otherwise the setTimeout breaks all the tests) this.telInput.on("keyup" + this.ns, function() { that._updateFlagFromNumber(that.telInput.val()); }); // update flag on cut/paste events (now supported in all major browsers) this.telInput.on("cut" + this.ns + " paste" + this.ns + " keyup" + this.ns, function() { // hack because "paste" event is fired before input is updated setTimeout(function() { that._updateFlagFromNumber(that.telInput.val()); }); }); }, // adhere to the input's maxlength attr _cap: function(number) { var max = this.telInput.attr("maxlength"); return max && number.length > max ? number.substr(0, max) : number; }, // listen for mousedown, focus and blur _initFocusListeners: function() { var that = this; // mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click this.telInput.on("mousedown" + this.ns, function(e) { if (!that.telInput.is(":focus") && !that.telInput.val()) { e.preventDefault(); // but this also cancels the focus, so we must trigger that manually that.telInput.focus(); } }); // on focus: if empty, insert the dial code for the currently selected flag this.telInput.on("focus" + this.ns, function(e) { if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) { // insert the dial code that.telInput.val("+" + that.selectedCountryData.dialCode); // after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one that.telInput.one("keypress.plus" + that.ns, function(e) { if (e.which == keys.PLUS) { that.telInput.val(""); } }); // after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that setTimeout(function() { var input = that.telInput[0]; if (that.isGoodBrowser) { var len = that.telInput.val().length; input.setSelectionRange(len, len); } }); } }); // on blur: if just a dial code then remove it this.telInput.on("blur" + this.ns, function() { var value = that.telInput.val(), startsPlus = value.charAt(0) == "+"; if (startsPlus) { var numeric = that._getNumeric(value); // if just a plus, or if just a dial code if (!numeric || that.selectedCountryData.dialCode == numeric) { that.telInput.val(""); } } // remove the keypress listener we added on focus that.telInput.off("keypress.plus" + that.ns); }); }, // extract the numeric digits from the given string _getNumeric: function(s) { return s.replace(/\D/g, ""); }, // show the dropdown _showDropdown: function() { this._setDropdownPosition(); // update highlighting and scroll to active list item var activeListItem = this.countryList.children(".active"); if (activeListItem.length) { this._highlightListItem(activeListItem); this._scrollTo(activeListItem); } // bind all the dropdown-related listeners: mouseover, click, click-off, keydown this._bindDropdownListeners(); // update the arrow this.selectedFlagInner.children(".iti-arrow").addClass("up"); }, // decide where to position dropdown (depends on position within viewport, and scroll) _setDropdownPosition: function() { var that = this; if (this.options.dropdownContainer) { this.dropdown.appendTo(this.options.dropdownContainer); } // show the menu and grab the dropdown height this.dropdownHeight = this.countryList.removeClass("hide").outerHeight(); if (!this.isMobile) { var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom) dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop; // by default, the dropdown will be below the input. If we want to position it above the input, we add the dropup class. this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove); // if dropdownContainer is enabled, calculate postion if (this.options.dropdownContainer) { // by default the dropdown will be directly over the input because it's not in the flow. If we want to position it below, we need to add some extra top value. var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight(); // calculate placement this.dropdown.css({ top: inputTop + extraTop, left: pos.left }); // close menu on window scroll $(window).on("scroll" + this.ns, function() { that._closeDropdown(); }); } } }, // we only bind dropdown listeners when the dropdown is open _bindDropdownListeners: function() { var that = this; // when mouse over a list item, just highlight that one // we add the class "highlight", so if they hit "enter" we know which one to select this.countryList.on("mouseover" + this.ns, ".country", function(e) { that._highlightListItem($(this)); }); // listen for country selection this.countryList.on("click" + this.ns, ".country", function(e) { that._selectListItem($(this)); }); // click off to close // (except when this initial opening click is bubbling up) // we cannot just stopPropagation as it may be needed to close another instance var isOpening = true; $("html").on("click" + this.ns, function(e) { if (!isOpening) { that._closeDropdown(); } isOpening = false; }); // listen for up/down scrolling, enter to select, or letters to jump to country name. // use keydown as keypress doesn't fire for non-char keys and we want to catch if they // just hit down and hold it to scroll down (no keyup event). // listen on the document because that's where key events are triggered if no input has focus var query = "", queryTimer = null; $(document).on("keydown" + this.ns, function(e) { // prevent down key from scrolling the whole page, // and enter key from submitting a form etc e.preventDefault(); if (e.which == keys.UP || e.which == keys.DOWN) { // up and down to navigate that._handleUpDownKey(e.which); } else if (e.which == keys.ENTER) { // enter to select that._handleEnterKey(); } else if (e.which == keys.ESC) { // esc to close that._closeDropdown(); } else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) { // upper case letters (note: keyup/keydown only return upper case letters) // jump to countries that start with the query string if (queryTimer) { clearTimeout(queryTimer); } query += String.fromCharCode(e.which); that._searchForCountry(query); // if the timer hits 1 second, reset the query queryTimer = setTimeout(function() { query = ""; }, 1e3); } }); }, // highlight the next/prev item in the list (and ensure it is visible) _handleUpDownKey: function(key) { var current = this.countryList.children(".highlight").first(); var next = key == keys.UP ? current.prev() : current.next(); if (next.length) { // skip the divider if (next.hasClass("divider")) { next = key == keys.UP ? next.prev() : next.next(); } this._highlightListItem(next); this._scrollTo(next); } }, // select the currently highlighted item _handleEnterKey: function() { var currentCountry = this.countryList.children(".highlight").first(); if (currentCountry.length) { this._selectListItem(currentCountry); } }, // find the first list item whose name starts with the query string _searchForCountry: function(query) { for (var i = 0; i < this.countries.length; i++) { if (this._startsWith(this.countries[i].name, query)) { var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred"); // update highlighting and scroll this._highlightListItem(listItem); this._scrollTo(listItem, true); break; } } }, // check if (uppercase) string a starts with string b _startsWith: function(a, b) { return a.substr(0, b.length).toUpperCase() == b; }, // update the input's value to the given val (format first if possible) // NOTE: this is called from _setInitialState, handleUtils and setNumber _updateValFromNumber: function(number, doFormat, format) { if (doFormat && window.intlTelInputUtils && this.selectedCountryData) { if (!$.isNumeric(format)) { format = this.options.nationalMode || number.charAt(0) != "+" ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL; } number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); } number = this._beforeSetNumber(number); this.telInput.val(number); }, // check if need to select a new flag based on the given number // Note: called from _setInitialState, keyup handler, setNumber _updateFlagFromNumber: function(number, isInit) { // if we're in nationalMode and we already have US/Canada selected, make sure the number starts with a +1 so _getDialCode will be able to extract the area code // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit if (number && this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") { if (number.charAt(0) != "1") { number = "1" + number; } number = "+" + number; } // try and extract valid dial code from input var dialCode = this._getDialCode(number), countryCode = null; if (dialCode) { // check if one of the matching countries is already selected var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) != -1; // if a matching country is not already selected (or this is an unknown NANP area code): choose the first in the list if (!alreadySelected || this._isUnknownNanp(number, dialCode)) { // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index for (var j = 0; j < countryCodes.length; j++) { if (countryCodes[j]) { countryCode = countryCodes[j]; break; } } } } else if (number.charAt(0) == "+" && this._getNumeric(number).length) { // invalid dial code, so empty // Note: use getNumeric here because the number has not been formatted yet, so could contain bad chars countryCode = ""; } else if (!number || number == "+") { // empty, or just a plus, so default countryCode = this.defaultCountry; } if (countryCode !== null) { this._setFlag(countryCode, isInit); } }, // check if the given number contains an unknown area code from the North American Numbering Plan i.e. the only dialCode that could be extracted was +1 (instead of say +1 702) and the actual number's length is >=4 _isUnknownNanp: function(number, dialCode) { return dialCode == "+1" && this._getNumeric(number).length >= 4; }, // remove highlighting from other list items and highlight the given item _highlightListItem: function(listItem) { this.countryListItems.removeClass("highlight"); listItem.addClass("highlight"); }, // find the country data for the given country code // the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array _getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) { var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; for (var i = 0; i < countryList.length; i++) { if (countryList[i].iso2 == countryCode) { return countryList[i]; } } if (allowFail) { return null; } else { throw new Error("No country data for '" + countryCode + "'"); } }, // select the given flag, update the placeholder and the active list item // Note: called from _setInitialState, _updateFlagFromNumber, _selectListItem, setCountry _setFlag: function(countryCode, isInit) { var prevCountry = this.selectedCountryData && this.selectedCountryData.iso2 ? this.selectedCountryData : {}; // do this first as it will throw an error and stop if countryCode is invalid this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; // update the defaultCountry - we only need the iso2 from now on, so just store that if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } this.selectedFlagInner.attr("class", "iti-flag " + countryCode); // update the selected country's title attribute var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown"; this.selectedFlagInner.parent().attr("title", title); if (this.options.separateDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", parent = this.telInput.parent(); if (prevCountry.dialCode) { parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1)); } if (dialCode) { parent.addClass("iti-sdc-" + dialCode.length); } this.selectedDialCode.text(dialCode); } // and the input's placeholder this._updatePlaceholder(); // update the active list item this.countryListItems.removeClass("active"); if (countryCode) { this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active"); } // on change flag, trigger a custom event if (!isInit && prevCountry.iso2 !== countryCode) { this.telInput.trigger("countrychange"); } }, // update the input placeholder to an example number from the currently selected country _updatePlaceholder: function() { if (window.intlTelInputUtils && !this.hadInitialPlaceholder && this.options.autoPlaceholder && this.selectedCountryData) { var numberType = intlTelInputUtils.numberType[this.options.numberType], placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; placeholder = this._beforeSetNumber(placeholder); if (typeof this.options.customPlaceholder === "function") { placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); } this.telInput.attr("placeholder", placeholder); } }, // called when the user selects a list item from the dropdown _selectListItem: function(listItem) { // update selected flag and active list item this._setFlag(listItem.attr("data-country-code")); this._closeDropdown(); this._updateDialCode(listItem.attr("data-dial-code"), true); // focus the input this.telInput.focus(); // fix for FF and IE11 (with nationalMode=false i.e. auto inserting dial code), who try to put the cursor at the beginning the first time if (this.isGoodBrowser) { var len = this.telInput.val().length; this.telInput[0].setSelectionRange(len, len); } }, // close the dropdown and unbind any listeners _closeDropdown: function() { this.countryList.addClass("hide"); // update the arrow this.selectedFlagInner.children(".iti-arrow").removeClass("up"); // unbind key events $(document).off(this.ns); // unbind click-off-to-close $("html").off(this.ns); // unbind hover and click listeners this.countryList.off(this.ns); // remove menu from container if (this.options.dropdownContainer) { if (!this.isMobile) { $(window).off("scroll" + this.ns); } this.dropdown.detach(); } }, // check if an element is visible within it's container, else scroll until it is _scrollTo: function(element, middle) { var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2; if (elementTop < containerTop) { // scroll up if (middle) { newScrollTop -= middleOffset; } container.scrollTop(newScrollTop); } else if (elementBottom > containerBottom) { // scroll down if (middle) { newScrollTop += middleOffset; } var heightDifference = containerHeight - elementHeight; container.scrollTop(newScrollTop - heightDifference); } }, // replace any existing dial code with the new one // Note: called from _selectListItem and setCountry _updateDialCode: function(newDialCode, hasSelectedListItem) { var inputVal = this.telInput.val(), newNumber; // save having to pass this every time newDialCode = "+" + newDialCode; if (inputVal.charAt(0) == "+") { // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not) var prevDialCode = this._getDialCode(inputVal); if (prevDialCode) { // current number contains a valid dial code, so replace it newNumber = inputVal.replace(prevDialCode, newDialCode); } else { // current number contains an invalid dial code, so ditch it // (no way to determine where the invalid dial code ends and the rest of the number begins) newNumber = newDialCode; } } else if (this.options.nationalMode || this.options.separateDialCode) { // don't do anything return; } else { // nationalMode is disabled if (inputVal) { // there is an existing value with no dial code: prefix the new dial code newNumber = newDialCode + inputVal; } else if (hasSelectedListItem || !this.options.autoHideDialCode) { // no existing value and either they've just selected a list item, or autoHideDialCode is disabled: insert new dial code newNumber = newDialCode; } else { return; } } this.telInput.val(newNumber); }, // try and extract a valid international dial code from a full telephone number // Note: returns the raw string inc plus character and any whitespace/dots etc _getDialCode: function(number) { var dialCode = ""; // only interested in international numbers (starting with a plus) if (number.charAt(0) == "+") { var numericChars = ""; // iterate over chars for (var i = 0; i < number.length; i++) { var c = number.charAt(i); // if char is number if ($.isNumeric(c)) { numericChars += c; // if current numericChars make a valid dial code if (this.countryCodes[numericChars]) { // store the actual raw string (useful for matching later) dialCode = number.substr(0, i + 1); } // longest dial code is 4 chars if (numericChars.length == 4) { break; } } } } return dialCode; }, // get the input val, adding the dial code if separateDialCode is enabled _getFullNumber: function() { var prefix = this.options.separateDialCode ? "+" + this.selectedCountryData.dialCode : ""; return prefix + this.telInput.val(); }, // remove the dial code if separateDialCode is enabled _beforeSetNumber: function(number) { if (this.options.separateDialCode) { var dialCode = this._getDialCode(number); if (dialCode) { // a lot of numbers will have a space separating the dial code and the main number, and some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get rid of it // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; number = number.substr(start); } } return this._cap(number); }, /******************** * PUBLIC METHODS ********************/ // this is called when the geoip call returns handleAutoCountry: function() { if (this.options.initialCountry === "auto") { // we must set this even if there is an initial val in the input: in case the initial val is invalid and they delete it - they should see their auto country this.defaultCountry = $.fn[pluginName].autoCountry; // if there's no initial value in the input, then update the flag if (!this.telInput.val()) { this.setCountry(this.defaultCountry); } this.autoCountryDeferred.resolve(); } }, // remove plugin destroy: function() { if (this.allowDropdown) { // make sure the dropdown is closed (and unbind listeners) this._closeDropdown(); // click event to open dropdown this.selectedFlagInner.parent().off(this.ns); // label click hack this.telInput.closest("label").off(this.ns); } // unbind all events: key events, and focus/blur events if autoHideDialCode=true this.telInput.off(this.ns); // remove markup (but leave the original input) var container = this.telInput.parent(); container.before(this.telInput).remove(); }, // get the extension from the current number getExtension: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); } return ""; }, // format the number to the given format getNumber: function(format) { if (window.intlTelInputUtils) { return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format); } return ""; }, // get the type of the entered number e.g. landline/mobile getNumberType: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // get the country data for the currently selected flag getSelectedCountryData: function() { // if this is undefined, the plugin will return it's instance instead, so in that case an empty object makes more sense return this.selectedCountryData || {}; }, // get the validation error getValidationError: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // validate the input val - assumes the global function isValidNumber (from utilsScript) isValidNumber: function() { var val = $.trim(this._getFullNumber()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : ""; return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null; }, // update the selected flag, and update the input val accordingly setCountry: function(countryCode) { countryCode = countryCode.toLowerCase(); // check if already selected if (!this.selectedFlagInner.hasClass(countryCode)) { this._setFlag(countryCode); this._updateDialCode(this.selectedCountryData.dialCode, false); } }, // set the input value and update the flag // NOTE: format arg is for public method: to allow devs to format how they want setNumber: function(number, format) { // we must update the flag first, which updates this.selectedCountryData, which is used for formatting the number before displaying it this._updateFlagFromNumber(number); this._updateValFromNumber(number, $.isNumeric(format), format); }, // this is called when the utils request completes handleUtils: function() { // if the request was successful if (window.intlTelInputUtils) { // if there's an initial value in the input, then format it if (this.telInput.val()) { this._updateValFromNumber(this.telInput.val(), this.options.formatOnInit); } this._updatePlaceholder(); } this.utilsScriptDeferred.resolve(); } }; // using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate // (adapted to allow public functions) $.fn[pluginName] = function(options) { var args = arguments; // Is the first parameter an object (options), or was omitted, // instantiate a new instance of the plugin. if (options === undefined || typeof options === "object") { // collect all of the deferred objects for all instances created with this selector var deferreds = []; this.each(function() { if (!$.data(this, "plugin_" + pluginName)) { var instance = new Plugin(this, options); var instanceDeferreds = instance._init(); // we now have 2 deffereds: 1 for auto country, 1 for utils script deferreds.push(instanceDeferreds[0]); deferreds.push(instanceDeferreds[1]); $.data(this, "plugin_" + pluginName, instance); } }); // return the promise from the "master" deferred object that tracks all the others return $.when.apply(null, deferreds); } else if (typeof options === "string" && options[0] !== "_") { // If the first parameter is a string and it doesn't start // with an underscore or "contains" the `init`-function, // treat this as a call to a public method. // Cache the method call to make it possible to return a value var returns; this.each(function() { var instance = $.data(this, "plugin_" + pluginName); // Tests that there's already a plugin-instance // and checks that the requested public method exists if (instance instanceof Plugin && typeof instance[options] === "function") { // Call the method of our plugin instance, // and pass it the supplied arguments. returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); } // Allow instances to be destroyed via the 'destroy' method if (options === "destroy") { $.data(this, "plugin_" + pluginName, null); } }); // If the earlier cached method gives a value back return the value, // otherwise return this to preserve chainability. return returns !== undefined ? returns : this; } }; /******************** * STATIC METHODS ********************/ // get the country data object $.fn[pluginName].getCountryData = function() { return allCountries; }; // load the utils script $.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) { if (!$.fn[pluginName].loadedUtilsScript) { // don't do this twice! (dont just check if window.intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet) $.fn[pluginName].loadedUtilsScript = true; // dont use $.getScript as it prevents caching $.ajax({ url: path, complete: function() { // tell all instances that the utils request is complete $(".intl-tel-input input").intlTelInput("handleUtils"); }, dataType: "script", cache: true }); } else if (utilsScriptDeferred) { utilsScriptDeferred.resolve(); } }; // version $.fn[pluginName].version = "8.4.0"; // Tell JSHint to ignore this warning: "character may get silently deleted by one or more browsers" // jshint -W100 // Array of country objects for the flag dropdown. // Each contains a name, country code (ISO 3166-1 alpha-2) and dial code. // Originally from https://github.com/mledoze/countries // then with a couple of manual re-arrangements to be alphabetical // then changed Kazakhstan from +76 to +7 // and Vatican City from +379 to +39 (see issue 50) // and Caribean Netherlands from +5997 to +599 // and Curacao from +5999 to +599 // Removed: Kosovo, Pitcairn Islands, South Georgia // UPDATE Sept 12th 2015 // List of regions that have iso2 country codes, which I have chosen to omit: // (based on this information: https://en.wikipedia.org/wiki/List_of_country_calling_codes) // AQ - Antarctica - all different country codes depending on which "base" // BV - Bouvet Island - no calling code // GS - South Georgia and the South Sandwich Islands - "inhospitable collection of islands" - same flag and calling code as Falkland Islands // HM - Heard Island and McDonald Islands - no calling code // PN - Pitcairn - tiny population (56), same calling code as New Zealand // TF - French Southern Territories - no calling code // UM - United States Minor Outlying Islands - no calling code // UPDATE the criteria of supported countries or territories (see issue 297) // Have an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 // Have a country calling code: https://en.wikipedia.org/wiki/List_of_country_calling_codes // Have a flag // Must be supported by libphonenumber: https://github.com/googlei18n/libphonenumber // Update: converted objects to arrays to save bytes! // Update: added "priority" for countries with the same dialCode as others // Update: added array of area codes for countries with the same dialCode as others // So each country array has the following information: // [ // Country name, // iso2 code, // International dial code, // Order (if >1 country with same dial code), // Area codes (if >1 country with same dial code) // ] var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy (Saint-Barthélemy)", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1 ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1 ] ]; // loop over all of the countries above for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; allCountries[i] = { name: c[0], iso2: c[1], dialCode: c[2], priority: c[3] || 0, areaCodes: c[4] || null }; } });
packages/examples/src/svg/svg.js
diegomura/react-pdf
import React from 'react'; import { Svg, G, Polygon } from '@react-pdf/renderer'; const Tiger = () => ( <Svg style={{ width: 400, height: 400 }}> <G transform="scale(1) translate(100,10)"> <Polygon fill="#f2cc99" points=" 69,18 82,8 99,3 118,5 135,12 149,21 156,13 165,9 177,13 183,28 180,50 164,91 155,107 154,114 151,121 141,127 139,136 155,206 157,251 126,342 133,357 128,376 83,376 75,368 67,350 61,350 53,369 4,369 2,361 5,354 12,342 16,321 4,257 4,244 7,218 9,179 26,127 43,93 32,77 30,70 24,67 16,49 17,35 18,23 30,12 40,7 53,7 62,12" /> <Polygon fill="#e5b27f" points=" 142,79 136,74 138,82 133,78 133,84 127,78 128,85 124,80 125,87 119,82 119,90 125,99 125,96 128,100 128,94 131,98 132,93 135,97 136,93 138,97 139,94 141,98 143,94 144,85" /> <Polygon fill="#eb8080" points=" 127,101 132,100 137,99 144,101 143,105 135,110" /> <Polygon fill="#f2cc99" points=" 178,229 157,248 139,296 126,349 137,356 158,357 183,342 212,332 235,288 235,261 228,252 212,250 188,251" /> <G fill="#9c826b"> <Polygon points=" 56,229 48,241 48,250 57,281 63,325 71,338 81,315 76,321 79,311 83,301 75,308 80,298 73,303 76,296 71,298 74,292 69,293 74,284 78,278 71,278 74,274 68,273 70,268 66,267 68,261 60,266 62,259 65,253 57,258 59,251 55,254 55,248 60,237 54,240 58,234 54,236" /> <Polygon points=" 74,363 79,368 81,368 85,362 89,363 92,370 96,373 101,372 108,361 110,371 113,373 116,371 120,358 122,363 123,371 126,371 129,367 132,357 135,361 130,376 127,377 94,378 84,376 76,371" /> <Polygon points=" 212,250 219,251 228,258 236,270 235,287 225,304 205,332 177,343 171,352 158,357 166,352 168,346 168,339 165,333 155,327 155,323 161,320 165,316 169,316 167,312 171,313 168,308 173,309 170,306 177,306 175,308 177,311 174,311 176,316 171,315 174,319 168,320 168,323 175,327 179,332 183,326 184,332 189,323 190,328 194,320 194,325 199,316 201,320 204,313 206,316 208,310 211,305 219,298 226,288 229,279 228,266 224,259 217,253" /> <Polygon points=" 151,205 151,238 149,252 141,268 128,282 121,301 130,300 126,313 118,324 116,337 120,346 133,352 133,340 137,333 145,329 156,327 153,319 153,291 157,271 170,259 178,277 193,250 174,216" /> <Polygon points=" 78,127 90,142 95,155 108,164 125,167 139,175 150,206 152,191 141,140 121,148 100,136" /> <Polygon points=" 21,58 35,63 38,68 32,69 42,74 40,79 47,80 54,83 45,94 34,81 32,73 24,66" /> <Polygon points=" 71,34 67,34 66,27 59,24 54,17 48,17 39,22 30,26 28,31 31,39 38,46 29,45 36,54 41,61 41,70 50,69 54,71 55,58 67,52 76,43 76,39 68,44" /> <Polygon points=" 139,74 141,83 143,89 144,104 148,104 155,106 154,86 157,77 155,72 150,77 144,77" /> <Polygon points=" 105,44 102,53 108,58 111,62 112,55" /> <Polygon points=" 141,48 141,54 144,58 139,62 137,66 136,59 137,52" /> <Polygon points=" 98,135 104,130 105,134 108,132 108,135 112,134 113,137 116,136 116,139 119,139 124,141 128,140 133,138 140,133 139,140 126,146 104,144" /> <Polygon points=" 97,116 103,119 103,116 111,118 116,117 122,114 127,107 135,111 142,107 141,114 145,118 149,121 145,125 140,124 127,121 113,125 100,124" /> <Polygon points=" 147,33 152,35 157,34 153,31 160,31 156,28 161,28 159,24 163,25 163,21 165,22 170,23 167,17 172,21 174,18 175,23 176,22 177,28 177,33 174,37 176,39 174,44 171,49 168,53 164,57 159,68 156,70 154,60 150,51 146,43 144,35" /> <Polygon points=" 85,72 89,74 93,75 100,76 105,75 102,79 94,79 88,76" /> <Polygon points=" 86,214 79,221 76,232 82,225 78,239 82,234 78,245 81,243 79,255 84,250 84,267 87,254 90,271 90,257 95,271 93,256 95,249 92,252 93,243 89,253 89,241 86,250 87,236 83,245 87,231 82,231 90,219 84,221" /> </G> <G fill="#ffcc7f"> <Polygon points=" 93,68 96,72 100,73 106,72 108,66 105,63 100,62" /> <Polygon points=" 144,64 142,68 142,73 146,74 150,73 154,64 149,62" /> </G> <G fill="#9c826b"> <Polygon points=" 57,91 42,111 52,105 41,117 53,112 46,120 53,116 50,124 57,119 55,127 61,122 60,130 67,126 66,134 71,129 72,136 77,130 76,137 80,133 82,138 86,135 96,135 94,129 86,124 83,117 77,123 79,117 73,120 75,112 68,116 71,111 65,114 69,107 63,110 68,102 61,107 66,98 61,103 63,97 57,99" /> <Polygon points=" 83,79 76,79 67,82 75,83 65,88 76,87 65,92 76,91 68,96 77,95 70,99 80,98 72,104 80,102 76,108 85,103 92,101 87,98 93,96 86,94 91,93 85,91 93,89 99,89 105,93 107,85 102,82 92,80" /> <Polygon points=" 109,77 111,83 109,89 113,94 117,90 117,81 114,78" /> <Polygon points=" 122,128 127,126 134,127 136,129 134,130 130,128 124,129" /> <Polygon points=" 78,27 82,32 80,33 82,36 78,37 82,40 78,42 81,46 76,47 78,49 74,50 82,52 87,50 83,48 91,46 86,45 91,42 88,40 92,37 86,34 90,31 86,29 89,26" /> <Polygon points=" 82,17 92,20 79,21 90,25 81,25 94,28 93,26 101,30 101,26 107,33 108,28 111,40 113,34 115,45 117,39 119,54 121,46 124,58 126,47 129,59 130,49 134,58 133,44 137,48 133,37 137,40 133,32 126,20 135,26 132,19 138,23 135,17 142,18 132,11 116,6 94,6 78,11 92,12 80,14 90,16" /> <Polygon points=" 142,234 132,227 124,223 115,220 110,225 118,224 127,229 135,236 122,234 115,237 113,242 121,238 139,243 121,245 111,254 95,254 102,244 104,235 110,229 100,231 104,224 113,216 122,215 132,217 141,224 145,230 149,240" /> <Polygon points=" 115,252 125,248 137,249 143,258 134,255 125,254" /> <Polygon points=" 114,212 130,213 140,219 147,225 144,214 137,209 128,207" /> <Polygon points=" 102,263 108,258 117,257 131,258 116,260 109,265" /> <Polygon points=" 51,241 35,224 40,238 23,224 31,242 19,239 28,247 17,246 25,250 37,254 39,263 44,271 47,294 48,317 51,328 60,351 60,323 53,262 47,246" /> <Polygon points=" 2,364 9,367 14,366 18,355 20,364 26,366 31,357 35,364 39,364 42,357 47,363 53,360 59,357 54,369 7,373" /> <Polygon points=" 7,349 19,345 25,339 18,341 23,333 28,326 23,326 27,320 23,316 25,311 20,298 15,277 12,264 9,249 10,223 3,248 5,261 15,307 17,326 11,343" /> <Polygon points=" 11,226 15,231 25,236 18,227" /> <Polygon points=" 13,214 19,217 32,227 23,214 16,208 15,190 24,148 31,121 24,137 14,170 8,189" /> <Polygon points=" 202,254 195,258 199,260 193,263 197,263 190,268 196,268 191,273 188,282 200,272 194,272 201,266 197,265 204,262 200,258 204,256" /> </G> <G fill="#845433"> <Polygon points=" 151,213 165,212 179,225 189,246 187,262 179,275 176,263 177,247 171,233 163,230 165,251 157,264 146,298 145,321 133,326 143,285 154,260 153,240" /> <Polygon points=" 91,132 95,145 97,154 104,148 107,155 109,150 111,158 115,152 118,159 120,153 125,161 126,155 133,164 132,154 137,163 137,152 142,163 147,186 152,192 148,167 141,143 124,145 105,143" /> </G> <G fill="#9c826b"> <Polygon points=" 31,57 23,52 26,51 20,44 23,42 21,36 22,29 25,23 24,32 30,43 26,41 30,50 26,48" /> <Polygon points=" 147,21 149,28 155,21 161,16 167,14 175,15 173,11 161,9" /> <Polygon points=" 181,39 175,51 169,57 171,65 165,68 165,75 160,76 162,91 171,71 180,51" /> <Polygon points=" 132,346 139,348 141,346 142,341 147,342 143,355 133,350" /> <Polygon points=" 146,355 151,352 155,348 157,343 160,349 151,356 147,357" /> <Polygon points=" 99,266 100,281 94,305 86,322 78,332 72,346 73,331 91,291" /> <Polygon points=" 20,347 32,342 45,340 54,345 45,350 42,353 38,350 31,353 29,356 23,350 19,353 15,349" /> <Polygon points=" 78,344 86,344 92,349 88,358 84,352" /> <Polygon points=" 93,347 104,344 117,345 124,354 121,357 116,351 112,351 108,355 102,351" /> </G> <G fill="#000000"> <Polygon points=" 105,12 111,18 113,24 113,29 119,34 116,23 112,16" /> <Polygon points=" 122,27 125,34 127,43 128,34 125,29" /> <Polygon points=" 115,13 122,19 122,15 113,10" /> </G> <G fill="#ffe5b2"> <Polygon points=" 116,172 107,182 98,193 98,183 90,199 89,189 84,207 88,206 87,215 95,206 93,219 91,230 98,216 97,226 104,214 112,209 104,208 113,202 126,200 139,207 132,198 142,203 134,192 142,195 134,187 140,185 130,181 136,177 126,177 125,171 116,180" /> <Polygon points=" 74,220 67,230 67,221 59,235 63,233 60,248 70,232 65,249 71,243 67,256 73,250 69,262 73,259 71,267 76,262 72,271 78,270 76,275 82,274 78,290 86,279 86,289 92,274 88,275 87,264 82,270 82,258 77,257 78,247 73,246 77,233 72,236" /> <Polygon points=" 133,230 147,242 148,250 145,254 138,247 129,246 142,245 138,241 128,237 137,238" /> <Polygon points=" 133,261 125,261 116,263 111,267 125,265" /> <Polygon points=" 121,271 109,273 103,279 99,305 92,316 85,327 83,335 89,340 97,341 94,336 101,336 96,331 103,330 97,327 108,325 99,322 109,321 100,318 110,317 105,314 110,312 107,310 113,308 105,306 114,303 105,301 115,298 107,295 115,294 108,293 117,291 109,289 117,286 109,286 118,283 112,281 118,279 114,278 119,276 115,274" /> <Polygon points=" 79,364 74,359 74,353 76,347 80,351 83,356 82,360" /> <Polygon points=" 91,363 93,356 97,353 103,355 105,360 103,366 99,371 94,368" /> <Polygon points=" 110,355 114,353 118,357 117,363 113,369 111,362" /> <Polygon points=" 126,354 123,358 124,367 126,369 129,361 129,357" /> <Polygon points=" 30,154 24,166 20,182 23,194 29,208 37,218 41,210 41,223 46,214 46,227 52,216 52,227 61,216 59,225 68,213 73,219 70,207 77,212 69,200 77,202 70,194 78,197 68,187 76,182 64,182 58,175 58,185 53,177 50,186 46,171 44,182 39,167 36,172 36,162 30,166" /> <Polygon points=" 44,130 41,137 45,136 43,150 48,142 48,157 53,150 52,164 60,156 61,169 64,165 66,175 70,167 74,176 77,168 80,183 85,172 90,182 93,174 98,181 99,173 104,175 105,169 114,168 102,163 95,157 94,166 90,154 87,162 82,149 75,159 72,148 68,155 67,143 62,148 62,138 58,145 56,133 52,142 52,128 49,134 47,125" /> <Polygon points=" 13,216 19,219 36,231 22,223 16,222 22,227 12,224 13,220 16,220" /> <Polygon points=" 10,231 14,236 25,239 27,237 19,234" /> <Polygon points=" 9,245 14,242 25,245 13,245" /> <Polygon points=" 33,255 26,253 18,254 25,256 18,258 27,260 18,263 27,265 19,267 29,270 21,272 29,276 21,278 30,281 22,283 31,287 24,288 32,292 23,293 34,298 26,299 37,303 32,305 39,309 33,309 39,314 34,314 40,318 34,317 40,321 34,321 41,326 33,326 40,330 33,332 39,333 33,337 42,337 54,341 49,337 52,335 47,330 50,330 45,325 49,325 45,321 48,321 45,316 46,306 45,286 43,274 36,261" /> <Polygon points=" 7,358 9,351 14,351 17,359 11,364" /> <Polygon points=" 44,354 49,351 52,355 49,361" /> <Polygon points=" 32,357 37,353 40,358 36,361" /> <Polygon points=" 139,334 145,330 154,330 158,334 154,341 152,348 145,350 149,340 147,336 141,339 139,345 136,342 136,339" /> <Polygon points=" 208,259 215,259 212,255 220,259 224,263 225,274 224,283 220,292 208,300 206,308 203,304 199,315 197,309 195,318 193,313 190,322 190,316 185,325 182,318 180,325 172,321 178,320 176,313 186,312 180,307 188,307 184,303 191,302 186,299 195,294 187,290 197,288 192,286 201,283 194,280 203,277 198,275 207,271 200,269 209,265 204,265 212,262" /> <Polygon points=" 106,126 106,131 109,132 111,134 115,132 115,135 119,133 118,137 123,137 128,137 133,134 136,130 136,127 132,124 118,128 112,128 106,126 106,126 106,126" /> <Polygon points=" 107,114 101,110 98,102 105,97 111,98 119,102 121,108 118,112 113,115" /> <Polygon points=" 148,106 145,110 146,116 150,118 152,111 151,107" /> <Polygon points=" 80,55 70,52 75,58 63,57 72,61 57,61 67,66 57,67 62,69 54,71 61,73 54,77 63,78 53,85 60,84 56,90 69,84 63,82 75,76 70,75 77,72 72,71 78,69 72,66 81,67 78,64 82,63 80,60 86,62" /> <Polygon points=" 87,56 91,52 96,50 102,56 98,56 92,60" /> <Polygon points=" 85,68 89,73 98,76 106,74 96,73 91,70" /> <Polygon points=" 115,57 114,64 111,64 115,75 122,81 122,74 126,79 126,74 131,78 130,72 133,77 131,68 126,61 119,57" /> <Polygon points=" 145,48 143,53 147,59 151,59 150,55" /> <Polygon points=" 26,22 34,15 43,10 52,10 59,16 47,15 32,22" /> <Polygon points=" 160,19 152,26 149,34 154,33 152,30 157,30 155,26 158,27 157,23 161,23" /> </G> <G fill="#000000"> <Polygon points=" 98,117 105,122 109,122 105,117 113,120 121,120 130,112 128,108 123,103 123,99 128,101 132,106 135,109 142,105 142,101 145,101 145,91 148,101 145,105 136,112 135,116 143,124 148,120 150,122 142,128 133,122 121,125 112,126 103,125 100,129 96,124" /> <Polygon points=" 146,118 152,118 152,115 149,115" /> <Polygon points=" 148,112 154,111 154,109 149,109" /> <Polygon points=" 106,112 108,115 114,116 118,114" /> <Polygon points=" 108,108 111,110 116,110 119,108" /> <Polygon points=" 106,104 109,105 117,106 115,104" /> <Polygon points=" 50,25 41,26 34,33 39,43 49,58 36,51 47,68 55,69 54,59 61,57 74,46 60,52 67,42 57,48 61,40 54,45 60,36 59,29 48,38 52,30 47,32" /> <Polygon points=" 147,34 152,41 155,49 161,53 157,47 164,47 158,43 168,44 159,40 164,37 169,37 164,33 169,34 165,28 170,30 170,25 173,29 175,27 176,32 173,36 175,39 172,42 172,46 168,49 170,55 162,57 158,63 155,58 153,50 149,46" /> <Polygon points=" 155,71 159,80 157,93 157,102 155,108 150,101 149,93 154,101 152,91 151,83 155,79" /> <Polygon points=" 112,78 115,81 114,91 112,87 113,82" /> <Polygon points=" 78,28 64,17 58,11 47,9 36,10 28,16 21,26 18,41 20,51 23,61 33,65 28,68 37,74 36,81 43,87 48,90 43,100 40,98 39,90 31,80 30,72 22,71 17,61 14,46 16,28 23,17 33,9 45,6 54,6 65,12" /> <Polygon points=" 67,18 76,9 87,5 101,2 118,3 135,8 149,20 149,26 144,19 132,12 121,9 105,7 89,8 76,14 70,20" /> <Polygon points=" 56,98 48,106 56,103 47,112 56,110 52,115 57,113 52,121 62,115 58,123 65,119 63,125 69,121 68,127 74,125 74,129 79,128 83,132 94,135 93,129 85,127 81,122 76,126 75,121 71,124 71,117 66,121 66,117 62,117 64,112 60,113 60,110 57,111 61,105 57,107 60,101 55,102" /> <Polygon points=" 101,132 103,138 106,134 106,139 112,136 111,142 115,139 114,143 119,142 125,145 131,142 135,138 140,134 140,129 143,135 145,149 150,171 149,184 145,165 141,150 136,147 132,151 131,149 126,152 125,150 121,152 117,148 111,152 110,148 105,149 104,145 98,150 96,138 94,132 94,130 98,132" /> <Polygon points=" 41,94 32,110 23,132 12,163 6,190 7,217 5,236 3,247 9,230 12,211 12,185 18,160 26,134 35,110 43,99" /> <Polygon points=" 32,246 41,250 50,257 52,267 53,295 53,323 59,350 54,363 51,365 44,366 42,360 40,372 54,372 59,366 62,353 71,352 75,335 73,330 66,318 68,302 64,294 67,288 63,286 63,279 59,275 58,267 56,262 50,247 42,235 44,246 32,236 35,244" /> <Polygon points=" 134,324 146,320 159,322 173,327 179,337 179,349 172,355 158,357 170,350 174,343 170,333 163,328 152,326 134,329" /> <Polygon points=" 173,339 183,334 184,338 191,329 194,332 199,323 202,325 206,318 209,320 213,309 221,303 228,296 232,289 234,279 233,269 230,262 225,256 219,253 208,252 198,252 210,249 223,250 232,257 237,265 238,277 238,291 232,305 221,323 218,335 212,342 200,349 178,348" /> <Polygon points=" 165,296 158,301 156,310 156,323 162,324 159,318 162,308 162,304" /> <Polygon points=" 99,252 105,244 107,234 115,228 121,228 131,235 122,233 113,235 109,246 121,239 133,243 121,243 110,251" /> <Polygon points=" 117,252 124,247 134,249 136,253 126,252" /> <Polygon points=" 117,218 132,224 144,233 140,225 132,219 117,218 117,218 117,218" /> <Polygon points=" 122,212 134,214 143,221 141,213 132,210" /> <Polygon points=" 69,352 70,363 76,373 86,378 97,379 108,379 120,377 128,378 132,373 135,361 133,358 132,366 127,375 121,374 121,362 119,367 117,374 110,376 110,362 107,357 106,371 104,375 97,376 90,375 90,368 86,362 83,364 86,369 85,373 78,370 73,362 71,351" /> <Polygon points=" 100,360 96,363 99,369 102,364" /> <Polygon points=" 115,360 112,363 114,369 117,364" /> <Polygon points=" 127,362 125,364 126,369 128,365" /> <Polygon points=" 5,255 7,276 11,304 15,320 13,334 6,348 2,353 0,363 5,372 12,374 25,372 38,372 44,369 42,367 36,368 31,369 30,360 27,368 20,370 16,361 15,368 10,369 3,366 3,359 6,352 11,348 17,331 19,316 12,291 9,274" /> <Polygon points=" 10,358 7,362 10,366 11,362" /> <Polygon points=" 25,357 22,360 24,366 27,360" /> <Polygon points=" 37,357 34,361 36,365 38,361" /> <Polygon points=" 49,356 46,359 47,364 50,360" /> <Polygon points=" 130,101 132,102 135,101 139,102 143,103 142,101 137,100 133,100" /> <Polygon points=" 106,48 105,52 108,56 109,52" /> <Polygon points=" 139,52 139,56 140,60 142,58 141,56" /> <Polygon points=" 25,349 29,351 30,355 33,350 37,348 42,351 45,347 49,345 44,343 36,345" /> <Polygon points=" 98,347 105,351 107,354 109,349 115,349 120,353 118,349 113,346 104,346" /> <Polygon points=" 83,348 87,352 87,357 89,351 87,348" /> <Polygon points=" 155,107 163,107 170,107 186,108 175,109 155,109" /> <Polygon points=" 153,114 162,113 175,112 192,114 173,114 154,115" /> <Polygon points=" 152,118 164,120 180,123 197,129 169,123 151,120" /> <Polygon points=" 68,109 87,106 107,106 106,108 88,108" /> <Polygon points=" 105,111 95,112 79,114 71,116 85,115 102,113" /> <Polygon points=" 108,101 98,99 87,99 78,99 93,100 105,102" /> <Polygon points=" 85,63 91,63 97,60 104,60 108,62 111,69 112,75 110,74 108,71 103,73 106,69 105,65 103,64 103,67 102,70 99,70 97,66 94,67 97,72 88,67 84,66" /> <Polygon points=" 140,74 141,66 144,61 150,61 156,62 153,70 150,73 152,65 150,65 151,68 149,71 146,71 144,66 143,70 143,74" /> <Polygon points=" 146,20 156,11 163,9 172,9 178,14 182,18 184,32 182,42 182,52 177,58 176,67 171,76 165,90 157,105 160,92 164,85 168,78 167,73 173,66 172,62 175,59 174,55 177,53 180,46 181,29 179,21 173,13 166,11 159,13 153,18 148,23" /> <Polygon points=" 150,187 148,211 150,233 153,247 148,267 135,283 125,299 136,292 131,313 122,328 122,345 129,352 133,359 133,367 137,359 148,356 140,350 131,347 129,340 132,332 140,328 137,322 140,304 154,265 157,244 155,223 161,220 175,229 186,247 185,260 176,275 178,287 185,277 188,261 196,253 189,236 174,213" /> <Polygon points=" 147,338 142,341 143,345 141,354 147,343" /> <Polygon points=" 157,342 156,349 150,356 157,353 163,346 162,342" /> <Polygon points=" 99,265 96,284 92,299 73,339 73,333 87,300" /> </G> </G> </Svg> ); export default Tiger;
examples/index.js
JakeDluhy/redux-dialog
import React from 'react'; import { render } from 'react-dom'; import reduxDialog, { dialogReducer, openDialog, closeDialog, closeAllDialogs } from '../src'; import { createStore, combineReducers } from 'redux'; import { Provider } from 'react-redux'; const reducers = { dialogs: dialogReducer }; const reducer = combineReducers(reducers); const store = createStore(reducer); const BasicDialog = (props) => ( <div> <div className="dlg--body"> My awesome modalbox for &quot;{props.payload.contentId}&quot;! <a href="#" onClick={ props.onRequestClose }>Close it</a> or <a href="#" onClick={ () => store.dispatch(closeAllDialogs()) }>close all</a> </div> </div> ); const Dialog = reduxDialog({ name: 'Sign up dialog' })(BasicDialog); const App = () => ( <Provider store={store}> <div> <Dialog onAfterOpen={ () => console.log('On After Open') } onRequestClose={ () => console.log('On Request Close') } /> <a onClick={() => store.dispatch(openDialog('Sign up dialog', { contentId: "How to pass payload" }))} href="#">Open Dialog</a> </div> </Provider> ); render(<App />, document.getElementById('react-js'));
ajax/libs/F2/1.3.1/f2.js
aminghaderi/cdnjs
;(function(exports) { if (exports.F2 && !exports.F2_TESTING_MODE) { return; } /*! JSON.org requires the following notice to accompany json2: Copyright (c) 2002 JSON.org http://json.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, regexp: true */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. if (typeof JSON !== 'object') { JSON = {}; } (function () { 'use strict'; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function (key) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) { return this.valueOf(); }; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }()); /*! * jQuery JavaScript Library v1.8.3 * The jQuery Foundation and other contributors require the following notice to accompany jQuery: * * Copyright (c) 2013 jQuery Foundation and other contributors * * http://jquery.com * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ (function( window, undefined ) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, navigator = window.navigator, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Save a reference to some core methods core_push = Array.prototype.push, core_slice = Array.prototype.slice, core_indexOf = Array.prototype.indexOf, core_toString = Object.prototype.toString, core_hasOwn = Object.prototype.hasOwnProperty, core_trim = String.prototype.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Used for matching numbers core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // The ready event handler and self cleanup method DOMContentLoaded = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); } else if ( document.readyState === "complete" ) { // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = ( context && context.nodeType ? context.ownerDocument || context : document ); // scripts is true for back-compat selector = jQuery.parseHTML( match[1], doc, true ); if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { this.attr.call( selector, context, true ); } return jQuery.merge( this, selector ); // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.8.3", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return core_slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( core_slice.apply( this, arguments ), "slice", core_slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ core_toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // scripts (optional): If true, will include scripts passed in the html string parseHTML: function( data, context, scripts ) { var parsed; if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { scripts = context; context = 0; } context = context || document; // Single tag if ( (parsed = rsingleTag.exec( data )) ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); return jQuery.merge( [], (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); }, parseJSON: function( data ) { if ( !data || typeof data !== "string") { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && core_rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var name, i = 0, length = obj.length, isObj = length === undefined || jQuery.isFunction( obj ); if ( args ) { if ( isObj ) { for ( name in obj ) { if ( callback.apply( obj[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( obj[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in obj ) { if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var type, ret = results || []; if ( arr != null ) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 type = jQuery.type( arr ); if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { core_push.call( ret, arr ); } else { jQuery.merge( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexOf ) { return core_indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyGet, pass ) { var exec, bulk = key == null, i = 0, length = elems.length; // Sets many values if ( key && typeof key === "object" ) { for ( i in key ) { jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); } chainable = 1; // Sets one value } else if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = pass === undefined && jQuery.isFunction( value ); if ( bulk ) { // Bulk operations only iterate when executing function values if ( exec ) { exec = fn; fn = function( elem, key, value ) { return exec.call( jQuery( elem ), value ); }; // Otherwise they run against the entire set } else { fn.call( elems, value ); fn = null; } } if ( fn ) { for (; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } } chainable = 1; } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }, now: function() { return ( new Date() ).getTime(); } }); jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.split( core_rspace ), function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Control if a given callback is in the list has: function( fn ) { return jQuery.inArray( fn, list ) > -1; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? function() { var returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } } : newDefer[ action ] ); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] = list.fire deferred[ tuple[0] ] = list.fire; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = core_slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, select, opt, input, fragment, eventName, i, isSupported, clickFn, div = document.createElement("div"); // Setup div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // Support tests won't run in some limited or non-browser environments all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; if ( !all || !a || !all.length ) { return {}; } // First batch of tests select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form (#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: ( document.compatMode === "CSS1Compat" ), // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", clickFn = function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent("onclick"); div.detachEvent( "onclick", clickFn ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; input.setAttribute( "checked", "checked" ); // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute( "name", "t" ); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild( input ); fragment.appendChild( div ); // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } // Run tests that need a body at doc ready jQuery(function() { var container, div, tds, marginDiv, divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; body.insertBefore( container, body.firstChild ); // Construct the test element div = document.createElement("div"); container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; tds = div.getElementsByTagName("td"); tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Check box-sizing and margin behavior div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = ( div.offsetWidth === 4 ); support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = document.createElement("div"); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; div.appendChild( marginDiv ); support.reliableMarginRight = !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); } if ( typeof div.style.zoom !== "undefined" ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerHTML = "<div></div>"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); container.style.zoom = 1; } // Null elements to avoid leaks in IE body.removeChild( container ); container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE fragment.removeChild( div ); all = a = select = opt = input = fragment = div = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, deletedIds: [], // Remove at next major release (1.9/2.0) uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if ( jQuery.support.deleteExpando || cache != cache.window ) { delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { attr = elem.attributes; for ( l = attr.length; i < l; i++ ) { name = attr[i].name; if ( !name.indexOf( "data-" ) ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split( ".", 2 ); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jQuery.access( this, function( value ) { if ( value === undefined ) { data = this.triggerHandler( "getData" + part, [ parts[0] ] ); // Try to fetch any internally stored data first if ( data === undefined && elem ) { data = jQuery.data( elem, key ); data = dataAttr( elem, key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } parts[1] = value; this.each(function() { var self = jQuery( this ); self.triggerHandler( "setData" + part, parts ); jQuery.data( this, key, value ); self.triggerHandler( "changeData" + part, parts ); }); }, null, value, arguments.length > 1, null, false ); }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery.removeData( elem, type + "queue", true ); jQuery.removeData( elem, key, true ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodeHook, boolHook, fixSpecified, rclass = /[\t\r\n]/g, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea|)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var removes, className, elem, c, cl, i, l; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { removes = ( value || "" ).split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { className = (" " + elem.className + " ").replace( rclass, " " ); // loop over each item in the removal list for ( c = 0, cl = removes.length; c < cl; c++ ) { // Remove until there is nothing to remove, while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { className = className.replace( " " + removes[ c ] + " " , " " ); } } elem.className = value ? jQuery.trim( className ) : ""; } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( core_rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val, self = jQuery(this); if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // Loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldIE doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 attrFn: {}, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, isBool, i = 0; if ( value && elem.nodeType === 1 ) { attrNames = value.split( core_rspace ); for ( ; i < attrNames.length; i++ ) { name = attrNames[ i ]; if ( name ) { propName = jQuery.propFix[ name ] || name; isBool = rboolean.test( name ); // See #9699 for explanation of this approach (setting first, then removal) // Do not do this for boolean attributes (see #10870) if ( !isBool ) { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes if ( isBool && propName in elem ) { elem[ propName ] = false; } } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { fixSpecified = { name: true, id: true, coords: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return ( ret.value = value + "" ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, hoverHack = function( events ) { return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim( hoverHack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim( hoverHack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; // Remove matching events for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, "events", true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, type = event.type || event, namespaces = []; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; for ( old = elem; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old === (elem.ownerDocument || document) ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), delegateCount = handlers.delegateCount, args = core_slice.call( arguments ), run_all = !event.exclusive && !event.namespace, special = jQuery.event.special[ event.type ] || {}, handlerQueue = []; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers that should run if there are delegated events // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && !(event.button && event.type === "click") ) { for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { selMatch = {}; matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { selMatch[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( selMatch[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } } // Add the remaining (directly-bound) handlers if ( handlers.length > delegateCount ) { handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); } // Run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; event.currentTarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = matched.matches[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { event.data = handleObj.data; event.handleObj = handleObj; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) event.metaKey = !!event.metaKey; return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "_submit_attached" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "_submit_attached", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "_change_attached", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // && selector != null // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function( window, undefined ) { var cachedruns, assertGetIdNotName, Expr, getText, isXML, contains, compile, sortOrder, hasDuplicate, outermostContext, baseHasDuplicate = true, strundefined = "undefined", expando = ( "sizcache" + Math.random() ).replace( ".", "" ), Token = String, document = window.document, docElem = document.documentElement, dirruns = 0, done = 0, pop = [].pop, push = [].push, slice = [].slice, // Use a stripped-down indexOf if a native one is unavailable indexOf = [].indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Augment a function for special use by Sizzle markFunction = function( fn, value ) { fn[ expando ] = value == null || value; return fn; }, createCache = function() { var cache = {}, keys = []; return markFunction(function( key, value ) { // Only keep the most recent entries if ( keys.push( key ) > Expr.cacheLength ) { delete cache[ keys.shift() ]; } // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) return (cache[ key + " " ] = value); }, cache ); }, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // Regex // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments not in parens/brackets, // then attribute selectors and non-pseudos (denoted by :), // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", // For matchExpr.POS and matchExpr.needsContext pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, rnot = /^:not/, rsibling = /[\x20\t\r\n\f]*[+~]/, rendsWithNot = /:not\($/, rheader = /h\d/i, rinputs = /input|select|textarea|button/i, rbackslash = /\\(?!\\)/g, matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "POS": new RegExp( pos, "i" ), "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) }, // Support // Used for testing something on an element assert = function( fn ) { var div = document.createElement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } }, // Check if getElementsByTagName("*") returns only elements assertTagNameNoComments = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }), // Check if getAttribute returns normalized href attributes assertHrefNotNormalized = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }), // Check if attributes should be retrieved by attribute nodes assertAttributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }), // Check if getElementsByClassName can be trusted assertUsableClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }), // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID assertUsableName = assert(function( div ) { // Inject content div.id = expando + 0; div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; docElem.insertBefore( div, docElem.firstChild ); // Test var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2 document.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 document.getElementsByName( expando + 0 ).length; assertGetIdNotName = !document.getElementById( expando ); // Cleanup docElem.removeChild( div ); return pass; }); // If slice is not available, provide a backup try { slice.call( docElem.childNodes, 0 )[0].nodeType; } catch ( e ) { slice = function( i ) { var elem, results = []; for ( ; (elem = this[i]); i++ ) { results.push( elem ); } return results; }; } function Sizzle( selector, context, results, seed ) { results = results || []; context = context || document; var match, elem, xml, m, nodeType = context.nodeType; if ( !selector || typeof selector !== "string" ) { return results; } if ( nodeType !== 1 && nodeType !== 9 ) { return []; } xml = isXML( context ); if ( !xml && !seed ) { if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); return results; } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); } Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { return Sizzle( expr, null, null, [ elem ] ).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( nodeType ) { if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes } else { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } return ret; }; isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); } : docElem.compareDocumentPosition ? function( a, b ) { return b && !!( a.compareDocumentPosition( b ) & 16 ); } : function( a, b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } return false; }; Sizzle.attr = function( elem, name ) { var val, xml = isXML( elem ); if ( !xml ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( xml || assertAttributes ) { return elem.getAttribute( name ); } val = elem.getAttributeNode( name ); return val ? typeof elem[ name ] === "boolean" ? elem[ name ] ? name : null : val.specified ? val.value : null : null; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, // IE6/7 return a modified href attrHandle: assertHrefNotNormalized ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }, find: { "ID": assertGetIdNotName ? function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } } : function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }, "TAG": assertTagNameNoComments ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { var elem, tmp = [], i = 0; for ( ; (elem = results[i]); i++ ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }, "NAME": assertUsableName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }, "CLASS": assertUsableClassName && function( className, context, xml ) { if ( typeof context.getElementsByClassName !== strundefined && !xml ) { return context.getElementsByClassName( className ); } } }, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( rbackslash, "" ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3 xn-component of xn+y argument ([+-]?\d*n|) 4 sign of xn-component 5 x of xn-component 6 sign of y-component 7 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1] === "nth" ) { // nth-child requires argument if ( !match[2] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); // other types prohibit arguments } else if ( match[2] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var unquoted, excess; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } if ( match[3] ) { match[2] = match[3]; } else if ( (unquoted = match[4]) ) { // Only check arguments that contain a pseudo if ( rpseudo.test(unquoted) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index unquoted = unquoted.slice( 0, excess ); match[0] = match[0].slice( 0, excess ); } match[2] = unquoted; } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "ID": assertGetIdNotName ? function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { return elem.getAttribute("id") === id; }; } : function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === id; }; }, "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ expando ][ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem, context ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.substr( result.length - check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, argument, first, last ) { if ( type === "nth" ) { return function( elem ) { var node, diff, parent = elem.parentNode; if ( first === 1 && last === 0 ) { return true; } if ( parent ) { diff = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { diff++; if ( elem === node ) { break; } } } } // Incorporate the offset (or cast to NaN), then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); }; } return function( elem ) { var node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; /* falls through */ case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") var nodeType; elem = elem.firstChild; while ( elem ) { if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { return false; } elem = elem.nextSibling; } return true; }, "header": function( elem ) { return rheader.test( elem.nodeName ); }, "text": function( elem ) { var type, attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); }, // Input types "radio": createInputPseudo("radio"), "checkbox": createInputPseudo("checkbox"), "file": createInputPseudo("file"), "password": createInputPseudo("password"), "image": createInputPseudo("image"), "submit": createButtonPseudo("submit"), "reset": createButtonPseudo("reset"), "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "focus": function( elem ) { var doc = elem.ownerDocument; return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, "active": function( elem ) { return elem === elem.ownerDocument.activeElement; }, // Positional types "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 0; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { for ( var i = 1; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; function siblingCheck( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; } sortOrder = docElem.compareDocumentPosition ? function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4 ) ? -1 : 1; } : function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], i = 1, j = 0; hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ expando ][ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); // Cast descendant combinators to space matched.type = match[0].replace( rtrim, " " ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); matched.type = type; matched.matches = match; } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( !xml ) { var cache, dirkey = dirruns + " " + doneName + " ", cachedkey = dirkey + cachedruns; while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( (cache = elem[ expando ]) === cachedkey ) { return elem.sizset; } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { if ( elem.sizset ) { return elem; } } else { elem[ expando ] = cachedkey; if ( matcher( elem, context, xml ) ) { elem.sizset = true; return elem; } elem.sizset = false; } } } } else { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( matcher( elem, context, xml ) ) { return elem; } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && tokens.join("") ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = superMatcher.el; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++superMatcher.el; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); j++ ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; superMatcher.el = 0; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ expando ][ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed, xml ) { var i, tokens, token, type, find, match = tokenize( selector ), j = match.length; if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().length ); } // Fetch a seed set for right-to-left matching for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( rbackslash, "" ), rsibling.test( tokens[0].type ) && context.parentNode || context, xml )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && tokens.join(""); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, xml, results, rsibling.test( selector ) ); return results; } if ( document.querySelectorAll ) { (function() { var disconnectedMatch, oldSelect = select, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ], // matchesSelector(:active) reports false when true (IE9/Opera 11.5) // A support test would require too much code (would include document ready) // just skip matchesSelector for :active rbuggyMatches = [ ":active" ], matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector; // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here (do not put tests after this one) if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE9 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<p test=''></p>"; if ( div.querySelectorAll("[test^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here (do not put tests after this one) div.innerHTML = "<input type='hidden'/>"; if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push(":enabled", ":disabled"); } }); // rbuggyQSA always contains :focus, so no need for a length check rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); select = function( selector, context, results, seed, xml ) { // Only use querySelectorAll when not filtering, // when this is not xml, // and when no QSA bugs apply if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { var groups, i, old = true, nid = expando, newContext = context, newSelector = context.nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + groups[i].join(""); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, slice.call( newContext.querySelectorAll( newSelector ), 0 ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } return oldSelect( selector, context, results, seed, xml ); }; if ( matches ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead try { matches.call( div, "[test!='']:sizzle" ); rbuggyMatches.push( "!=", pseudos ); } catch ( e ) {} }); // rbuggyMatches always contains :active and :focus, so no need for a length check rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); Sizzle.matchesSelector = function( elem, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyMatches always contains :active, so no need for an existence check if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, null, null, [ elem ] ).length > 0; }; } })(); } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Back-compat function setFilters() {} Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, l, length, n, r, ret, self = this; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } ret = this.pushStack( "", "find", selector ); for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentNode; } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, rnocache = /<(?:script|object|embed|option|style)/i, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rcheckableType = /^(?:checkbox|radio)$/, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], area: [ 1, "<map>", "</map>" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if ( !jQuery.support.htmlSerialize ) { wrapMap._default = [ 1, "X<div>", "</div>" ]; } jQuery.fn.extend({ text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); } }, after: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); } }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return jQuery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName( "*" ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function( value ) { if ( !isDisconnected( this[0] ) ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } if ( typeof value !== "string" ) { value = jQuery( value ).detach(); } return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); } else { jQuery(parent).append( value ); } }); } return this.length ? this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : this; }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { // Flatten any nested arrays args = [].concat.apply( [], args ); var results, first, fragment, iNoClone, i = 0, value = args[0], scripts = [], l = this.length; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { return this.each(function() { jQuery(this).domManip( args, table, callback ); }); } if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); args[0] = value.call( this, i, table ? self.html() : undefined ); self.domManip( args, table, callback ); }); } if ( this[0] ) { results = jQuery.buildFragment( args, this, scripts ); fragment = results.fragment; first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). // Fragments from the fragment cache must always be cloned and never used in place. for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { callback.call( table && jQuery.nodeName( this[i], "table" ) ? findOrAppend( this[i], "tbody" ) : this[i], i === iNoClone ? fragment : jQuery.clone( fragment, true, true ) ); } } // Fix #11809: Avoid leaking memory fragment = first = null; if ( scripts.length ) { jQuery.each( scripts, function( i, elem ) { if ( elem.src ) { if ( jQuery.ajax ) { jQuery.ajax({ url: elem.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.error("no ajax"); } } else { jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } }); } } return this; } }); function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function cloneFixAttributes( src, dest ) { var nodeName; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want if ( dest.clearAttributes ) { dest.clearAttributes(); } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events if ( dest.mergeAttributes ) { dest.mergeAttributes( src ); } nodeName = dest.nodeName.toLowerCase(); if ( nodeName === "object" ) { // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; // IE blanks contents when cloning scripts } else if ( nodeName === "script" && dest.text !== src.text ) { dest.text = src.text; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, context, scripts ) { var fragment, cacheable, cachehit, first = args[ 0 ]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && first.charAt(0) === "<" && !rnocache.test( first ) && (jQuery.support.checkClone || !rchecked.test( first )) && (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { // Mark cacheable and look for a hit cacheable = true; fragment = jQuery.fragments[ first ]; cachehit = fragment !== undefined; } if ( !fragment ) { fragment = context.createDocumentFragment(); jQuery.clean( args, context, fragment, scripts ); // Update the cache, but only store false // unless this is a second parsing of the same content if ( cacheable ) { jQuery.fragments[ first ] = cachehit && fragment; } } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), l = insert.length, parent = this.length === 1 && this[0].parentNode; if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { insert[ original ]( this[0] ); return this; } else { for ( ; i < l; i++ ) { elems = ( i > 0 ? this.clone(true) : this ).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, insert.selector ); } }; }); function getAll( elem ) { if ( typeof elem.getElementsByTagName !== "undefined" ) { return elem.getElementsByTagName( "*" ); } else if ( typeof elem.querySelectorAll !== "undefined" ) { return elem.querySelectorAll( "*" ); } else { return []; } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var srcElements, destElements, i, clone; if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. cloneFixAttributes( elem, clone ); // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll( elem ); destElements = getAll( clone ); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { cloneFixAttributes( srcElements[i], destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { cloneCopyEvent( elem, clone ); if ( deepDataAndEvents ) { srcElements = getAll( elem ); destElements = getAll( clone ); for ( i = 0; srcElements[i]; ++i ) { cloneCopyEvent( srcElements[i], destElements[i] ); } } } srcElements = destElements = null; // Return the cloned set return clone; }, clean: function( elems, context, fragment, scripts ) { var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, safe = context === document && safeFragment, ret = []; // Ensure that context is a document if ( !context || typeof context.createDocumentFragment === "undefined" ) { context = document; } // Use the already-created safe fragment if context permits for ( i = 0; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { elem += ""; } if ( !elem ) { continue; } // Convert html string into DOM nodes if ( typeof elem === "string" ) { if ( !rhtml.test( elem ) ) { elem = context.createTextNode( elem ); } else { // Ensure a safe container in which to render the html safe = safe || createSafeFragment( context ); div = context.createElement("div"); safe.appendChild( div ); // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Go to html and back, then peel off extra wrappers tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; depth = wrap[0]; div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( depth-- ) { div = div.lastChild; } // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> hasBody = rtbody.test(elem); tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !hasBody ? div.childNodes : []; for ( j = tbody.length - 1; j >= 0 ; --j ) { if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { tbody[ j ].parentNode.removeChild( tbody[ j ] ); } } } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); } elem = div.childNodes; // Take out of fragment container (we need a fresh div each time) div.parentNode.removeChild( div ); } } if ( elem.nodeType ) { ret.push( elem ); } else { jQuery.merge( ret, elem ); } } // Fix #11356: Clear elements from safeFragment if ( div ) { elem = div = safe = null; } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !jQuery.support.appendChecked ) { for ( i = 0; (elem = ret[i]) != null; i++ ) { if ( jQuery.nodeName( elem, "input" ) ) { fixDefaultChecked( elem ); } else if ( typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); } } } // Append elements to a provided document fragment if ( fragment ) { // Special handling of each script element handleScript = function( elem ) { // Check if we consider it executable if ( !elem.type || rscriptType.test( elem.type ) ) { // Detach the script and store it in the scripts array (if provided) or the fragment // Return truthy to indicate that it has been handled return scripts ? scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : fragment.appendChild( elem ); } }; for ( i = 0; (elem = ret[i]) != null; i++ ) { // Check if we're done after handling an executable script if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { // Append to fragment and handle embedded scripts fragment.appendChild( elem ); if ( typeof elem.getElementsByTagName !== "undefined" ) { // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); // Splice the scripts into ret after their former ancestor and advance our index beyond them ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); i += jsTags.length; } } } } return ret; }, cleanData: function( elems, /* internal */ acceptData ) { var data, id, elem, type, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } jQuery.deletedIds.push( id ); } } } } } }); // Limit scope pollution from any deprecated API (function() { var matched, browser; // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } jQuery.browser = browser; jQuery.sub = function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), elemdisplay = { BODY: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function isHidden( elem, el ) { elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { var elem, display, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { display = curCSS( elem, "display" ); if ( !values[ index ] && display !== "none" ) { jQuery._data( elem, "olddisplay", display ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function( name, value ) { return jQuery.access( this, function( elem, name, value ) { return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state, fn2 ) { var bool = typeof state === "boolean"; if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { return eventsToggle.apply( this, arguments ); } return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, numeric, extra ) { var val, num, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( numeric || extra !== undefined ) { num = parseFloat( val ); return numeric || jQuery.isNumeric( num ) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.call( elem ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { curCSS = function( elem, name ) { var ret, width, minWidth, maxWidth, computed = window.getComputedStyle( elem, null ), style = elem.style; if ( computed ) { // getPropertyValue is only needed for .css('filter') in IE9, see #12537 ret = computed.getPropertyValue( name ) || computed[ name ]; if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if ( document.documentElement.currentStyle ) { curCSS = function( elem, name ) { var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { // we use jQuery.css instead of curCSS here // because of the reliableMarginRight CSS hook! val += jQuery.css( elem, extra + cssExpand[ i ], true ); } // From this point on we use curCSS for maximum performance (relevant in animations) if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } else { // at this point, extra isn't content, so add padding val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { if ( elemdisplay[ nodeName ] ) { return elemdisplay[ nodeName ]; } var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend( document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if ( !iframeDoc || !iframe.createElement ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write("<!doctype html><html><body>"); iframeDoc.close(); } elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); display = curCSS( elem, "display" ); document.body.removeChild( iframe ); } // Store the correct default display elemdisplay[ nodeName ] = display; return display; } jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { return jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }); } else { return getWidthOrHeight( elem, name, extra ); } } }, set: function( elem, value, extra ) { return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" ) : 0 ); } }; }); if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute( "filter" ); // if there there is no filter style applied in a css rule, we are done if ( currentStyle && !currentStyle.filter ) { return; } } // otherwise, set new filter values style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function() { if ( !jQuery.support.reliableMarginRight ) { jQuery.cssHooks.marginRight = { get: function( elem, computed ) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap( elem, { "display": "inline-block" }, function() { if ( computed ) { return curCSS( elem, "marginRight" ); } }); } }; } // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = { get: function( elem, computed ) { if ( computed ) { var ret = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; } } }; }); } }); if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [ value ], expanded = {}; for ( i = 0; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rts = /([?&])_=[^&]*/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), i = 0, length = dataTypes.length; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var selection, list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ); for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already if ( typeof selection === "string" ) { if ( !executeOnly || inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } } jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } // Don't do a request if no elements are being requested if ( !this.length ) { return this; } var selector, type, response, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // Request the remote document jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params, complete: function( jqXHR, status ) { if ( callback ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); } } }).done(function( responseText ) { // Save response for use in complete callback response = arguments; // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append( responseText.replace( rscript, "" ) ) // Locate the specified elements .find( selector ) : // If not, just inject the full result responseText ); }); return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ return this.on( o, f ); }; }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; }); jQuery.extend({ getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { if ( settings ) { // Building a settings object ajaxExtend( target, jQuery.ajaxSettings ); } else { // Extending ajaxSettings settings = target; target = jQuery.ajaxSettings; } ajaxExtend( target, settings ); return target; }, ajaxSettings: { url: ajaxLocation, isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, type: "GET", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": allTypes }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { context: true, url: true } }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // ifModified key ifModifiedKey, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars parts, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events // It's the callbackContext if one was provided in the options // and if it's a DOM node or a jQuery collection globalEventContext = callbackContext !== s && ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { var lname = name.toLowerCase(); name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match === undefined ? null : match; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Cancel the request abort: function( statusText ) { statusText = statusText || strAbort; if ( transport ) { transport.abort( statusText ); } done( 0, statusText ); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ ifModifiedKey ] = modified; } modified = jqXHR.getResponseHeader("Etag"); if ( modified ) { jQuery.etag[ ifModifiedKey ] = modified; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } // Attach deferreds deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { for ( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { tmp = map[ jqXHR.status ]; jqXHR.always( tmp ); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ); s.crossDomain = !!( parts && ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter ifModifiedKey = s.url; // Add anti-cache in url if needed if ( s.cache === false ) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { ifModifiedKey = ifModifiedKey || s.url; if ( jQuery.lastModified[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); } if ( jQuery.etag[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); } } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout( function(){ jqXHR.abort( "timeout" ); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } return jqXHR; }, // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ], converters = {}, i = 0; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split(" "); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.splice( i--, 0, current ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s["throws"] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; } var oldCallbacks = [], rquestion = /\?/, rjsonp = /(=)\?(?=&|$)|\?\?/, nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, data = s.data, url = s.url, hasCallback = s.jsonp !== false, replaceInUrl = hasCallback && rjsonp.test( url ), replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( data ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; overwritten = window[ callbackName ]; // Insert callback into url or form data if ( replaceInUrl ) { s.url = url.replace( rjsonp, "$1" + callbackName ); } else if ( replaceInData ) { s.data = data.replace( rjsonp, "$1" + callbackName ); } else if ( hasCallback ) { s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement( "script" ); script.async = "async"; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } // Dereference the script script = undefined; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( 0, 1 ); } } }; } }); var xhrCallbacks, // #5280: Internet Explorer will keep connections alive if we don't abort on unload xhrOnUnloadAbort = window.ActiveXObject ? function() { // Abort all pending requests for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( 0, 1 ); } } : false, xhrId = 0; // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function() { return !this.isLocal && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; // Determine support properties (function( xhr ) { jQuery.extend( jQuery.support, { ajax: !!xhr, cors: !!xhr && ( "withCredentials" in xhr ) }); })( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { jQuery.ajaxTransport(function( s ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !s.crossDomain || jQuery.support.cors ) { var callback; return { send: function( headers, complete ) { // Get a new xhr var handle, i, xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if ( s.username ) { xhr.open( s.type, s.url, s.async, s.username, s.password ); } else { xhr.open( s.type, s.url, s.async ); } // Apply custom fields if provided if ( s.xhrFields ) { for ( i in s.xhrFields ) { xhr[ i ] = s.xhrFields[ i ]; } } // Override mime type if needed if ( s.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( s.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !s.crossDomain && !headers["X-Requested-With"] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } } catch( _ ) {} // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( s.hasContent && s.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responseHeaders, responses, xml; // Firefox throws exceptions when accessing properties // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Only called once callback = undefined; // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; if ( xhrOnUnloadAbort ) { delete xhrCallbacks[ handle ]; } } // If it's an abort if ( isAbort ) { // Abort it manually if needed if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { status = xhr.status; responseHeaders = xhr.getAllResponseHeaders(); responses = {}; xml = xhr.responseXML; // Construct response list if ( xml && xml.documentElement /* #4958 */ ) { responses.xml = xml; } // When requesting binary data, IE6-9 will throw an exception // on any attempt to access responseText (#11426) try { responses.text = xhr.responseText; } catch( e ) { } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && s.isLocal && !s.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } } catch( firefoxAccessException ) { if ( !isAbort ) { complete( -1, firefoxAccessException ); } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, responseHeaders ); } }; if ( !s.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback, 0 ); } else { handle = ++xhrId; if ( xhrOnUnloadAbort ) { // Create the active xhrs callbacks list if needed // and attach the unload handler if ( !xhrCallbacks ) { xhrCallbacks = {}; jQuery( window ).unload( xhrOnUnloadAbort ); } // Add to list of active xhrs callbacks xhrCallbacks[ handle ] = callback; } xhr.onreadystatechange = callback; } }, abort: function() { if ( callback ) { callback(0,1); } } }; } }); } var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [function( prop, value ) { var end, unit, tween = this.createTween( prop, value ), parts = rfxnum.exec( value ), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20; if ( parts ) { end = +parts[2]; unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); // We need to compute starting value if ( unit !== "px" && start ) { // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant start = jQuery.css( tween.elem, prop, true ) || end || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style( tween.elem, prop, start + unit ); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; } return tween; }] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function() { fxNow = undefined; }, 0 ); return ( fxNow = jQuery.now() ); } function createTweens( animation, props ) { jQuery.each( props, function( prop, value ) { var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( collection[ index ].call( animation, prop, value ) ) { // we're done with this property return; } } }); } function Animation( elem, properties, options ) { var result, index = 0, tweenerIndex = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { // don't match elem in the :animated selector delete tick.elem; }), tick = function() { var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end, easing ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // resolve when we played the last frame // otherwise, reject if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } createTweens( animation, props ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { anim: animation, queue: animation.opts.queue, elem: elem }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); function defaultPrefilter( elem, props, opts ) { var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden( elem ); // handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { // doing this makes sure that the complete handler will be called // before this completes anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } // height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated if ( jQuery.css( elem, "display" ) === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { anim.done(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( index in props ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } handled.push( index ); } } length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } // store state if its toggle - enables .stop().toggle() to "reverse" if ( toggle ) { dataShow.hidden = !hidden; } if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery.removeData( elem, "fxshow", true ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( index = 0 ; index < length ; index++ ) { prop = handled[ index ]; tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } } function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } // passing any value as a 4th parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css( tween.elem, tween.prop, false, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" || // special check for .toggle( handler, handler, ... ) ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { // show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations resolve immediately if ( empty ) { anim.stop( true ); } }; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); } }); // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p*Math.PI ) / 2; } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; fxNow = jQuery.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } fxNow = undefined; }; jQuery.fx.timer = function( timer ) { if ( timer() && jQuery.timers.push( timer ) && !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.interval = 13; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } if ( (body = doc.body) === elem ) { return jQuery.offset.bodyOffset( elem ); } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if ( typeof elem.getBoundingClientRect !== "undefined" ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); clientTop = docElem.clientTop || body.clientTop || 0; clientLeft = docElem.clientLeft || body.clientLeft || 0; scrollTop = win.pageYOffset || docElem.scrollTop; scrollLeft = win.pageXOffset || docElem.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; }; jQuery.offset = { bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, setOffset: function( elem, options, i ) { var position = jQuery.css( elem, "position" ); // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } var curElem = jQuery( elem ), curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ position: function() { if ( !this[0] ) { return; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent || document.body; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return jQuery.access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return jQuery.access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, value, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } })( window ); /*! ========================================================= * bootstrap-modal.js v2.2.2 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Twitter, Inc. require the following notice to accompany Bootstrap: * * Copyright (c) 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work * except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing permissions and limitations under the License. * * ========================================================= */ !function ($) { "use strict"; // jshint ;_; /* MODAL CLASS DEFINITION * ====================== */ var Modal = function (element, options) { this.options = options this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } Modal.prototype = { constructor: Modal , toggle: function () { return this[!this.isShown ? 'show' : 'hide']() } , show: function () { var that = this , e = $.Event('show') this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.escape() this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(document.body) //don't move modals dom position } that.$element .show() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') .attr('aria-hidden', false) that.enforceFocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : that.$element.focus().trigger('shown') }) } , hide: function (e) { e && e.preventDefault() var that = this e = $.Event('hide') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() $(document).off('focusin.modal') this.$element .removeClass('in') .attr('aria-hidden', true) $.support.transition && this.$element.hasClass('fade') ? this.hideWithTransition() : this.hideModal() } , enforceFocus: function () { var that = this $(document).on('focusin.modal', function (e) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus() } }) } , escape: function () { var that = this if (this.isShown && this.options.keyboard) { this.$element.on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isShown) { this.$element.off('keyup.dismiss.modal') } } , hideWithTransition: function () { var that = this , timeout = setTimeout(function () { that.$element.off($.support.transition.end) that.hideModal() }, 500) this.$element.one($.support.transition.end, function () { clearTimeout(timeout) that.hideModal() }) } , hideModal: function (that) { this.$element .hide() .trigger('hidden') this.backdrop() } , removeBackdrop: function () { this.$backdrop.remove() this.$backdrop = null } , backdrop: function (callback) { var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendTo(document.body) this.$backdrop.click( this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this) ) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') doAnimate ? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') $.support.transition && this.$element.hasClass('fade')? this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : this.removeBackdrop() } else if (callback) { callback() } } } /* MODAL PLUGIN DEFINITION * ======================= */ var old = $.fn.modal $.fn.modal = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('modal') , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true , show: true } $.fn.modal.Constructor = Modal /* MODAL NO CONFLICT * ================= */ $.fn.modal.noConflict = function () { $.fn.modal = old return this } /* MODAL DATA-API * ============== */ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) , href = $this.attr('href') , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target .modal(option) .one('hide', function () { $this.focus() }) }) }(window.jQuery); /*! * This file creates $ and jQuery variables within the F2 closure scope */ var $, jQuery = $ = window.jQuery.noConflict(true); /*! * Hij1nx requires the following notice to accompany EventEmitter: * * Copyright (c) 2011 hij1nx * * http://www.twitter.com/hij1nx * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the 'Software'), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ !function(exports, undefined) { var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; }; var defaultMaxListeners = 10; function init() { this._events = new Object; } function configure(conf) { if (conf) { conf.delimiter && (this.delimiter = conf.delimiter); conf.wildcard && (this.wildcard = conf.wildcard); if (this.wildcard) { this.listenerTree = new Object; } } } function EventEmitter(conf) { this._events = new Object; configure.call(this, conf); } // // Attention, function return type now is array, always ! // It has zero elements if no any matches found and one or more // elements (leafs) if there are matches // function searchListenerTree(handlers, type, tree, i) { if (!tree) { return []; } var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached, typeLength = type.length, currentType = type[i], nextType = type[i+1]; if (i === typeLength && tree._listeners) { // // If at the end of the event(s) list and the tree has listeners // invoke those listeners. // if (typeof tree._listeners === 'function') { handlers && handlers.push(tree._listeners); return [tree]; } else { for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) { handlers && handlers.push(tree._listeners[leaf]); } return [tree]; } } if ((currentType === '*' || currentType === '**') || tree[currentType]) { // // If the event emitted is '*' at this part // or there is a concrete match at this patch // if (currentType === '*') { for (branch in tree) { if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1)); } } return listeners; } else if(currentType === '**') { endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*')); if(endReached && tree._listeners) { // The next element has a _listeners, add it to the handlers. listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength)); } for (branch in tree) { if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { if(branch === '*' || branch === '**') { if(tree[branch]._listeners && !endReached) { listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength)); } listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); } else if(branch === nextType) { listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2)); } else { // No match on this one, shift into the tree but not in the type array. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); } } } return listeners; } listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1)); } xTree = tree['*']; if (xTree) { // // If the listener tree will allow any match for this part, // then recursively explore all branches of the tree // searchListenerTree(handlers, type, xTree, i+1); } xxTree = tree['**']; if(xxTree) { if(i < typeLength) { if(xxTree._listeners) { // If we have a listener on a '**', it will catch all, so add its handler. searchListenerTree(handlers, type, xxTree, typeLength); } // Build arrays of matching next branches and others. for(branch in xxTree) { if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) { if(branch === nextType) { // We know the next element will match, so jump twice. searchListenerTree(handlers, type, xxTree[branch], i+2); } else if(branch === currentType) { // Current node matches, move into the tree. searchListenerTree(handlers, type, xxTree[branch], i+1); } else { isolatedBranch = {}; isolatedBranch[branch] = xxTree[branch]; searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1); } } } } else if(xxTree._listeners) { // We have reached the end and still on a '**' searchListenerTree(handlers, type, xxTree, typeLength); } else if(xxTree['*'] && xxTree['*']._listeners) { searchListenerTree(handlers, type, xxTree['*'], typeLength); } } return listeners; } function growListenerTree(type, listener) { type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); // // Looks for two consecutive '**', if so, don't add the event at all. // for(var i = 0, len = type.length; i+1 < len; i++) { if(type[i] === '**' && type[i+1] === '**') { return; } } var tree = this.listenerTree; var name = type.shift(); while (name) { if (!tree[name]) { tree[name] = new Object; } tree = tree[name]; if (type.length === 0) { if (!tree._listeners) { tree._listeners = listener; } else if(typeof tree._listeners === 'function') { tree._listeners = [tree._listeners, listener]; } else if (isArray(tree._listeners)) { tree._listeners.push(listener); if (!tree._listeners.warned) { var m = defaultMaxListeners; if (typeof this._events.maxListeners !== 'undefined') { m = this._events.maxListeners; } if (m > 0 && tree._listeners.length > m) { tree._listeners.warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', tree._listeners.length); console.trace(); } } } return true; } name = type.shift(); } return true; }; // By default EventEmitters will print a warning if more than // 10 listeners are added to it. This is a useful default which // helps finding memory leaks. // // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.delimiter = '.'; EventEmitter.prototype.setMaxListeners = function(n) { this._events || init.call(this); this._events.maxListeners = n; }; EventEmitter.prototype.event = ''; EventEmitter.prototype.once = function(event, fn) { this.many(event, 1, fn); return this; }; EventEmitter.prototype.many = function(event, ttl, fn) { var self = this; if (typeof fn !== 'function') { throw new Error('many only accepts instances of Function'); } function listener() { if (--ttl === 0) { self.off(event, listener); } fn.apply(this, arguments); }; listener._origin = fn; this.on(event, listener); return self; }; EventEmitter.prototype.emit = function() { this._events || init.call(this); var type = arguments[0]; if (type === 'newListener') { if (!this._events.newListener) { return false; } } // Loop through the *_all* functions and invoke them. if (this._all) { var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; for (i = 0, l = this._all.length; i < l; i++) { this.event = type; this._all[i].apply(this, args); } } // If there is no 'error' event listener then throw. if (type === 'error') { if (!this._all && !this._events.error && !(this.wildcard && this.listenerTree.error)) { if (arguments[1] instanceof Error) { throw arguments[1]; // Unhandled 'error' event } else { throw new Error("Uncaught, unspecified 'error' event."); } return false; } } var handler; if(this.wildcard) { handler = []; var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); searchListenerTree.call(this, handler, ns, this.listenerTree, 0); } else { handler = this._events[type]; } if (typeof handler === 'function') { this.event = type; if (arguments.length === 1) { handler.call(this); } else if (arguments.length > 1) switch (arguments.length) { case 2: handler.call(this, arguments[1]); break; case 3: handler.call(this, arguments[1], arguments[2]); break; // slower default: var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; handler.apply(this, args); } return true; } else if (handler) { var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; var listeners = handler.slice(); for (var i = 0, l = listeners.length; i < l; i++) { this.event = type; listeners[i].apply(this, args); } return (listeners.length > 0) || this._all; } else { return this._all; } }; EventEmitter.prototype.on = function(type, listener) { if (typeof type === 'function') { this.onAny(type); return this; } if (typeof listener !== 'function') { throw new Error('on only accepts instances of Function'); } this._events || init.call(this); // To avoid recursion in the case that type == "newListeners"! Before // adding it to the listeners, first emit "newListeners". this.emit('newListener', type, listener); if(this.wildcard) { growListenerTree.call(this, type, listener); return this; } if (!this._events[type]) { // Optimize the case of one listener. Don't need the extra array object. this._events[type] = listener; } else if(typeof this._events[type] === 'function') { // Adding the second element, need to change to array. this._events[type] = [this._events[type], listener]; } else if (isArray(this._events[type])) { // If we've already got an array, just append. this._events[type].push(listener); // Check for listener leak if (!this._events[type].warned) { var m = defaultMaxListeners; if (typeof this._events.maxListeners !== 'undefined') { m = this._events.maxListeners; } if (m > 0 && this._events[type].length > m) { this._events[type].warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length); console.trace(); } } } return this; }; EventEmitter.prototype.onAny = function(fn) { if(!this._all) { this._all = []; } if (typeof fn !== 'function') { throw new Error('onAny only accepts instances of Function'); } // Add the function to the event listener collection. this._all.push(fn); return this; }; EventEmitter.prototype.addListener = EventEmitter.prototype.on; EventEmitter.prototype.off = function(type, listener) { if (typeof listener !== 'function') { throw new Error('removeListener only takes instances of Function'); } var handlers,leafs=[]; if(this.wildcard) { var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); } else { // does not use listeners(), so no side effect of creating _events[type] if (!this._events[type]) return this; handlers = this._events[type]; leafs.push({_listeners:handlers}); } for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) { var leaf = leafs[iLeaf]; handlers = leaf._listeners; if (isArray(handlers)) { var position = -1; for (var i = 0, length = handlers.length; i < length; i++) { if (handlers[i] === listener || (handlers[i].listener && handlers[i].listener === listener) || (handlers[i]._origin && handlers[i]._origin === listener)) { position = i; break; } } if (position < 0) { return this; } if(this.wildcard) { leaf._listeners.splice(position, 1) } else { this._events[type].splice(position, 1); } if (handlers.length === 0) { if(this.wildcard) { delete leaf._listeners; } else { delete this._events[type]; } } } else if (handlers === listener || (handlers.listener && handlers.listener === listener) || (handlers._origin && handlers._origin === listener)) { if(this.wildcard) { delete leaf._listeners; } else { delete this._events[type]; } } } return this; }; EventEmitter.prototype.offAny = function(fn) { var i = 0, l = 0, fns; if (fn && this._all && this._all.length > 0) { fns = this._all; for(i = 0, l = fns.length; i < l; i++) { if(fn === fns[i]) { fns.splice(i, 1); return this; } } } else { this._all = []; } return this; }; EventEmitter.prototype.removeListener = EventEmitter.prototype.off; EventEmitter.prototype.removeAllListeners = function(type) { if (arguments.length === 0) { !this._events || init.call(this); return this; } if(this.wildcard) { var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) { var leaf = leafs[iLeaf]; leaf._listeners = null; } } else { if (!this._events[type]) return this; this._events[type] = null; } return this; }; EventEmitter.prototype.listeners = function(type) { if(this.wildcard) { var handlers = []; var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); return handlers; } this._events || init.call(this); if (!this._events[type]) this._events[type] = []; if (!isArray(this._events[type])) { this._events[type] = [this._events[type]]; } return this._events[type]; }; EventEmitter.prototype.listenersAny = function() { if(this._all) { return this._all; } else { return []; } }; // if (typeof define === 'function' && define.amd) { // define('EventEmitter2', [], function() { // return EventEmitter; // }); // } else { exports.EventEmitter2 = EventEmitter; // } }(typeof process !== 'undefined' && typeof process.title !== 'undefined' && typeof exports !== 'undefined' ? exports : window); /*! * Øyvind Sean Kinsey and others require the following notice to accompany easyXDM: * * http://easyxdm.net/ * Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ (function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) { /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */ var global = this; var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded var emptyFn = Function.prototype; var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4) var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global) var easyXDM = {}; var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite var IFRAME_PREFIX = "easyXDM_"; var HAS_NAME_PROPERTY_BUG; var useHash = false; // whether to use the hash over the query var flashVersion; // will be set if using flash var HAS_FLASH_THROTTLED_BUG; // http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting function isHostMethod(object, property){ var t = typeof object[property]; return t == 'function' || (!!(t == 'object' && object[property])) || t == 'unknown'; } function isHostObject(object, property){ return !!(typeof(object[property]) == 'object' && object[property]); } // end // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/ function isArray(o){ return Object.prototype.toString.call(o) === '[object Array]'; } // end function hasFlash(){ try { var activeX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); flashVersion = Array.prototype.slice.call(activeX.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1); HAS_FLASH_THROTTLED_BUG = parseInt(flashVersion[0], 10) > 9 && parseInt(flashVersion[1], 10) > 0; activeX = null; return true; } catch (notSupportedException) { return false; } } /* * Cross Browser implementation for adding and removing event listeners. */ var on, un; if (isHostMethod(window, "addEventListener")) { on = function(target, type, listener){ target.addEventListener(type, listener, false); }; un = function(target, type, listener){ target.removeEventListener(type, listener, false); }; } else if (isHostMethod(window, "attachEvent")) { on = function(object, sEvent, fpNotify){ object.attachEvent("on" + sEvent, fpNotify); }; un = function(object, sEvent, fpNotify){ object.detachEvent("on" + sEvent, fpNotify); }; } else { throw new Error("Browser not supported"); } /* * Cross Browser implementation of DOMContentLoaded. */ var domIsReady = false, domReadyQueue = [], readyState; if ("readyState" in document) { // If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and // 'interactive' (HTML5 specs, recent WebKit builds) states. // https://bugs.webkit.org/show_bug.cgi?id=45119 readyState = document.readyState; domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive")); } else { // If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately // when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not. // We only need a body to add elements to, so the existence of document.body is enough for us. domIsReady = !!document.body; } function dom_onReady(){ if (domIsReady) { return; } domIsReady = true; for (var i = 0; i < domReadyQueue.length; i++) { domReadyQueue[i](); } domReadyQueue.length = 0; } if (!domIsReady) { if (isHostMethod(window, "addEventListener")) { on(document, "DOMContentLoaded", dom_onReady); } else { on(document, "readystatechange", function(){ if (document.readyState == "complete") { dom_onReady(); } }); if (document.documentElement.doScroll && window === top) { var doScrollCheck = function(){ if (domIsReady) { return; } // http://javascript.nwbox.com/IEContentLoaded/ try { document.documentElement.doScroll("left"); } catch (e) { setTimeout(doScrollCheck, 1); return; } dom_onReady(); }; doScrollCheck(); } } // A fallback to window.onload, that will always work on(window, "load", dom_onReady); } /** * This will add a function to the queue of functions to be run once the DOM reaches a ready state. * If functions are added after this event then they will be executed immediately. * @param {function} fn The function to add * @param {Object} scope An optional scope for the function to be called with. */ function whenReady(fn, scope){ if (domIsReady) { fn.call(scope); return; } domReadyQueue.push(function(){ fn.call(scope); }); } /** * Returns an instance of easyXDM from the parent window with * respect to the namespace. * * @return An instance of easyXDM (in the parent window) */ function getParentObject(){ var obj = parent; if (namespace !== "") { for (var i = 0, ii = namespace.split("."); i < ii.length; i++) { obj = obj[ii[i]]; } } return obj.easyXDM; } /** * Removes easyXDM variable from the global scope. It also returns control * of the easyXDM variable to whatever code used it before. * * @param {String} ns A string representation of an object that will hold * an instance of easyXDM. * @return An instance of easyXDM */ function noConflict(ns){ window.easyXDM = _easyXDM; namespace = ns; if (namespace) { IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_"; } return easyXDM; } /* * Methods for working with URLs */ /** * Get the domain name from a url. * @param {String} url The url to extract the domain from. * @return The domain part of the url. * @type {String} */ function getDomainName(url){ return url.match(reURI)[3]; } /** * Get the port for a given URL, or "" if none * @param {String} url The url to extract the port from. * @return The port part of the url. * @type {String} */ function getPort(url){ return url.match(reURI)[4] || ""; } /** * Returns a string containing the schema, domain and if present the port * @param {String} url The url to extract the location from * @return {String} The location part of the url */ function getLocation(url){ var m = url.toLowerCase().match(reURI); var proto = m[2], domain = m[3], port = m[4] || ""; if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) { port = ""; } return proto + "//" + domain + port; } /** * Resolves a relative url into an absolute one. * @param {String} url The path to resolve. * @return {String} The resolved url. */ function resolveUrl(url){ // replace all // except the one in proto with / url = url.replace(reDoubleSlash, "$1/"); // If the url is a valid url we do nothing if (!url.match(/^(http||https):\/\//)) { // If this is a relative path var path = (url.substring(0, 1) === "/") ? "" : location.pathname; if (path.substring(path.length - 1) !== "/") { path = path.substring(0, path.lastIndexOf("/") + 1); } url = location.protocol + "//" + location.host + path + url; } // reduce all 'xyz/../' to just '' while (reParent.test(url)) { url = url.replace(reParent, ""); } return url; } /** * Appends the parameters to the given url.<br/> * The base url can contain existing query parameters. * @param {String} url The base url. * @param {Object} parameters The parameters to add. * @return {String} A new valid url with the parameters appended. */ function appendQueryParameters(url, parameters){ var hash = "", indexOf = url.indexOf("#"); if (indexOf !== -1) { hash = url.substring(indexOf); url = url.substring(0, indexOf); } var q = []; for (var key in parameters) { if (parameters.hasOwnProperty(key)) { q.push(key + "=" + encodeURIComponent(parameters[key])); } } return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash; } // build the query object either from location.query, if it contains the xdm_e argument, or from location.hash var query = (function(input){ input = input.substring(1).split("&"); var data = {}, pair, i = input.length; while (i--) { pair = input[i].split("="); data[pair[0]] = decodeURIComponent(pair[1]); } return data; }(/xdm_e=/.test(location.search) ? location.search : location.hash)); /* * Helper methods */ /** * Helper for checking if a variable/property is undefined * @param {Object} v The variable to test * @return {Boolean} True if the passed variable is undefined */ function undef(v){ return typeof v === "undefined"; } /** * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works. * @return {JSON} A valid JSON conforming object, or null if not found. */ var getJSON = function(){ var cached = {}; var obj = { a: [1, 2, 3] }, json = "{\"a\":[1,2,3]}"; if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) { // this is a working JSON instance return JSON; } if (Object.toJSON) { if (Object.toJSON(obj).replace((/\s/g), "") === json) { // this is a working stringify method cached.stringify = Object.toJSON; } } if (typeof String.prototype.evalJSON === "function") { obj = json.evalJSON(); if (obj.a && obj.a.length === 3 && obj.a[2] === 3) { // this is a working parse method cached.parse = function(str){ return str.evalJSON(); }; } } if (cached.stringify && cached.parse) { // Only memoize the result if we have valid instance getJSON = function(){ return cached; }; return cached; } return null; }; /** * Applies properties from the source object to the target object.<br/> * @param {Object} target The target of the properties. * @param {Object} source The source of the properties. * @param {Boolean} noOverwrite Set to True to only set non-existing properties. */ function apply(destination, source, noOverwrite){ var member; for (var prop in source) { if (source.hasOwnProperty(prop)) { if (prop in destination) { member = source[prop]; if (typeof member === "object") { apply(destination[prop], member, noOverwrite); } else if (!noOverwrite) { destination[prop] = source[prop]; } } else { destination[prop] = source[prop]; } } } return destination; } // This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName]. function testForNamePropertyBug(){ var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input")); input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name]; document.body.removeChild(form); } /** * Creates a frame and appends it to the DOM. * @param config {object} This object can have the following properties * <ul> * <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li> * <li> {object} attr The attributes that should be set on the frame.</li> * <li> {DOMElement} container Its parent element (Optional).</li> * <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li> * </ul> * @return The frames DOMElement * @type DOMElement */ function createFrame(config){ if (undef(HAS_NAME_PROPERTY_BUG)) { testForNamePropertyBug(); } var frame; // This is to work around the problems in IE6/7 with setting the name property. // Internally this is set as 'submitName' instead when using 'iframe.name = ...' // This is not required by easyXDM itself, but is to facilitate other use cases if (HAS_NAME_PROPERTY_BUG) { frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>"); } else { frame = document.createElement("IFRAME"); frame.name = config.props.name; } frame.id = frame.name = config.props.name; delete config.props.name; if (config.onLoad) { on(frame, "load", config.onLoad); } if (typeof config.container == "string") { config.container = document.getElementById(config.container); } if (!config.container) { // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers. apply(frame.style, { position: "absolute", top: "-2000px" }); config.container = document.body; } // HACK for some reason, IE needs the source set // after the frame has been appended into the DOM // so remove the src, and set it afterwards var src = config.props.src; delete config.props.src; // transfer properties to the frame apply(frame, config.props); frame.border = frame.frameBorder = 0; frame.allowTransparency = true; config.container.appendChild(frame); // HACK see above frame.src = src; config.props.src = src; return frame; } /** * Check whether a domain is allowed using an Access Control List. * The ACL can contain * and ? as wildcards, or can be regular expressions. * If regular expressions they need to begin with ^ and end with $. * @param {Array/String} acl The list of allowed domains * @param {String} domain The domain to test. * @return {Boolean} True if the domain is allowed, false if not. */ function checkAcl(acl, domain){ // normalize into an array if (typeof acl == "string") { acl = [acl]; } var re, i = acl.length; while (i--) { re = acl[i]; re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$")); if (re.test(domain)) { return true; } } return false; } /* * Functions related to stacks */ /** * Prepares an array of stack-elements suitable for the current configuration * @param {Object} config The Transports configuration. See easyXDM.Socket for more. * @return {Array} An array of stack-elements with the TransportElement at index 0. */ function prepareTransportStack(config){ var protocol = config.protocol, stackEls; config.isHost = config.isHost || undef(query.xdm_p); useHash = config.hash || false; if (!config.props) { config.props = {}; } if (!config.isHost) { config.channel = query.xdm_c; config.secret = query.xdm_s; config.remote = query.xdm_e; protocol = query.xdm_p; if (config.acl && !checkAcl(config.acl, config.remote)) { throw new Error("Access denied for " + config.remote); } } else { config.remote = resolveUrl(config.remote); config.channel = config.channel || "default" + channelId++; config.secret = Math.random().toString(16).substring(2); if (undef(protocol)) { if (getLocation(location.href) == getLocation(config.remote)) { /* * Both documents has the same origin, lets use direct access. */ protocol = "4"; } else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) { /* * This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+ */ protocol = "1"; } else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) { /* * The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS */ protocol = "6"; } else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) { /* * This is supported in Gecko (Firefox 1+) */ protocol = "5"; } else if (config.remoteHelper) { /* * This is supported in all browsers that retains the value of window.name when * navigating from one domain to another, and where parent.frames[foo] can be used * to get access to a frame from the same domain */ config.remoteHelper = resolveUrl(config.remoteHelper); protocol = "2"; } else { /* * This is supported in all browsers where [window].location is writable for all * The resize event will be used if resize is supported and the iframe is not put * into a container, else polling will be used. */ protocol = "0"; } } } config.protocol = protocol; // for conditional branching switch (protocol) { case "0":// 0 = HashTransport apply(config, { interval: 100, delay: 2000, useResize: true, useParent: false, usePolling: false }, true); if (config.isHost) { if (!config.local) { // If no local is set then we need to find an image hosted on the current domain var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image; var i = images.length; while (i--) { image = images[i]; if (image.src.substring(0, domain.length) === domain) { config.local = image.src; break; } } if (!config.local) { // If no local was set, and we are unable to find a suitable file, then we resort to using the current window config.local = window; } } var parameters = { xdm_c: config.channel, xdm_p: 0 }; if (config.local === window) { // We are using the current window to listen to config.usePolling = true; config.useParent = true; config.local = location.protocol + "//" + location.host + location.pathname + location.search; parameters.xdm_e = config.local; parameters.xdm_pa = 1; // use parent } else { parameters.xdm_e = resolveUrl(config.local); } if (config.container) { config.useResize = false; parameters.xdm_po = 1; // use polling } config.remote = appendQueryParameters(config.remote, parameters); } else { apply(config, { channel: query.xdm_c, remote: query.xdm_e, useParent: !undef(query.xdm_pa), usePolling: !undef(query.xdm_po), useResize: config.useParent ? false : config.useResize }); } stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({ encode: true, maxLength: 4000 - config.remote.length }), new easyXDM.stack.VerifyBehavior({ initiate: config.isHost })]; break; case "1": stackEls = [new easyXDM.stack.PostMessageTransport(config)]; break; case "2": stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({ initiate: config.isHost })]; break; case "3": stackEls = [new easyXDM.stack.NixTransport(config)]; break; case "4": stackEls = [new easyXDM.stack.SameOriginTransport(config)]; break; case "5": stackEls = [new easyXDM.stack.FrameElementTransport(config)]; break; case "6": if (!flashVersion) { hasFlash(); } stackEls = [new easyXDM.stack.FlashTransport(config)]; break; } // this behavior is responsible for buffering outgoing messages, and for performing lazy initialization stackEls.push(new easyXDM.stack.QueueBehavior({ lazy: config.lazy, remove: true })); return stackEls; } /** * Chains all the separate stack elements into a single usable stack.<br/> * If an element is missing a necessary method then it will have a pass-through method applied. * @param {Array} stackElements An array of stack elements to be linked. * @return {easyXDM.stack.StackElement} The last element in the chain. */ function chainStack(stackElements){ var stackEl, defaults = { incoming: function(message, origin){ this.up.incoming(message, origin); }, outgoing: function(message, recipient){ this.down.outgoing(message, recipient); }, callback: function(success){ this.up.callback(success); }, init: function(){ this.down.init(); }, destroy: function(){ this.down.destroy(); } }; for (var i = 0, len = stackElements.length; i < len; i++) { stackEl = stackElements[i]; apply(stackEl, defaults, true); if (i !== 0) { stackEl.down = stackElements[i - 1]; } if (i !== len - 1) { stackEl.up = stackElements[i + 1]; } } return stackEl; } /** * This will remove a stackelement from its stack while leaving the stack functional. * @param {Object} element The elment to remove from the stack. */ function removeFromStack(element){ element.up.down = element.down; element.down.up = element.up; element.up = element.down = null; } /* * Export the main object and any other methods applicable */ /** * @class easyXDM * A javascript library providing cross-browser, cross-domain messaging/RPC. * @version 2.4.15.118 * @singleton */ apply(easyXDM, { /** * The version of the library * @type {string} */ version: "2.4.15.118", /** * This is a map containing all the query parameters passed to the document. * All the values has been decoded using decodeURIComponent. * @type {object} */ query: query, /** * @private */ stack: {}, /** * Applies properties from the source object to the target object.<br/> * @param {object} target The target of the properties. * @param {object} source The source of the properties. * @param {boolean} noOverwrite Set to True to only set non-existing properties. */ apply: apply, /** * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works. * @return {JSON} A valid JSON conforming object, or null if not found. */ getJSONObject: getJSON, /** * This will add a function to the queue of functions to be run once the DOM reaches a ready state. * If functions are added after this event then they will be executed immediately. * @param {function} fn The function to add * @param {object} scope An optional scope for the function to be called with. */ whenReady: whenReady, /** * Removes easyXDM variable from the global scope. It also returns control * of the easyXDM variable to whatever code used it before. * * @param {String} ns A string representation of an object that will hold * an instance of easyXDM. * @return An instance of easyXDM */ noConflict: noConflict }); /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.DomHelper * Contains methods for dealing with the DOM * @singleton */ easyXDM.DomHelper = { /** * Provides a consistent interface for adding eventhandlers * @param {Object} target The target to add the event to * @param {String} type The name of the event * @param {Function} listener The listener */ on: on, /** * Provides a consistent interface for removing eventhandlers * @param {Object} target The target to remove the event from * @param {String} type The name of the event * @param {Function} listener The listener */ un: un, /** * Checks for the presence of the JSON object. * If it is not present it will use the supplied path to load the JSON2 library. * This should be called in the documents head right after the easyXDM script tag. * http://json.org/json2.js * @param {String} path A valid path to json2.js */ requiresJSON: function(path){ if (!isHostObject(window, "JSON")) { // we need to encode the < in order to avoid an illegal token error // when the script is inlined in a document. document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>'); } } }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, debug */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // (function(){ // The map containing the stored functions var _map = {}; /** * @class easyXDM.Fn * This contains methods related to function handling, such as storing callbacks. * @singleton * @namespace easyXDM */ easyXDM.Fn = { /** * Stores a function using the given name for reference * @param {String} name The name that the function should be referred by * @param {Function} fn The function to store * @namespace easyXDM.fn */ set: function(name, fn){ _map[name] = fn; }, /** * Retrieves the function referred to by the given name * @param {String} name The name of the function to retrieve * @param {Boolean} del If the function should be deleted after retrieval * @return {Function} The stored function * @namespace easyXDM.fn */ get: function(name, del){ var fn = _map[name]; if (del) { delete _map[name]; } return fn; } }; }()); /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.Socket * This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/> * The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/> * Internally different stacks will be used depending on the browsers features and the available parameters. * <h2>How to set up</h2> * Setting up the provider: * <pre><code> * var socket = new easyXDM.Socket({ * &nbsp; local: "name.html", * &nbsp; onReady: function(){ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket * &nbsp; &nbsp; socket.postMessage("foo-message"); * &nbsp; }, * &nbsp; onMessage: function(message, origin) { * &nbsp;&nbsp; alert("received " + message + " from " + origin); * &nbsp; } * }); * </code></pre> * Setting up the consumer: * <pre><code> * var socket = new easyXDM.Socket({ * &nbsp; remote: "http:&#47;&#47;remotedomain/page.html", * &nbsp; remoteHelper: "http:&#47;&#47;remotedomain/name.html", * &nbsp; onReady: function(){ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket * &nbsp; &nbsp; socket.postMessage("foo-message"); * &nbsp; }, * &nbsp; onMessage: function(message, origin) { * &nbsp;&nbsp; alert("received " + message + " from " + origin); * &nbsp; } * }); * </code></pre> * If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property * and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports. * @namespace easyXDM * @constructor * @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window. * @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed. * @cfg {String} remote (Consumer only) The url to the providers document. * @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional. * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000. * @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300. * @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional. * @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional. * @cfg {Function} onReady A method that should be called when the transport is ready. Optional. * @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional. * @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/> * This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $. * If none of the patterns match an Error will be thrown. * @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>. * Properties such as 'name' and 'src' will be overrided. Optional. */ easyXDM.Socket = function(config){ // create the stack var stack = chainStack(prepareTransportStack(config).concat([{ incoming: function(message, origin){ config.onMessage(message, origin); }, callback: function(success){ if (config.onReady) { config.onReady(success); } } }])), recipient = getLocation(config.remote); // set the origin this.origin = getLocation(config.remote); /** * Initiates the destruction of the stack. */ this.destroy = function(){ stack.destroy(); }; /** * Posts a message to the remote end of the channel * @param {String} message The message to send */ this.postMessage = function(message){ stack.outgoing(message, recipient); }; stack.init(); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.Rpc * Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation * of methods to be called from the remote end.<br/> * The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/> * This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods. * <h2>How to set up</h2> * <pre><code> * var rpc = new easyXDM.Rpc({ * &nbsp; &#47;&#47; this configuration is equal to that used by the Socket. * &nbsp; remote: "http:&#47;&#47;remotedomain/...", * &nbsp; onReady: function(){ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the proxy * &nbsp; &nbsp; rpc.foo(... * &nbsp; } * },{ * &nbsp; local: {..}, * &nbsp; remote: {..} * }); * </code></pre> * * <h2>Exposing functions (procedures)</h2> * <pre><code> * var rpc = new easyXDM.Rpc({ * &nbsp; ... * },{ * &nbsp; local: { * &nbsp; &nbsp; nameOfMethod: { * &nbsp; &nbsp; &nbsp; method: function(arg1, arg2, success, error){ * &nbsp; &nbsp; &nbsp; &nbsp; ... * &nbsp; &nbsp; &nbsp; } * &nbsp; &nbsp; }, * &nbsp; &nbsp; &#47;&#47; with shorthand notation * &nbsp; &nbsp; nameOfAnotherMethod: function(arg1, arg2, success, error){ * &nbsp; &nbsp; } * &nbsp; }, * &nbsp; remote: {...} * }); * </code></pre> * The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/> * To send a successfull result back you can use * <pre><code> * return foo; * </pre></code> * or * <pre><code> * success(foo); * </pre></code> * To return an error you can use * <pre><code> * throw new Error("foo error"); * </code></pre> * or * <pre><code> * error("foo error"); * </code></pre> * * <h2>Defining remotely exposed methods (procedures/notifications)</h2> * The definition of the remote end is quite similar: * <pre><code> * var rpc = new easyXDM.Rpc({ * &nbsp; ... * },{ * &nbsp; local: {...}, * &nbsp; remote: { * &nbsp; &nbsp; nameOfMethod: {} * &nbsp; } * }); * </code></pre> * To call a remote method use * <pre><code> * rpc.nameOfMethod("arg1", "arg2", function(value) { * &nbsp; alert("success: " + value); * }, function(message) { * &nbsp; alert("error: " + message + ); * }); * </code></pre> * Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/> * When called with no callback a JSON-RPC 2.0 notification will be executed. * Be aware that you will not be notified of any errors with this method. * <br/> * <h2>Specifying a custom serializer</h2> * If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library * then you can specify a custom serializer using <code>serializer: foo</code> * <pre><code> * var rpc = new easyXDM.Rpc({ * &nbsp; ... * },{ * &nbsp; local: {...}, * &nbsp; remote: {...}, * &nbsp; serializer : { * &nbsp; &nbsp; parse: function(string){ ... }, * &nbsp; &nbsp; stringify: function(object) {...} * &nbsp; } * }); * </code></pre> * If <code>serializer</code> is set then the class will not attempt to use the native implementation. * @namespace easyXDM * @constructor * @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters. * @param {Object} jsonRpcConfig The description of the interface to implement. */ easyXDM.Rpc = function(config, jsonRpcConfig){ // expand shorthand notation if (jsonRpcConfig.local) { for (var method in jsonRpcConfig.local) { if (jsonRpcConfig.local.hasOwnProperty(method)) { var member = jsonRpcConfig.local[method]; if (typeof member === "function") { jsonRpcConfig.local[method] = { method: member }; } } } } // create the stack var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), { callback: function(success){ if (config.onReady) { config.onReady(success); } } }])); // set the origin this.origin = getLocation(config.remote); /** * Initiates the destruction of the stack. */ this.destroy = function(){ stack.destroy(); }; stack.init(); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.SameOriginTransport * SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/> * This can be useful for testing and for when the main application supports both internal and external sources. * @namespace easyXDM.stack * @constructor * @param {Object} config The transports configuration. * @cfg {String} remote The remote document to communicate with. */ easyXDM.stack.SameOriginTransport = function(config){ var pub, frame, send, targetOrigin; return (pub = { outgoing: function(message, domain, fn){ send(message); if (fn) { fn(); } }, destroy: function(){ if (frame) { frame.parentNode.removeChild(frame); frame = null; } }, onDOMReady: function(){ targetOrigin = getLocation(config.remote); if (config.isHost) { // set up the iframe apply(config.props, { src: appendQueryParameters(config.remote, { xdm_e: location.protocol + "//" + location.host + location.pathname, xdm_c: config.channel, xdm_p: 4 // 4 = SameOriginTransport }), name: IFRAME_PREFIX + config.channel + "_provider" }); frame = createFrame(config); easyXDM.Fn.set(config.channel, function(sendFn){ send = sendFn; setTimeout(function(){ pub.up.callback(true); }, 0); return function(msg){ pub.up.incoming(msg, targetOrigin); }; }); } else { send = getParentObject().Fn.get(config.channel, true)(function(msg){ pub.up.incoming(msg, targetOrigin); }); setTimeout(function(){ pub.up.callback(true); }, 0); } }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.FlashTransport * FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth. * @namespace easyXDM.stack * @constructor * @param {Object} config The transports configuration. * @cfg {String} remote The remote domain to communicate with. * @cfg {String} secret the pre-shared secret used to secure the communication. * @cfg {String} swf The path to the swf file * @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden. * @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed */ easyXDM.stack.FlashTransport = function(config){ var pub, // the public interface frame, send, targetOrigin, swf, swfContainer; function onMessage(message, origin){ setTimeout(function(){ pub.up.incoming(message, targetOrigin); }, 0); } /** * This method adds the SWF to the DOM and prepares the initialization of the channel */ function addSwf(domain){ // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error. var url = config.swf + "?host=" + config.isHost; var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000); // prepare the init function that will fire once the swf is ready easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){ easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild; var queue = easyXDM.stack.FlashTransport[domain].queue; for (var i = 0; i < queue.length; i++) { queue[i](); } queue.length = 0; }); if (config.swfContainer) { swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer; } else { // create the container that will hold the swf swfContainer = document.createElement('div'); // http://bugs.adobe.com/jira/browse/FP-4796 // http://tech.groups.yahoo.com/group/flexcoders/message/162365 // https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? { height: "20px", width: "20px", position: "fixed", right: 0, top: 0 } : { height: "1px", width: "1px", position: "absolute", overflow: "hidden", right: 0, top: 0 }); document.body.appendChild(swfContainer); } // create the object/embed var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace; swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" + "<param name='allowScriptAccess' value='always'></param>" + "<param name='wmode' value='transparent'>" + "<param name='movie' value='" + url + "'></param>" + "<param name='flashvars' value='" + flashVars + "'></param>" + "<embed type='application/x-shockwave-flash' FlashVars='" + flashVars + "' allowScriptAccess='always' wmode='transparent' src='" + url + "' height='1' width='1'></embed>" + "</object>"; } return (pub = { outgoing: function(message, domain, fn){ swf.postMessage(config.channel, message.toString()); if (fn) { fn(); } }, destroy: function(){ try { swf.destroyChannel(config.channel); } catch (e) { } swf = null; if (frame) { frame.parentNode.removeChild(frame); frame = null; } }, onDOMReady: function(){ targetOrigin = config.remote; // Prepare the code that will be run after the swf has been intialized easyXDM.Fn.set("flash_" + config.channel + "_init", function(){ setTimeout(function(){ pub.up.callback(true); }); }); // set up the omMessage handler easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage); config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths var swfdomain = getDomainName(config.swf); var fn = function(){ // set init to true in case the fn was called was invoked from a separate instance easyXDM.stack.FlashTransport[swfdomain].init = true; swf = easyXDM.stack.FlashTransport[swfdomain].swf; // create the channel swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost); if (config.isHost) { // if Flash is going to be throttled and we want to avoid this if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) { apply(config.props, { position: "fixed", right: 0, top: 0, height: "20px", width: "20px" }); } // set up the iframe apply(config.props, { src: appendQueryParameters(config.remote, { xdm_e: getLocation(location.href), xdm_c: config.channel, xdm_p: 6, // 6 = FlashTransport xdm_s: config.secret }), name: IFRAME_PREFIX + config.channel + "_provider" }); frame = createFrame(config); } }; if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) { // if the swf is in place and we are the consumer fn(); } else { // if the swf does not yet exist if (!easyXDM.stack.FlashTransport[swfdomain]) { // add the queue to hold the init fn's easyXDM.stack.FlashTransport[swfdomain] = { queue: [fn] }; addSwf(swfdomain); } else { easyXDM.stack.FlashTransport[swfdomain].queue.push(fn); } } }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.PostMessageTransport * PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/> * <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/> * <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a> * @namespace easyXDM.stack * @constructor * @param {Object} config The transports configuration. * @cfg {String} remote The remote domain to communicate with. */ easyXDM.stack.PostMessageTransport = function(config){ var pub, // the public interface frame, // the remote frame, if any callerWindow, // the window that we will call with targetOrigin; // the domain to communicate with /** * Resolves the origin from the event object * @private * @param {Object} event The messageevent * @return {String} The scheme, host and port of the origin */ function _getOrigin(event){ if (event.origin) { // This is the HTML5 property return getLocation(event.origin); } if (event.uri) { // From earlier implementations return getLocation(event.uri); } if (event.domain) { // This is the last option and will fail if the // origin is not using the same schema as we are return location.protocol + "//" + event.domain; } throw "Unable to retrieve the origin of the event"; } /** * This is the main implementation for the onMessage event.<br/> * It checks the validity of the origin and passes the message on if appropriate. * @private * @param {Object} event The messageevent */ function _window_onMessage(event){ var origin = _getOrigin(event); if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") { pub.up.incoming(event.data.substring(config.channel.length + 1), origin); } } return (pub = { outgoing: function(message, domain, fn){ callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin); if (fn) { fn(); } }, destroy: function(){ un(window, "message", _window_onMessage); if (frame) { callerWindow = null; frame.parentNode.removeChild(frame); frame = null; } }, onDOMReady: function(){ targetOrigin = getLocation(config.remote); if (config.isHost) { // add the event handler for listening var waitForReady = function(event){ if (event.data == config.channel + "-ready") { // replace the eventlistener callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document; un(window, "message", waitForReady); on(window, "message", _window_onMessage); setTimeout(function(){ pub.up.callback(true); }, 0); } }; on(window, "message", waitForReady); // set up the iframe apply(config.props, { src: appendQueryParameters(config.remote, { xdm_e: getLocation(location.href), xdm_c: config.channel, xdm_p: 1 // 1 = PostMessage }), name: IFRAME_PREFIX + config.channel + "_provider" }); frame = createFrame(config); } else { // add the event handler for listening on(window, "message", _window_onMessage); callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document; callerWindow.postMessage(config.channel + "-ready", targetOrigin); setTimeout(function(){ pub.up.callback(true); }, 0); } }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.FrameElementTransport * FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/> * Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running. * @namespace easyXDM.stack * @constructor * @param {Object} config The transports configuration. * @cfg {String} remote The remote document to communicate with. */ easyXDM.stack.FrameElementTransport = function(config){ var pub, frame, send, targetOrigin; return (pub = { outgoing: function(message, domain, fn){ send.call(this, message); if (fn) { fn(); } }, destroy: function(){ if (frame) { frame.parentNode.removeChild(frame); frame = null; } }, onDOMReady: function(){ targetOrigin = getLocation(config.remote); if (config.isHost) { // set up the iframe apply(config.props, { src: appendQueryParameters(config.remote, { xdm_e: getLocation(location.href), xdm_c: config.channel, xdm_p: 5 // 5 = FrameElementTransport }), name: IFRAME_PREFIX + config.channel + "_provider" }); frame = createFrame(config); frame.fn = function(sendFn){ delete frame.fn; send = sendFn; setTimeout(function(){ pub.up.callback(true); }, 0); // remove the function so that it cannot be used to overwrite the send function later on return function(msg){ pub.up.incoming(msg, targetOrigin); }; }; } else { // This is to mitigate origin-spoofing if (document.referrer && getLocation(document.referrer) != query.xdm_e) { window.top.location = query.xdm_e; } send = window.frameElement.fn(function(msg){ pub.up.incoming(msg, targetOrigin); }); pub.up.callback(true); } }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.NameTransport * NameTransport uses the window.name property to relay data. * The <code>local</code> parameter needs to be set on both the consumer and provider,<br/> * and the <code>remoteHelper</code> parameter needs to be set on the consumer. * @constructor * @param {Object} config The transports configuration. * @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host. * @namespace easyXDM.stack */ easyXDM.stack.NameTransport = function(config){ var pub; // the public interface var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl; function _sendMessage(message){ var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel; callerWindow.contentWindow.sendMessage(message, url); } function _onReady(){ if (isHost) { if (++readyCount === 2 || !isHost) { pub.up.callback(true); } } else { _sendMessage("ready"); pub.up.callback(true); } } function _onMessage(message){ pub.up.incoming(message, remoteOrigin); } function _onLoad(){ if (callback) { setTimeout(function(){ callback(true); }, 0); } } return (pub = { outgoing: function(message, domain, fn){ callback = fn; _sendMessage(message); }, destroy: function(){ callerWindow.parentNode.removeChild(callerWindow); callerWindow = null; if (isHost) { remoteWindow.parentNode.removeChild(remoteWindow); remoteWindow = null; } }, onDOMReady: function(){ isHost = config.isHost; readyCount = 0; remoteOrigin = getLocation(config.remote); config.local = resolveUrl(config.local); if (isHost) { // Register the callback easyXDM.Fn.set(config.channel, function(message){ if (isHost && message === "ready") { // Replace the handler easyXDM.Fn.set(config.channel, _onMessage); _onReady(); } }); // Set up the frame that points to the remote instance remoteUrl = appendQueryParameters(config.remote, { xdm_e: config.local, xdm_c: config.channel, xdm_p: 2 }); apply(config.props, { src: remoteUrl + '#' + config.channel, name: IFRAME_PREFIX + config.channel + "_provider" }); remoteWindow = createFrame(config); } else { config.remoteHelper = config.remote; easyXDM.Fn.set(config.channel, _onMessage); } // Set up the iframe that will be used for the transport callerWindow = createFrame({ props: { src: config.local + "#_4" + config.channel }, onLoad: function onLoad(){ // Remove the handler var w = callerWindow || this; un(w, "load", onLoad); easyXDM.Fn.set(config.channel + "_load", _onLoad); (function test(){ if (typeof w.contentWindow.sendMessage == "function") { _onReady(); } else { setTimeout(test, 50); } }()); } }); }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.HashTransport * HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/> * <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/> * @namespace easyXDM.stack * @constructor * @param {Object} config The transports configuration. * @cfg {String/Window} local The url to the local file used for proxying messages, or the local window. * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. * @cfg {Number} interval The interval used when polling for messages. */ easyXDM.stack.HashTransport = function(config){ var pub; var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow; var useParent, _remoteOrigin; function _sendMessage(message){ if (!_callerWindow) { return; } var url = config.remote + "#" + (_msgNr++) + "_" + message; ((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url; } function _handleHash(hash){ _lastMsg = hash; pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin); } /** * Checks location.hash for a new message and relays this to the receiver. * @private */ function _pollHash(){ if (!_listenerWindow) { return; } var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#"); if (indexOf != -1) { hash = href.substring(indexOf); } if (hash && hash != _lastMsg) { _handleHash(hash); } } function _attachListeners(){ _timer = setInterval(_pollHash, pollInterval); } return (pub = { outgoing: function(message, domain){ _sendMessage(message); }, destroy: function(){ window.clearInterval(_timer); if (isHost || !useParent) { _callerWindow.parentNode.removeChild(_callerWindow); } _callerWindow = null; }, onDOMReady: function(){ isHost = config.isHost; pollInterval = config.interval; _lastMsg = "#" + config.channel; _msgNr = 0; useParent = config.useParent; _remoteOrigin = getLocation(config.remote); if (isHost) { config.props = { src: config.remote, name: IFRAME_PREFIX + config.channel + "_provider" }; if (useParent) { config.onLoad = function(){ _listenerWindow = window; _attachListeners(); pub.up.callback(true); }; } else { var tries = 0, max = config.delay / 50; (function getRef(){ if (++tries > max) { throw new Error("Unable to reference listenerwindow"); } try { _listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"]; } catch (ex) { } if (_listenerWindow) { _attachListeners(); pub.up.callback(true); } else { setTimeout(getRef, 50); } }()); } _callerWindow = createFrame(config); } else { _listenerWindow = window; _attachListeners(); if (useParent) { _callerWindow = parent; pub.up.callback(true); } else { apply(config, { props: { src: config.remote + "#" + config.channel + new Date(), name: IFRAME_PREFIX + config.channel + "_consumer" }, onLoad: function(){ pub.up.callback(true); } }); _callerWindow = createFrame(config); } } }, init: function(){ whenReady(pub.onDOMReady, pub); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, debug */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.ReliableBehavior * This is a behavior that tries to make the underlying transport reliable by using acknowledgements. * @namespace easyXDM.stack * @constructor * @param {Object} config The behaviors configuration. */ easyXDM.stack.ReliableBehavior = function(config){ var pub, // the public interface callback; // the callback to execute when we have a confirmed success/failure var idOut = 0, idIn = 0, currentMessage = ""; return (pub = { incoming: function(message, origin){ var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(","); message = message.substring(indexOf + 1); if (ack[0] == idOut) { currentMessage = ""; if (callback) { callback(true); } } if (message.length > 0) { pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin); if (idIn != ack[1]) { idIn = ack[1]; pub.up.incoming(message, origin); } } }, outgoing: function(message, origin, fn){ currentMessage = message; callback = fn; pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.QueueBehavior * This is a behavior that enables queueing of messages. <br/> * It will buffer incoming messages and dispach these as fast as the underlying transport allows. * This will also fragment/defragment messages so that the outgoing message is never bigger than the * set length. * @namespace easyXDM.stack * @constructor * @param {Object} config The behaviors configuration. Optional. * @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation. */ easyXDM.stack.QueueBehavior = function(config){ var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false; function dispatch(){ if (config.remove && queue.length === 0) { removeFromStack(pub); return; } if (waiting || queue.length === 0 || destroying) { return; } waiting = true; var message = queue.shift(); pub.down.outgoing(message.data, message.origin, function(success){ waiting = false; if (message.callback) { setTimeout(function(){ message.callback(success); }, 0); } dispatch(); }); } return (pub = { init: function(){ if (undef(config)) { config = {}; } if (config.maxLength) { maxLength = config.maxLength; doFragment = true; } if (config.lazy) { lazy = true; } else { pub.down.init(); } }, callback: function(success){ waiting = false; var up = pub.up; // in case dispatch calls removeFromStack dispatch(); up.callback(success); }, incoming: function(message, origin){ if (doFragment) { var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10); incoming += message.substring(indexOf + 1); if (seq === 0) { if (config.encode) { incoming = decodeURIComponent(incoming); } pub.up.incoming(incoming, origin); incoming = ""; } } else { pub.up.incoming(message, origin); } }, outgoing: function(message, origin, fn){ if (config.encode) { message = encodeURIComponent(message); } var fragments = [], fragment; if (doFragment) { // fragment into chunks while (message.length !== 0) { fragment = message.substring(0, maxLength); message = message.substring(fragment.length); fragments.push(fragment); } // enqueue the chunks while ((fragment = fragments.shift())) { queue.push({ data: fragments.length + "_" + fragment, origin: origin, callback: fragments.length === 0 ? fn : null }); } } else { queue.push({ data: message, origin: origin, callback: fn }); } if (lazy) { pub.down.init(); } else { dispatch(); } }, destroy: function(){ destroying = true; pub.down.destroy(); } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, undef, debug */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.VerifyBehavior * This behavior will verify that communication with the remote end is possible, and will also sign all outgoing, * and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages. * @namespace easyXDM.stack * @constructor * @param {Object} config The behaviors configuration. * @cfg {Boolean} initiate If the verification should be initiated from this end. */ easyXDM.stack.VerifyBehavior = function(config){ var pub, mySecret, theirSecret, verified = false; function startVerification(){ mySecret = Math.random().toString(16).substring(2); pub.down.outgoing(mySecret); } return (pub = { incoming: function(message, origin){ var indexOf = message.indexOf("_"); if (indexOf === -1) { if (message === mySecret) { pub.up.callback(true); } else if (!theirSecret) { theirSecret = message; if (!config.initiate) { startVerification(); } pub.down.outgoing(message); } } else { if (message.substring(0, indexOf) === theirSecret) { pub.up.incoming(message.substring(indexOf + 1), origin); } } }, outgoing: function(message, origin, fn){ pub.down.outgoing(mySecret + "_" + message, origin, fn); }, callback: function(success){ if (config.initiate) { startVerification(); } } }); }; /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/ /*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */ // // easyXDM // http://easyxdm.net/ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // /** * @class easyXDM.stack.RpcBehavior * This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/> * Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything. * @namespace easyXDM.stack * @constructor * @param {Object} proxy The object to apply the methods to. * @param {Object} config The definition of the local and remote interface to implement. * @cfg {Object} local The local interface to expose. * @cfg {Object} remote The remote methods to expose through the proxy. * @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON. */ easyXDM.stack.RpcBehavior = function(proxy, config){ var pub, serializer = config.serializer || getJSON(); var _callbackCounter = 0, _callbacks = {}; /** * Serializes and sends the message * @private * @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added. */ function _send(data){ data.jsonrpc = "2.0"; pub.down.outgoing(serializer.stringify(data)); } /** * Creates a method that implements the given definition * @private * @param {Object} The method configuration * @param {String} method The name of the method * @return {Function} A stub capable of proxying the requested method call */ function _createMethod(definition, method){ var slice = Array.prototype.slice; return function(){ var l = arguments.length, callback, message = { method: method }; if (l > 0 && typeof arguments[l - 1] === "function") { //with callback, procedure if (l > 1 && typeof arguments[l - 2] === "function") { // two callbacks, success and error callback = { success: arguments[l - 2], error: arguments[l - 1] }; message.params = slice.call(arguments, 0, l - 2); } else { // single callback, success callback = { success: arguments[l - 1] }; message.params = slice.call(arguments, 0, l - 1); } _callbacks["" + (++_callbackCounter)] = callback; message.id = _callbackCounter; } else { // no callbacks, a notification message.params = slice.call(arguments, 0); } if (definition.namedParams && message.params.length === 1) { message.params = message.params[0]; } // Send the method request _send(message); }; } /** * Executes the exposed method * @private * @param {String} method The name of the method * @param {Number} id The callback id to use * @param {Function} method The exposed implementation * @param {Array} params The parameters supplied by the remote end */ function _executeMethod(method, id, fn, params){ if (!fn) { if (id) { _send({ id: id, error: { code: -32601, message: "Procedure not found." } }); } return; } var success, error; if (id) { success = function(result){ success = emptyFn; _send({ id: id, result: result }); }; error = function(message, data){ error = emptyFn; var msg = { id: id, error: { code: -32099, message: message } }; if (data) { msg.error.data = data; } _send(msg); }; } else { success = error = emptyFn; } // Call local method if (!isArray(params)) { params = [params]; } try { var result = fn.method.apply(fn.scope, params.concat([success, error])); if (!undef(result)) { success(result); } } catch (ex1) { error(ex1.message); } } return (pub = { incoming: function(message, origin){ var data = serializer.parse(message); if (data.method) { // A method call from the remote end if (config.handle) { config.handle(data, _send); } else { _executeMethod(data.method, data.id, config.local[data.method], data.params); } } else { // A method response from the other end var callback = _callbacks[data.id]; if (data.error) { if (callback.error) { callback.error(data.error); } } else if (callback.success) { callback.success(data.result); } delete _callbacks[data.id]; } }, init: function(){ if (config.remote) { // Implement the remote sides exposed methods for (var method in config.remote) { if (config.remote.hasOwnProperty(method)) { proxy[method] = _createMethod(config.remote[method], method); } } } pub.down.init(); }, destroy: function(){ for (var method in config.remote) { if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) { delete proxy[method]; } } pub.down.destroy(); } }); }; global.easyXDM = easyXDM; })(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent); /*! * F2 v1.3.1 10-15-2013 * Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org * * "F2" is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * * Please note that F2 ("Software") may contain third party material that Markit * On Demand Inc. has a license to use and include within the Software (the * "Third Party Material"). A list of the software comprising the Third Party Material * and the terms and conditions under which such Third Party Material is distributed * are reproduced in the ThirdPartyMaterial.md file available at: * * https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md * * The inclusion of the Third Party Material in the Software does not grant, provide * nor result in you having acquiring any rights whatsoever, other than as stipulated * in the terms and conditions related to the specific Third Party Material, if any. * */ var F2; /** * Open F2 * @module f2 * @main f2 */ F2 = (function() { /** * Abosolutizes a relative URL * @method _absolutizeURI * @private * @param {e.g., location.href} base * @param {URL to absolutize} href * @returns {string} URL * Source: https://gist.github.com/Yaffle/1088850 * Tests: http://skew.org/uri/uri_tests.html */ var _absolutizeURI = function(base, href) {// RFC 3986 function removeDotSegments(input) { var output = []; input.replace(/^(\.\.?(\/|$))+/, '') .replace(/\/(\.(\/|$))+/g, '/') .replace(/\/\.\.$/, '/../') .replace(/\/?[^\/]*/g, function (p) { if (p === '/..') { output.pop(); } else { output.push(p); } }); return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : ''); } href = _parseURI(href || ''); base = _parseURI(base || ''); return !href || !base ? null : (href.protocol || base.protocol) + (href.protocol || href.authority ? href.authority : base.authority) + removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) + (href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) + href.hash; }; /** * Parses URI * @method _parseURI * @private * @param {The URL to parse} url * @returns {Parsed URL} string * Source: https://gist.github.com/Yaffle/1088850 * Tests: http://skew.org/uri/uri_tests.html */ var _parseURI = function(url) { var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); // authority = '//' + user + ':' + pass '@' + hostname + ':' port return (m ? { href : m[0] || '', protocol : m[1] || '', authority: m[2] || '', host : m[3] || '', hostname : m[4] || '', port : m[5] || '', pathname : m[6] || '', search : m[7] || '', hash : m[8] || '' } : null); }; return { /** * A function to pass into F2.stringify which will prevent circular * reference errors when serializing objects * @method appConfigReplacer */ appConfigReplacer: function(key, value) { if (key == 'root' || key == 'ui' || key == 'height') { return undefined; } else { return value; } }, /** * The apps namespace is a place for app developers to put the javascript * class that is used to initialize their app. The javascript classes should * be namepaced with the {{#crossLink "F2.AppConfig"}}{{/crossLink}}.appId. * It is recommended that the code be placed in a closure to help keep the * global namespace clean. * * If the class has an 'init' function, that function will be called * automatically by F2. * @property Apps * @type object * @example * F2.Apps["com_example_helloworld"] = (function() { * var App_Class = function(appConfig, appContent, root) { * this._app = appConfig; // the F2.AppConfig object * this._appContent = appContent // the F2.AppManifest.AppContent object * this.$root = $(root); // the root DOM Element that contains this app * } * * App_Class.prototype.init = function() { * // perform init actions * } * * return App_Class; * })(); * @example * F2.Apps["com_example_helloworld"] = function(appConfig, appContent, root) { * return { * init:function() { * // perform init actions * } * }; * }; * @for F2 */ Apps: {}, /** * Creates a namespace on F2 and copies the contents of an object into * that namespace optionally overwriting existing properties. * @method extend * @param {string} ns The namespace to create. Pass a falsy value to * add properties to the F2 namespace directly. * @param {object} obj The object to copy into the namespace. * @param {bool} overwrite True if object properties should be overwritten * @return {object} The created object */ extend: function (ns, obj, overwrite) { var isFunc = typeof obj === 'function'; var parts = ns ? ns.split('.') : []; var parent = this; obj = obj || {}; // ignore leading global if (parts[0] === 'F2') { parts = parts.slice(1); } // create namespaces for (var i = 0, len = parts.length; i < len; i++) { if (!parent[parts[i]]) { parent[parts[i]] = isFunc && i + 1 == len ? obj : {}; } parent = parent[parts[i]]; } // copy object into namespace if (!isFunc) { for (var prop in obj) { if (typeof parent[prop] === 'undefined' || overwrite) { parent[prop] = obj[prop]; } } } return parent; }, /** * Generates a somewhat random id * @method guid * @return {string} A random id * @for F2 */ guid: function() { var S4 = function() { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); }; return (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4()); }, /** * Search for a value within an array. * @method inArray * @param {object} value The value to search for * @param {Array} array The array to search * @return {bool} True if the item is in the array */ inArray: function(value, array) { return jQuery.inArray(value, array) > -1; }, /** * Tests a URL to see if it's on the same domain (local) or not * @method isLocalRequest * @param {URL to test} url * @returns {bool} Whether the URL is local or not * Derived from: https://github.com/jquery/jquery/blob/master/src/ajax.js */ isLocalRequest: function(url){ var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, urlLower = url.toLowerCase(), parts = rurl.exec( urlLower ), ajaxLocation, ajaxLocParts; try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement('a'); ajaxLocation.href = ''; ajaxLocation = ajaxLocation.href; } ajaxLocation = ajaxLocation.toLowerCase(); // uh oh, the url must be relative // make it fully qualified and re-regex url if (!parts){ urlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase(); parts = rurl.exec( urlLower ); } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation ) || []; // do hostname and protocol and port of manifest URL match location.href? (a "local" request on the same domain) var matched = !(parts && (parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || (parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !== (ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443')))); return matched; }, /** * Utility method to determine whether or not the argument passed in is or is not a native dom node. * @method isNativeDOMNode * @param {object} testObject The object you want to check as native dom node. * @return {bool} Returns true if the object passed is a native dom node. */ isNativeDOMNode: function(testObject) { var bIsNode = ( typeof Node === 'object' ? testObject instanceof Node : testObject && typeof testObject === 'object' && typeof testObject.nodeType === 'number' && typeof testObject.nodeName === 'string' ); var bIsElement = ( typeof HTMLElement === 'object' ? testObject instanceof HTMLElement : //DOM2 testObject && typeof testObject === 'object' && testObject.nodeType === 1 && typeof testObject.nodeName === 'string' ); return (bIsNode || bIsElement); }, /** * A utility logging function to write messages or objects to the browser console. This is a proxy for the [`console` API](https://developers.google.com/chrome-developer-tools/docs/console). * @method log * @param {object|string} Object/Method An object to be logged _or_ a `console` API method name, such as `warn` or `error`. All of the console method names are [detailed in the Chrome docs](https://developers.google.com/chrome-developer-tools/docs/console-api). * @param {object} [obj2]* An object to be logged * @example //Pass any object (string, int, array, object, bool) to .log() F2.log('foo'); F2.log(myArray); //Use a console method name as the first argument. F2.log('error', err); F2.log('info', 'The session ID is ' + sessionId); * Some code derived from [HTML5 Boilerplate console plugin](https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js) */ log: function() { var _log; var _logMethod = 'log'; var method; var noop = function () { }; var methods = [ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn' ]; var length = methods.length; var console = (window.console = window.console || {}); var args; while (length--) { method = methods[length]; // Only stub undefined methods. if (!console[method]) { console[method] = noop; } //if first arg is a console function, use it. //defaults to console.log() if (arguments && arguments.length > 1 && arguments[0] == method){ _logMethod = method; //remove console func from args args = Array.prototype.slice.call(arguments, 1); } } if (Function.prototype.bind) { _log = Function.prototype.bind.call(console[_logMethod], console); } else { _log = function() { Function.prototype.apply.call(console[_logMethod], console, (args || arguments)); }; } _log.apply(this, (args || arguments)); }, /** * Wrapper to convert a JSON string to an object * @method parse * @param {string} str The JSON string to convert * @return {object} The parsed object */ parse: function(str) { return JSON.parse(str); }, /** * Wrapper to convert an object to JSON * * **Note: When using F2.stringify on an F2.AppConfig object, it is * recommended to pass F2.appConfigReplacer as the replacer function in * order to prevent circular serialization errors.** * @method stringify * @param {object} value The object to convert * @param {function|Array} replacer An optional parameter that determines * how object values are stringified for objects. It can be a function or an * array of strings. * @param {int|string} space An optional parameter that specifies the * indentation of nested structures. If it is omitted, the text will be * packed without extra whitespace. If it is a number, it will specify the * number of spaces to indent at each level. If it is a string (such as '\t' * or '&nbsp;'), it contains the characters used to indent at each level. * @return {string} The JSON string */ stringify: function(value, replacer, space) { return JSON.stringify(value, replacer, space); }, /** * Function to get the F2 version number * @method version * @return {string} F2 version number */ version: function() { return '{{sdk.version}}'; } }; })(); /** * The new `AppHandlers` functionality provides Container Developers a higher level of control over configuring app rendering and interaction. * *<p class="alert alert-block alert-warning"> *The addition of `F2.AppHandlers` replaces the previous {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} properties `beforeAppRender`, `appRender`, and `afterAppRender`. These methods were deprecated&mdash;but not removed&mdash;in version 1.2. They will be permanently removed in a future version of F2. *</p> * *<p class="alert alert-block alert-info"> *Starting with F2 version 1.2, `AppHandlers` is the preferred method for Container Developers to manage app layout. *</p> * * ### Order of Execution * * **App Rendering** * * 0. {{#crossLink "F2/registerApps"}}F2.registerApps(){{/crossLink}} method is called by the Container Developer and the following methods are run for *each* {{#crossLink "F2.AppConfig"}}{{/crossLink}} passed. * 1. **'appCreateRoot'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_CREATE\_ROOT*) handlers are fired in the order they were attached. * 2. **'appRenderBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_BEFORE*) handlers are fired in the order they were attached. * 3. Each app's `manifestUrl` is requested asynchronously; on success the following methods are fired. * 3. **'appRender'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER*) handlers are fired in the order they were attached. * 4. **'appRenderAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_AFTER*) handlers are fired in the order they were attached. * * * **App Removal** * 0. {{#crossLink "F2/removeApp"}}F2.removeApp(){{/crossLink}} with a specific {{#crossLink "F2.AppConfig/instanceId "}}{{/crossLink}} or {{#crossLink "F2/removeAllApps"}}F2.removeAllApps(){{/crossLink}} method is called by the Container Developer and the following methods are run. * 1. **'appDestroyBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_BEFORE*) handlers are fired in the order they were attached. * 2. **'appDestroy'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY*) handlers are fired in the order they were attached. * 3. **'appDestroyAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_AFTER*) handlers are fired in the order they were attached. * * **Error Handling** * 0. **'appScriptLoadFailed'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_SCRIPT\_LOAD\_FAILED*) handlers are fired in the order they were attached. * * @class F2.AppHandlers */ F2.extend('AppHandlers', (function() { // the hidden token that we will check against every time someone tries to add, remove, fire handler var _ct = F2.guid(); var _f2t = F2.guid(); var _handlerCollection = { appCreateRoot: [], appRenderBefore: [], appDestroyBefore: [], appRenderAfter: [], appDestroyAfter: [], appRender: [], appDestroy: [], appScriptLoadFailed: [] }; var _defaultMethods = { appRender: function(appConfig, appHtml) { var $root = null; // if no app root is defined use the app's outer most node if(!F2.isNativeDOMNode(appConfig.root)) { appConfig.root = jQuery(appHtml).get(0); // get a handle on the root in jQuery $root = jQuery(appConfig.root); } else { // get a handle on the root in jQuery $root = jQuery(appConfig.root); // append the app html to the root $root.append(appHtml); } // append the root to the body by default. jQuery('body').append($root); }, appDestroy: function(appInstance) { // call the apps destroy method, if it has one if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') { appInstance.app.destroy(); } // warn the Container and App Developer that even though they have a destroy method it hasn't been else if(appInstance && appInstance.app && appInstance.app.destroy) { F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.'); } // fade out and remove the root jQuery(appInstance.config.root).fadeOut(500, function() { jQuery(this).remove(); }); } }; var _createHandler = function(token, sNamespace, func_or_element, bDomNodeAppropriate) { // will throw an exception and stop execution if the token is invalid _validateToken(token); // create handler structure. Not all arguments properties will be populated/used. var handler = { func: (typeof(func_or_element)) ? func_or_element : null, namespace: sNamespace, domNode: (F2.isNativeDOMNode(func_or_element)) ? func_or_element : null }; if(!handler.func && !handler.domNode) { throw ('Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.'); } if(handler.domNode && !bDomNodeAppropriate) { throw ('Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.'); } return handler; }; var _validateToken = function(sToken) { // check token against F2 and container if(_ct != sToken && _f2t != sToken) { throw ('Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken().'); } }; var _removeHandler = function(sToken, eventKey, sNamespace) { // will throw an exception and stop execution if the token is invalid _validateToken(sToken); if(!sNamespace && !eventKey) { return; } // remove by event key else if(!sNamespace && eventKey) { _handlerCollection[eventKey] = []; } // remove by namespace only else if(sNamespace && !eventKey) { sNamespace = sNamespace.toLowerCase(); for(var currentEventKey in _handlerCollection) { var eventCollection = _handlerCollection[currentEventKey]; var newEvents = []; for(var i = 0, ec = eventCollection.length; i < ec; i++) { var currentEventHandler = eventCollection[i]; if(currentEventHandler) { if(!currentEventHandler.namespace || currentEventHandler.namespace.toLowerCase() != sNamespace) { newEvents.push(currentEventHandler); } } } eventCollection = newEvents; } } else if(sNamespace && _handlerCollection[eventKey]) { sNamespace = sNamespace.toLowerCase(); var newHandlerCollection = []; for(var iCounter = 0, hc = _handlerCollection[eventKey].length; iCounter < hc; iCounter++) { var currentHandler = _handlerCollection[eventKey][iCounter]; if(currentHandler) { if(!currentHandler.namespace || currentHandler.namespace.toLowerCase() != sNamespace) { newHandlerCollection.push(currentHandler); } } } _handlerCollection[eventKey] = newHandlerCollection; } }; return { /** * Allows Container Developer to retrieve a unique token which must be passed to * all `on` and `off` methods. This function will self destruct and can only be called * one time. Container Developers must store the return value inside of a closure. * @method getToken **/ getToken: function() { // delete this method for security that way only the container has access to the token 1 time. // kind of Ethan Hunt-ish, this message will self destruct immediately. delete this.getToken; // return the token, which we validate against. return _ct; }, /** * Allows F2 to get a token internally. Token is required to call {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}. * This function will self destruct to eliminate other sources from using the {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}} * and additional internal methods. * @method __f2GetToken * @private **/ __f2GetToken: function() { // delete this method for security that way only the F2 internally has access to the token 1 time. // kind of Ethan Hunt-ish, this message will self destruct immediately. delete this.__f2GetToken; // return the token, which we validate against. return _f2t; }, /** * Allows F2 to trigger specific events internally. * @method __trigger * @private * @chainable * @param {String} token The token received from {{#crossLink "F2.AppHandlers/\_\_f2GetToken:method"}}{{/crossLink}}. * @param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. **/ __trigger: function(token, eventKey) // additional arguments will likely be passed { // will throw an exception and stop execution if the token is invalid if(token != _f2t) { throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().'); } if(_handlerCollection && _handlerCollection[eventKey]) { // create a collection of arguments that are safe to pass to the callback. var passableArgs = []; // populate that collection with all arguments except token and eventKey for(var i = 2, j = arguments.length; i < j; i++) { passableArgs.push(arguments[i]); } if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey]) { _defaultMethods[eventKey].apply(F2, passableArgs); return this; } else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey]) { return this; } // fire all event listeners in the order that they were added. for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++) { var handler = _handlerCollection[eventKey][iCounter]; // appRender where root is already defined if (handler.domNode && arguments[2] && arguments[2].root && arguments[3]) { var $appRoot = jQuery(arguments[2].root).append(arguments[3]); jQuery(handler.domNode).append($appRoot); } else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3]) { // set the root to the actual HTML of the app arguments[2].root = jQuery(arguments[3]).get(0); // appends the root to the dom node specified jQuery(handler.domNode).append(arguments[2].root); } else { handler.func.apply(F2, passableArgs); } } } else { throw ('Invalid EventKey passed. Check your inputs and try again.'); } return this; }, /** * Allows Container Developer to easily tell all apps to render in a specific location. Only valid for eventType `appRender`. * @method on * @chainable * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal * purposes. At this time it does not affect when an event is fired. Complete list of event keys available in * {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. * @params {HTMLElement} element Specific DOM element to which app gets appended. * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * 'appRender', * document.getElementById('my_app') * ); * * Or: * @example * F2.AppHandlers.on( * _token, * 'appRender.myNamespace', * document.getElementById('my_app') * ); **/ /** * Allows Container Developer to add listener method that will be triggered when a specific event occurs. * @method on * @chainable * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal * purposes. At this time it does not affect when an event is fired. Complete list of event keys available in * {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. * @params {Function} listener A function that will be triggered when a specific event occurs. For detailed argument definition refer to {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * 'appRenderBefore' * function() { F2.log('before app rendered!'); } * ); * * Or: * @example * F2.AppHandlers.on( * _token, * 'appRenderBefore.myNamespace', * function() { F2.log('before app rendered!'); } * ); **/ on: function(token, eventKey, func_or_element) { var sNamespace = null; if(!eventKey) { throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.'); } // we need to check the key for a namespace if(eventKey.indexOf('.') > -1) { var arData = eventKey.split('.'); eventKey = arData[0]; sNamespace = arData[1]; } if(_handlerCollection && _handlerCollection[eventKey]) { _handlerCollection[eventKey].push( _createHandler( token, sNamespace, func_or_element, (eventKey == 'appRender') ) ); } else { throw ('Invalid EventKey passed. Check your inputs and try again.'); } return this; }, /** * Allows Container Developer to remove listener methods for specific events * @method off * @chainable * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. If no namespace is provided all * listeners for the specified event type will be removed. * Complete list available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.off(_token,'appRenderBefore'); * **/ off: function(token, eventKey) { var sNamespace = null; if(!eventKey) { throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.'); } // we need to check the key for a namespace if(eventKey.indexOf('.') > -1) { var arData = eventKey.split('.'); eventKey = arData[0]; sNamespace = arData[1]; } if(_handlerCollection && _handlerCollection[eventKey]) { _removeHandler( token, eventKey, sNamespace ); } else { throw ('Invalid EventKey passed. Check your inputs and try again.'); } return this; } }; })()); F2.extend('Constants', { /** * A convenient collection of all available appHandler events. * @class F2.Constants.AppHandlers **/ AppHandlers: (function() { return { /** * Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_CREATE_ROOT * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_CREATE_ROOT, * function(appConfig) * { * // If you want to create a custom root. By default F2 uses the app's outermost HTML element. * // the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER * appConfig.root = jQuery('<section></section>').get(0); * } * ); */ APP_CREATE_ROOT: 'appCreateRoot', /** * Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_RENDER_BEFORE * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_RENDER_BEFORE, * function(appConfig) * { * F2.log(appConfig); * } * ); */ APP_RENDER_BEFORE: 'appRenderBefore', /** * Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) ) * @property APP_RENDER * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_RENDER, * function(appConfig, appHtml) * { * var $root = null; * * // if no app root is defined use the app's outer most node * if(!F2.isNativeDOMNode(appConfig.root)) * { * appConfig.root = jQuery(appHtml).get(0); * // get a handle on the root in jQuery * $root = jQuery(appConfig.root); * } * else * { * // get a handle on the root in jQuery * $root = jQuery(appConfig.root); * * // append the app html to the root * $root.append(appHtml); * } * * // append the root to the body by default. * jQuery('body').append($root); * } * ); */ APP_RENDER: 'appRender', /** * Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_RENDER_AFTER * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_RENDER_AFTER, * function(appConfig) * { * F2.log(appConfig); * } * ); */ APP_RENDER_AFTER: 'appRenderAfter', /** * Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY_BEFORE * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_DESTROY_BEFORE, * function(appInstance) * { * F2.log(appInstance); * } * ); */ APP_DESTROY_BEFORE: 'appDestroyBefore', /** * Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_DESTROY, * function(appInstance) * { * // call the apps destroy method, if it has one * if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') * { * appInstance.app.destroy(); * } * else if(appInstance && appInstance.app && appInstance.app.destroy) * { * F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.'); * } * * // fade out and remove the root * jQuery(appInstance.config.root).fadeOut(500, function() { * jQuery(this).remove(); * }); * } * ); */ APP_DESTROY: 'appDestroy', /** * Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY_AFTER * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_DESTROY_AFTER, * function(appInstance) * { * F2.log(appInstance); * } * ); */ APP_DESTROY_AFTER: 'appDestroyAfter', /** * Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, scriptInfo ) * @property APP_SCRIPT_LOAD_FAILED * @type string * @static * @final * @example * var _token = F2.AppHandlers.getToken(); * F2.AppHandlers.on( * _token, * F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, * function(appConfig, scriptInfo) * { * F2.log(appConfig.appId); * } * ); */ APP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed' }; })() }); /** * Class stubs for documentation purposes * @main F2 */ F2.extend('', { /** * The App Class is an optional class that can be namespaced onto the * {{#crossLink "F2\Apps"}}{{/crossLink}} namespace. The * [F2 Docs](../../app-development.html#app-class) * has more information on the usage of the App Class. * @class F2.App * @constructor * @param {F2.AppConfig} appConfig The F2.AppConfig object for the app * @param {F2.AppManifest.AppContent} appContent The F2.AppManifest.AppContent * object * @param {Element} root The root DOM Element for the app */ App: function(appConfig, appContent, root) { return { /** * An optional init function that will automatically be called when * F2.{{#crossLink "F2\registerApps"}}{{/crossLink}} is called. * @method init * @optional */ init:function() {} }; }, /** * The AppConfig object represents an app's meta data * @class F2.AppConfig */ AppConfig: { /** * The unique ID of the app. More information can be found * [here](../../app-development.html#f2-appid) * @property appId * @type string * @required */ appId: '', /** * An object that represents the context of an app * @property context * @type object */ context: {}, /** * True if the app should be requested in a single request with other apps. * @property enableBatchRequests * @type bool * @default false */ enableBatchRequests: false, /** * The height of the app. The initial height will be pulled from * the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object, but later * modified by calling * F2.UI.{{#crossLink "F2.UI/updateHeight"}}{{/crossLink}}. This is used * for secure apps to be able to set the initial height of the iframe. * @property height * @type int */ height: 0, /** * The unique runtime ID of the app. * * **This property is populated during the * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process** * @property instanceId * @type string */ instanceId: '', /** * True if the app will be loaded in an iframe. This property * will be true if the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object * sets isSecure = true. It will also be true if the * [container](../../container-development.html) has made the decision to * run apps in iframes. * @property isSecure * @type bool * @default false */ isSecure: false, /** * The url to retrieve the {{#crossLink "F2.AppManifest"}}{{/crossLink}} * object. * @property manifestUrl * @type string * @required */ manifestUrl: '', /** * The recommended maximum width in pixels that this app should be run. * **It is up to the [container](../../container-development.html) to * implement the logic to prevent an app from being run when the maxWidth * requirements are not met.** * @property maxWidth * @type int */ maxWidth: 0, /** * The recommended minimum grid size that this app should be run. This * value corresponds to the 12-grid system that is used by the * [container](../../container-development.html). This property should be * set by apps that require a certain number of columns in their layout. * @property minGridSize * @type int * @default 4 */ minGridSize: 4, /** * The recommended minimum width in pixels that this app should be run. **It * is up to the [container](../../container-development.html) to implement * the logic to prevent an app from being run when the minWidth requirements * are not met. * @property minWidth * @type int * @default 300 */ minWidth: 300, /** * The name of the app * @property name * @type string * @required */ name: '', /** * The root DOM element that contains the app * * **This property is populated during the * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process** * @property root * @type Element */ root: undefined, /** * The instance of F2.UI providing easy access to F2.UI methods * * **This property is populated during the * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process** * @property ui * @type F2.UI */ ui: undefined, /** * The views that this app supports. Available views * are defined in {{#crossLink "F2.Constants.Views"}}{{/crossLink}}. The * presence of a view can be checked via * F2.{{#crossLink "F2/inArray"}}{{/crossLink}}: * * F2.inArray(F2.Constants.Views.SETTINGS, app.views) * * @property views * @type Array */ views: [] }, /** * The assets needed to render an app on the page * @class F2.AppManifest */ AppManifest: { /** * The array of {{#crossLink "F2.AppManifest.AppContent"}}{{/crossLink}} * objects * @property apps * @type Array * @required */ apps: [], /** * Any inline javascript tha should initially be run * @property inlineScripts * @type Array * @optional */ inlineScripts: [], /** * Urls to javascript files required by the app * @property scripts * @type Array * @optional */ scripts: [], /** * Urls to CSS files required by the app * @property styles * @type Array * @optional */ styles: [] }, /** * The AppContent object * @class F2.AppManifest.AppContent **/ AppContent: { /** * Arbitrary data to be passed along with the app * @property data * @type object * @optional */ data: {}, /** * The string of HTML representing the app * @property html * @type string * @required */ html: '', /** * A status message * @property status * @type string * @optional */ status: '' }, /** * An object containing configuration information for the * [container](../../container-development.html) * @class F2.ContainerConfig */ ContainerConfig: { /** * Allows the [container](../../container-development.html) to override how * an app's html is inserted into the page. The function should accept an * {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of * html * @method afterAppRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {string} html The string of html representing the app * @return {Element} The DOM Element surrounding the app */ afterAppRender: function(appConfig, html) {}, /** * Allows the [container](../../container-development.html) to wrap an app * in extra html. The function should accept an * {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of * html. The extra html can provide links to edit app settings and remove an * app from the container. See * {{#crossLink "F2.Constants.Css"}}{{/crossLink}} for CSS classes that * should be applied to elements. * @method appRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {string} html The string of html representing the app */ appRender: function(appConfig, html) {}, /** * Allows the container to render html for an app before the AppManifest for * an app has loaded. This can be useful if the design calls for loading * icons to appear for each app before each app is loaded and rendered to * the page. * @method beforeAppRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @param {F2.AppConfig} appConfig The F2.AppConfig object * @return {Element} The DOM Element surrounding the app */ beforeAppRender: function(appConfig) {}, /** * True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc. * @property debugMode * @type bool * @default false */ debugMode: false, /** * Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire. * @property scriptErrorTimeout * @type milliseconds * @default 7000 (7 seconds) */ scriptErrorTimeout: 7000, /** * Tells the container that it is currently running within * a secure app page * @property isSecureAppPage * @type bool */ isSecureAppPage: false, /** * Allows the container to specify which page is used when * loading a secure app. The page must reside on a different domain than the * container * @property secureAppPagePath * @type string * @for F2.ContainerConfig */ secureAppPagePath: '', /** * Specifies what views a container will provide buttons * or links to. Generally, the views will be switched via buttons or links * in the app's header. * @property supportedViews * @type Array * @required */ supportedViews: [], /** * An object containing configuration defaults for F2.UI * @class F2.ContainerConfig.UI */ UI: { /** * An object containing configuration defaults for the * F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} and * F2.UI.{{#crossLink "F2.UI/hideMask"}}{{/crossLink}} methods. * @class F2.ContainerConfig.UI.Mask */ Mask: { /** * The backround color of the overlay * @property backgroundColor * @type string * @default #FFF */ backgroundColor: '#FFF', /** * The path to the loading icon * @property loadingIcon * @type string */ loadingIcon: '', /** * The opacity of the background overlay * @property opacity * @type int * @default 0.6 */ opacity: 0.6, /** * Do not use inline styles for mask functinality. Instead classes will * be applied to the elements and it is up to the container provider to * implement the class definitions. * @property useClasses * @type bool * @default false */ useClasses: false, /** * The z-index to use for the overlay * @property zIndex * @type int * @default 2 */ zIndex: 2 } }, /** * Allows the container to fully override how the AppManifest request is * made inside of F2. * * @method xhr * @param {string} url The manifest url * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} * objects * @param {function} success The function to be called if the request * succeeds * @param {function} error The function to be called if the request fails * @param {function} complete The function to be called when the request * finishes (after success and error callbacks have been executed) * @return {XMLHttpRequest} The XMLHttpRequest object (or an object that has * an `abort` function (such as the jqXHR object in jQuery) to abort the * request) * * @example * F2.init({ * xhr: function(url, appConfigs, success, error, complete) { * $.ajax({ * url: url, * type: 'POST', * data: { * params: F2.stringify(appConfigs, F2.appConfigReplacer) * }, * jsonp: false, // do not put 'callback=' in the query string * jsonpCallback: F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name * dataType: 'json', * success: function(appManifest) { * // custom success logic * success(appManifest); // fire success callback * }, * error: function() { * // custom error logic * error(); // fire error callback * }, * complete: function() { * // custom complete logic * complete(); // fire complete callback * } * }); * } * }); * * @for F2.ContainerConfig */ //xhr: function(url, appConfigs, success, error, complete) {}, /** * Allows the container to override individual parts of the AppManifest * request. See properties and methods with the `xhr.` prefix. * @property xhr * @type Object * * @example * F2.init({ * xhr: { * url: function(url, appConfigs) { * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url); * } * } * }); */ xhr: { /** * Allows the container to override the request data type (JSON or JSONP) * that is used for the request * @method xhr.dataType * @param {string} url The manifest url * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} * objects * @return {string} The request data type that should be used * * @example * F2.init({ * xhr: { * dataType: function(url) { * return F2.isLocalRequest(url) ? 'json' : 'jsonp'; * }, * type: function(url) { * return F2.isLocalRequest(url) ? 'POST' : 'GET'; * } * } * }); */ dataType: function(url, appConfigs) {}, /** * Allows the container to override the request method that is used (just * like the `type` parameter to `jQuery.ajax()`. * @method xhr.type * @param {string} url The manifest url * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} * objects * @return {string} The request method that should be used * * @example * F2.init({ * xhr: { * dataType: function(url) { * return F2.isLocalRequest(url) ? 'json' : 'jsonp'; * }, * type: function(url) { * return F2.isLocalRequest(url) ? 'POST' : 'GET'; * } * } * }); */ type: function(url, appConfigs) {}, /** * Allows the container to override the url that is used to request an * app's F2.{{#crossLink "F2.AppManifest"}}{{/crossLink}} * @method xhr.url * @param {string} url The manifest url * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} * objects * @return {string} The url that should be used for the request * * @example * F2.init({ * xhr: { * url: function(url, appConfigs) { * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url); * } * } * }); */ url: function(url, appConfigs) {} } } }); /** * Constants used throughout the Open Financial Framework * @class F2.Constants * @static */ F2.extend('Constants', { /** * CSS class constants * @class F2.Constants.Css */ Css: (function() { /** @private */ var _PREFIX = 'f2-'; return { /** * The APP class should be applied to the DOM Element that surrounds the * entire app, including any extra html that surrounds the APP\_CONTAINER * that is inserted by the container. See the * {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} object. * @property APP * @type string * @static * @final */ APP: _PREFIX + 'app', /** * The APP\_CONTAINER class should be applied to the outermost DOM Element * of the app. * @property APP_CONTAINER * @type string * @static * @final */ APP_CONTAINER: _PREFIX + 'app-container', /** * The APP\_TITLE class should be applied to the DOM Element that contains * the title for an app. If this class is not present, then * F2.UI.{{#crossLink "F2.UI/setTitle"}}{{/crossLink}} will not function. * @property APP_TITLE * @type string * @static * @final */ APP_TITLE: _PREFIX + 'app-title', /** * The APP\_VIEW class should be applied to the DOM Element that contains * a view for an app. The DOM Element should also have a * {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE * attribute that specifies which * {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it is. * @property APP_VIEW * @type string * @static * @final */ APP_VIEW: _PREFIX + 'app-view', /** * APP\_VIEW\_TRIGGER class should be applied to the DOM Elements that * trigger an * {{#crossLink "F2.Constants.Events"}}{{/crossLink}}.APP\_VIEW\_CHANGE * event. The DOM Element should also have a * {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE * attribute that specifies which * {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it will trigger. * @property APP_VIEW_TRIGGER * @type string * @static * @final */ APP_VIEW_TRIGGER: _PREFIX + 'app-view-trigger', /** * The MASK class is applied to the overlay element that is created * when the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method is * fired. * @property MASK * @type string * @static * @final */ MASK: _PREFIX + 'mask', /** * The MASK_CONTAINER class is applied to the Element that is passed into * the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method. * @property MASK_CONTAINER * @type string * @static * @final */ MASK_CONTAINER: _PREFIX + 'mask-container' }; })(), /** * Events constants * @class F2.Constants.Events */ Events: (function() { /** @private */ var _APP_EVENT_PREFIX = 'App.'; /** @private */ var _CONTAINER_EVENT_PREFIX = 'Container.'; return { /** * The APP\_SYMBOL\_CHANGE event is fired when the symbol is changed in an * app. It is up to the app developer to fire this event. * Returns an object with the symbol and company name: * * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' } * * @property APP_SYMBOL_CHANGE * @type string * @static * @final */ APP_SYMBOL_CHANGE: _APP_EVENT_PREFIX + 'symbolChange', /** * The APP\_WIDTH\_CHANGE event will be fired by the container when the * width of an app is changed. The app's instanceId should be concatenated * to this constant. * Returns an object with the gridSize and width in pixels: * * { gridSize:8, width:620 } * * @property APP_WIDTH_CHANGE * @type string * @static * @final */ APP_WIDTH_CHANGE: _APP_EVENT_PREFIX + 'widthChange.', /** * The CONTAINER\_SYMBOL\_CHANGE event is fired when the symbol is changed * at the container level. This event should only be fired by the * container or container provider. * Returns an object with the symbol and company name: * * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' } * * @property CONTAINER_SYMBOL_CHANGE * @type string * @static * @final */ CONTAINER_SYMBOL_CHANGE: _CONTAINER_EVENT_PREFIX + 'symbolChange', /** * The CONTAINER\_WIDTH\_CHANGE event will be fired by the container when * the width of the container has changed. * @property CONTAINER_WIDTH_CHANGE * @type string * @static * @final */ CONTAINER_WIDTH_CHANGE: _CONTAINER_EVENT_PREFIX + 'widthChange' }; })(), JSONP_CALLBACK: 'F2_jsonpCallback_', /** * Constants for use with cross-domain sockets * @class F2.Constants.Sockets * @protected */ Sockets: { /** * The EVENT message is sent whenever * F2.Events.{{#crossLink "F2.Events/emit"}}{{/crossLink}} is fired * @property EVENT * @type string * @static * @final */ EVENT: '__event__', /** * The LOAD message is sent when an iframe socket initially loads. * Returns a JSON string that represents: * * [ App, AppManifest] * * @property LOAD * @type string * @static * @final */ LOAD: '__socketLoad__', /** * The RPC message is sent when a method is passed up from within a secure * app page. * @property RPC * @type string * @static * @final */ RPC: '__rpc__', /** * The RPC\_CALLBACK message is sent when a call back from an RPC method is * fired. * @property RPC_CALLBACK * @type string * @static * @final */ RPC_CALLBACK: '__rpcCallback__', /** * The UI\_RPC message is sent when a UI method called. * @property UI_RPC * @type string * @static * @final */ UI_RPC: '__uiRpc__' }, /** * The available view types to apps. The view should be specified by applying * the {{#crossLink "F2.Constants.Css"}}{{/crossLink}}.APP\_VIEW class to the * containing DOM Element. A DATA\_ATTRIBUTE attribute should be added to the * Element as well which defines what view type is represented. * The `hide` class can be applied to views that should be hidden by default. * @class F2.Constants.Views */ Views: { /** * The DATA_ATTRIBUTE should be placed on the DOM Element that contains the * view. * @property DATA_ATTRIBUTE * @type string * @static * @final */ DATA_ATTRIBUTE: 'data-f2-view', /** * The ABOUT view gives details about the app. * @property ABOUT * @type string * @static * @final */ ABOUT: 'about', /** * The HELP view provides users with help information for using an app. * @property HELP * @type string * @static * @final */ HELP: 'help', /** * The HOME view is the main view for an app. This view should always * be provided by an app. * @property HOME * @type string * @static * @final */ HOME: 'home', /** * The REMOVE view is a special view that handles the removal of an app * from the container. * @property REMOVE * @type string * @static * @final */ REMOVE: 'remove', /** * The SETTINGS view provides users the ability to modify advanced settings * for an app. * @property SETTINGS * @type string * @static * @final */ SETTINGS: 'settings' } }); /** * Handles [Context](../../app-development.html#context) passing from * containers to apps and apps to apps. * @class F2.Events */ F2.extend('Events', (function() { // init EventEmitter var _events = new EventEmitter2({ wildcard:true }); // unlimited listeners, set to > 0 for debugging _events.setMaxListeners(0); return { /** * Same as F2.Events.emit except that it will not send the event * to all sockets. * @method _socketEmit * @private * @param {string} event The event name * @param {object} [arg]* The arguments to be passed */ _socketEmit: function() { return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments)); }, /** * Execute each of the listeners that may be listening for the specified * event name in order with the list of arguments. * @method emit * @param {string} event The event name * @param {object} [arg]* The arguments to be passed */ emit: function() { F2.Rpc.broadcast(F2.Constants.Sockets.EVENT, [].slice.call(arguments)); return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments)); }, /** * Adds a listener that will execute n times for the event before being * removed. The listener is invoked only the first time the event is * fired, after which it is removed. * @method many * @param {string} event The event name * @param {int} timesToListen The number of times to execute the event * before being removed * @param {function} listener The function to be fired when the event is * emitted */ many: function(event, timesToListen, listener) { return _events.many(event, timesToListen, listener); }, /** * Remove a listener for the specified event. * @method off * @param {string} event The event name * @param {function} listener The function that will be removed */ off: function(event, listener) { return _events.off(event, listener); }, /** * Adds a listener for the specified event * @method on * @param {string} event The event name * @param {function} listener The function to be fired when the event is * emitted */ on: function(event, listener){ return _events.on(event, listener); }, /** * Adds a one time listener for the event. The listener is invoked only * the first time the event is fired, after which it is removed. * @method once * @param {string} event The event name * @param {function} listener The function to be fired when the event is * emitted */ once: function(event, listener) { return _events.once(event, listener); } }; })()); /** * Handles socket communication between the container and secure apps * @class F2.Rpc */ F2.extend('Rpc', (function(){ var _callbacks = {}; var _secureAppPagePath = ''; var _apps = {}; var _rEvents = new RegExp('^' + F2.Constants.Sockets.EVENT); var _rRpc = new RegExp('^' + F2.Constants.Sockets.RPC); var _rRpcCallback = new RegExp('^' + F2.Constants.Sockets.RPC_CALLBACK); var _rSocketLoad = new RegExp('^' + F2.Constants.Sockets.LOAD); var _rUiCall = new RegExp('^' + F2.Constants.Sockets.UI_RPC); /** * Creates a socket connection from the app to the container using * <a href="http://easyxdm.net" target="_blank">easyXDM</a>. * @method _createAppToContainerSocket * @private */ var _createAppToContainerSocket = function() { var appConfig; // socket closure var isLoaded = false; // its possible for messages to be received before the socket load event has // happened. We'll save off these messages and replay them once the socket // is ready var messagePlayback = []; var socket = new easyXDM.Socket({ onMessage: function(message, origin){ // handle Socket Load if (!isLoaded && _rSocketLoad.test(message)) { message = message.replace(_rSocketLoad, ''); var appParts = F2.parse(message); // make sure we have the AppConfig and AppManifest if (appParts.length == 2) { appConfig = appParts[0]; // save socket _apps[appConfig.instanceId] = { config:appConfig, socket:socket }; // register app F2.registerApps([appConfig], [appParts[1]]); // socket message playback jQuery.each(messagePlayback, function(i, e) { _onMessage(appConfig, message, origin); }); isLoaded = true; } } else if (isLoaded) { // pass everyting else to _onMessage _onMessage(appConfig, message, origin); } else { //F2.log('socket not ready, queuing message', message); messagePlayback.push(message); } } }); }; /** * Creates a socket connection from the container to the app using * <a href="http://easyxdm.net" target="_blank">easyXDM</a>. * @method _createContainerToAppSocket * @private * @param {appConfig} appConfig The F2.AppConfig object * @param {F2.AppManifest} appManifest The F2.AppManifest object */ var _createContainerToAppSocket = function(appConfig, appManifest) { var container = jQuery(appConfig.root); if (!container.is('.' + F2.Constants.Css.APP_CONTAINER)) { container.find('.' + F2.Constants.Css.APP_CONTAINER); } if (!container.length) { F2.log('Unable to locate app in order to establish secure connection.'); return; } var iframeProps = { scrolling:'no', style:{ width:'100%' } }; if (appConfig.height) { iframeProps.style.height = appConfig.height + 'px'; } var socket = new easyXDM.Socket({ remote: _secureAppPagePath, container: container.get(0), props:iframeProps, onMessage: function(message, origin) { // pass everything to _onMessage _onMessage(appConfig, message, origin); }, onReady: function() { socket.postMessage(F2.Constants.Sockets.LOAD + F2.stringify([appConfig, appManifest], F2.appConfigReplacer)); } }); return socket; }; /** * @method _createRpcCallback * @private * @param {string} instanceId The app's Instance ID * @param {function} callbackId The callback ID * @return {function} A function to make the RPC call */ var _createRpcCallback = function(instanceId, callbackId) { return function() { F2.Rpc.call( instanceId, F2.Constants.Sockets.RPC_CALLBACK, callbackId, [].slice.call(arguments).slice(2) ); }; }; /** * Handles messages that come across the sockets * @method _onMessage * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {string} message The socket message * @param {string} origin The originator */ var _onMessage = function(appConfig, message, origin) { var obj, func; function parseFunction(parent, functionName) { var path = String(functionName).split('.'); for (var i = 0; i < path.length; i++) { if (parent[path[i]] === undefined) { parent = undefined; break; } parent = parent[path[i]]; } return parent; } function parseMessage(regEx, message, instanceId) { var o = F2.parse(message.replace(regEx, '')); // if obj.callbacks // for each callback // for each params // if callback matches param // replace param with _createRpcCallback(app.instanceId, callback) if (o.params && o.params.length && o.callbacks && o.callbacks.length) { jQuery.each(o.callbacks, function(i, c) { jQuery.each(o.params, function(i, p) { if (c == p) { o.params[i] = _createRpcCallback(instanceId, c); } }); }); } return o; } // handle UI Call if (_rUiCall.test(message)) { obj = parseMessage(_rUiCall, message, appConfig.instanceId); func = parseFunction(appConfig.ui, obj.functionName); // if we found the function, call it if (func !== undefined) { func.apply(appConfig.ui, obj.params); } else { F2.log('Unable to locate UI RPC function: ' + obj.functionName); } // handle RPC } else if (_rRpc.test(message)) { obj = parseMessage(_rRpc, message, appConfig.instanceId); func = parseFunction(window, obj.functionName); if (func !== undefined) { func.apply(func, obj.params); } else { F2.log('Unable to locate RPC function: ' + obj.functionName); } // handle RPC Callback } else if (_rRpcCallback.test(message)) { obj = parseMessage(_rRpcCallback, message, appConfig.instanceId); if (_callbacks[obj.functionName] !== undefined) { _callbacks[obj.functionName].apply(_callbacks[obj.functionName], obj.params); delete _callbacks[obj.functionName]; } // handle Events } else if (_rEvents.test(message)) { obj = parseMessage(_rEvents, message, appConfig.instanceId); F2.Events._socketEmit.apply(F2.Events, obj); } }; /** * Registers a callback function * @method _registerCallback * @private * @param {function} callback The callback function * @return {string} The callback ID */ var _registerCallback = function(callback) { var callbackId = F2.guid(); _callbacks[callbackId] = callback; return callbackId; }; return { /** * Broadcast an RPC function to all sockets * @method broadcast * @param {string} messageType The message type * @param {Array} params The parameters to broadcast */ broadcast: function(messageType, params) { // check valid messageType var message = messageType + F2.stringify(params); jQuery.each(_apps, function(i, a) { a.socket.postMessage(message); }); }, /** * Calls a remote function * @method call * @param {string} instanceId The app's Instance ID * @param {string} messageType The message type * @param {string} functionName The name of the remote function * @param {Array} params An array of parameters to pass to the remote * function. Any functions found within the params will be treated as a * callback function. */ call: function(instanceId, messageType, functionName, params) { // loop through params and find functions and convert them to callbacks var callbacks = []; jQuery.each(params, function(i, e) { if (typeof e === 'function') { var cid = _registerCallback(e); params[i] = cid; callbacks.push(cid); } }); // check valid messageType _apps[instanceId].socket.postMessage( messageType + F2.stringify({ functionName:functionName, params:params, callbacks:callbacks }) ); }, /** * Init function which tells F2.Rpc whether it is running at the container- * level or the app-level. This method is generally called by * F2.{{#crossLink "F2/init"}}{{/crossLink}} * @method init * @param {string} [secureAppPagePath] The * {{#crossLink "F2.ContainerConfig"}}{{/crossLink}}.secureAppPagePath * property */ init: function(secureAppPagePath) { _secureAppPagePath = secureAppPagePath; if (!_secureAppPagePath) { _createAppToContainerSocket(); } }, /** * Determines whether the Instance ID is considered to be 'remote'. This is * determined by checking if 1) the app has an open socket and 2) whether * F2.Rpc is running inside of an iframe * @method isRemote * @param {string} instanceId The Instance ID * @return {bool} True if there is an open socket */ isRemote: function(instanceId) { return ( // we have an app _apps[instanceId] !== undefined && // the app is secure _apps[instanceId].config.isSecure && // we can't access the iframe jQuery(_apps[instanceId].config.root).find('iframe').length === 0 ); }, /** * Creates a container-to-app or app-to-container socket for communication * @method register * @param {F2.AppConfig} [appConfig] The F2.AppConfig object * @param {F2.AppManifest} [appManifest] The F2.AppManifest object */ register: function(appConfig, appManifest) { if (!!appConfig && !!appManifest) { _apps[appConfig.instanceId] = { config:appConfig, socket:_createContainerToAppSocket(appConfig, appManifest) }; } else { F2.log('Unable to register socket connection. Please check container configuration.'); } } }; })()); F2.extend('UI', (function(){ var _containerConfig; /** * UI helper methods * @class F2.UI * @constructor * @param {F2.AppConfig} appConfig The F2.AppConfig object */ var UI_Class = function(appConfig) { var _appConfig = appConfig; var $root = jQuery(appConfig.root); var _updateHeight = function(height) { height = height || jQuery(_appConfig.root).outerHeight(); if (F2.Rpc.isRemote(_appConfig.instanceId)) { F2.Rpc.call( _appConfig.instanceId, F2.Constants.Sockets.UI_RPC, 'updateHeight', [ height ] ); } else { _appConfig.height = height; $root.find('iframe').height(_appConfig.height); } }; return { /** * Removes a overlay from an Element on the page * @method hideMask * @param {string|Element} selector The Element or selector to an Element * that currently contains the loader */ hideMask: function(selector) { F2.UI.hideMask(_appConfig.instanceId, selector); }, /** * Helper methods for creating and using Modals * @class F2.UI.Modals * @for F2.UI */ Modals: (function(){ var _renderAlert = function(message) { return [ '<div class="modal">', '<header class="modal-header">', '<h3>Alert!</h3>', '</header>', '<div class="modal-body">', '<p>', message, '</p>', '</div>', '<div class="modal-footer">', '<button class="btn btn-primary btn-ok">OK</button>', '</div>', '</div>' ].join(''); }; var _renderConfirm = function(message) { return [ '<div class="modal">', '<header class="modal-header">', '<h3>Confirm</h3>', '</header>', '<div class="modal-body">', '<p>', message, '</p>', '</div>', '<div class="modal-footer">', '<button type="button" class="btn btn-primary btn-ok">OK</button>', '<button type="button" class="btn btn-cancel">Cancel</button">', '</div>', '</div>' ].join(''); }; return { /** * Display an alert message on the page * @method alert * @param {string} message The message to be displayed * @param {function} [callback] The callback to be fired when the user * closes the dialog * @for F2.UI.Modals */ alert: function(message, callback) { if (!F2.isInit()) { F2.log('F2.init() must be called before F2.UI.Modals.alert()'); return; } if (F2.Rpc.isRemote(_appConfig.instanceId)) { F2.Rpc.call( _appConfig.instanceId, F2.Constants.Sockets.UI_RPC, 'Modals.alert', [].slice.call(arguments) ); } else { // display the alert jQuery(_renderAlert(message)) .on('show', function() { var modal = this; jQuery(modal).find('.btn-primary').on('click', function() { jQuery(modal).modal('hide').remove(); (callback || jQuery.noop)(); }); }) .modal({backdrop:true}); } }, /** * Display a confirm message on the page * @method confirm * @param {string} message The message to be displayed * @param {function} okCallback The function that will be called when the OK * button is pressed * @param {function} cancelCallback The function that will be called when * the Cancel button is pressed * @for F2.UI.Modals */ confirm: function(message, okCallback, cancelCallback) { if (!F2.isInit()) { F2.log('F2.init() must be called before F2.UI.Modals.confirm()'); return; } if (F2.Rpc.isRemote(_appConfig.instanceId)) { F2.Rpc.call( _appConfig.instanceId, F2.Constants.Sockets.UI_RPC, 'Modals.confirm', [].slice.call(arguments) ); } else { // display the alert jQuery(_renderConfirm(message)) .on('show', function() { var modal = this; jQuery(modal).find('.btn-ok').on('click', function() { jQuery(modal).modal('hide').remove(); (okCallback || jQuery.noop)(); }); jQuery(modal).find('.btn-cancel').on('click', function() { jQuery(modal).modal('hide').remove(); (cancelCallback || jQuery.noop)(); }); }) .modal({backdrop:true}); } } }; })(), /** * Sets the title of the app as shown in the browser. Depending on the * container HTML, this method may do nothing if the container has not been * configured properly or else the container provider does not allow Title's * to be set. * @method setTitle * @params {string} title The title of the app * @for F2.UI */ setTitle: function(title) { if (F2.Rpc.isRemote(_appConfig.instanceId)) { F2.Rpc.call( _appConfig.instanceId, F2.Constants.Sockets.UI_RPC, 'setTitle', [ title ] ); } else { jQuery(_appConfig.root).find('.' + F2.Constants.Css.APP_TITLE).text(title); } }, /** * Display an ovarlay over an Element on the page * @method showMask * @param {string|Element} selector The Element or selector to an Element * over which to display the loader * @param {bool} showLoading Display a loading icon */ showMask: function(selector, showLoader) { F2.UI.showMask(_appConfig.instanceId, selector, showLoader); }, /** * For secure apps, this method updates the size of the iframe that * contains the app. **Note: It is recommended that app developers call * this method anytime Elements are added or removed from the DOM** * @method updateHeight * @params {int} height The height of the app */ updateHeight: _updateHeight, /** * Helper methods for creating and using Views * @class F2.UI.Views * @for F2.UI */ Views: (function(){ var _events = new EventEmitter2(); var _rValidEvents = /change/i; // unlimited listeners, set to > 0 for debugging _events.setMaxListeners(0); var _isValid = function(eventName) { if (_rValidEvents.test(eventName)) { return true; } else { F2.log('"' + eventName + '" is not a valid F2.UI.Views event name'); return false; } }; return { /** * Change the current view for the app or add an event listener * @method change * @param {string|function} [input] If a string is passed in, the view * will be changed for the app. If a function is passed in, a change * event listener will be added. * @for F2.UI.Views */ change: function(input) { if (typeof input === 'function') { this.on('change', input); } else if (typeof input === 'string') { if (_appConfig.isSecure && !F2.Rpc.isRemote(_appConfig.instanceId)) { F2.Rpc.call( _appConfig.instanceId, F2.Constants.Sockets.UI_RPC, 'Views.change', [].slice.call(arguments) ); } else if (F2.inArray(input, _appConfig.views)) { jQuery('.' + F2.Constants.Css.APP_VIEW, $root) .addClass('hide') .filter('[data-f2-view="' + input + '"]', $root) .removeClass('hide'); _updateHeight(); _events.emit('change', input); } } }, /** * Removes a view event listener * @method off * @param {string} event The event name * @param {function} listener The function that will be removed * @for F2.UI.Views */ off: function(event, listener) { if (_isValid(event)) { _events.off(event, listener); } }, /** * Adds a view event listener * @method on * @param {string} event The event name * @param {function} listener The function to be fired when the event is * emitted * @for F2.UI.Views */ on: function(event, listener) { if (_isValid(event)) { _events.on(event, listener); } } }; })() }; }; /** * Removes a overlay from an Element on the page * @method hideMask * @static * @param {string} instanceId The Instance ID of the app * @param {string|Element} selector The Element or selector to an Element * that currently contains the loader * @for F2.UI */ UI_Class.hideMask = function(instanceId, selector) { if (!F2.isInit()) { F2.log('F2.init() must be called before F2.UI.hideMask()'); return; } if (F2.Rpc.isRemote(instanceId) && !jQuery(selector).is('.' + F2.Constants.Css.APP)) { F2.Rpc.call( instanceId, F2.Constants.Sockets.RPC, 'F2.UI.hideMask', [ instanceId, // must only pass the selector argument. if we pass an Element there // will be F2.stringify() errors jQuery(selector).selector ] ); } else { var container = jQuery(selector); container.find('> .' + F2.Constants.Css.MASK).remove(); container.removeClass(F2.Constants.Css.MASK_CONTAINER); // if the element contains this data property, we need to reset static // position if (container.data(F2.Constants.Css.MASK_CONTAINER)) { container.css({'position':'static'}); } } }; /** * * @method init * @static * @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object */ UI_Class.init = function(containerConfig) { _containerConfig = containerConfig; // set defaults _containerConfig.UI = jQuery.extend(true, {}, F2.ContainerConfig.UI, _containerConfig.UI || {}); }; /** * Display an ovarlay over an Element on the page * @method showMask * @static * @param {string} instanceId The Instance ID of the app * @param {string|Element} selector The Element or selector to an Element * over which to display the loader * @param {bool} showLoading Display a loading icon */ UI_Class.showMask = function(instanceId, selector, showLoading) { if (!F2.isInit()) { F2.log('F2.init() must be called before F2.UI.showMask()'); return; } if (F2.Rpc.isRemote(instanceId) && jQuery(selector).is('.' + F2.Constants.Css.APP)) { F2.Rpc.call( instanceId, F2.Constants.Sockets.RPC, 'F2.UI.showMask', [ instanceId, // must only pass the selector argument. if we pass an Element there // will be F2.stringify() errors jQuery(selector).selector, showLoading ] ); } else { if (showLoading && !_containerConfig.UI.Mask.loadingIcon) { F2.log('Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();'); } var container = jQuery(selector).addClass(F2.Constants.Css.MASK_CONTAINER); var mask = jQuery('<div>') .height('100%' /*container.outerHeight()*/) .width('100%' /*container.outerWidth()*/) .addClass(F2.Constants.Css.MASK); // set inline styles if useClasses is false if (!_containerConfig.UI.Mask.useClasses) { mask.css({ 'background-color':_containerConfig.UI.Mask.backgroundColor, 'background-image': !!_containerConfig.UI.Mask.loadingIcon ? ('url(' + _containerConfig.UI.Mask.loadingIcon + ')') : '', 'background-position':'50% 50%', 'background-repeat':'no-repeat', 'display':'block', 'left':0, 'min-height':30, 'padding':0, 'position':'absolute', 'top':0, 'z-index':_containerConfig.UI.Mask.zIndex, 'filter':'alpha(opacity=' + (_containerConfig.UI.Mask.opacity * 100) + ')', 'opacity':_containerConfig.UI.Mask.opacity }); } // only set the position if the container is currently static if (container.css('position') === 'static') { container.css({'position':'relative'}); // setting this data property tells hideMask to set the position // back to static container.data(F2.Constants.Css.MASK_CONTAINER, true); } // add the mask to the container container.append(mask); } }; return UI_Class; })()); /** * Root namespace of the F2 SDK * @module f2 * @class F2 */ F2.extend('', (function(){ var _apps = {}; var _config = false; var _bUsesAppHandlers = false; var _sAppHandlerToken = F2.AppHandlers.__f2GetToken(); /** * Appends the app's html to the DOM * @method _afterAppRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {string} html The string of html * @return {Element} The DOM Element that contains the app */ var _afterAppRender = function(appConfig, html) { var handler = _config.afterAppRender || function(appConfig, html) { return jQuery(html).appendTo('body'); }; var appContainer = handler(appConfig, html); if (!!_config.afterAppRender && !appContainer) { F2.log('F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app'); return; } else { // apply APP class and Instance ID jQuery(appContainer).addClass(F2.Constants.Css.APP); return appContainer.get(0); } }; /** * Renders the html for an app. * @method _appRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {string} html The string of html */ var _appRender = function(appConfig, html) { // apply APP_CONTAINER class html = _outerHtml(jQuery(html).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId)); // optionally apply wrapper html if (_config.appRender) { html = _config.appRender(appConfig, html); } // apply APP class and instanceId return _outerHtml(html); }; /** * Rendering hook to allow containers to render some html prior to an app * loading * @method _beforeAppRender * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @return {Element} The DOM Element surrounding the app */ var _beforeAppRender = function(appConfig) { var handler = _config.beforeAppRender || jQuery.noop; return handler(appConfig); }; /** * Handler to inform the container that a script failed to load * @method _onScriptLoadFailure * @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0 * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param scriptInfo The path of the script that failed to load or the exception info * for the inline script that failed to execute */ var _appScriptLoadFailed = function(appConfig, scriptInfo) { var handler = _config.appScriptLoadFailed || jQuery.noop; return handler(appConfig, scriptInfo); }; /** * Adds properties to the AppConfig object * @method _createAppConfig * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @return {F2.AppConfig} The new F2.AppConfig object, prepopulated with * necessary properties */ var _createAppConfig = function(appConfig) { // make a copy of the app config to ensure that the original is not modified appConfig = jQuery.extend(true, {}, appConfig); // create the instanceId for the app appConfig.instanceId = appConfig.instanceId || F2.guid(); // default the views if not provided appConfig.views = appConfig.views || []; if (!F2.inArray(F2.Constants.Views.HOME, appConfig.views)) { appConfig.views.push(F2.Constants.Views.HOME); } return appConfig; }; /** * Adds properties to the ContainerConfig object to take advantage of defaults * @method _hydrateContainerConfig * @private * @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object */ var _hydrateContainerConfig = function(containerConfig) { if (!containerConfig.scriptErrorTimeout){ containerConfig.scriptErrorTimeout = F2.ContainerConfig.scriptErrorTimeout; } if (containerConfig.debugMode !== true){ containerConfig.debugMode = F2.ContainerConfig.debugMode; } }; /** * Attach app events * @method _initAppEvents * @private */ var _initAppEvents = function (appConfig) { jQuery(appConfig.root).on('click', '.' + F2.Constants.Css.APP_VIEW_TRIGGER + '[' + F2.Constants.Views.DATA_ATTRIBUTE + ']', function(event) { event.preventDefault(); var view = jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase(); // handle the special REMOVE view if (view == F2.Constants.Views.REMOVE) { F2.removeApp(appConfig.instanceId); } else { appConfig.ui.Views.change(view); } }); }; /** * Attach container Events * @method _initContainerEvents * @private */ var _initContainerEvents = function() { var resizeTimeout; var resizeHandler = function() { F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE); }; jQuery(window).on('resize', function() { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(resizeHandler, 100); }); }; /** * Has the container been init? * @method _isInit * @private * @return {bool} True if the container has been init */ var _isInit = function() { return !!_config; }; /** * Instantiates each app from it's appConfig and stores that in a local private collection * @method _createAppInstance * @private * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects */ var _createAppInstance = function(appConfig, appContent){ // instantiate F2.UI appConfig.ui = new F2.UI(appConfig); // instantiate F2.App if (F2.Apps[appConfig.appId] !== undefined) { if (typeof F2.Apps[appConfig.appId] === 'function') { // IE setTimeout(function() { _apps[appConfig.instanceId].app = new F2.Apps[appConfig.appId](appConfig, appContent, appConfig.root); if (_apps[appConfig.instanceId].app['init'] !== undefined) { _apps[appConfig.instanceId].app.init(); } }, 0); } else { F2.log('app initialization class is defined but not a function. (' + appConfig.appId + ')'); } } }; /** * Loads the app's html/css/javascript * @method loadApp * @private * @param {Array} appConfigs An array of * {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects * @param {F2.AppManifest} [appManifest] The AppManifest object */ var _loadApps = function(appConfigs, appManifest) { appConfigs = [].concat(appConfigs); // check for secure app if (appConfigs.length == 1 && appConfigs[0].isSecure && !_config.isSecureAppPage) { _loadSecureApp(appConfigs[0], appManifest); return; } // check that the number of apps in manifest matches the number requested if (appConfigs.length != appManifest.apps.length) { F2.log('The number of apps defined in the AppManifest do not match the number requested.', appManifest); return; } var scripts = appManifest.scripts || []; var styles = appManifest.styles || []; var inlines = appManifest.inlineScripts || []; var scriptCount = scripts.length; var scriptsLoaded = 0; var appInit = function() { jQuery.each(appConfigs, function(i, a) { _createAppInstance(a, appManifest.apps[i]); }); }; //Check to see if any of the ways a file can be ready are available as properties on the file's element (borrowed from yepnope) var isFileReady = function(readyState) { return ( !readyState || readyState == 'loaded' || readyState == 'complete' || readyState == 'uninitialized' ); }; var _onload = function(e){ if ( e.type == 'load' || isFileReady((e.currentTarget || e.srcElement).readyState) ){ //done, cleanup var script = e.currentTarget || e.srcElement; if (script.detachEvent){ script.detachEvent('onreadystatechange', _onload);//IE } else { removeEventListener(script, _onload, 'load'); removeEventListener(script, _error, 'error'); } } //are we done loading all scripts for this app? if (++scriptsLoaded == scriptCount) { evalInlines(); appInit(); } }; var _error = function(e){ //log and emit event for the failed (400,500) scripts setTimeout(function(){ var evtData = { src: e.target.src, appId: appConfigs[0].appId }; //send error to console F2.log('Script defined in \'' + evtData.appId + '\' failed to load \'' + evtData.src + '\''); //emit event F2.Events.emit('RESOURCE_FAILED_TO_LOAD', evtData); if(!_bUsesAppHandlers) { _appScriptLoadFailed(appConfigs[0],evtData.src); } else { F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, appConfigs[0], evtData.src ); } }, _config.scriptErrorTimeout);//defaults to 7000 }; //eval inlines var evalInlines = function(){ jQuery.each(inlines, function(i, e) { try { eval(e); } catch (exception) { F2.log('Error loading inline script: ' + exception + '\n\n' + e); if(!_bUsesAppHandlers) { _appScriptLoadFailed(appConfigs[0],exception); } else { F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, appConfigs[0], exception ); } } }); }; // load styles, see #101 var stylesFragment = null, useCreateStyleSheet = !!document.createStyleSheet; jQuery.each(styles, function(i, e) { if (useCreateStyleSheet) { document.createStyleSheet(e); } else { stylesFragment = stylesFragment || []; stylesFragment.push('<link rel="stylesheet" type="text/css" href="' + e + '"/>'); } }); if (stylesFragment){ jQuery('head').append(stylesFragment.join('')); } // load html jQuery.each(appManifest.apps, function(i, a) { if(!_bUsesAppHandlers) { // load html and save the root node appConfigs[i].root = _afterAppRender(appConfigs[i], _appRender(appConfigs[i], a.html)); } else { F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER, appConfigs[i], // the app config _outerHtml(a.html) ); var appId = appConfigs[i].appId; if (!appConfigs[i].root) { throw('Root for ' +appId+ ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.'); } var $root = jQuery(appConfigs[i].root); if ($root.parents('body:first').length === 0) { throw('App root for ' +appId+ ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.'); } F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER_AFTER, appConfigs[i] // the app config ); if(!F2.isNativeDOMNode(appConfigs[i].root)) { throw('App root for ' +appId+ ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.'); } $root.addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appId); } // init events _initAppEvents(appConfigs[i]); }); // load scripts and eval inlines once complete jQuery.each(scripts, function(i, e) { var doc = document, script = doc.createElement('script'), resourceUrl = e; //if in debugMode, add cache buster to each script URL if (_config.debugMode){ resourceUrl += '?cachebuster=' + new Date().getTime(); } //scripts needed to be loaded in order they're defined in the AppManifest script.async = false; //add other attrs script.src = resourceUrl; script.type = 'text/javascript'; script.charset = 'utf-8'; //attach load event to script to evaluate inline scripts and init the AppClass if (script.attachEvent && !(script.attachEvent.toString && script.attachEvent.toString().indexOf('[native code') < 0)){//for IE, from requirejs script.attachEvent('onreadystatechange', _onload); } else { script.addEventListener('load', _onload, false); //attach error event for 400s and 500s script.addEventListener('error', _error, false); } doc.body.appendChild(script); }); // if no scripts were to be processed, fire the appInit event if (!scriptCount) { evalInlines(); appInit(); } }; /** * Loads the app's html/css/javascript into an iframe * @method loadSecureApp * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @param {F2.AppManifest} appManifest The app's html/css/js to be loaded into the * page. */ var _loadSecureApp = function(appConfig, appManifest) { // make sure the container is configured for secure apps if (_config.secureAppPagePath) { if(!_bUsesAppHandlers) { // create the html container for the iframe appConfig.root = _afterAppRender(appConfig, _appRender(appConfig, '<div></div>')); } else { var $root = jQuery(appConfig.root); F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER, appConfig, // the app config appManifest.html ); if ($root.parents('body:first').length === 0) { throw('App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.'); } F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER_AFTER, appConfig // the app config ); if (!appConfig.root) { throw('App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.'); } if (!F2.isNativeDOMNode(appConfig.root)) { throw('App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.'); } jQuery(appConfig.root).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId); } // instantiate F2.UI appConfig.ui = new F2.UI(appConfig); // init events _initAppEvents(appConfig); // create RPC socket F2.Rpc.register(appConfig, appManifest); } else { F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.'); } }; var _outerHtml = function(html) { return jQuery('<div></div>').append(html).html(); }; /** * Checks if the app is valid * @method _validateApp * @private * @param {F2.AppConfig} appConfig The F2.AppConfig object * @returns {bool} True if the app is valid */ var _validateApp = function(appConfig) { // check for valid app configurations if (!appConfig.appId) { F2.log('"appId" missing from app object'); return false; } else if (!appConfig.root && !appConfig.manifestUrl) { F2.log('"manifestUrl" missing from app object'); return false; } return true; }; /** * Checks if the ContainerConfig is valid * @method _validateContainerConfig * @private * @returns {bool} True if the config is valid */ var _validateContainerConfig = function() { if (_config) { if (_config.xhr) { if (!(typeof _config.xhr === 'function' || typeof _config.xhr === 'object')) { throw('ContainerConfig.xhr should be a function or an object'); } if (_config.xhr.dataType && typeof _config.xhr.dataType !== 'function') { throw('ContainerConfig.xhr.dataType should be a function'); } if (_config.xhr.type && typeof _config.xhr.type !== 'function') { throw('ContainerConfig.xhr.type should be a function'); } if (_config.xhr.url && typeof _config.xhr.url !== 'function') { throw('ContainerConfig.xhr.url should be a function'); } } } return true; }; return { /** * Gets the current list of apps in the container * @method getContainerState * @returns {Array} An array of objects containing the appId */ getContainerState: function() { if (!_isInit()) { F2.log('F2.init() must be called before F2.getContainerState()'); return; } return jQuery.map(_apps, function(app) { return { appId: app.config.appId }; }); }, /** * Initializes the container. This method must be called before performing * any other actions in the container. * @method init * @param {F2.ContainerConfig} config The configuration object */ init: function(config) { _config = config || {}; _validateContainerConfig(); _hydrateContainerConfig(_config); // dictates whether we use the old logic or the new logic. // TODO: Remove in v2.0 _bUsesAppHandlers = (!_config.beforeAppRender && !_config.appRender && !_config.afterAppRender && !_config.appScriptLoadFailed); // only establish RPC connection if the container supports the secure app page if (!!_config.secureAppPagePath || _config.isSecureAppPage) { F2.Rpc.init(!!_config.secureAppPagePath ? _config.secureAppPagePath : false); } F2.UI.init(_config); if (!_config.isSecureAppPage) { _initContainerEvents(); } }, /** * Has the container been init? * @method isInit * @return {bool} True if the container has been init */ isInit: _isInit, /** * Begins the loading process for all apps and/or initialization process for pre-loaded apps. * The app will be passed the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object which will * contain the app's unique instanceId within the container. If the * {{#crossLink "F2.AppConfig"}}{{/crossLink}}.root property is populated the app is considered * to be a pre-loaded app and will be handled accordingly. Optionally, the * {{#crossLink "F2.AppManifest"}}{{/crossLink}} can be passed in and those * assets will be used instead of making a request. * @method registerApps * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} * objects * @param {Array} [appManifests] An array of * {{#crossLink "F2.AppManifest"}}{{/crossLink}} * objects. This array must be the same length as the apps array that is * objects. This array must be the same length as the apps array that is * passed in. This can be useful if apps are loaded on the server-side and * passed down to the client. * @example * Traditional App requests. * * // Traditional f2 app configs * var arConfigs = [ * { * appId: 'com_externaldomain_example_app', * context: {}, * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' * }, * { * appId: 'com_externaldomain_example_app', * context: {}, * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' * }, * { * appId: 'com_externaldomain_example_app2', * context: {}, * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' * } * ]; * * F2.init(); * F2.registerApps(arConfigs); * * @example * Pre-loaded and tradition apps mixed. * * // Pre-loaded apps and traditional f2 app configs * // you can preload the same app multiple times as long as you have a unique root for each * var arConfigs = [ * { * appId: 'com_mydomain_example_app', * context: {}, * root: 'div#example-app-1', * manifestUrl: '' * }, * { * appId: 'com_mydomain_example_app', * context: {}, * root: 'div#example-app-2', * manifestUrl: '' * }, * { * appId: 'com_externaldomain_example_app', * context: {}, * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' * } * ]; * * F2.init(); * F2.registerApps(arConfigs); * * @example * Apps with predefined manifests. * * // Traditional f2 app configs * var arConfigs = [ * {appId: 'com_externaldomain_example_app', context: {}}, * {appId: 'com_externaldomain_example_app', context: {}}, * {appId: 'com_externaldomain_example_app2', context: {}} * ]; * * // Pre requested manifest responses * var arManifests = [ * { * apps: ['<div>Example App!</div>'], * inlineScripts: [], * scripts: ['http://www.domain.com/js/AppClass.js'], * styles: ['http://www.domain.com/css/AppStyles.css'] * }, * { * apps: ['<div>Example App!</div>'], * inlineScripts: [], * scripts: ['http://www.domain.com/js/AppClass.js'], * styles: ['http://www.domain.com/css/AppStyles.css'] * }, * { * apps: ['<div>Example App 2!</div>'], * inlineScripts: [], * scripts: ['http://www.domain.com/js/App2Class.js'], * styles: ['http://www.domain.com/css/App2Styles.css'] * } * ]; * * F2.init(); * F2.registerApps(arConfigs, arManifests); */ registerApps: function(appConfigs, appManifests) { if (!_isInit()) { F2.log('F2.init() must be called before F2.registerApps()'); return; } else if (!appConfigs) { F2.log('At least one AppConfig must be passed when calling F2.registerApps()'); return; } var appStack = []; var batches = {}; var callbackStack = {}; var haveManifests = false; appConfigs = [].concat(appConfigs); appManifests = [].concat(appManifests || []); haveManifests = !!appManifests.length; // appConfigs must have a length if (!appConfigs.length) { F2.log('At least one AppConfig must be passed when calling F2.registerApps()'); return; // ensure that the array of apps and manifests are qual } else if (appConfigs.length && haveManifests && appConfigs.length != appManifests.length) { F2.log('The length of "apps" does not equal the length of "appManifests"'); return; } // validate each app and assign it an instanceId // then determine which apps can be batched together jQuery.each(appConfigs, function(i, a) { // add properties and methods a = _createAppConfig(a); // Will set to itself, for preloaded apps, or set to null for apps that aren't already // on the page. a.root = a.root || null; // we validate the app after setting the root property because pre-load apps do no require // manifest url if (!_validateApp(a)) { return; // move to the next app } // save app _apps[a.instanceId] = { config:a }; // If the root property is defined then this app is considered to be preloaded and we will // run it through that logic. if(a.root) { if((!a.root && typeof(a.root) != 'string') && !F2.isNativeDOMNode(a.root)) { F2.log('AppConfig invalid for pre-load, not a valid string and not dom node'); F2.log('AppConfig instance:', a); throw('Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.'); } else if(jQuery(a.root).length != 1) { F2.log('AppConfig invalid for pre-load, root not unique'); F2.log('AppConfig instance:', a); F2.log('Number of dom node instances:', jQuery(a.root).length); throw('Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.'); } // instantiate F2.App _createAppInstance(a); // init events _initAppEvents(a); // Continue on in the .each loop, no need to continue because the app is on the page // the js in initialized, and it is ready to role. return; // equivalent to continue in .each } if(!_bUsesAppHandlers) { // fire beforeAppRender a.root = _beforeAppRender(a); } else { F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_CREATE_ROOT, a // the app config ); F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER_BEFORE, a // the app config ); } // if we have the manifest, go ahead and load the app if (haveManifests) { _loadApps(a, appManifests[i]); } else { // check if this app can be batched if (a.enableBatchRequests && !a.isSecure) { batches[a.manifestUrl.toLowerCase()] = batches[a.manifestUrl.toLowerCase()] || []; batches[a.manifestUrl.toLowerCase()].push(a); } else { appStack.push({ apps:[a], url:a.manifestUrl }); } } }); // we don't have the manifests, go ahead and load them if (!haveManifests) { // add the batches to the appStack jQuery.each(batches, function(i, b) { appStack.push({ url:i, apps:b }); }); // if an app is being loaded more than once on the page, there is the // potential that the jsonp callback will be clobbered if the request // for the AppManifest for the app comes back at the same time as // another request for the same app. We'll create a callbackStack // that will ensure that requests for the same app are loaded in order // rather than at the same time jQuery.each(appStack, function(i, req) { // define the callback function based on the first app's App ID var jsonpCallback = F2.Constants.JSONP_CALLBACK + req.apps[0].appId; // push the request onto the callback stack callbackStack[jsonpCallback] = callbackStack[jsonpCallback] || []; callbackStack[jsonpCallback].push(req); }); // loop through each item in the callback stack and make the request // for the AppManifest. When the request is complete, pop the next // request off the stack and make the request. jQuery.each(callbackStack, function(i, requests) { var manifestRequest = function(jsonpCallback, req) { if (!req) { return; } // setup defaults and callbacks var url = req.url, type = 'GET', dataType = 'jsonp', completeFunc = function() { manifestRequest(i, requests.pop()); }, errorFunc = function() { jQuery.each(req.apps, function(idx,item){ F2.log('Removed failed ' +item.name+ ' app', item); F2.removeApp(item.instanceId); }); }, successFunc = function(appManifest) { _loadApps(req.apps, appManifest); }; // optionally fire xhr overrides if (_config.xhr && _config.xhr.dataType) { dataType = _config.xhr.dataType(req.url, req.apps); if (typeof dataType !== 'string') { throw('ContainerConfig.xhr.dataType should return a string'); } } if (_config.xhr && _config.xhr.type) { type = _config.xhr.type(req.url, req.apps); if (typeof type !== 'string') { throw('ContainerConfig.xhr.type should return a string'); } } if (_config.xhr && _config.xhr.url) { url = _config.xhr.url(req.url, req.apps); if (typeof url !== 'string') { throw('ContainerConfig.xhr.url should return a string'); } } // setup the default request function if an override is not present var requestFunc = _config.xhr; if (typeof requestFunc !== 'function') { requestFunc = function(url, appConfigs, successCallback, errorCallback, completeCallback) { jQuery.ajax({ url: url, type: type, data: { params: F2.stringify(req.apps, F2.appConfigReplacer) }, jsonp: false, // do not put 'callback=' in the query string jsonpCallback: jsonpCallback, // Unique function name dataType: dataType, success: successCallback, error: function(jqxhr, settings, exception) { F2.log('Failed to load app(s)', exception.toString(), req.apps); errorCallback(); }, complete: completeCallback }); }; } requestFunc(url, req.apps, successFunc, errorFunc, completeFunc); }; manifestRequest(i, requests.pop()); }); } }, /** * Removes all apps from the container * @method removeAllApps */ removeAllApps: function() { if (!_isInit()) { F2.log('F2.init() must be called before F2.removeAllApps()'); return; } jQuery.each(_apps, function(i, a) { F2.removeApp(a.config.instanceId); }); }, /** * Removes an app from the container * @method removeApp * @param {string} instanceId The app's instanceId */ removeApp: function(instanceId) { if (!_isInit()) { F2.log('F2.init() must be called before F2.removeApp()'); return; } if (_apps[instanceId]) { F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_DESTROY_BEFORE, _apps[instanceId] // the app instance ); F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_DESTROY, _apps[instanceId] // the app instance ); F2.AppHandlers.__trigger( _sAppHandlerToken, F2.Constants.AppHandlers.APP_DESTROY_AFTER, _apps[instanceId] // the app instance ); delete _apps[instanceId]; } } }; })()); exports.F2 = F2; if (typeof define !== 'undefined' && define.amd) { define(function() { return F2; }); } })(typeof exports !== 'undefined' ? exports : window);
docs/src/ComponentsPage.js
zerkms/react-bootstrap
/* eslint react/no-did-mount-set-state: 0 */ import React from 'react'; import Affix from '../../src/Affix'; import Nav from '../../src/Nav'; import SubNav from '../../src/SubNav'; import NavItem from '../../src/NavItem'; import NavMain from './NavMain'; import PageHeader from './PageHeader'; import PropTable from './PropTable'; import PageFooter from './PageFooter'; import ReactPlayground from './ReactPlayground'; import Samples from './Samples'; import Anchor from './Anchor'; const ComponentsPage = React.createClass({ getInitialState() { return { activeNavItemHref: null, navOffsetTop: null }; }, handleNavItemSelect(key, href) { this.setState({ activeNavItemHref: href }); window.location = href; }, componentDidMount() { let elem = React.findDOMNode(this.refs.sideNav); let domUtils = Affix.domUtils; let sideNavOffsetTop = domUtils.getOffset(elem).top; let sideNavMarginTop = parseInt(domUtils.getComputedStyles(elem.firstChild).marginTop, 10); let topNavHeight = React.findDOMNode(this.refs.topNav).offsetHeight; this.setState({ navOffsetTop: sideNavOffsetTop - topNavHeight - sideNavMarginTop, navOffsetBottom: React.findDOMNode(this.refs.footer).offsetHeight }); }, render() { return ( <div> <NavMain activePage='components' ref='topNav' /> <PageHeader title='Components' subTitle='' /> <div className='container bs-docs-container'> <div className='row'> <div className='col-md-9' role='main'> {/* Buttons */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='buttons'>Buttons</Anchor> <small>Button</small></h1> <h2><Anchor id='buttons-options'>Options</Anchor></h2> <p>Use any of the available button style types to quickly create a styled button. Just modify the <code>bsStyle</code> prop.</p> <ReactPlayground codeText={Samples.ButtonTypes} /> <div className='bs-callout bs-callout-warning'> <h4>Button spacing</h4> <p>Because React doesn't output newlines between elements, buttons on the same line are displayed flush against each other. To preserve the spacing between multiple inline buttons, wrap your button group in <code>{'<ButtonToolbar />'}</code>.</p> </div> <h2><Anchor id='buttons-sizes'>Sizes</Anchor></h2> <p>Fancy larger or smaller buttons? Add <code>bsSize="large"</code>, <code>bsSize="small"</code>, or <code>bsSize="xsmall"</code> for additional sizes.</p> <ReactPlayground codeText={Samples.ButtonSizes} /> <p>Create block level buttons—those that span the full width of a parent— by adding the <code>block</code> prop.</p> <ReactPlayground codeText={Samples.ButtonBlock} /> <h2><Anchor id='buttons-active'>Active state</Anchor></h2> <p>To set a buttons active state simply set the components <code>active</code> prop.</p> <ReactPlayground codeText={Samples.ButtonActive} /> <h2><Anchor id='buttons-disabled'>Disabled state</Anchor></h2> <p>Make buttons look unclickable by fading them back 50%. To do this add the <code>disabled</code> attribute to buttons.</p> <ReactPlayground codeText={Samples.ButtonDisabled} /> <div className='bs-callout bs-callout-warning'> <h4>Event handler functionality not impacted</h4> <p>This prop will only change the <code>{'<Button />'}</code>&#8217;s appearance, not its functionality. Use custom logic to disable the effect of the <code>onClick</code> handlers.</p> </div> <h2><Anchor id='buttons-tags'>Button tags</Anchor></h2> <p>The DOM element tag is choosen automatically for you based on the props you supply. Passing a <code>href</code> will result in the button using a <code>{'<a />'}</code> element otherwise a <code>{'<button />'}</code> element will be used.</p> <ReactPlayground codeText={Samples.ButtonTagTypes} /> <h2><Anchor id='buttons-loading'>Button loading state</Anchor></h2> <p>When activating an asynchronous action from a button it is a good UX pattern to give the user feedback as to the loading state, this can easily be done by updating your <code>{'<Button />'}</code>&#8217;s props from a state change like below.</p> <ReactPlayground codeText={Samples.ButtonLoading} /> <h3><Anchor id='buttons-props'>Props</Anchor></h3> <PropTable component='Button'/> </div> {/* Button Groups */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='btn-groups'>Button groups</Anchor> <small>ButtonGroup, ButtonToolbar</small></h1> <p className='lead'>Group a series of buttons together on a single line with the button group.</p> <h3><Anchor id='btn-groups-single'>Basic example</Anchor></h3> <p>Wrap a series of <code>{'<Button />'}</code>s in a <code>{'<ButtonGroup />'}</code>.</p> <ReactPlayground codeText={Samples.ButtonGroupBasic} /> <h3><Anchor id='btn-groups-toolbar'>Button toolbar</Anchor></h3> <p>Combine sets of <code>{'<ButtonGroup />'}</code>s into a <code>{'<ButtonToolbar />'}</code> for more complex components.</p> <ReactPlayground codeText={Samples.ButtonToolbarBasic} /> <h3><Anchor id='btn-groups-sizing'>Sizing</Anchor></h3> <p>Instead of applying button sizing props to every button in a group, just add <code>bsSize</code> prop to the <code>{'<ButtonGroup />'}</code>.</p> <ReactPlayground codeText={Samples.ButtonGroupSizes} /> <h3><Anchor id='btn-groups-nested'>Nesting</Anchor></h3> <p>You can place other button types within the <code>{'<ButtonGroup />'}</code> like <code>{'<DropdownButton />'}</code>s.</p> <ReactPlayground codeText={Samples.ButtonGroupNested} /> <h3><Anchor id='btn-groups-vertical'>Vertical variation</Anchor></h3> <p>Make a set of buttons appear vertically stacked rather than horizontally. <strong className='text-danger'>Split button dropdowns are not supported here.</strong></p> <p>Just add <code>vertical</code> to the <code>{'<ButtonGroup />'}</code>.</p> <ReactPlayground codeText={Samples.ButtonGroupVertical} /> <br /> <p>Moreover, you can have buttons be block level elements so they take the full width of their container, just add <code>block</code> to the <code>{'<ButtonGroup />'}</code>, in addition to the <code>vertical</code> you just added.</p> <ReactPlayground codeText={Samples.ButtonGroupBlock} /> <h3><Anchor id='btn-groups-justified'>Justified button groups</Anchor></h3> <p>Make a group of buttons stretch at equal sizes to span the entire width of its parent. Also works with button dropdowns within the button group.</p> <div className='bs-callout bs-callout-warning'> <h4>Style issues</h4> <p>There are some issues and workarounds required when using this property, please see <a href='http://getbootstrap.com/components/#btn-groups-justified'>bootstrap&#8217;s button group docs</a> for more specifics.</p> </div> <p>Just add <code>justified</code> to the <code>{'<ButtonGroup />'}</code>.</p> <ReactPlayground codeText={Samples.ButtonGroupJustified} /> <h3><Anchor id='btn-groups-props'>Props</Anchor></h3> <PropTable component='ButtonGroup'/> </div> <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='btn-dropdowns'>Button dropdowns</Anchor></h1> <p className='lead'>Use <code>{'<DropdownButton />'}</code> or <code>{'<SplitButton />'}</code> components to display a button with a dropdown menu.</p> <h3><Anchor id='btn-dropdowns-single'>Single button dropdowns</Anchor></h3> <p>Create a dropdown button with the <code>{'<DropdownButton />'}</code> component.</p> <ReactPlayground codeText={Samples.DropdownButtonBasic} /> <h3><Anchor id='btn-dropdowns-split'>Split button dropdowns</Anchor></h3> <p>Similarly, create split button dropdowns with the <code>{'<SplitButton />'}</code> component.</p> <ReactPlayground codeText={Samples.SplitButtonBasic} /> <h3><Anchor id='btn-dropdowns-sizing'>Sizing</Anchor></h3> <p>Button dropdowns work with buttons of all sizes.</p> <ReactPlayground codeText={Samples.DropdownButtonSizes} /> <h3><Anchor id='btn-dropdowns-nocaret'>No caret variation</Anchor></h3> <p>Remove the caret using the <code>noCaret</code> prop.</p> <ReactPlayground codeText={Samples.DropdownButtonNoCaret} /> <h3><Anchor id='btn-dropdowns-dropup'>Dropup variation</Anchor></h3> <p>Trigger dropdown menus that site above the button by adding the <code>dropup</code> prop.</p> <ReactPlayground codeText={Samples.SplitButtonDropup} /> <h3><Anchor id='btn-dropdowns-right'>Dropdown right variation</Anchor></h3> <p>Trigger dropdown menus that align to the right of the button using the <code>pullRight</code> prop.</p> <ReactPlayground codeText={Samples.SplitButtonRight} /> <h3><Anchor id='btn-dropdowns-props'>Props</Anchor></h3> <h4><Anchor id='btn-dropdowns-props-dropdown'>DropdownButton</Anchor></h4> <PropTable component='DropdownButton'/> <h4><Anchor id='btn-dropdowns-props-split'>SplitButton</Anchor></h4> <PropTable component='SplitButton'/> </div> {/* Menu Item */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='menu-item'>Menu Item</Anchor> <small> MenuItem</small></h1> <p>This is a component used in other components (see <a href="buttons">Buttons</a>, <a href="#navbars">Navbars</a>).</p> <p>It supports the basic anchor properties <code>href</code>, <code>target</code>, <code>title</code>.</p> <p>It also supports different properties of the normal Bootstrap MenuItem. <ul> <li><code>header</code>: To add a header label to sections</li> <li><code>divider</code>: Adds an horizontal divider between sections</li> <li><code>disabled</code>: shows the item as disabled, and prevents the onclick</li> <li><code>eventKey</code>: passed to the callback</li> <li><code>onSelect</code>: a callback that is called when the user clicks the item.</li> </ul> <p>The callback is called with the following arguments: <code>eventKey</code>, <code>href</code> and <code>target</code></p> </p> <ReactPlayground codeText={Samples.MenuItem} /> <h3><Anchor id='menu-item-props'>Props</Anchor></h3> <PropTable component='MenuItem'/> </div> {/* Panels */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='panels'>Panels</Anchor> <small>Panel, PanelGroup, Accordion</small></h1> <h3><Anchor id='panels-basic'>Basic example</Anchor></h3> <p>By default, all the <code>&lt;Panel /&gt;</code> does is apply some basic border and padding to contain some content.</p> <p>You can pass on any additional properties you need, e.g. a custom <code>onClick</code> handler, as it is shown in the example code. They all will apply to the wrapper <code>div</code> element.</p> <ReactPlayground codeText={Samples.PanelBasic} /> <h3><Anchor id='panels-collapsible'>Collapsible Panel</Anchor></h3> <ReactPlayground codeText={Samples.PanelCollapsible} /> <h3><Anchor id='panels-heading'>Panel with heading</Anchor></h3> <p>Easily add a heading container to your panel with the <code>header</code> prop.</p> <ReactPlayground codeText={Samples.PanelWithHeading} /> <h3><Anchor id='panels-footer'>Panel with footer</Anchor></h3> <p>Pass buttons or secondary text in the <code>footer</code> prop. Note that panel footers do not inherit colors and borders when using contextual variations as they are not meant to be in the foreground.</p> <ReactPlayground codeText={Samples.PanelWithFooter} /> <h3><Anchor id='panels-contextual'>Contextual alternatives</Anchor></h3> <p>Like other components, easily make a panel more meaningful to a particular context by adding a <code>bsStyle</code> prop.</p> <ReactPlayground codeText={Samples.PanelContextual} /> <h3><Anchor id='panels-tables'>With tables and list groups</Anchor></h3> <p>Add the <code>fill</code> prop to <code>&lt;Table /&gt;</code> or <code>&lt;ListGroup /&gt;</code> elements to make them fill the panel.</p> <ReactPlayground codeText={Samples.PanelListGroupFill} /> <h3><Anchor id='panels-controlled'>Controlled PanelGroups</Anchor></h3> <p><code>PanelGroup</code>s can be controlled by a parent component. The <code>activeKey</code> prop dictates which panel is open.</p> <ReactPlayground codeText={Samples.PanelGroupControlled} /> <h3><Anchor id='panels-uncontrolled'>Uncontrolled PanelGroups</Anchor></h3> <p><code>PanelGroup</code>s can also be uncontrolled where they manage their own state. The <code>defaultActiveKey</code> prop dictates which panel is open when initially.</p> <ReactPlayground codeText={Samples.PanelGroupUncontrolled} /> <h3><Anchor id='panels-accordion'>Accordions</Anchor></h3> <p><code>&lt;Accordion /&gt;</code> aliases <code>&lt;PanelGroup accordion /&gt;</code>.</p> <ReactPlayground codeText={Samples.PanelGroupAccordion} /> <h3><Anchor id='panels-props'>Props</Anchor></h3> <h4><Anchor id='panels-props-accordion'>Panels, Accordion</Anchor></h4> <PropTable component='Panel'/> <h4><Anchor id='panels-props-group'>PanelGroup</Anchor></h4> <PropTable component='PanelGroup'/> </div> <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='modals'>Modals</Anchor> <small>Modal</small></h1> <h3><Anchor id='modals-static'>Static Markup</Anchor></h3> <p>A modal dialog component</p> <ReactPlayground codeText={Samples.ModalStatic} /> <h3><Anchor id='modals-live'>Basic example</Anchor></h3> <p></p> <p> A modal with header, body, and set of actions in the footer. Use <code>{'<Modal/>'}</code> in combination with other components to show or hide your Modal. The <code>{'<Modal/>'}</code> Component comes with a few convenient "sub components": <code>{'<Modal.Header/>'}</code>, <code>{'<Modal.Title/>'}</code>, <code>{'<Modal.Body/>'}</code>, and <code>{'<Modal.Footer/>'}</code>, which you can use to build the Modal content. </p> <ReactPlayground codeText={Samples.Modal} /> <div className='bs-callout bs-callout-info'> <h4>Additional Import Options</h4> <p> The Modal Header, Title, Body, and Footer components are available as static properties the <code>{'<Modal/>'}</code> component, but you can also, import them directly from the <code>/lib</code> directory like: <code>{"require('react-bootstrap/lib/ModalHeader')"}</code>. </p> </div> <h3><Anchor id='modals-contained'>Contained Modal</Anchor></h3> <p>You will need to add the following css to your project and ensure that your container has the <code>modal-container</code> class.</p> <pre> {React.DOM.code(null, '.modal-container {\n' + ' position: relative;\n' + '}\n' + '.modal-container .modal, .modal-container .modal-backdrop {\n' + ' position: absolute;\n' + '}\n' )} </pre> <ReactPlayground codeText={Samples.ModalContained} /> <h3><Anchor id='modal-default-sizing'>Sizing modals using standard Bootstrap props</Anchor></h3> <p>You can specify a bootstrap large or small modal by using the "bsSize" prop.</p> <ReactPlayground codeText={Samples.ModalDefaultSizing} /> <h3><Anchor id='modal-custom-sizing'>Sizing modals using custom CSS</Anchor></h3> <p>You can apply custom css to the modal dialog div using the "dialogClassName" prop. Example is using a custom css class with width set to 90%.</p> <ReactPlayground codeText={Samples.ModalCustomSizing} /> <h3><Anchor id='modals-props'>Props</Anchor></h3> <h4><Anchor id='modals-props-modal'>Modal</Anchor></h4> <PropTable component='Modal'/> <h4><Anchor id='modals-props-modal-header'>Modal.Header</Anchor></h4> <PropTable component='ModalHeader'/> <h4><Anchor id='modals-props-modal-title'>Modal.Title</Anchor></h4> <PropTable component='ModalTitle'/> <h4><Anchor id='modals-props-modal-body'>Modal.Body</Anchor></h4> <PropTable component='ModalBody'/> <h4><Anchor id='modals-props-modal-footer'>Modal.Footer</Anchor></h4> <PropTable component='ModalFooter'/> </div> {/* Tooltip */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='tooltips'>Tooltip</Anchor></h1> <p> Tooltip component for a more stylish alternative to that anchor tag <code>title</code> attribute. </p> <ReactPlayground codeText={Samples.TooltipBasic} exampleClassName='tooltip-static'/> <h4><Anchor id='tooltips-overlay-trigger'>With OverlayTrigger</Anchor></h4> <p>Attach and position tooltips with <code>OverlayTrigger</code>.</p> <ReactPlayground codeText={Samples.TooltipPositioned} /> <h4><Anchor id='tooltips-in-text'>In text copy</Anchor></h4> <p>Positioned tooltip in text copy.</p> <ReactPlayground codeText={Samples.TooltipInCopy} /> <h3><Anchor id='tooltips-props'>Props</Anchor></h3> <h4><Anchor id='overlays-trigger-props'>Overlay Trigger</Anchor></h4> <PropTable component='OverlayTrigger'/> <h4><Anchor id='tooltips-props-tooltip'>Tooltip</Anchor></h4> <PropTable component='Tooltip'/> </div> {/* Popover */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='popovers'>Popovers</Anchor></h1> <p> The Popover, offers a more robust alternative to the Tooltip for displaying overlays of content. </p> <ReactPlayground codeText={Samples.PopoverBasic}/> <h4><Anchor id='popovers-overlay-trigger'>With OverlayTrigger</Anchor></h4> <p>The Popover component, like the Tooltip can be used with an <code>OverlayTrigger</code> Component, and positioned around it.</p> <ReactPlayground codeText={Samples.PopoverPositioned} /> <h4><Anchor id='popovers-trigger-behaviors'>Trigger behaviors</Anchor></h4> <p>It's inadvisable to use <code>"hover"</code> or <code>"focus"</code> triggers for popovers, because they have poor accessibility from keyboard and on mobile devices.</p> <ReactPlayground codeText={Samples.PopoverTriggerBehaviors} /> <h4><Anchor id='popovers-in-container'>Popover component in container</Anchor></h4> <ReactPlayground codeText={Samples.PopoverContained} exampleClassName='bs-example-popover-contained' /> <h4><Anchor id='popovers-positioned-scrolling'>Positioned popover components in scrolling container</Anchor></h4> <ReactPlayground codeText={Samples.PopoverPositionedScrolling} exampleClassName='bs-example-popover-scroll' /> <h3><Anchor id='popover-props'>Props</Anchor></h3> <PropTable component='Popover'/> </div> {/* Overlay */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='overlays'>Overlay</Anchor></h1> <p> The <code>OverlayTrigger</code> component is great for most use cases, but as a higher level abstraction it can lack the flexibility needed to build more nuanced or custom behaviors into your Overlay components. For these cases it can be helpful to forgo the trigger and use the <code>Overlay</code> component directly. </p> <ReactPlayground codeText={Samples.Overlay}/> <h4><Anchor id='overlays-overlay'>Use Overlay instead of Tooltip and Popover</Anchor></h4> <p> You don't need to use the provided <code>Tooltip</code> or <code>Popover</code> components. Creating custom overlays is as easy as wrapping some markup in an <code>Overlay</code> component </p> <ReactPlayground codeText={Samples.OverlayCustom} /> <h3><Anchor id='overlays-props'>Props</Anchor></h3> <PropTable component='Overlay'/> </div> {/* Progress Bar */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='progress'>Progress bars</Anchor> <small>ProgressBar</small></h1> <p className='lead'>Provide up-to-date feedback on the progress of a workflow or action with simple yet flexible progress bars.</p> <h2><Anchor id='progress-basic'>Basic example</Anchor></h2> <p>Default progress bar.</p> <ReactPlayground codeText={Samples.ProgressBarBasic} /> <h2><Anchor id='progress-label'>With label</Anchor></h2> <p>Add a <code>label</code> prop to show a visible percentage. For low percentages, consider adding a min-width to ensure the label's text is fully visible.</p> <p>The following keys are interpolated with the current values: <code>%(min)s</code>, <code>%(max)s</code>, <code>%(now)s</code>, <code>%(percent)s</code>, <code>%(bsStyle)s</code></p> <ReactPlayground codeText={Samples.ProgressBarWithLabel} /> <h2><Anchor id='progress-screenreader-label'>Screenreader only label</Anchor></h2> <p>Add a <code>srOnly</code> prop to hide the label visually.</p> <ReactPlayground codeText={Samples.ProgressBarScreenreaderLabel} /> <h2><Anchor id='progress-contextual'>Contextual alternatives</Anchor></h2> <p>Progress bars use some of the same button and alert classes for consistent styles.</p> <ReactPlayground codeText={Samples.ProgressBarContextual} /> <h2><Anchor id='progress-striped'>Striped</Anchor></h2> <p>Uses a gradient to create a striped effect. Not available in IE8.</p> <ReactPlayground codeText={Samples.ProgressBarStriped} /> <h2><Anchor id='progress-animated'>Animated</Anchor></h2> <p>Add <code>active</code> prop to animate the stripes right to left. Not available in IE9 and below.</p> <ReactPlayground codeText={Samples.ProgressBarAnimated} /> <h2><Anchor id='progress-stacked'>Stacked</Anchor></h2> <p>Nest <code>&lt;ProgressBar /&gt;</code>s to stack them.</p> <ReactPlayground codeText={Samples.ProgressBarStacked} /> <h3><Anchor id='progress-props'>ProgressBar</Anchor></h3> <PropTable component='ProgressBar'/> </div> {/* Nav */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='navs'>Navs</Anchor> <small>Nav, NavItem</small></h1> <p>Navs come in two styles, <code>pills</code> and <code>tabs</code>. Disable a tab by adding <code>disabled</code>.</p> <ReactPlayground codeText={Samples.NavBasic} /> <h3><Anchor id='navs-dropdown'>Dropdown</Anchor></h3> <p>Add dropdowns using the <code>DropdownButton</code> component. Just make sure to set <code>navItem</code> property to true.</p> <ReactPlayground codeText={Samples.NavDropdown} /> <h3><Anchor id='navs-stacked'>Stacked</Anchor></h3> <p>They can also be <code>stacked</code> vertically.</p> <ReactPlayground codeText={Samples.NavStacked} /> <h3><Anchor id='navs-justified'>Justified</Anchor></h3> <p>They can be <code>justified</code> to take the full width of their parent.</p> <ReactPlayground codeText={Samples.NavJustified} /> <h3><Anchor id='navs-props'>Props</Anchor></h3> <h4><Anchor id='navs-props-nav'>Nav</Anchor></h4> <PropTable component='Nav'/> <h4><Anchor id='navs-props-navitem'>NavItem</Anchor></h4> <PropTable component='NavItem'/> </div> {/* Navbar */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='navbars'>Navbars</Anchor> <small>Navbar, Nav, NavItem</small></h1> <p>Navbars are by default accessible and will provide <code>role="navigation"</code>.</p> <p>They also supports all the different Bootstrap classes as properties. Just camelCase the css class and remove navbar from it. For example <code>navbar-fixed-top</code> becomes the property <code>fixedTop</code>. The different properties are <code>fixedTop</code>, <code>fixedBottom</code>, <code>staticTop</code>, <code>inverse</code>, <code>fluid</code>.</p> <p>You can drag elements to the right by specifying the <code>right</code> property on a nav group.</p> <h3><Anchor id='navbars-basic'>Navbar Basic Example</Anchor></h3> <ReactPlayground codeText={Samples.NavbarBasic} /> <h3><Anchor id='navbars-brand'>Navbar Brand Example</Anchor></h3> <p>You can specify a brand by passing in a string to <code>brand</code>, or you can pass in a renderable component.</p> <ReactPlayground codeText={Samples.NavbarBrand} /> <h3><Anchor id='navbars-mobile-friendly'>Mobile Friendly</Anchor></h3> <p>To have a mobile friendly Navbar, specify the property <code>toggleNavKey</code> on the Navbar with a value corresponding to an <code>eventKey</code> of one of his <code>Nav</code> children. This child will be the one collapsed.</p> <p>By setting the property {React.DOM.code(null, 'defaultNavExpanded')} the Navbar will start expanded by default.</p> <div className='bs-callout bs-callout-info'> <h4>Scrollbar overflow</h4> <p>The height of the collapsible is slightly smaller than the real height. To hide the scroll bar, add the following css to your style files.</p> <pre> {React.DOM.code(null, '.navbar-collapse {\n' + ' overflow: hidden;\n' + '}\n' )} </pre> </div> <ReactPlayground codeText={Samples.NavbarCollapsible} /> <h3><Anchor id='navbars-mobile-friendly-multiple'>Mobile Friendly (Multiple Nav Components)</Anchor></h3> <p>To have a mobile friendly Navbar that handles multiple <code>Nav</code> components use <code>CollapsibleNav</code>. The <code>toggleNavKey</code> must still be set, however, the corresponding <code>eventKey</code> must now be on the <code>CollapsibleNav</code> component.</p> <div className="bs-callout bs-callout-info"> <h4>Div collapse</h4> <p>The <code>navbar-collapse</code> div gets created as the collapsible element which follows the <a href="http://getbootstrap.com/components/#navbar-default">bootstrap</a> collapsible navbar documentation.</p> <pre>&lt;div class="collapse navbar-collapse"&gt;&lt;/div&gt;</pre> </div> <ReactPlayground codeText={Samples.CollapsibleNav} /> <h3><Anchor id='navbar-props'>Props</Anchor></h3> <PropTable component='Navbar'/> </div> {/* Tabbed Areas */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='tabs'>Togglable tabs</Anchor> <small>TabbedArea, TabPane</small></h1> <p>Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.</p> <h3><Anchor id='tabs-uncontrolled'>Uncontrolled</Anchor></h3> <p>Allow the component to control its own state.</p> <ReactPlayground codeText={Samples.TabbedAreaUncontrolled} exampleClassName='bs-example-tabs' /> <h3><Anchor id='tabs-controlled'>Controlled</Anchor></h3> <p>Pass down the active state on render via props.</p> <ReactPlayground codeText={Samples.TabbedAreaControlled} exampleClassName='bs-example-tabs' /> <h3><Anchor id='tabs-no-animation'>No animation</Anchor></h3> <p>Set the <code>animation</code> prop to <code>false</code></p> <ReactPlayground codeText={Samples.TabbedAreaNoAnimation} exampleClassName='bs-example-tabs' /> <div className='bs-callout bs-callout-info'> <h4>Extends tabbed navigation</h4> <p>This plugin extends the <a href='#navs'>tabbed navigation component</a> to add tabbable areas.</p> </div> <h3><Anchor id='tabs-props'>Props</Anchor></h3> <h4><Anchor id='tabs-props-area'>TabbedArea</Anchor></h4> <PropTable component='TabbedArea'/> <h4><Anchor id='tabs-props-pane'>TabPane</Anchor></h4> <PropTable component='TabPane'/> </div> {/* Pager */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='pager'>Pager</Anchor> <small>Pager, PageItem</small></h1> <p>Quick previous and next links.</p> <h3><Anchor id='pager-default'>Centers by default</Anchor></h3> <ReactPlayground codeText={Samples.PagerDefault} /> <h3><Anchor id='pager-aligned'>Aligned</Anchor></h3> <p>Set the <code>previous</code> or <code>next</code> prop to <code>true</code>, to align left or right.</p> <ReactPlayground codeText={Samples.PagerAligned} /> <h3><Anchor id='pager-disabled'>Disabled</Anchor></h3> <p>Set the <code>disabled</code> prop to <code>true</code> to disable the link.</p> <ReactPlayground codeText={Samples.PagerDisabled} /> <h3><Anchor id='pager-props'>Props</Anchor></h3> <h4><Anchor id='pager-props-pager'>Pager</Anchor></h4> <PropTable component='Pager'/> <h4><Anchor id='pager-props-pageitem'>PageItem</Anchor></h4> <PropTable component='PageItem'/> </div> {/* Pagination */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='pagination'>Pagination</Anchor> <small>Pagination</small></h1> <p>Provide pagination links for your site or app with the multi-page pagination component. Set <code>items</code> to the number of pages. <code>activePage</code> prop dictates which page is active</p> <ReactPlayground codeText={Samples.PaginationBasic} /> <h4><Anchor id='pagination-more'>More options</Anchor></h4> <p>such as <code>first</code>, <code>last</code>, <code>previous</code>, <code>next</code> and <code>ellipsis</code>.</p> <ReactPlayground codeText={Samples.PaginationAdvanced} /> <h3><Anchor id='pagination-props'>Props</Anchor></h3> <PropTable component='Pagination'/> </div> {/* Alerts */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='alerts'>Alert messages</Anchor> <small>Alert</small></h1> <p>Basic alert styles.</p> <ReactPlayground codeText={Samples.AlertBasic} /> <h4><Anchor id='alerts-closeable'>Closeable alerts</Anchor></h4> <p>just pass in a <code>onDismiss</code> function.</p> <ReactPlayground codeText={Samples.AlertDismissable} /> <h4><Anchor id='alerts-auto-closeable'>Auto closeable</Anchor></h4> <p>Auto close after a set time with <code>dismissAfter</code> prop.</p> <ReactPlayground codeText={Samples.AlertAutoDismissable} /> <h3><Anchor id='alert-props'>Props</Anchor></h3> <PropTable component='Alert'/> </div> {/* Carousels */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='carousels'>Carousels</Anchor> <small>Carousel, CarouselItem</small></h1> <h3><Anchor id='carousels-uncontrolled'>Uncontrolled</Anchor></h3> <p>Allow the component to control its own state.</p> <ReactPlayground codeText={Samples.CarouselUncontrolled} exampleClassName='bs-example-tabs' /> <h3><Anchor id='carousels-controlled'>Controlled</Anchor></h3> <p>Pass down the active state on render via props.</p> <ReactPlayground codeText={Samples.CarouselControlled} exampleClassName='bs-example-tabs' /> <h3><Anchor id='carousels-props'>Props</Anchor></h3> <h4><Anchor id='carousels-props-carousel'>Carousel</Anchor></h4> <PropTable component='Carousel'/> <h4><Anchor id='carousels-props-item'>CarouselItem</Anchor></h4> <PropTable component='CarouselItem'/> </div> {/* Grids */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='grids'>Grids</Anchor> <small>Grid, Row, Col</small></h1> <ReactPlayground codeText={Samples.GridBasic} exampleClassName='bs-example-tabs' /> <h3><Anchor id='grids-props'>Props</Anchor></h3> <h4><Anchor id='grids-props-grid'>Grid</Anchor></h4> <PropTable component='Grid'/> <h4><Anchor id='grids-props-row'>Row</Anchor></h4> <PropTable component='Row'/> <h4><Anchor id='grids-props-col'>Col</Anchor></h4> <PropTable component='Col'/> </div> {/* Thumbnail */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='thumbnail'>Thumbnail</Anchor></h1> <p>Thumbnails are designed to showcase linked images with minimal required markup. You can extend the grid component with thumbnails.</p> <h3><Anchor id='thumbnail-anchor'>Anchor Thumbnail</Anchor></h3> <p>Creates an anchor wrapping an image.</p> <ReactPlayground codeText={Samples.ThumbnailAnchor} /> <h3><Anchor id='thumbnail-divider'>Divider Thumbnail</Anchor></h3> <p>Creates a divider wrapping an image and other children elements.</p> <ReactPlayground codeText={Samples.ThumbnailDiv} /> <h3><Anchor id='thumbnail-props'>Props</Anchor></h3> <PropTable component='Thumbnail'/> </div> {/* ListGroup */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='listgroup'>List group</Anchor> <small>ListGroup, ListGroupItem</small></h1> <p>Quick previous and next links.</p> <h3><Anchor id='listgroup-default'>Centers by default</Anchor></h3> <ReactPlayground codeText={Samples.ListGroupDefault} /> <h3><Anchor id='listgroup-linked'>Linked</Anchor></h3> <p>Set the <code>href</code> or <code>onClick</code> prop on <code>ListGroupItem</code>, to create a linked or clickable element.</p> <ReactPlayground codeText={Samples.ListGroupLinked} /> <h3><Anchor id='listgroup-styling-state'>Styling by state</Anchor></h3> <p>Set the <code>active</code> or <code>disabled</code> prop to <code>true</code> to mark or disable the item.</p> <ReactPlayground codeText={Samples.ListGroupActive} /> <h3><Anchor id='listgroup-styling-color'>Styling by color</Anchor></h3> <p>Set the <code>bsStyle</code> prop to style the item</p> <ReactPlayground codeText={Samples.ListGroupStyle} /> <h3><Anchor id='listgroup-with-header'>With header</Anchor></h3> <p>Set the <code>header</code> prop to create a structured item, with a heading and a body area.</p> <ReactPlayground codeText={Samples.ListGroupHeader} /> <h3><Anchor id='listgroup-props'>Props</Anchor></h3> <h4><Anchor id='listgroup-props-group'>ListGroup</Anchor></h4> <PropTable component='ListGroup'/> <h4><Anchor id='listgroup-props-item'>ListGroupItem</Anchor></h4> <PropTable component='ListGroupItem'/> </div> {/* Labels */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='labels'>Labels</Anchor></h1> <p>Create a <code>{'<Label>label</Label>'}</code> to highlight information</p> <ReactPlayground codeText={Samples.Label} /> <h3><Anchor id='labels-variations'>Available variations</Anchor></h3> <p>Add any of the below mentioned modifier classes to change the appearance of a label.</p> <ReactPlayground codeText={Samples.LabelVariations} /> <h3><Anchor id='label-props'>Props</Anchor></h3> <PropTable component='Label'/> </div> {/* Badges */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='badges'>Badges</Anchor></h1> <p>Easily highlight new or unread items by adding a <code>{'<Badge>'}</code> to links, Bootstrap navs, and more.</p> <ReactPlayground codeText={Samples.Badge} /> <div className='bs-callout bs-callout-info'> <h4>Cross-browser compatibility</h4> <p>Unlike regular Bootstrap badges self collapse even in Internet Explorer 8.</p> </div> <h3><Anchor id='badges-props'>Props</Anchor></h3> <PropTable component='Badge'/> </div> {/* Jumbotron */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='jumbotron'>Jumbotron</Anchor></h1> <p>A lightweight, flexible component that can optionally extend the entire viewport to showcase key content on your site.</p> <ReactPlayground codeText={Samples.Jumbotron} /> <h3><Anchor id='jumbotron-props'>Props</Anchor></h3> <PropTable component='Jumbotron'/> </div> {/* Page Header */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='page-header'>Page Header</Anchor></h1> <p>A simple shell for an <code>h1</code> to appropriately space out and segment sections of content on a page. It can utilize the <code>h1</code>&#8217;s default <code>small</code> element, as well as most other components (with additional styles).</p> <ReactPlayground codeText={Samples.PageHeader} /> </div> {/* Wells */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='wells'>Wells</Anchor></h1> <p>Use the well as a simple effect on an element to give it an inset effect.</p> <ReactPlayground codeText={Samples.Well} /> <h2><Anchor id='wells-optional'>Optional classes</Anchor></h2> <p>Control padding and rounded corners with two optional modifier classes.</p> <ReactPlayground codeText={Samples.WellSizes} /> <h3><Anchor id='wells-props'>Props</Anchor></h3> <PropTable component='Well'/> </div> {/* Glyphicons */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='glyphicons'>Glyphicons</Anchor></h1> <p>Use them in buttons, button groups for a toolbar, navigation, or prepended form inputs.</p> <ReactPlayground codeText={Samples.Glyphicon} /> <h3><Anchor id='glyphicons-props'>Props</Anchor></h3> <PropTable component='Glyphicon'/> </div> {/* Tables */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='tables'>Tables</Anchor></h1> <p>Use the <code>striped</code>, <code>bordered</code>, <code>condensed</code> and <code>hover</code> props to customise the table.</p> <ReactPlayground codeText={Samples.TableBasic} /> <h2><Anchor id='table-responsive'>Responsive</Anchor></h2> <p>Add <code>responsive</code> prop to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.</p> <ReactPlayground codeText={Samples.TableResponsive} /> <h3><Anchor id='table-props'>Props</Anchor></h3> <PropTable component='Table'/> </div> {/* Input */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='input'>Input</Anchor></h1> <p>Renders an input in bootstrap wrappers. Supports label, help, text input add-ons, validation and use as wrapper. Use <code>getValue()</code> or <code>getChecked()</code> to get the current state. The helper method <code>getInputDOMNode()</code> returns the internal input element. If you don't want the <code>form-group</code> class applied apply the prop named <code>standalone</code>.</p> <ReactPlayground codeText={Samples.Input} /> <h3><Anchor id='input-types'>Types</Anchor></h3> <p>Supports <code>select</code>, <code>textarea</code>, as well as standard HTML input types. <code>getValue()</code> returns an array for multiple select.</p> <ReactPlayground codeText={Samples.InputTypes} /> <h3><Anchor id='input-static'>FormControls.Static</Anchor></h3> <p>Static text can be added to your form controls through the use of the <code>FormControls.Static</code> component.</p> <ReactPlayground codeText={Samples.StaticText} /> <h3><Anchor id='button-input-types'>Button Input Types</Anchor></h3> <p>Form buttons are encapsulated by <code>ButtonInput</code>. Pass in <code>type="reset"</code> or <code>type="submit"</code> to suit your needs. Styling is the same as <code>Button</code>.</p> <ReactPlayground codeText={Samples.ButtonInput} /> <h3><Anchor id='input-addons'>Add-ons</Anchor></h3> <p>Use <code>addonBefore</code> and <code>addonAfter</code> for normal addons, <code>buttonBefore</code> and <code>buttonAfter</code> for button addons. Exotic configurations may require some css on your side.</p> <ReactPlayground codeText={Samples.InputAddons} /> <h3><Anchor id='input-sizes'>Sizes</Anchor></h3> <p>Use <code>bsSize</code> to change the size of inputs. It also works with addons and most other options.</p> <ReactPlayground codeText={Samples.InputSizes} /> <h3><Anchor id='input-validation'>Validation</Anchor></h3> <p>Set <code>bsStyle</code> to one of <code>success</code>, <code>warning</code> or <code>error</code>. Add <code>hasFeedback</code> to show glyphicon. Glyphicon may need additional styling if there is an add-on or no label.</p> <ReactPlayground codeText={Samples.InputValidation} /> <h3><Anchor id='input-horizontal'>Horizontal forms</Anchor></h3> <p>Use <code>labelClassName</code> and <code>wrapperClassName</code> properties to add col classes manually. <code>checkbox</code> and <code>radio</code> types need special treatment because label wraps input.</p> <ReactPlayground codeText={Samples.InputHorizontal} /> <h3><Anchor id='input-wrapper'>Use as a wrapper</Anchor></h3> <p>If <code>type</code> is not set, child element(s) will be rendered instead of an input element. <code>getValue()</code> will not work when used this way.</p> <ReactPlayground codeText={Samples.InputWrapper} /> <h3><Anchor id='input-props'>Props</Anchor></h3> <PropTable component='InputBase'/> </div> {/* Utilities */} <div className='bs-docs-section'> <h1 className='page-header'><Anchor id='utilities'>Utilities</Anchor> <small>Portal, Position</small></h1> <h2><Anchor id='utilities-portal'>Portal</Anchor></h2> <p> A Component that renders its children into a new React "subtree" or <code>container</code>. The Portal component kind of like the React equivalent to jQuery's <code>.appendTo()</code>, which is helpful for components that need to be appended to a DOM node other than the component's direct parent. The Modal, and Overlay components use the Portal component internally. </p> <h3><Anchor id='utilities-portal-props'>Props</Anchor></h3> <PropTable component='Portal'/> <h2 id='utilities-position'><Anchor id='utilities-position'>Position</Anchor></h2> <p> A Component that absolutely positions its child to a <code>target</code> component or DOM node. Useful for creating custom popups or tooltips. Used by the Overlay Components. </p> <h3><Anchor id='utilities-position-props'>Props</Anchor></h3> <PropTable component='Position'/> <h2><Anchor id='utilities-transitions'>Transitions</Anchor></h2> <h3><Anchor id='utilities-collapse'>Collapse</Anchor></h3> <p>Add a collapse toggle animation to an element or component.</p> <ReactPlayground codeText={Samples.Collapse} /> <h4><Anchor id='utilities-collapse-props'>Props</Anchor></h4> <PropTable component='Collapse'/> <h3><Anchor id='utilities-fade'>Fade</Anchor></h3> <p>Add a fade animation to a child element or component.</p> <ReactPlayground codeText={Samples.Fade} /> <h4><Anchor id='utilities-fade-props'>Props</Anchor></h4> <PropTable component='Fade'/> </div> </div> <div className='col-md-3'> <Affix className='bs-docs-sidebar hidden-print' role='complementary' offsetTop={this.state.navOffsetTop} offsetBottom={this.state.navOffsetBottom}> <Nav className='bs-docs-sidenav' activeHref={this.state.activeNavItemHref} onSelect={this.handleNavItemSelect} ref='sideNav'> <SubNav href='#buttons' key={1} text='Buttons'> <NavItem href='#btn-groups' key={2}>Button groups</NavItem> <NavItem href='#btn-dropdowns' key={3}>Button dropdowns</NavItem> <NavItem href='#menu-item' key={25}>Menu Item</NavItem> </SubNav> <NavItem href='#panels' key={4}>Panels</NavItem> <NavItem href='#modals' key={5}>Modals</NavItem> <NavItem href='#tooltips' key={6}>Tooltips</NavItem> <NavItem href='#popovers' key={7}>Popovers</NavItem> <NavItem href='#overlays' key={27}>Overlays</NavItem> <NavItem href='#progress' key={8}>Progress bars</NavItem> <NavItem href='#navs' key={9}>Navs</NavItem> <NavItem href='#navbars' key={10}>Navbars</NavItem> <NavItem href='#tabs' key={11}>Togglable tabs</NavItem> <NavItem href='#pager' key={12}>Pager</NavItem> <NavItem href='#pagination' key={13}>Pagination</NavItem> <NavItem href='#alerts' key={14}>Alerts</NavItem> <NavItem href='#carousels' key={15}>Carousels</NavItem> <NavItem href='#grids' key={16}>Grids</NavItem> <NavItem href='#thumbnail' key={17}>Thumbnail</NavItem> <NavItem href='#listgroup' key={18}>List group</NavItem> <NavItem href='#labels' key={19}>Labels</NavItem> <NavItem href='#badges' key={20}>Badges</NavItem> <NavItem href='#jumbotron' key={21}>Jumbotron</NavItem> <NavItem href='#page-header' key={22}>Page Header</NavItem> <NavItem href='#wells' key={23}>Wells</NavItem> <NavItem href='#glyphicons' key={24}>Glyphicons</NavItem> <NavItem href='#tables' key={25}>Tables</NavItem> <NavItem href='#input' key={26}>Input</NavItem> <NavItem href='#utilities' key={28}>Utilities</NavItem> </Nav> <a className='back-to-top' href='#top'> Back to top </a> </Affix> </div> </div> </div> <PageFooter ref='footer' /> </div> ); } }); export default ComponentsPage;
docs/src/app/components/pages/components/List/ExampleSimple.js
ArcanisCz/material-ui
import React from 'react'; import MobileTearSheet from '../../../MobileTearSheet'; import {List, ListItem} from 'material-ui/List'; import ContentInbox from 'material-ui/svg-icons/content/inbox'; import ActionGrade from 'material-ui/svg-icons/action/grade'; import ContentSend from 'material-ui/svg-icons/content/send'; import ContentDrafts from 'material-ui/svg-icons/content/drafts'; import Divider from 'material-ui/Divider'; import ActionInfo from 'material-ui/svg-icons/action/info'; const ListExampleSimple = () => ( <MobileTearSheet> <List> <ListItem primaryText="Inbox" leftIcon={<ContentInbox />} /> <ListItem primaryText="Starred" leftIcon={<ActionGrade />} /> <ListItem primaryText="Sent mail" leftIcon={<ContentSend />} /> <ListItem primaryText="Drafts" leftIcon={<ContentDrafts />} /> <ListItem primaryText="Inbox" leftIcon={<ContentInbox />} /> </List> <Divider /> <List> <ListItem primaryText="All mail" rightIcon={<ActionInfo />} /> <ListItem primaryText="Trash" rightIcon={<ActionInfo />} /> <ListItem primaryText="Spam" rightIcon={<ActionInfo />} /> <ListItem primaryText="Follow up" rightIcon={<ActionInfo />} /> </List> </MobileTearSheet> ); export default ListExampleSimple;
src/svg-icons/editor/format-underlined.js
igorbt/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorFormatUnderlined = (props) => ( <SvgIcon {...props}> <path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"/> </SvgIcon> ); EditorFormatUnderlined = pure(EditorFormatUnderlined); EditorFormatUnderlined.displayName = 'EditorFormatUnderlined'; EditorFormatUnderlined.muiName = 'SvgIcon'; export default EditorFormatUnderlined;
src/AppBundle/Resources/static/jsx/app/CourseCategory.js
viszerale-therapie/simple-courses
import React from 'react'; import ReactDOM from 'react-dom'; import tl from '../util/translator'; import DataTable from '../util/DataTable'; import actions from '../util/actions'; import dataDefinition from '../data/CourseCategory'; export default { init : function(data, meta) { ReactDOM.render( <div> <h1>{tl.t('course_category.headline')}</h1> <p>{tl.t('course_category.explanation')}</p> <DataTable data={data} entityName="CourseCategory" actions={[actions.CREATE, actions.EDIT, actions.DELETE]} definition={dataDefinition.getFields()} ignore_fields={meta.ignore_fields} /> </div> , document.getElementById('main-content') ); } };
src/interface/statistics/components/BoringSpellValue/index.js
ronaldpereira/WoWAnalyzer
/** * A simple component that shows the spell icon left and a value right. * Use this only for things that the player certainly should be familiar with, such as their own spells. * Do NOT use for items or azerite powers. */ import React from 'react'; import PropTypes from 'prop-types'; import SpellIcon from 'common/SpellIcon'; import '../BoringValue.scss'; const BoringSpellValue = ({ spell, value, label, extra, className }) => ( <div className={`flex boring-value ${className || ''}`}> <div className="flex-sub icon"> <SpellIcon id={spell.id} /> </div> <div className="flex-main value"> <div>{value}</div> <small>{label}</small> {extra} </div> </div> ); BoringSpellValue.propTypes = { spell: PropTypes.shape({ id: PropTypes.number.isRequired, }).isRequired, value: PropTypes.node.isRequired, label: PropTypes.node.isRequired, extra: PropTypes.node, className: PropTypes.string, }; export default BoringSpellValue;
templates/react/src/test/components/SoundTest.js
Jam3/generator-jam3
import React from 'react'; import audio from '../../util/audio'; const path = process.env.ASSET_PATH + 'sounds/'; const data = { 'button': { src: `${path}button-sprite.mp3`, sprite: { 'sprite-rollover': [0, 50], 'sprite-click': [60, 100], } }, }; export default class SoundTest extends React.PureComponent { constructor(props) { super(props); audio.extraData = data; } render() { const containerStyles = { padding: 20, }; const buttonStyles = { padding: '20px 50px', marginRight: 20, color: '#fff', background: '#000', border: '1px solid #fff', fontSize: 18 }; return ( <div> <div style={containerStyles}> <button style={buttonStyles} onMouseEnter={() => audio.play('button-rollover')} onClick={() => audio.play('button-click')} > Test singe sounds </button> </div> <br/> <div style={containerStyles}> <button style={buttonStyles} onMouseEnter={() => audio.play('sprite-rollover')} onClick={() => audio.play('sprite-click')} > Test sprite sounds </button> </div> </div> ); } }